|
@@ -15,7 +15,6 @@
|
|
|
#include "mapView/mapHandler.h"
|
|
|
#include "adventureMap/CList.h"
|
|
|
#include "adventureMap/CInfoBar.h"
|
|
|
-#include "adventureMap/CMinimap.h"
|
|
|
#include "battle/BattleInterface.h"
|
|
|
#include "battle/BattleEffectsController.h"
|
|
|
#include "battle/BattleFieldController.h"
|
|
@@ -161,8 +160,7 @@ void HeroPathStorage::removeLastNode(const CGHeroInstance *h)
|
|
|
void HeroPathStorage::erasePath(const CGHeroInstance *h)
|
|
|
{
|
|
|
paths.erase(h);
|
|
|
- adventureInt->updateMoveHero(h, false);
|
|
|
-
|
|
|
+ adventureInt->onHeroChanged(h);
|
|
|
}
|
|
|
|
|
|
void HeroPathStorage::verifyPath(const CGHeroInstance *h)
|
|
@@ -258,7 +256,6 @@ void CPlayerInterface::yourTurn()
|
|
|
|
|
|
LOCPLINT = this;
|
|
|
GH.curInt = this;
|
|
|
- adventureInt->selection = nullptr;
|
|
|
|
|
|
NotificationHandler::notify("Your turn");
|
|
|
|
|
@@ -267,7 +264,7 @@ void CPlayerInterface::yourTurn()
|
|
|
if (firstCall)
|
|
|
{
|
|
|
if(CSH->howManyPlayerInterfaces() == 1)
|
|
|
- adventureInt->setPlayer(playerID);
|
|
|
+ adventureInt->onCurrentPlayerChanged(playerID);
|
|
|
|
|
|
autosaveCount = getLastIndex(prefix + "Autosave_");
|
|
|
|
|
@@ -285,7 +282,7 @@ void CPlayerInterface::yourTurn()
|
|
|
autosaveCount %= 5;
|
|
|
}
|
|
|
|
|
|
- adventureInt->setPlayer(playerID);
|
|
|
+ adventureInt->onCurrentPlayerChanged(playerID);
|
|
|
|
|
|
if (CSH->howManyPlayerInterfaces() > 1) //hot seat message
|
|
|
{
|
|
@@ -324,15 +321,15 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose)
|
|
|
if (!hero)
|
|
|
return;
|
|
|
|
|
|
- adventureInt->infoBar->requestPopAll();
|
|
|
if (details.result == TryMoveHero::EMBARK || details.result == TryMoveHero::DISEMBARK)
|
|
|
{
|
|
|
if(hero->getRemovalSound() && hero->tempOwner == playerID)
|
|
|
CCS->soundh->playSound(hero->getRemovalSound().value());
|
|
|
}
|
|
|
|
|
|
- adventureInt->minimap->updateTile(hero->convertToVisitablePos(details.start));
|
|
|
- adventureInt->minimap->updateTile(hero->convertToVisitablePos(details.end));
|
|
|
+
|
|
|
+ adventureInt->onMapTileChanged(hero->convertToVisitablePos(details.start));
|
|
|
+ adventureInt->onMapTileChanged(hero->convertToVisitablePos(details.end));
|
|
|
|
|
|
bool directlyAttackingCreature = details.attackedFrom && paths.hasPath(hero) && paths.getPath(hero).endPos() == *details.attackedFrom;
|
|
|
|
|
@@ -375,16 +372,14 @@ void CPlayerInterface::heroMoved(const TryMoveHero & details, bool verbose)
|
|
|
if(details.stopMovement()) //hero failed to move
|
|
|
{
|
|
|
stillMoveHero.setn(STOP_MOVE);
|
|
|
- adventureInt->heroList->update(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- adventureInt->heroList->redraw();
|
|
|
-
|
|
|
CGI->mh->waitForOngoingAnimations();
|
|
|
|
|
|
//move finished
|
|
|
- adventureInt->heroList->update(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
|
|
|
//check if user cancelled movement
|
|
|
{
|
|
@@ -427,33 +422,8 @@ void CPlayerInterface::heroKilled(const CGHeroInstance* hero)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
LOG_TRACE_PARAMS(logGlobal, "Hero %s killed handler for player %s", hero->getNameTranslated() % playerID);
|
|
|
-
|
|
|
- const CArmedInstance *newSelection = nullptr;
|
|
|
- if (makingTurn)
|
|
|
- {
|
|
|
- //find new object for selection: either hero
|
|
|
- int next = adventureInt->getNextHeroIndex(vstd::find_pos(wanderingHeroes, hero));
|
|
|
- if (next >= 0)
|
|
|
- newSelection = wanderingHeroes[next];
|
|
|
-
|
|
|
- //or town
|
|
|
- if (!newSelection || newSelection == hero)
|
|
|
- {
|
|
|
- if (towns.empty())
|
|
|
- newSelection = nullptr;
|
|
|
- else
|
|
|
- newSelection = towns.front();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
wanderingHeroes -= hero;
|
|
|
-
|
|
|
- adventureInt->heroList->update(hero);
|
|
|
- if (makingTurn && newSelection)
|
|
|
- adventureInt->select(newSelection, true);
|
|
|
- else if (adventureInt->selection == hero)
|
|
|
- adventureInt->selection = nullptr;
|
|
|
-
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
paths.erasePath(hero);
|
|
|
}
|
|
|
|
|
@@ -471,7 +441,7 @@ void CPlayerInterface::heroCreated(const CGHeroInstance * hero)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
wanderingHeroes.push_back(hero);
|
|
|
- adventureInt->heroList->update(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
}
|
|
|
void CPlayerInterface::openTownWindow(const CGTownInstance * town)
|
|
|
{
|
|
@@ -486,9 +456,7 @@ void CPlayerInterface::openTownWindow(const CGTownInstance * town)
|
|
|
|
|
|
void CPlayerInterface::activateForSpectator()
|
|
|
{
|
|
|
- adventureInt->state = CAdvMapInt::INGAME;
|
|
|
adventureInt->activate();
|
|
|
- adventureInt->minimap->activate();
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int which, si64 val)
|
|
@@ -499,8 +467,8 @@ void CPlayerInterface::heroPrimarySkillChanged(const CGHeroInstance * hero, int
|
|
|
if (CAltarWindow *ctw = dynamic_cast<CAltarWindow *>(GH.topInt().get()))
|
|
|
ctw->setExpToLevel();
|
|
|
}
|
|
|
- else if (which < GameConstants::PRIMARY_SKILLS) //no need to redraw infowin if this is experience (exp is treated as prim skill with id==4)
|
|
|
- updateInfo(hero);
|
|
|
+ else
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::heroSecondarySkillChanged(const CGHeroInstance * hero, int which, int val)
|
|
@@ -516,15 +484,15 @@ void CPlayerInterface::heroSecondarySkillChanged(const CGHeroInstance * hero, in
|
|
|
void CPlayerInterface::heroManaPointsChanged(const CGHeroInstance * hero)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
if (makingTurn && hero->tempOwner == playerID)
|
|
|
- adventureInt->heroList->update(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
}
|
|
|
void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
if (makingTurn && hero->tempOwner == playerID)
|
|
|
- adventureInt->heroList->update(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
}
|
|
|
void CPlayerInterface::receivedResource()
|
|
|
{
|
|
@@ -560,7 +528,6 @@ void CPlayerInterface::commanderGotLevel (const CCommanderInstance * commander,
|
|
|
void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- updateInfo(town);
|
|
|
|
|
|
if (town->garrisonHero) //wandering hero moved to the garrison
|
|
|
{
|
|
@@ -573,8 +540,8 @@ void CPlayerInterface::heroInGarrisonChange(const CGTownInstance *town)
|
|
|
if (town->visitingHero->tempOwner == playerID && !vstd::contains(wanderingHeroes,town->visitingHero)) // our hero
|
|
|
wanderingHeroes.push_back(town->visitingHero);
|
|
|
}
|
|
|
- adventureInt->heroList->update();
|
|
|
- adventureInt->updateNextHero(nullptr);
|
|
|
+ adventureInt->onHeroChanged(nullptr);
|
|
|
+ adventureInt->onTownChanged(town);
|
|
|
|
|
|
if(castleInt)
|
|
|
{
|
|
@@ -627,7 +594,15 @@ void CPlayerInterface::garrisonsChanged(std::vector<const CGObjectInstance *> ob
|
|
|
{
|
|
|
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
|
|
for (auto object : objs)
|
|
|
- updateInfo(object);
|
|
|
+ {
|
|
|
+ auto * hero = dynamic_cast<const CGHeroInstance*>(object);
|
|
|
+ auto * town = dynamic_cast<const CGTownInstance*>(object);
|
|
|
+
|
|
|
+ if (hero)
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
+ if (town)
|
|
|
+ adventureInt->onTownChanged(town);
|
|
|
+ }
|
|
|
|
|
|
for (auto & elem : GH.listInt)
|
|
|
{
|
|
@@ -653,15 +628,6 @@ void CPlayerInterface::garrisonChanged( const CGObjectInstance * obj)
|
|
|
void CPlayerInterface::buildChanged(const CGTownInstance *town, BuildingID buildingID, int what) //what: 1 - built, 2 - demolished
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- switch (buildingID)
|
|
|
- {
|
|
|
- case BuildingID::FORT: case BuildingID::CITADEL: case BuildingID::CASTLE:
|
|
|
- case BuildingID::VILLAGE_HALL: case BuildingID::TOWN_HALL: case BuildingID::CITY_HALL: case BuildingID::CAPITOL:
|
|
|
- case BuildingID::RESOURCE_SILO:
|
|
|
- updateInfo(town);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
if (castleInt)
|
|
|
{
|
|
|
castleInt->townlist->update(town);
|
|
@@ -680,7 +646,7 @@ void CPlayerInterface::buildChanged(const CGTownInstance *town, BuildingID build
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- adventureInt->townList->update(town);
|
|
|
+ adventureInt->onTownChanged(town);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::battleStartBefore(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2)
|
|
@@ -709,7 +675,6 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
|
|
|
isAutoFightOn = true;
|
|
|
cb->registerBattleInterface(autofightingAI);
|
|
|
// Player shouldn't be able to move on adventure map if quick combat is going
|
|
|
- adventureInt->quickCombatLock();
|
|
|
allowBattleReplay = true;
|
|
|
}
|
|
|
|
|
@@ -920,7 +885,6 @@ void CPlayerInterface::battleEnd(const BattleResult *br, QueryID queryID)
|
|
|
// #1490 - during AI turn when quick combat is on, we need to display the message and wait for user to close it.
|
|
|
// Otherwise NewTurn causes freeze.
|
|
|
waitWhileDialog();
|
|
|
- adventureInt->quickCombatUnlock();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -928,7 +892,6 @@ void CPlayerInterface::battleEnd(const BattleResult *br, QueryID queryID)
|
|
|
BATTLE_EVENT_POSSIBLE_RETURN;
|
|
|
|
|
|
battleInt->battleFinished(*br, queryID);
|
|
|
- adventureInt->quickCombatUnlock();
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::battleLogMessage(const std::vector<MetaString> & lines)
|
|
@@ -1070,7 +1033,7 @@ void CPlayerInterface::showInfoDialog(EInfoWindowMode type, const std::string &t
|
|
|
if(autoTryHover || type == EInfoWindowMode::INFO)
|
|
|
{
|
|
|
waitWhileDialog(); //Fix for mantis #98
|
|
|
- adventureInt->infoBar->pushComponents(components, text, timer);
|
|
|
+ adventureInt->showInfoBoxMessage(components, text, timer);
|
|
|
|
|
|
if (makingTurn && GH.listInt.size() && LOCPLINT == this)
|
|
|
CCS->soundh->playSound(static_cast<soundBase::soundID>(soundID));
|
|
@@ -1235,14 +1198,14 @@ void CPlayerInterface::tileRevealed(const std::unordered_set<int3, ShashInt3> &p
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
//FIXME: wait for dialog? Magi hut/eye would benefit from this but may break other areas
|
|
|
for (auto & po : pos)
|
|
|
- adventureInt->minimap->updateTile(po);
|
|
|
+ adventureInt->onMapTileChanged(po);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::tileHidden(const std::unordered_set<int3, ShashInt3> &pos)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
for (auto & po : pos)
|
|
|
- adventureInt->minimap->updateTile(po);
|
|
|
+ adventureInt->onMapTileChanged(po);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::openHeroWindow(const CGHeroInstance *hero)
|
|
@@ -1286,7 +1249,7 @@ void CPlayerInterface::heroBonusChanged( const CGHeroInstance *hero, const Bonus
|
|
|
if (bonus.type == Bonus::NONE)
|
|
|
return;
|
|
|
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
if ((bonus.type == Bonus::FLYING_MOVEMENT || bonus.type == Bonus::WATER_WALKING) && !gain)
|
|
|
{
|
|
|
//recalculate paths because hero has lost bonus influencing pathfinding
|
|
@@ -1330,14 +1293,8 @@ void CPlayerInterface::moveHero( const CGHeroInstance *h, const CGPath& path )
|
|
|
|
|
|
setMovementStatus(true);
|
|
|
|
|
|
- if (adventureInt && adventureInt->isHeroSleeping(h))
|
|
|
- {
|
|
|
- adventureInt->sleepWake->clickLeft(true, false);
|
|
|
- adventureInt->sleepWake->clickLeft(false, true);
|
|
|
- //could've just called
|
|
|
- //adventureInt->fsleepWake();
|
|
|
- //but no authentic button click/sound ;-)
|
|
|
- }
|
|
|
+ if (adventureInt)
|
|
|
+ adventureInt->onHeroWokeUp(h);
|
|
|
|
|
|
boost::thread moveHeroTask(std::bind(&CPlayerInterface::doMoveHero,this,h,path));
|
|
|
}
|
|
@@ -1415,6 +1372,7 @@ void CPlayerInterface::heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanc
|
|
|
void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
+
|
|
|
//redraw minimap if owner changed
|
|
|
if (sop->what == ObjProperty::OWNER)
|
|
|
{
|
|
@@ -1424,17 +1382,19 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
|
|
|
for(auto & po : pos)
|
|
|
{
|
|
|
if(cb->isVisible(po))
|
|
|
- adventureInt->minimap->updateTile(po);
|
|
|
+ adventureInt->onMapTileChanged(po);
|
|
|
}
|
|
|
if(obj->ID == Obj::TOWN)
|
|
|
{
|
|
|
+ auto town = static_cast<const CGTownInstance *>(obj);
|
|
|
+
|
|
|
if(obj->tempOwner == playerID)
|
|
|
- towns.push_back(static_cast<const CGTownInstance *>(obj));
|
|
|
+ towns.push_back(town);
|
|
|
else
|
|
|
towns -= obj;
|
|
|
|
|
|
- adventureInt->townList->update();
|
|
|
- adventureInt->minimap->update();
|
|
|
+ adventureInt->onTownChanged(town);
|
|
|
+ adventureInt->onMapTilesChanged();
|
|
|
}
|
|
|
assert(cb->getTownsInfo().size() == towns.size());
|
|
|
}
|
|
@@ -1456,7 +1416,7 @@ void CPlayerInterface::initializeHeroTownList()
|
|
|
towns = cb->getTownsInfo();
|
|
|
|
|
|
if(adventureInt)
|
|
|
- adventureInt->updateNextHero(nullptr);
|
|
|
+ adventureInt->onHeroChanged(nullptr);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::showRecruitmentDialog(const CGDwelling *dwelling, const CArmedInstance *dst, int level)
|
|
@@ -1545,7 +1505,7 @@ void CPlayerInterface::objectRemoved(const CGObjectInstance * obj)
|
|
|
void CPlayerInterface::objectRemovedAfter()
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
- adventureInt->minimap->update();
|
|
|
+ adventureInt->onMapTilesChanged();
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::playerBlocked(int reason, bool start)
|
|
@@ -1558,8 +1518,7 @@ void CPlayerInterface::playerBlocked(int reason, bool start)
|
|
|
boost::unique_lock<boost::mutex> lock(eventsM); //TODO: copied from yourTurn, no idea if it's needed
|
|
|
LOCPLINT = this;
|
|
|
GH.curInt = this;
|
|
|
- adventureInt->selection = nullptr;
|
|
|
- adventureInt->setPlayer(playerID);
|
|
|
+ adventureInt->onCurrentPlayerChanged(playerID);
|
|
|
std::string msg = CGI->generaltexth->translate("vcmi.adventureMap.playerAttacked");
|
|
|
boost::replace_first(msg, "%s", cb->getStartInfo()->playerInfos.find(playerID)->second.name);
|
|
|
std::vector<std::shared_ptr<CComponent>> cmp;
|
|
@@ -1810,21 +1769,6 @@ void CPlayerInterface::tryDiggging(const CGHeroInstance * h)
|
|
|
showInfoDialog(CGI->generaltexth->allTexts[msgToShow]);
|
|
|
}
|
|
|
|
|
|
-void CPlayerInterface::updateInfo(const CGObjectInstance * specific)
|
|
|
-{
|
|
|
- bool isHero = dynamic_cast<const CGHeroInstance *>(specific) != nullptr;
|
|
|
- bool changedHero = dynamic_cast<const CGHeroInstance *>(specific) != adventureInt->curHero();
|
|
|
- bool isTown = dynamic_cast<const CGTownInstance *>(specific) != nullptr;
|
|
|
-
|
|
|
- bool update = (isHero && changedHero) || (isTown);
|
|
|
- // If infobar is showing components and we request an update to hero
|
|
|
- // do not force infobar tick here, it will prevents us to show components just picked up
|
|
|
- if(adventureInt->infoBar->showingComponents() && !update)
|
|
|
- return;
|
|
|
-
|
|
|
- adventureInt->infoBar->showSelection();
|
|
|
-}
|
|
|
-
|
|
|
void CPlayerInterface::battleNewRoundFirst( int round )
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
@@ -1933,14 +1877,14 @@ void CPlayerInterface::artifactPut(const ArtifactLocation &al)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
}
|
|
|
|
|
|
void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
for(auto isa : GH.listInt)
|
|
|
{
|
|
|
auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
@@ -1955,7 +1899,7 @@ void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const Artifact
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), dst.artHolder);
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
|
|
|
bool redraw = true;
|
|
|
// If a bulk transfer has arrived, then redrawing only the last art movement.
|
|
@@ -1984,7 +1928,7 @@ void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
for(auto isa : GH.listInt)
|
|
|
{
|
|
|
auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
@@ -1997,7 +1941,7 @@ void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al)
|
|
|
{
|
|
|
EVENT_HANDLER_CALLED_BY_CLIENT;
|
|
|
auto hero = std::visit(HeroObjectRetriever(), al.artHolder);
|
|
|
- updateInfo(hero);
|
|
|
+ adventureInt->onHeroChanged(hero);
|
|
|
for(auto isa : GH.listInt)
|
|
|
{
|
|
|
auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
|
|
@@ -2016,8 +1960,6 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (player == playerID)
|
|
|
- adventureInt->infoBar->showSelection();
|
|
|
while (GH.listInt.front() != adventureInt && !dynamic_cast<CInfoWindow*>(GH.listInt.front().get())) //don't remove dialogs that expect query answer
|
|
|
GH.popInts(1);
|
|
|
}
|
|
@@ -2057,7 +1999,7 @@ CPlayerInterface::SpellbookLastSetting::SpellbookLastSetting()
|
|
|
|
|
|
bool CPlayerInterface::capturedAllEvents()
|
|
|
{
|
|
|
- if (duringMovement)
|
|
|
+ if(duringMovement)
|
|
|
{
|
|
|
//just inform that we are capturing events. they will be processed by heroMoved() in client thread.
|
|
|
return true;
|
|
@@ -2065,7 +2007,7 @@ bool CPlayerInterface::capturedAllEvents()
|
|
|
|
|
|
bool needToLockAdventureMap = adventureInt && adventureInt->active && CGI->mh->hasOngoingAnimations();
|
|
|
|
|
|
- if (ignoreEvents || needToLockAdventureMap)
|
|
|
+ if (ignoreEvents || needToLockAdventureMap || isAutoFightOn)
|
|
|
{
|
|
|
boost::unique_lock<boost::mutex> un(eventsM);
|
|
|
while(!SDLEventsQueue.empty())
|
|
@@ -2245,15 +2187,6 @@ void CPlayerInterface::doMoveHero(const CGHeroInstance * h, CGPath path)
|
|
|
if (!showingDialog->get())
|
|
|
GH.fakeMouseMove();
|
|
|
|
|
|
-
|
|
|
- //todo: this should be in main thread
|
|
|
- if (adventureInt)
|
|
|
- {
|
|
|
- // (i == 0) means hero went through all the path
|
|
|
- adventureInt->updateMoveHero(h, (i != 0));
|
|
|
- adventureInt->updateNextHero(h);
|
|
|
- }
|
|
|
-
|
|
|
CGI->mh->waitForOngoingAnimations();
|
|
|
setMovementStatus(false);
|
|
|
}
|