Example #1
0
        public Persistent(Empire empire, IntPtr dataPtr)
        {
            if (sizeof(MyData) > 4096)
            {
                throw new Exception("Persistent data size exceeds limit!");
            }

            this.theEmpire = empire;
            this.data      = (MyData *)dataPtr;

            // initialization
            data->LastResearch = Advance.None;
            for (int nationID = 0; nationID < Cevo.MaxNumberOfNations; nationID++)
            {
                data->EstimatedStrength[nationID] = 100;
                data->BiggestFriend[nationID]     = (sbyte)Nation.None.ID;
            }
        }
Example #2
0
        public Persistent(Empire empire, MyData *dataPtr)
        {
            if (sizeof(MyData) > 4096)
            {
                throw new Exception("Persistent data size exceeds limit!");
            }

            TheEmpire = empire;
            Data      = dataPtr;

            // Initialization of the Data block *only*. Creating persistent collections here will not save and reload
            // correctly.
            Data->LastResearch = Advance.None;
            for (int nationID = 0; nationID < Cevo.MaxNumberOfNations; nationID++)
            {
                Data->EstimatedStrength[nationID] = 100;
                Data->BiggestFriend[nationID]     = (sbyte)((IId)Nation.None.Id).Index;
            }
        }