diff --git a/client/CMT.cpp b/client/CMT.cpp index e62bc0136..40afec038 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -836,7 +836,7 @@ void processCommand(const std::string &message) } else if(cn == "gosolo") { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); PlayerColor color; if(session["aiSolo"].Bool()) { @@ -870,7 +870,7 @@ void processCommand(const std::string &message) readed >> colorName; boost::to_lower(colorName); - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); PlayerColor color; if(LOCPLINT) color = LOCPLINT->playerID; @@ -892,7 +892,7 @@ void processCommand(const std::string &message) // Check mantis issue 2292 for details /* else if(client && client->serv && client->serv->connected && LOCPLINT) //send to server { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); LOCPLINT->cb->sendMessage(message); }*/ } @@ -1113,7 +1113,7 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen, int displayInde static void fullScreenChanged() { - boost::unique_lock lock(*LOCPLINT->pim); + boost::unique_lock lock(*CPlayerInterface::pim); Settings full = settings.write["video"]["fullscreen"]; const bool toFullscreen = full->Bool(); diff --git a/client/Client.cpp b/client/Client.cpp index 4589a654a..36645da75 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -219,7 +219,7 @@ void CClient::endGame(bool closeConnection /*= true*/) GH.curInt = nullptr; { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); logNetwork->infoStream() << "Ending current game!"; if(GH.topInt()) { @@ -481,7 +481,7 @@ void CClient::newGame( CConnection *con, StartInfo *si ) { if(!gNoGUI) { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); auto p = std::make_shared(PlayerColor::NEUTRAL); p->observerInDuelMode = true; installNewPlayerInterface(p, boost::none); @@ -663,7 +663,7 @@ void CClient::handlePack( CPack * pack ) CBaseForCLApply *apply = applier->getApplier(typeList.getTypeID(pack)); //find the applier if(apply) { - boost::unique_lock guiLock(*LOCPLINT->pim); + boost::unique_lock guiLock(*CPlayerInterface::pim); apply->applyOnClBefore(this, pack); logNetwork->trace("\tMade first apply on cl"); gs->apply(pack); @@ -750,7 +750,7 @@ void CClient::battleStarted(const BattleInfo * info) if(!gNoGUI && (!!att || !!def || gs->scenarioOps->mode == StartInfo::DUEL)) { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); auto bi = new CBattleInterface(leftSide.armyObject, rightSide.armyObject, leftSide.hero, rightSide.hero, Rect((screen->w - 800)/2, (screen->h - 600)/2, 800, 600), att, def); @@ -877,7 +877,7 @@ void CClient::campaignMapFinished( std::shared_ptr camp ) void CClient::installNewPlayerInterface(std::shared_ptr gameInterface, boost::optional color) { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); PlayerColor colorUsed = color.get_value_or(PlayerColor::UNFLAGGABLE); if(!color) @@ -896,7 +896,7 @@ void CClient::installNewPlayerInterface(std::shared_ptr gameInte void CClient::installNewBattleInterface(std::shared_ptr battleInterface, boost::optional color, bool needCallback /*= true*/) { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); PlayerColor colorUsed = color.get_value_or(PlayerColor::UNFLAGGABLE); if(!color) diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index 9c8cda4a1..d56fbea17 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -1231,7 +1231,7 @@ void CBattleInterface::battleFinished(const BattleResult& br) { bresult = &br; { - auto unlockPim = vstd::makeUnlockGuard(*LOCPLINT->pim); + auto unlockPim = vstd::makeUnlockGuard(*CPlayerInterface::pim); animsAreDisplayed.waitUntil(false); } displayBattleFinished(); @@ -1969,7 +1969,7 @@ void CBattleInterface::startAction(const BattleAction* action) void CBattleInterface::waitForAnims() { - auto unlockPim = vstd::makeUnlockGuard(*LOCPLINT->pim); + auto unlockPim = vstd::makeUnlockGuard(*CPlayerInterface::pim); animsAreDisplayed.waitWhileTrue(); } @@ -2828,7 +2828,7 @@ void CBattleInterface::requestAutofightingAIToTakeAction() } else { - boost::unique_lock un(*LOCPLINT->pim); + boost::unique_lock un(*CPlayerInterface::pim); activateStack(); } }); diff --git a/client/windows/CAdvmapInterface.cpp b/client/windows/CAdvmapInterface.cpp index b646efce7..173fc61e2 100644 --- a/client/windows/CAdvmapInterface.cpp +++ b/client/windows/CAdvmapInterface.cpp @@ -1122,7 +1122,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key) return; if(h && key.state == SDL_PRESSED) { - auto unlockPim = vstd::makeUnlockGuard(*LOCPLINT->pim); + auto unlockPim = vstd::makeUnlockGuard(*CPlayerInterface::pim); //TODO!!!!!!! possible freeze, when GS mutex is locked and network thread can't apply package //this thread leaves scope and tries to lock pim while holding gs, //network thread tries to lock gs (appluy cl) while holding pim