more cleanup

This commit is contained in:
Chris Forbes
2010-04-01 21:00:33 +13:00
parent 1f1e748f1b
commit c5fdda9141
6 changed files with 46 additions and 72 deletions

View File

@@ -35,7 +35,7 @@ namespace OpenRA
public static TechTree TechTree;
public static Dictionary<string, ActorInfo> Info;
public static Dictionary<string, NewWeaponInfo> Weapons;
public static Dictionary<string, WeaponInfo> 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<string, NewWeaponInfo>();
Weapons = new Dictionary<string, WeaponInfo>();
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();
}

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#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,
}
}

View File

@@ -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<WarheadInfo> Warheads = new List<WarheadInfo>();
public NewWeaponInfo(string name, MiniYaml content)
public WeaponInfo(string name, MiniYaml content)
{
foreach (var kv in content.Nodes)
{