Skip to content

Commit

Permalink
Move static last tile variable to member variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Aug 26, 2024
1 parent cc57ce3 commit 00fa891
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/game/client/components/chillerbot/chillerbotux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ void CChillerBotUX::ChangeTileNotifyTick()
return;
if(!GameClient()->m_Snap.m_pLocalCharacter)
return;
static int LastTile = -1;

float X = m_pClient->m_Snap.m_aCharacters[m_pClient->m_aLocalIds[g_Config.m_ClDummy]].m_Cur.m_X;
float Y = m_pClient->m_Snap.m_aCharacters[m_pClient->m_aLocalIds[g_Config.m_ClDummy]].m_Cur.m_Y;
int CurrentTile = Collision()->GetTileIndex(Collision()->GetPureMapIndex(X, Y));
if(LastTile != CurrentTile && m_LastNotification + time_freq() * 10 < time_get())
if(m_LastTile != CurrentTile && m_LastNotification + time_freq() * 10 < time_get())
{
IEngineGraphics *pGraphics = ((IEngineGraphics *)Kernel()->RequestInterface<IEngineGraphics>());
if(pGraphics && !pGraphics->WindowActive() && Graphics())
Expand All @@ -228,7 +228,7 @@ void CChillerBotUX::ChangeTileNotifyTick()
}
m_LastNotification = time_get();
}
LastTile = CurrentTile;
m_LastTile = CurrentTile;
}

void CChillerBotUX::RenderWeaponHud()
Expand Down Expand Up @@ -659,6 +659,7 @@ void CChillerBotUX::OnInit()
if(!g_Config.m_ClChillerbotId[0])
secure_random_password(g_Config.m_ClChillerbotId, sizeof(g_Config.m_ClChillerbotId), 16);
m_NextSkinSteal = 0;
m_LastTile = -1;
}

void CChillerBotUX::OnShutdown()
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/components/chillerbot/chillerbotux.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class CChillerBotUX : public CComponent
int m_LastForceDir;
int64_t m_LastNotification;
int64_t m_NextSkinSteal;
// used for notifications when tabbed out
int m_LastTile = -1;

void SaveSkins();
void RestoreSkins();
Expand Down

0 comments on commit 00fa891

Please sign in to comment.