PSpawnedVehicle* PVehicles::SpawnVehicle( u32 nVehicleId, u32 nLocation, PVhcCoordinates const* nVhcPos ) { PSpawnedVehicle* newVhc = NULL; PWorld* cWorld; PVehicleInformation nVhcInfo; if (( nLocation != PWorlds::mNcSubwayWorldId ) && IsValidVehicle( nVehicleId ) && !IsSpawned( nVehicleId ) ) { cWorld = Worlds->LeaseWorld( nLocation ); if ( cWorld && GetVehicleInfo( nVehicleId, &nVhcInfo ) ) { newVhc = cWorld->GetSpawnedVehicules()->SpawnVehicle( &nVhcInfo, nVhcPos ); if ( newVhc ) { if ( !RegisterSpawnedVehicle( newVhc ) ) { Console->Print( RED, BLACK, "[Error] PVehicles::SpawnVehicle : Could not register spawned vhc" ); } if( gDevDebug ) Console->Print( "%d Spawned vhc %d (local 0x%04x) type %d (requested: %d)", Console->ColorText( CYAN, BLACK, "[DEBUG]" ), newVhc->GetVehicleId(), newVhc->GetLocalId(), newVhc->GetInformation().GetVehicleType(), nVhcInfo.GetVehicleType() ); } else Console->Print( RED, BLACK, "[Error] PVehicles::SpawnVehicle : Could not create vhc" ); } Worlds->ReleaseWorld( nLocation ); } return newVhc; }