CNCMaps.FileFormats.Map.MapFile.ReadInfantry C# (CSharp) Method

ReadInfantry() private method

Reads the infantry.
private ReadInfantry ( ) : void
return void
        private void ReadInfantry()
        {
            IniSection infantrySection = GetSection("Infantry");
            if (infantrySection == null) {
                Logger.Info("Infantry section unavailable in {0}", Path.GetFileName(FileName));
                return;
            }

            foreach (var v in infantrySection.OrderedEntries) {
                try {

                    string[] entries = ((string)v.Value).Split(',');
                    if (entries.Length <= 8) continue;
                    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[7]);
                    bool onBridge = entries[11] == "1";
                    var i = new Infantry(owner, name, health, direction, onBridge);
                    i.Tile = Tiles.GetTileR(rx, ry);
                    if (i.Tile != null)
                        Infantries.Add(i);
                }
                catch (IndexOutOfRangeException) {
                }
                catch (FormatException) {
                }
            }
            Logger.Trace("Read {0} infantry objects", Infantries.Count);
        }