1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

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

This commit is contained in:
DjWarmonger 2016-11-25 20:43:26 +01:00
commit 5058d5771e
8 changed files with 19 additions and 26 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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