mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Reset obelisks upon game end
Otherwise, the static variables are preserved and lead to wrong values in next new game.
This commit is contained in:
parent
1a2cd36df8
commit
e8db456beb
@ -219,18 +219,20 @@ void CClient::endGame( bool closeConnection /*= true*/ )
|
||||
GH.curInt = nullptr;
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
logNetwork->infoStream() << "Ending current game!";
|
||||
logNetwork->infoStream() << "Ending current game!";
|
||||
if(GH.topInt())
|
||||
{
|
||||
GH.topInt()->deactivate();
|
||||
}
|
||||
GH.listInt.clear();
|
||||
GH.objsToBlit.clear();
|
||||
GH.statusbar = nullptr;
|
||||
logNetwork->infoStream() << "Removed GUI.";
|
||||
logNetwork->infoStream() << "Removed GUI.";
|
||||
|
||||
vstd::clear_pointer(const_cast<CGameInfo*>(CGI)->mh);
|
||||
vstd::clear_pointer(gs);
|
||||
|
||||
logNetwork->infoStream() << "Deleted mapHandler and gameState.";
|
||||
logNetwork->infoStream() << "Deleted mapHandler and gameState.";
|
||||
LOCPLINT = nullptr;
|
||||
}
|
||||
|
||||
@ -238,9 +240,9 @@ void CClient::endGame( bool closeConnection /*= true*/ )
|
||||
battleints.clear();
|
||||
callbacks.clear();
|
||||
battleCallbacks.clear();
|
||||
logNetwork->infoStream() << "Deleted playerInts.";
|
||||
|
||||
logNetwork->infoStream() << "Client stopped.";
|
||||
CGObelisk::reset();
|
||||
logNetwork->infoStream() << "Deleted playerInts.";
|
||||
logNetwork->infoStream() << "Client stopped.";
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
@ -1867,6 +1867,12 @@ void CGObelisk::initObj()
|
||||
obeliskCount++;
|
||||
}
|
||||
|
||||
void CGObelisk::reset()
|
||||
{
|
||||
obeliskCount = 0;
|
||||
visited.clear();
|
||||
}
|
||||
|
||||
std::string CGObelisk::getHoverText(PlayerColor player) const
|
||||
{
|
||||
return getObjectName() + " " + visitedTxt(wasVisited(player));
|
||||
|
@ -460,6 +460,7 @@ public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
std::string getHoverText(PlayerColor player) const override;
|
||||
static void reset();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user