diff --git a/OpenRA.Game/Combat.cs b/OpenRA.Game/Combat.cs index 4ba3c0cf85..986e08d3d8 100644 --- a/OpenRA.Game/Combat.cs +++ b/OpenRA.Game/Combat.cs @@ -90,7 +90,7 @@ namespace OpenRA return rawDamage * multiplier; } - public static bool WeaponValidForTarget(NewWeaponInfo weapon, Actor target) + public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target) { return true; // massive hack, and very wrong. diff --git a/OpenRA.Game/Exts.cs b/OpenRA.Game/Exts.cs index c04bfd6827..4283f9b481 100644 --- a/OpenRA.Game/Exts.cs +++ b/OpenRA.Game/Exts.cs @@ -44,7 +44,7 @@ namespace OpenRA return xs.Aggregate(1f, (a, x) => a * x); } - public static NewWeaponInfo GetPrimaryWeapon(this Actor self) + public static WeaponInfo GetPrimaryWeapon(this Actor self) { var info = self.Info.Traits.GetOrDefault(); if (info == null) return null; @@ -55,7 +55,7 @@ namespace OpenRA return Rules.Weapons[weapon.ToLowerInvariant()]; } - public static NewWeaponInfo GetSecondaryWeapon(this Actor self) + public static WeaponInfo GetSecondaryWeapon(this Actor self) { var info = self.Info.Traits.GetOrDefault(); if (info == null) return null; diff --git a/OpenRA.Game/GameRules/Rules.cs b/OpenRA.Game/GameRules/Rules.cs index dd5f3271fe..172736956a 100755 --- a/OpenRA.Game/GameRules/Rules.cs +++ b/OpenRA.Game/GameRules/Rules.cs @@ -35,7 +35,7 @@ namespace OpenRA public static TechTree TechTree; public static Dictionary Info; - public static Dictionary Weapons; + public static Dictionary Weapons; public static void LoadRules(string map, Manifest m) { @@ -64,9 +64,9 @@ namespace OpenRA Info.Add(kv.Key.ToLowerInvariant(), new ActorInfo(kv.Key.ToLowerInvariant(), kv.Value, yamlRules)); var weaponsYaml = m.Weapons.Select(a => MiniYaml.FromFile(a)).Aggregate(MiniYaml.Merge); - Weapons = new Dictionary(); + Weapons = new Dictionary(); foreach (var kv in weaponsYaml) - Weapons.Add(kv.Key.ToLowerInvariant(), new NewWeaponInfo(kv.Key.ToLowerInvariant(), kv.Value)); + Weapons.Add(kv.Key.ToLowerInvariant(), new WeaponInfo(kv.Key.ToLowerInvariant(), kv.Value)); TechTree = new TechTree(); } diff --git a/OpenRA.Game/GameRules/WarheadInfo.cs b/OpenRA.Game/GameRules/WarheadInfo.cs deleted file mode 100644 index 603621c8c1..0000000000 --- a/OpenRA.Game/GameRules/WarheadInfo.cs +++ /dev/null @@ -1,57 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. - * This file is part of OpenRA. - * - * OpenRA is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * OpenRA is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with OpenRA. If not, see . - */ -#endregion - -namespace OpenRA.GameRules -{ - public class WarheadInfo - { - public readonly int Spread = 1; - public readonly float[] Verses = { 1, 1, 1, 1, 1 }; - public readonly bool Wall = false; - public readonly bool Wood = false; - public readonly bool Ore = false; - public readonly int Explosion = 0; - public readonly SmudgeType SmudgeType = SmudgeType.None; - public readonly int[] SmudgeSize = { 0,0 }; - public readonly int InfDeath = 0; - public readonly string ImpactSound = null; - public readonly string WaterImpactSound = null; - public readonly int Damage = 0; // for new weapons infrastructure - public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant - - public float EffectivenessAgainst(ArmorType at) { return Verses[ (int)at ]; } - } - - public enum ArmorType - { - none = 0, - wood = 1, - light = 2, - heavy = 3, - concrete = 4, - } - - public enum SmudgeType - { - None = 0, - Crater = 1, - Scorch = 2, - } -} diff --git a/OpenRA.Game/GameRules/NewWeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs similarity index 68% rename from OpenRA.Game/GameRules/NewWeaponInfo.cs rename to OpenRA.Game/GameRules/WeaponInfo.cs index b41c012e91..dd6a81b594 100644 --- a/OpenRA.Game/GameRules/NewWeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -25,9 +25,44 @@ using System; namespace OpenRA.GameRules { + public class WarheadInfo + { + public readonly int Spread = 1; + public readonly float[] Verses = { 1, 1, 1, 1, 1 }; + public readonly bool Wall = false; + public readonly bool Wood = false; + public readonly bool Ore = false; + public readonly int Explosion = 0; + public readonly SmudgeType SmudgeType = SmudgeType.None; + public readonly int[] SmudgeSize = { 0, 0 }; + public readonly int InfDeath = 0; + public readonly string ImpactSound = null; + public readonly string WaterImpactSound = null; + public readonly int Damage = 0; // for new weapons infrastructure + public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant + + public float EffectivenessAgainst(ArmorType at) { return Verses[(int)at]; } + } + + public enum ArmorType + { + none = 0, + wood = 1, + light = 2, + heavy = 3, + concrete = 4, + } + + public enum SmudgeType + { + None = 0, + Crater = 1, + Scorch = 2, + } + public class ProjectileArgs { - public NewWeaponInfo weapon; + public WeaponInfo weapon; public Actor firedBy; public int2 src; public int srcAltitude; @@ -37,12 +72,9 @@ namespace OpenRA.GameRules public int destAltitude; } - public interface IProjectileInfo - { - IEffect Create(ProjectileArgs args); - } + public interface IProjectileInfo { IEffect Create(ProjectileArgs args); } - public class NewWeaponInfo + public class WeaponInfo { public readonly float Range = 0; public readonly string Report = null; @@ -53,7 +85,7 @@ namespace OpenRA.GameRules public IProjectileInfo Projectile; public List Warheads = new List(); - public NewWeaponInfo(string name, MiniYaml content) + public WeaponInfo(string name, MiniYaml content) { foreach (var kv in content.Nodes) { diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 5e6910cc69..00f2e22832 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -75,7 +75,7 @@ - + @@ -155,7 +155,6 @@ -