using System; using System.Collections.Generic; using System.Linq; using OpenRa.FileFormats; using OpenRa.Game.GameRules; using IjwFramework.Types; namespace OpenRa.Game { static class Rules { public static InfoLoader UnitInfo; public static InfoLoader WeaponInfo; public static InfoLoader WarheadInfo; public static InfoLoader ProjectileInfo; public static Footprint Footprint; // TODO: load rules from the map, where appropriate. public static void LoadRules() { var rulesIni = new IniFile(FileSystem.Open("rules.ini")); UnitInfo = new InfoLoader(rulesIni, Pair.New>( "buildings.txt", s => new UnitInfo.BuildingInfo(s)), Pair.New>("infantry.txt", s => new UnitInfo.InfantryInfo(s)), Pair.New>( "vehicles.txt", s => new UnitInfo.VehicleInfo(s))); WeaponInfo = new InfoLoader(rulesIni, Pair.New>("weapons.txt", _ => new WeaponInfo())); WarheadInfo = new InfoLoader(rulesIni, Pair.New>("warheads.txt", _ => new WarheadInfo())); ProjectileInfo = new InfoLoader(rulesIni, Pair.New>("projectiles.txt", _ => new ProjectileInfo())); Footprint = new Footprint(FileSystem.Open("footprint.txt")); } } }