1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Removed remaining references to 'pim' name

This commit is contained in:
Ivan Savenko 2023-09-27 18:49:30 +03:00
parent 0dcfd6e65c
commit 195320dcf2
6 changed files with 16 additions and 17 deletions

View File

@ -486,7 +486,7 @@ static void quitApplication()
std::cout << "Ending...\n";
// this method is always called from event/network threads, which keep interface mutex locked
// unlock it here to avoid assertion failure on GH descruction in exit()
// unlock it here to avoid assertion failure on GH destruction in exit()
GH.interfaceMutex.unlock();
exit(0);
}

View File

@ -104,7 +104,7 @@
#include "../lib/spells/CSpellHandler.h"
// The macro below is used to mark functions that are called by client when game state changes.
// They all assume that CPlayerInterface::pim mutex is locked.
// They all assume that interface mutex is locked.
#define EVENT_HANDLER_CALLED_BY_CLIENT
#define BATTLE_EVENT_POSSIBLE_RETURN \
@ -751,7 +751,7 @@ void CPlayerInterface::activeStack(const BattleID & battleID, const CStack * sta
{
//FIXME: we want client rendering to proceed while AI is making actions
// so unlock mutex while AI is busy since this might take quite a while, especially if hero has many spells
auto unlockPim = vstd::makeUnlockGuard(GH.interfaceMutex);
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
autofightingAI->activeStack(battleID, stack);
return;
}
@ -1339,7 +1339,7 @@ void CPlayerInterface::waitWhileDialog()
return;
}
auto unlock = vstd::makeUnlockGuard(GH.interfaceMutex);
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
boost::unique_lock<boost::mutex> un(showingDialog->mx);
while(showingDialog->data)
showingDialog->cond.wait(un);
@ -1378,7 +1378,7 @@ void CPlayerInterface::centerView (int3 pos, int focusTime)
GH.windows().totalRedraw();
{
IgnoreEvents ignore(*this);
auto unlockPim = vstd::makeUnlockGuard(GH.interfaceMutex);
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
boost::this_thread::sleep_for(boost::chrono::milliseconds(focusTime));
}
}
@ -1815,7 +1815,7 @@ void CPlayerInterface::waitForAllDialogs()
{
while(!dialogs.empty())
{
auto unlock = vstd::makeUnlockGuard(GH.interfaceMutex);
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
boost::this_thread::sleep_for(boost::chrono::milliseconds(5));
}
waitWhileDialog();

View File

@ -641,15 +641,17 @@ void CClient::battleFinished(const BattleID & battleID)
void CClient::startPlayerBattleAction(const BattleID & battleID, PlayerColor color)
{
assert(vstd::contains(battleints, color));
auto battleint = battleints.at(color);
if(vstd::contains(battleints, color))
if (!battleint->human)
{
// we want to avoid locking gamestate and causing UI to freeze while AI is making turn
auto unlock = vstd::makeUnlockGuardIf(GH.interfaceMutex, !battleints[color]->human);
assert(vstd::contains(battleints, color));
battleints[color]->activeStack(battleID, gs->getBattle(battleID)->battleGetStackByID(gs->getBattle(battleID)->activeStack, false));
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
battleint->activeStack(battleID, gs->getBattle(battleID)->battleGetStackByID(gs->getBattle(battleID)->activeStack, false));
}
else
{
battleint->activeStack(battleID, gs->getBattle(battleID)->battleGetStackByID(gs->getBattle(battleID)->activeStack, false));
}
}

View File

@ -78,9 +78,6 @@ class ClientCommandManager //take mantis #2292 issue about account if thinking a
// set <command> <on/off> - sets special temporary settings that reset on game quit.
void handleSetCommand(std::istringstream& singleWordBuffer);
// Unlocks specific mutex known in VCMI code as "pim"
void handleUnlockCommand(std::istringstream& singleWordBuffer);
// Crashes the game forcing an exception
void handleCrashCommand();

View File

@ -780,7 +780,7 @@ void BattleInterface::onAnimationsFinished()
void BattleInterface::waitForAnimations()
{
{
auto unlockPim = vstd::makeUnlockGuard(GH.interfaceMutex);
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
ongoingAnimationsState.waitUntil(false);
}

View File

@ -38,7 +38,7 @@ void CMapHandler::waitForOngoingAnimations()
{
while(CGI->mh->hasOngoingAnimations())
{
auto unlockPim = vstd::makeUnlockGuard(GH.interfaceMutex);
auto unlockInterface = vstd::makeUnlockGuard(GH.interfaceMutex);
boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
}
}