removing crap from FieldLoader

This commit is contained in:
Chris Forbes
2010-01-14 19:12:44 +13:00
parent c52bcbc1fc
commit 8e86ce6d4a

View File

@@ -27,39 +27,6 @@ namespace OpenRa.Game.GameRules
}
}
public static void CheckYaml( object self, Dictionary<string, MiniYaml> d )
{
//foreach( var x in d )
//{
// if( x.Key == "Tab" ) continue;
// if( x.Key == "Description" ) continue;
// if( x.Key == "LongDesc" ) continue;
// var key = x.Key;
// if( key == "Prerequisites" ) key = "Prerequisite";
// if( key == "HP" ) key = "Strength";
// if( key == "Priority" ) key = "SelectionPriority";
// if( key == "Bounds" ) key = "SelectionSize";
// var field = self.GetType().GetField( key );
// var old = field.GetValue( self );
// var neww = GetValue( field.FieldType, x.Value.Value.Trim() );
// if( old.ToString() != neww.ToString() )
// throw new NotImplementedException();
//}
foreach( var x in d )
{
var key = x.Key;
if( key == "Tab" )
continue;
if( key == "Prerequisites" ) key = "Prerequisite";
if( key == "HP" ) key = "Strength";
if( key == "Priority" ) key = "SelectionPriority";
if( key == "Bounds" ) key = "SelectionSize";
var field = self.GetType().GetField( key.Trim() );
field.SetValue( self, GetValue( field.FieldType, x.Value.Value.Trim() ) );
}
}
static object GetValue( Type fieldType, string x )
{
if( fieldType == typeof( int ) )