From 7a8ab81c91cac81e761c069d11562e1dd3c5c27e Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 10 Jan 2010 12:38:26 +1300 Subject: [PATCH] added BuildableInfo --- OpenRa.Game/GameRules/FieldLoader.cs | 2 ++ OpenRa.Game/Traits/Buildable.cs | 12 ++++++++++++ OpenRa.Game/Traits/Mobile.cs | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/OpenRa.Game/GameRules/FieldLoader.cs b/OpenRa.Game/GameRules/FieldLoader.cs index 55731a6445..f1034dc5f0 100755 --- a/OpenRa.Game/GameRules/FieldLoader.cs +++ b/OpenRa.Game/GameRules/FieldLoader.cs @@ -21,6 +21,8 @@ namespace OpenRa.Game.GameRules foreach (var x in my.Nodes) { var field = self.GetType().GetField(x.Key.Trim()); + if (field == null) + throw new NotImplementedException("Missing field `{0}` on `{1}`".F(x.Key.Trim(), self.GetType().Name)); field.SetValue(self, GetValue(field.FieldType, x.Value.Value.Trim())); } } diff --git a/OpenRa.Game/Traits/Buildable.cs b/OpenRa.Game/Traits/Buildable.cs index fb1f95dc52..ebff7ae4d1 100755 --- a/OpenRa.Game/Traits/Buildable.cs +++ b/OpenRa.Game/Traits/Buildable.cs @@ -5,6 +5,18 @@ using System.Text; namespace OpenRa.Game.Traits { + class BuildableInfo : ITraitInfo + { + public readonly int TechLevel = -1; + public readonly string Tab = null; + public readonly string[] Prerequisites = { }; + public readonly Race[] Owner = { }; + public readonly int Cost = 0; + public readonly string Description = ""; + public readonly string LongDesc = ""; + public object Create(Actor self) { return new Buildable(self); } + } + class Buildable { public Buildable( Actor self ) { } diff --git a/OpenRa.Game/Traits/Mobile.cs b/OpenRa.Game/Traits/Mobile.cs index 7645d36cab..3f753ac289 100644 --- a/OpenRa.Game/Traits/Mobile.cs +++ b/OpenRa.Game/Traits/Mobile.cs @@ -7,9 +7,9 @@ namespace OpenRa.Game.Traits { class MobileInfo : ITraitInfo { - public readonly int Sight; - public readonly int ROT; - public readonly int Speed; + public readonly int Sight = 0; + public readonly int ROT = 0; + public readonly int Speed = 0; public object Create(Actor self) { return new Mobile(self); } }