Example #1
0
        public JsdStruct Clone()
        {
            JsdStruct _newStruct = new JsdStruct(this.IsHighDefenition);

            Header _header = new Header();

            _header.bDestructionPartner = this.FHeader.bDestructionPartner;
            _header.bPartnerDelta       = this.FHeader.bPartnerDelta;
            _header.bUnused             = this.FHeader.bUnused;
            _header.bZTileOffsetX       = this.FHeader.bZTileOffsetX;
            _header.bZTileOffsetY       = this.FHeader.bZTileOffsetY;
            _header.fFlags            = this.FHeader.fFlags;
            _header.ubArmour          = this.FHeader.ubArmour;
            _header.ubDensity         = this.FHeader.ubDensity;
            _header.ubHitPoints       = this.FHeader.ubHitPoints;
            _header.ubNumberOfTiles   = this.FHeader.ubNumberOfTiles;
            _header.ubWallOrientation = this.FHeader.ubWallOrientation;
            _header.usStructureNumber = this.FHeader.usStructureNumber;

            _newStruct.FHeader = _header;
            if (this.FTiles == null)
            {
                _newStruct.FTiles = null;
            }
            else
            {
                _newStruct.FTiles = new JsdTile[this.FTiles.Length];
                for (int i = 0; i < this.FTiles.Length; i++)
                {
                    _newStruct.FTiles[i] = this.FTiles[i].Clone();
                }
            }

            return(_newStruct);
        }
Example #2
0
        public static JsdFile Load(Stream aInput)
        {
            Deserializer _deserializer = new Deserializer(aInput);

            JsdFile.Header _header = (Header)_deserializer.Deserialize(typeof(Header));

            JsdFile _jsdFile = new JsdFile(_header);

            for (int i = 0; i < _jsdFile.FAuxilarity.Length; i++)
            {
                AuxObjectData data = new AuxObjectData();
                data.Load(_deserializer);
                _jsdFile.FAuxilarity[i] = data;
            }

            aInput.Read(_jsdFile.FTileLocData, 0, _jsdFile.FTileLocData.Length);

            for (int i = 0; i < _jsdFile.FStructs.Length; i++)
            {
                JsdStruct jsdStruct = new JsdStruct(_jsdFile.IsHighDefenition);
                jsdStruct.Load(_deserializer);
                _jsdFile.FStructs[i] = jsdStruct;
            }

            return(_jsdFile);
        }
Example #3
0
 public void AddStruct(JsdStruct aStruct)
 {
     JsdStruct[] _structs = new JsdStruct[this.NumberOfStructuresStored + 1];
     Array.Copy(this.FStructs, _structs, this.NumberOfStructuresStored);
     _structs[this.NumberOfStructuresStored] = aStruct;
     Array.Sort(_structs);
     this.FStructs = _structs;
 }
Example #4
0
        public int CompareTo(object obj)
        {
            JsdStruct _struct = obj as JsdStruct;

            if (_struct != null)
            {
                return(this.StructureNumber.CompareTo(_struct.StructureNumber));
            }
            else
            {
                return(0);
            }
        }
Example #5
0
        public void RemoveStruct(JsdStruct aStruct)
        {
            List <JsdStruct> _structs = new List <JsdStruct>();

            foreach (JsdStruct _struct in this.FStructs)
            {
                if (_struct != aStruct)
                {
                    _structs.Add(_struct);
                }
            }
            this.FStructs = _structs.ToArray();
        }