From a99e62029ff77311a1fc4d411a99886384c4fea8 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 21 Oct 2024 22:46:54 +0800 Subject: [PATCH] [saco] Implement/match `QuitGame()` --- saco/main.cpp | 14 ++++++++++++++ saco/net/netgame.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/saco/main.cpp b/saco/main.cpp index e964823..0c1d42b 100644 --- a/saco/main.cpp +++ b/saco/main.cpp @@ -28,6 +28,9 @@ CUnkClass15 *pUnkClass15=0; BOOL bGameInited=FALSE; +BOOL bQuitGame=FALSE; +DWORD dwStartQuitTick=0; + WORD wVehicleComponentDebug=0; IDirect3D9 *pD3D; @@ -428,6 +431,17 @@ void TheGraphicsLoop() //---------------------------------------------------- +void QuitGame() +{ + if(pNetGame && pNetGame->GetGameState() == GAMESTATE_CONNECTED) { + pNetGame->GetRakClient()->Disconnect(500); + } + bQuitGame = TRUE; + dwStartQuitTick = GetTickCount(); +} + +//---------------------------------------------------- + void InitSettings() { PCHAR szCmdLine = GetCommandLineA(); diff --git a/saco/net/netgame.h b/saco/net/netgame.h index d6c98cf..62967e0 100644 --- a/saco/net/netgame.h +++ b/saco/net/netgame.h @@ -1,6 +1,8 @@ #pragma once +#define GAMESTATE_CONNECTED 5 + #define GAMESTATE_WAIT_CONNECT 1 struct struc_41 @@ -70,6 +72,7 @@ public: void InitPools(); DWORD GetTime(); + int GetGameState() { return m_iGameState; }; BOOL GetWalkStyle() { return field_3D5->bUseCJWalk; }; CPlayerPool * GetPlayerPool() { return m_pPools->pPlayerPool; };