mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Tweaks
This commit is contained in:
parent
f0963c91bb
commit
80666fb134
@ -836,7 +836,7 @@ void processCommand(const std::string &message)
|
||||
}
|
||||
else if(cn == "gosolo")
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> 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<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> 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<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> 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<boost::recursive_mutex> lock(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> lock(*CPlayerInterface::pim);
|
||||
|
||||
Settings full = settings.write["video"]["fullscreen"];
|
||||
const bool toFullscreen = full->Bool();
|
||||
|
@ -219,7 +219,7 @@ void CClient::endGame(bool closeConnection /*= true*/)
|
||||
|
||||
GH.curInt = nullptr;
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> 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<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
auto p = std::make_shared<CPlayerInterface>(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<boost::recursive_mutex> guiLock(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> 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<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> 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<CCampaignState> camp )
|
||||
|
||||
void CClient::installNewPlayerInterface(std::shared_ptr<CGameInterface> gameInterface, boost::optional<PlayerColor> color)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
PlayerColor colorUsed = color.get_value_or(PlayerColor::UNFLAGGABLE);
|
||||
|
||||
if(!color)
|
||||
@ -896,7 +896,7 @@ void CClient::installNewPlayerInterface(std::shared_ptr<CGameInterface> gameInte
|
||||
|
||||
void CClient::installNewBattleInterface(std::shared_ptr<CBattleGameInterface> battleInterface, boost::optional<PlayerColor> color, bool needCallback /*= true*/)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
PlayerColor colorUsed = color.get_value_or(PlayerColor::UNFLAGGABLE);
|
||||
|
||||
if(!color)
|
||||
|
@ -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<boost::recursive_mutex> un(*LOCPLINT->pim);
|
||||
boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
|
||||
activateStack();
|
||||
}
|
||||
});
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user