1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-29 21:56:54 +02:00

Add reset to some static variables on client

This commit is contained in:
Arseniy Shestakov 2016-08-25 15:52:20 +03:00
parent f020fa06fd
commit a90b657b86
5 changed files with 16 additions and 0 deletions

View File

@ -240,6 +240,8 @@ void CClient::endGame( bool closeConnection /*= true*/ )
battleints.clear();
callbacks.clear();
battleCallbacks.clear();
CGKeys::reset();
CGMagi::reset();
CGObelisk::reset();
logNetwork->infoStream() << "Deleted playerInts.";
logNetwork->infoStream() << "Client stopped.";

View File

@ -762,6 +762,11 @@ void CGQuestGuard::completeQuest(const CGHeroInstance *h) const
cb->removeObject(this);
}
void CGKeys::reset()
{
playerKeyMap.clear();
}
void CGKeys::setPropertyDer (ui8 what, ui32 val) //101-108 - enable key for player 1-8
{
if (what >= 101 && what <= (100 + PlayerColor::PLAYER_LIMIT_I))

View File

@ -154,6 +154,8 @@ public:
static std::map <PlayerColor, std::set <ui8> > playerKeyMap; //[players][keysowned]
//SubID 0 - lightblue, 1 - green, 2 - red, 3 - darkblue, 4 - brown, 5 - purple, 6 - white, 7 - black
static void reset();
bool wasMyColorVisited (PlayerColor player) const;
std::string getObjectName() const override; //depending on color

View File

@ -1869,6 +1869,11 @@ void CGGarrison::serializeJsonOptions(JsonSerializeFormat& handler)
CCreatureSet::serializeJson(handler, "army");
}
void CGMagi::reset()
{
eyelist.clear();
}
void CGMagi::initObj()
{
if (ID == Obj::EYE_OF_MAGI)

View File

@ -441,6 +441,8 @@ class DLL_LINKAGE CGMagi : public CGObjectInstance
public:
static std::map <si32, std::vector<ObjectInstanceID> > eyelist; //[subID][id], supports multiple sets as in H5
static void reset();
void initObj() override;
void onHeroVisit(const CGHeroInstance * h) const override;