remove redundant parameter from ObjectCreator.Param attribute

This commit is contained in:
Bob
2010-10-11 15:16:08 +13:00
parent 6a25d989a7
commit beecb8aeb1
10 changed files with 14 additions and 12 deletions

View File

@@ -67,7 +67,7 @@ namespace OpenRA
{
var attrs = p[ i ].GetCustomAttributes<ParamAttribute>();
if( attrs.Length != 1 ) throw new InvalidOperationException( "ObjectCreator: argument in [UseCtor] doesn't have [Param]" );
a[ i ] = args[ attrs[ 0 ].ParamName ];
a[ i ] = args[ attrs[ 0 ].ParamName ?? p[i].Name ];
}
return ctor.Invoke( a );
}
@@ -77,6 +77,8 @@ namespace OpenRA
{
public string ParamName { get; private set; }
public ParamAttribute() { }
public ParamAttribute( string paramName )
{
ParamName = paramName;