Inheritance: NamedMapObject
Example #1
0
 /// <summary>Reads the aircraft.</summary>
 private void ReadAircraft()
 {
     IniSection aircraftSection = GetSection("Aircraft");
     if (aircraftSection == null) {
         Logger.Info("Aircraft section unavailable in {0}", Path.GetFileName(FileName));
         return;
     }
     foreach (var v in aircraftSection.OrderedEntries) {
         try {
             string[] entries = ((string)v.Value).Split(',');
             string owner = entries[0];
             string name = entries[1];
             short health = short.Parse(entries[2]);
             int rx = int.Parse(entries[3]);
             int ry = int.Parse(entries[4]);
             short direction = short.Parse(entries[5]);
             bool onBridge = entries[entries.Length - 4] == "1";
             var a = new Aircraft(owner, name, health, direction, onBridge);
             a.Tile = Tiles.GetTileR(rx, ry);
             if (a.Tile != null)
                 Aircrafts.Add(a);
         }
         catch (FormatException) {
         }
         catch (IndexOutOfRangeException) {
         }
     }
     Logger.Trace("Read {0} aircraft objects", Aircrafts.Count);
 }