[saco] Implement CVehiclePool ctor

This commit is contained in:
RD42 2024-02-06 22:08:24 +08:00
parent 2ae74bd25e
commit 125a453d53
7 changed files with 65 additions and 1 deletions

View File

@ -3,8 +3,13 @@
#include <windows.h> #include <windows.h>
#define MAX_VEHICLES 2000
#define PLAYER_PED_SLOTS 210 #define PLAYER_PED_SLOTS 210
//-----------------------------------------------------------
typedef unsigned short VEHICLEID;
typedef struct _VECTOR { typedef struct _VECTOR {
float X,Y,Z; float X,Y,Z;
} VECTOR, *PVECTOR; } VECTOR, *PVECTOR;

View File

@ -30,6 +30,7 @@ typedef struct _GAME_SETTINGS {
#include "../raknet/GetTime.h" #include "../raknet/GetTime.h"
#include "net/netrpc.h" #include "net/netrpc.h"
#include "net/vehiclepool.h"
#include "net/netgame.h" #include "net/netgame.h"
#include "net/scriptrpc.h" #include "net/scriptrpc.h"

View File

@ -32,6 +32,8 @@ CNetGame::CNetGame(PCHAR szHostOrIp, int iPort,
void CNetGame::InitPools() void CNetGame::InitPools()
{ {
m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS)); m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS));
m_pPools->pVehiclePool = new CVehiclePool();
} }
DWORD CNetGame::GetTime() DWORD CNetGame::GetTime()

View File

@ -26,7 +26,8 @@ struct struc_41
}; };
typedef struct _NETGAME_POOLS { typedef struct _NETGAME_POOLS {
char _gap0[0x24]; CVehiclePool *pVehiclePool;
char _gap0[32];
} NETGAME_POOLS; } NETGAME_POOLS;
class CNetGame // size: 994 class CNetGame // size: 994

20
saco/net/vehiclepool.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "../main.h"
//----------------------------------------------------
CVehiclePool::CVehiclePool()
{
// loop through and initialize all vehicle properties to 0
for(VEHICLEID VehicleID = 0; VehicleID < MAX_VEHICLES; VehicleID++) {
field_3074[VehicleID] = 0;
field_1134[VehicleID] = 0;
field_4FB4[VehicleID] = 0;
field_9DD4[VehicleID] = GetTickCount();
}
memset(field_FA4, 0, sizeof(field_FA4));
field_0 = 0;
field_17894 = 1;
}
//----------------------------------------------------

29
saco/net/vehiclepool.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
//----------------------------------------------------
class CVehiclePool
{
public:
int field_0;
char _gap4[4000];
char field_FA4[400];
int field_1134[MAX_VEHICLES];
int field_3074[MAX_VEHICLES];
int field_4FB4[MAX_VEHICLES];
char _gap6EF4[12000];
DWORD field_9DD4[MAX_VEHICLES];
char _gapBD14[48000];
int field_17894;
CVehiclePool();
};
//----------------------------------------------------

View File

@ -258,6 +258,12 @@
<File <File
RelativePath=".\net\scriptrpc.h"> RelativePath=".\net\scriptrpc.h">
</File> </File>
<File
RelativePath=".\net\vehiclepool.cpp">
</File>
<File
RelativePath=".\net\vehiclepool.h">
</File>
</Filter> </Filter>
<Filter <Filter
Name="ttmath" Name="ttmath"