[C#] Fixed Vehicle::GetColor() crash

This commit is contained in:
Kernell 2015-12-27 21:25:05 +03:00
parent cea46b3241
commit 2007d6d5ab

View File

@ -83,28 +83,24 @@ MonoObject* CMonoFunctions::Vehicle::GetColor( DWORD pUserData )
{ {
if( RESOURCE ) if( RESOURCE )
{ {
CVehicleColor pColor; CVehicleColor pVehicleColor;
if( CLuaFunctionDefinitions::GetVehicleColor( RESOURCE->GetLua(), (void*)pUserData, pColor ) ) if( CLuaFunctionDefinitions::GetVehicleColor( RESOURCE->GetLua(), (PVOID)pUserData, pVehicleColor ) )
{ {
SColor pColor1 = pColor.GetRGBColor( 0 ); CMonoMTALib* pMTALib = RESOURCE->GetDomain()->GetMTALib();
SColor pColor2 = pColor.GetRGBColor( 1 );
SColor pColor3 = pColor.GetRGBColor( 2 );
SColor pColor4 = pColor.GetRGBColor( 3 );
void* args[] = PVOID args[ 4 ];
for( int i = 0; i < 4; i++ )
{ {
&pColor1, args[ i ] = pMTALib->Color->New( pVehicleColor.GetRGBColor( i ) );
&pColor2, }
&pColor3,
&pColor4
};
return RESOURCE->GetDomain()->GetMTALib()->GetClass( "VehicleColor" )->New( args, 4 ); return pMTALib->GetClass( "VehicleColor" )->New( args, 4 );
} }
} }
return NULL; return nullptr;
} }
unsigned short CMonoFunctions::Vehicle::GetModelFromName( MonoString* msName ) unsigned short CMonoFunctions::Vehicle::GetModelFromName( MonoString* msName )