2023-10-31 21:31:16 +08:00
|
|
|
|
2024-01-15 23:52:08 +08:00
|
|
|
#include "../main.h"
|
2024-03-14 23:24:26 +08:00
|
|
|
extern CNetGame *pNetGame;
|
2024-01-15 23:52:08 +08:00
|
|
|
|
|
|
|
//----------------------------------------------------
|
2023-10-31 21:31:16 +08:00
|
|
|
|
|
|
|
CVehiclePool::CVehiclePool()
|
|
|
|
{
|
2024-01-15 23:52:08 +08:00
|
|
|
// loop through and initialize all net players to null and slot states to false
|
|
|
|
for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) {
|
|
|
|
field_84D0[VehicleID] = 0;
|
2023-10-31 21:31:16 +08:00
|
|
|
}
|
|
|
|
}
|
2024-01-15 23:52:08 +08:00
|
|
|
|
|
|
|
//----------------------------------------------------
|
2024-03-14 23:24:26 +08:00
|
|
|
|
|
|
|
CVehiclePool::~CVehiclePool()
|
|
|
|
{
|
|
|
|
for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) {
|
|
|
|
Delete(VehicleID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------
|
|
|
|
|
2024-06-26 23:21:06 +08:00
|
|
|
BOOL CVehiclePool::New(NEW_VEHICLE *pNewVehicle)
|
|
|
|
{
|
|
|
|
if(pNewVehicle->VehicleId < MAX_VEHICLES)
|
|
|
|
{
|
|
|
|
memset(&m_SpawnInfo[pNewVehicle->VehicleId],0,sizeof(VEHICLE_SPAWN_INFO));
|
|
|
|
|
|
|
|
// Setup the spawninfo for the next respawn.
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_0 = pNewVehicle->field_2;
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_4 = pNewVehicle->field_6;
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_8 = pNewVehicle->field_6;
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_C = pNewVehicle->field_6;
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_10 = pNewVehicle->field_12;
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_14 = pNewVehicle->field_16;
|
|
|
|
m_SpawnInfo[pNewVehicle->VehicleId].field_18 = pNewVehicle->field_17;
|
|
|
|
|
|
|
|
pNetGame->SetVehicleAdded(pNewVehicle->VehicleId, TRUE);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------
|
|
|
|
|
2024-03-14 23:24:26 +08:00
|
|
|
BOOL CVehiclePool::Delete(VEHICLEID VehicleID)
|
|
|
|
{
|
2024-06-26 23:08:18 +08:00
|
|
|
pNetGame->SetVehicleAdded(VehicleID, FALSE);
|
2024-03-14 23:24:26 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------
|