Exemple #1
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            // This is the object definition which defined the WeaponSet
            // (either a normal object or DefaultThingTemplate)
            var objectDefinitionName = reader.ReadAsciiString();

            var conditions = reader.ReadBitArray <WeaponSetConditions>();

            _currentWeaponTemplateSet = _gameObject.Definition.WeaponSets[conditions];

            // In Generals there are 3 possible weapons.
            // Later games have up to 5.
            for (var i = 0; i < 3; i++)
            {
                var slotFilled = reader.ReadBoolean();
                if (slotFilled)
                {
                    _weapons[i] = new Weapon(_gameObject, _currentWeaponTemplateSet.Slots[i].Weapon.Value, (WeaponSlot)i, _gameObject.GameContext);
                    _weapons[i].Load(reader);
                }
                else
                {
                    _weapons[i] = null;
                }
            }

            _currentWeaponSlot = reader.ReadEnum <WeaponSlot>();

            var unknown2 = reader.ReadUInt32();

            _filledWeaponSlots = reader.ReadUInt32();
            _combinedAntiMask  = reader.ReadEnumFlags <WeaponAntiFlags>();

            var unknown5 = reader.ReadUInt32();

            var unknownBool1 = reader.ReadBoolean();
            var unknownBool2 = reader.ReadBoolean();
        }