mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Update DoProcessStuff()
* Add `CNetGame::Process()` stub * Add `CNetGame::UpdateNetwork()` stub * Implement `GetPacketID(...)` * Implement `HasTimestamps()`
This commit is contained in:
parent
3687b95a9d
commit
b6d8c9c215
@ -349,6 +349,18 @@ void DoInitStuff()
|
||||
void DoProcessStuff()
|
||||
{
|
||||
DoInitStuff();
|
||||
|
||||
SetupD3DFog(TRUE);
|
||||
|
||||
// Process the netgame if it's active.
|
||||
if(pNetGame) {
|
||||
//Sleep(0); // This hands the context over to raknet
|
||||
pNetGame->Process();
|
||||
}
|
||||
|
||||
if(pAudioStream) {
|
||||
pAudioStream->Process();
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
@ -4,6 +4,34 @@
|
||||
extern CGame *pGame;
|
||||
extern CChatWindow *pChatWindow;
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
BYTE GetPacketID(Packet *p)
|
||||
{
|
||||
if (p==0) return 255;
|
||||
|
||||
if ((unsigned char)p->data[0] == ID_TIMESTAMP) {
|
||||
assert(p->length > sizeof(unsigned char) + sizeof(unsigned long));
|
||||
return (unsigned char) p->data[sizeof(unsigned char) + sizeof(unsigned long)];
|
||||
}
|
||||
else {
|
||||
return (unsigned char) p->data[0];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
bool HasTimestamps(Packet *p)
|
||||
{
|
||||
if (p==0) return 0;
|
||||
|
||||
if ((unsigned char)p->data[0] == ID_TIMESTAMP)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
CNetGame::CNetGame(PCHAR szHostOrIp, int iPort,
|
||||
PCHAR szPlayerName, PCHAR szPass)
|
||||
{
|
||||
@ -32,6 +60,29 @@ CNetGame::CNetGame(PCHAR szHostOrIp, int iPort,
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
void CNetGame::Process()
|
||||
{
|
||||
UpdateNetwork();
|
||||
// TODO: CNetGame::Process()
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// UPDATE NETWORK
|
||||
//----------------------------------------------------
|
||||
|
||||
void CNetGame::UpdateNetwork()
|
||||
{
|
||||
/* Packet* pkt=NULL;
|
||||
unsigned char packetIdentifier;
|
||||
|
||||
while((pkt = m_pRakClient->Receive()))
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
// TODO: CNetGame::UpdateNetwork()
|
||||
}
|
||||
|
||||
void CNetGame::InitPools()
|
||||
{
|
||||
m_pPools = (NETGAME_POOLS *)calloc(1, sizeof(NETGAME_POOLS));
|
||||
|
@ -43,6 +43,8 @@ private:
|
||||
|
||||
RakClientInterface *m_pRakClient;
|
||||
|
||||
void UpdateNetwork();
|
||||
|
||||
char _gap4[44];
|
||||
char m_szHostOrIp[257];
|
||||
char m_szHostName[257];
|
||||
@ -63,6 +65,8 @@ public:
|
||||
|
||||
CNetGame(char *a2, int a3, char *a4, char *a5);
|
||||
|
||||
void Process();
|
||||
|
||||
void InitPools();
|
||||
|
||||
DWORD GetTime();
|
||||
|
Loading…
Reference in New Issue
Block a user