ソースを参照

Merge branch 'develop' of https://github.com/vcmi/vcmi into develop

DjWarmonger 9 年 前
コミット
5058d5771e

+ 4 - 4
client/CMT.cpp

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

+ 6 - 6
client/Client.cpp

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

+ 3 - 3
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<boost::recursive_mutex> un(*LOCPLINT->pim);
+			boost::unique_lock<boost::recursive_mutex> un(*CPlayerInterface::pim);
 			activateStack();
 		}
 	});

+ 1 - 1
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

+ 4 - 2
client/windows/CKingdomInterface.cpp

@@ -148,9 +148,11 @@ std::string InfoBoxAbstractHeroData::getValueText()
 			si64 value = getValue();
 			if (value)
 				return CGI->generaltexth->levels[value];
+			else
+				return "";
 		}
 	default:
-		assert(0);
+		logGlobal->error("Invalid InfoBox info type");
 	}
 	return "";
 }
@@ -173,7 +175,7 @@ std::string InfoBoxAbstractHeroData::getNameText()
 		else
 			return "";
 	default:
-		assert(0);
+		logGlobal->error("Invalid InfoBox info type");
 	}
 	return "";
 }

+ 0 - 8
client/windows/CTradeWindow.cpp

@@ -1299,14 +1299,6 @@ void CAltarWindow::selectionChanged(bool side)
 	if(mode != EMarketMode::CREATURE_EXP)
 		return;
 
-	CTradeableItem *&selected = side ? hLeft : hRight;
-	CTradeableItem *&theOther = side ? hRight : hLeft;
-
-	theOther = *std::find_if(items[!side].begin(), items[!side].end(), [&](const CTradeableItem * item)
-	{
-		return item->serial == selected->serial;
-	});
-
 	int stackCount = 0;
 	for (int i = 0; i < GameConstants::ARMY_SIZE; i++)
 		if(hero->getStackCount(SlotID(i)) > sacrificedUnits[i])

+ 0 - 1
lib/serializer/Connection.h

@@ -58,7 +58,6 @@ public:
 
 	boost::mutex *rmx, *wmx; // read/write mutexes
 	TSocket * socket;
-	bool logging;
 	bool connected;
 	bool myEndianess, contactEndianess; //true if little endian, if endianness is different we'll have to revert received multi-byte vars
 	boost::asio::io_service *io_service;

+ 1 - 1
test/MapComparer.cpp

@@ -230,7 +230,7 @@ void MapComparer::compareObjects()
 		{
 			auto it = actual->instanceNames.find(expectedObject->instanceName);
 
-			BOOST_REQUIRE(it != expected->instanceNames.end());
+			BOOST_REQUIRE(it != actual->instanceNames.end());
 
 			auto actualObject = it->second;