diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 3599c399a..72b6e2438 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -77,7 +77,6 @@ #define COMPLAIN_RETF(txt, FORMAT) {complain(boost::str(boost::format(txt) % FORMAT)); return false;} CondSh battleMadeAction(false); -boost::recursive_mutex battleActionMutex; CondSh battleResult(nullptr); template class CApplyOnGH; diff --git a/server/CGameHandler.h b/server/CGameHandler.h index a3f906408..49a6dfcd6 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -102,6 +102,8 @@ class CGameHandler : public IGameCallback, public CBattleInfoCallback, public En std::unique_ptr battleThread; public: + boost::recursive_mutex battleActionMutex; + std::unique_ptr heroPool; using FireShieldInfo = std::vector>; diff --git a/server/NetPacksServer.cpp b/server/NetPacksServer.cpp index 7660bc073..3027242c0 100644 --- a/server/NetPacksServer.cpp +++ b/server/NetPacksServer.cpp @@ -25,8 +25,6 @@ #include "../lib/spells/ISpellMechanics.h" #include "../lib/serializer/Cast.h" -extern boost::recursive_mutex battleActionMutex; - void ApplyGhNetPackVisitor::visitSaveGame(SaveGame & pack) { gh.save(pack.fname); @@ -282,7 +280,7 @@ void ApplyGhNetPackVisitor::visitQueryReply(QueryReply & pack) void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack) { - boost::unique_lock lock(battleActionMutex); + boost::unique_lock lock(gh.battleActionMutex); const BattleInfo * b = gs.curB; if(!b) @@ -311,7 +309,7 @@ void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack) void ApplyGhNetPackVisitor::visitMakeCustomAction(MakeCustomAction & pack) { - boost::unique_lock lock(battleActionMutex); + boost::unique_lock lock(gh.battleActionMutex); const BattleInfo * b = gs.curB; if(!b)