Browse Source

Removed remaining references to 'pim' name

Ivan Savenko 2 years ago
parent
commit
195320dcf2

+ 1 - 1
client/CMT.cpp

@@ -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);
 }

+ 5 - 5
client/CPlayerInterface.cpp

@@ -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();

+ 8 - 6
client/Client.cpp

@@ -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));
 	}
 }
 

+ 0 - 3
client/ClientCommandManager.h

@@ -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();
 

+ 1 - 1
client/battle/BattleInterface.cpp

@@ -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);
 	}
 

+ 1 - 1
client/mapView/mapHandler.cpp

@@ -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));
 	}
 }