Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Client/mods/deathmatch/CClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CGame* g_pGame = NULL;
CMultiplayer* g_pMultiplayer = NULL;
CNet* g_pNet = NULL;
CClientGame* g_pClientGame = NULL;
bool g_bClientShuttingDown = false;

int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)
{
Expand Down Expand Up @@ -183,6 +184,9 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore)

void CClient::ClientShutdown()
{
// Global shutdown flag
g_bClientShuttingDown = true;

// Unbind our radio controls
g_pCore->GetKeyBinds()->RemoveControlFunction("radio_next", CClientGame::HandleRadioNext);
g_pCore->GetKeyBinds()->RemoveControlFunction("radio_previous", CClientGame::HandleRadioPrevious);
Expand Down
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/CClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include <core/CClientBase.h>

extern bool g_bClientShuttingDown;

class CClient : public CClientBase
{
public:
Expand Down
4 changes: 4 additions & 0 deletions Client/mods/deathmatch/logic/CClientGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6851,6 +6851,10 @@ bool CClientGame::RestreamModel(std::uint16_t model)

void CClientGame::RestreamWorld()
{
// If game is shutting down, do nothing for avoid crashes
if (g_bClientShuttingDown)
return;

unsigned int numberOfFileIDs = g_pGame->GetCountOfAllFileIDs();

for (unsigned int uiModelID = 0; uiModelID < numberOfFileIDs; uiModelID++)
Expand Down