Exemple #1
0
            public static void ApplyDelta(Interface.Struct.GridDelta delta)
            {
                if (CellStacks == null)
                {
                    Out.Log(Significance.ProgramFatal, "World not initialized. Cannot apply delta.");
                    return;
                }
                if (delta.nodeOffset + delta.nodeCount > Graph.Nodes.Length)
                {
                    Out.Log(Significance.ProgramFatal, "Invalid node range for world delta: [" + delta.nodeOffset + "," + (delta.nodeOffset + delta.nodeCount) + ") /" + Graph.Nodes.Length);
                    return;
                }
                Out.Log(Significance.Common, "Applying world delta at range " + delta.nodeOffset + "..." + (delta.nodeOffset + delta.nodeCount) + " /" + Graph.Nodes.Length);


                ApplyDeltaField(delta, delta.contentBlocks, (stack, layer, value) => stack.volumeCell[layer].ApplyContentDelta(value));
                ApplyDeltaField(delta, delta.techniteFactionBlocks, (stack, layer, value) => stack.volumeCell[layer].ApplyTechniteDelta(value));
            }
Exemple #2
0
            private static void ApplyDeltaField(Interface.Struct.GridDelta delta, Interface.Struct.GridDeltaBlock[] blocks, Action <CellStack, uint, byte> action)
            {
                if (blocks.Length != 0)
                {
                    //Out.Log(Significance.Low, "  Applying " + blocks.Length + " blocks...");
                    uint at = 0;
                    foreach (var block in blocks)
                    {
                        for (int i = 0; i < block.repitition; i++)
                        {
                            uint stackIndex = (at % delta.nodeCount) + delta.nodeOffset;
                            uint layer      = at / delta.nodeCount;

                            CellStack stack = CellStacks[stackIndex];
                            action(stack, layer, block.value);

                            at++;
                        }
                    }
                    Debug.Assert(at == delta.nodeCount * CellStack.LayersPerStack);
                }
            }
Exemple #3
0
 public static void ApplyDelta(Interface.Struct.GridDelta delta)
 {
     World.Create();
     World.ApplyDelta(delta);
 }