mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix bug where restart commands don't work
We reset the idle name in HS_GAME_SHUTDOWN, but the restart command callback uses the name field to 'map' into the same map (restarting), which causes issues when we reset it to 'server_idle'. Changed behavior to only reset name (non recursive) if we are running but do not have an active game.
This commit is contained in:
parent
4d2c5513f2
commit
d32a4f2df0
@ -57,6 +57,7 @@
|
|||||||
FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurrentTime, float flFrameTime)
|
FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurrentTime, float flFrameTime)
|
||||||
{
|
{
|
||||||
static bool bInitialized = false;
|
static bool bInitialized = false;
|
||||||
|
static bool bResetIdleName = false;
|
||||||
if (!bInitialized)
|
if (!bInitialized)
|
||||||
{
|
{
|
||||||
g_pHostState->Setup();
|
g_pHostState->Setup();
|
||||||
@ -106,15 +107,25 @@ FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurren
|
|||||||
}
|
}
|
||||||
case HostStates_t::HS_RUN:
|
case HostStates_t::HS_RUN:
|
||||||
{
|
{
|
||||||
|
if (!g_pHostState->m_bActiveGame)
|
||||||
|
{
|
||||||
|
if (bResetIdleName)
|
||||||
|
{
|
||||||
|
g_pHostState->ResetLevelName();
|
||||||
|
bResetIdleName = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Reset idle name the next non-active frame.
|
||||||
|
{
|
||||||
|
bResetIdleName = true;
|
||||||
|
}
|
||||||
|
|
||||||
CHostState_State_Run(&g_pHostState->m_iCurrentState, flCurrentTime, flFrameTime);
|
CHostState_State_Run(&g_pHostState->m_iCurrentState, flCurrentTime, flFrameTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HostStates_t::HS_GAME_SHUTDOWN:
|
case HostStates_t::HS_GAME_SHUTDOWN:
|
||||||
{
|
{
|
||||||
DevMsg(eDLL_T::ENGINE, "%s - Shutdown host game\n", "CHostState::FrameUpdate");
|
DevMsg(eDLL_T::ENGINE, "%s - Shutdown host game\n", "CHostState::FrameUpdate");
|
||||||
if (g_pHostState->m_bActiveGame) {
|
|
||||||
g_pHostState->ResetLevelName();
|
|
||||||
}
|
|
||||||
CHostState_State_GameShutDown(g_pHostState);
|
CHostState_State_GameShutDown(g_pHostState);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -310,8 +321,6 @@ FORCEINLINE void CHostState::GameShutDown(void)
|
|||||||
g_pServerGameDLL->GameShutdown();
|
g_pServerGameDLL->GameShutdown();
|
||||||
#endif // !CLIENT_DLL
|
#endif // !CLIENT_DLL
|
||||||
m_bActiveGame = 0;
|
m_bActiveGame = 0;
|
||||||
|
|
||||||
ResetLevelName();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +428,7 @@ FORCEINLINE void CHostState::ResetLevelName(void)
|
|||||||
#else // DEDICATED
|
#else // DEDICATED
|
||||||
const char* szNoMap = "main_menu";
|
const char* szNoMap = "main_menu";
|
||||||
#endif
|
#endif
|
||||||
snprintf(const_cast<char*>(m_levelName), sizeof(m_levelName), szNoMap);
|
Q_snprintf(const_cast<char*>(m_levelName), sizeof(m_levelName), szNoMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user