1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-07 07:10:04 +02:00

Fixed potentially uninitialized class member

This commit is contained in:
Ivan Savenko 2023-12-17 19:31:32 +02:00
parent e6dcf355e8
commit dd88220b7c
4 changed files with 8 additions and 8 deletions

View File

@ -721,6 +721,11 @@ bool CGameInfoCallback::isPlayerMakingTurn(PlayerColor player) const
return gs->actingPlayers.count(player);
}
CGameInfoCallback::CGameInfoCallback():
gs(nullptr)
{
}
CGameInfoCallback::CGameInfoCallback(CGameState * GS):
gs(GS)
{

View File

@ -134,7 +134,7 @@ class DLL_LINKAGE CGameInfoCallback : public IGameInfoCallback
protected:
CGameState * gs;//todo: replace with protected const getter, only actual Server and Client objects should hold game state
CGameInfoCallback() = default;
CGameInfoCallback();
CGameInfoCallback(CGameState * GS);
bool hasAccess(std::optional<PlayerColor> playerId) const;

View File

@ -489,11 +489,6 @@ void CGameHandler::handleReceivedPack(CPackForServer * pack)
vstd::clear_pointer(pack);
}
CGameHandler::CGameHandler()
: turnTimerHandler(*this)
{}
CGameHandler::CGameHandler(CVCMIServer * lobby)
: lobby(lobby)
, heroPool(std::make_unique<HeroPoolProcessor>(this))
@ -518,6 +513,7 @@ CGameHandler::~CGameHandler()
{
delete spellEnv;
delete gs;
gs = nullptr;
}
void CGameHandler::reinitScripting()

View File

@ -92,8 +92,7 @@ public:
bool isAllowedExchange(ObjectInstanceID id1, ObjectInstanceID id2);
void giveSpells(const CGTownInstance *t, const CGHeroInstance *h);
CGameHandler();
CGameHandler(CVCMIServer * lobby);
explicit CGameHandler(CVCMIServer * lobby);
~CGameHandler();
//////////////////////////////////////////////////////////////////////////