1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Unblock interface during turn of another human player

This commit is contained in:
Ivan Savenko 2024-04-27 12:40:22 +03:00
parent ac11a0e639
commit 49691ef743
4 changed files with 21 additions and 13 deletions

View File

@ -1215,7 +1215,6 @@ void CPlayerInterface::loadGame( BinaryDeserializer & h )
void CPlayerInterface::moveHero( const CGHeroInstance *h, const CGPath& path )
{
assert(LOCPLINT->makingTurn);
assert(h);
assert(!showingDialog->get());
assert(dialogs.empty());

View File

@ -510,9 +510,6 @@ void AdventureMapInterface::onTileLeftClicked(const int3 &targetPosition)
if(!shortcuts->optionMapViewActive())
return;
if(!LOCPLINT->makingTurn)
return;
const CGObjectInstance *topBlocking = LOCPLINT->cb->isVisible(targetPosition) ? getActiveObject(targetPosition) : nullptr;
if(spellBeingCasted)

View File

@ -475,16 +475,16 @@ bool AdventureMapShortcuts::optionInWorldView()
bool AdventureMapShortcuts::optionSidePanelActive()
{
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW;
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::OTHER_HUMAN_PLAYER_TURN;
}
bool AdventureMapShortcuts::optionMapScrollingActive()
{
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || (state == EAdventureState::OTHER_HUMAN_PLAYER_TURN);
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::OTHER_HUMAN_PLAYER_TURN;
}
bool AdventureMapShortcuts::optionMapViewActive()
{
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::CASTING_SPELL
|| (state == EAdventureState::OTHER_HUMAN_PLAYER_TURN);
|| state == EAdventureState::OTHER_HUMAN_PLAYER_TURN;
}

View File

@ -16,6 +16,7 @@
#include "MapViewCache.h"
#include "MapViewModel.h"
#include "../CCallback.h"
#include "../CPlayerInterface.h"
#include "../adventureMap/AdventureMapInterface.h"
#include "../gui/CGuiHandler.h"
@ -23,6 +24,7 @@
#include "../eventsSDL/InputHandler.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/StartInfo.h"
#include "../../lib/mapObjects/CGHeroInstance.h"
#include "../../lib/mapObjects/MiscObjects.h"
#include "../../lib/pathfinder/CGPathNode.h"
@ -295,9 +297,14 @@ bool MapViewController::isEventVisible(const CGObjectInstance * obj, const Playe
if(!GH.windows().isTopWindow(adventureInt))
return false;
// do not focus on actions of other players during our turn (e.g. simturns)
if (LOCPLINT->makingTurn && initiator != LOCPLINT->playerID)
return false;
// do not focus on actions of other players except for AI with simturns off
if (initiator != LOCPLINT->playerID)
{
if (LOCPLINT->makingTurn)
return false;
if (LOCPLINT->cb->getStartInfo()->playerInfos.at(initiator).isControlledByHuman())
return false;
}
if(obj->isVisitable())
return context->isVisible(obj->visitablePos());
@ -316,9 +323,14 @@ bool MapViewController::isEventVisible(const CGHeroInstance * obj, const int3 &
if(!GH.windows().isTopWindow(adventureInt))
return false;
// do not focus on actions of other players during our turn (e.g. simturns)
if (LOCPLINT->makingTurn && obj->getOwner() != LOCPLINT->playerID)
return false;
// do not focus on actions of other players except for AI with simturns off
if (obj->getOwner() != LOCPLINT->playerID)
{
if (LOCPLINT->makingTurn)
return false;
if (LOCPLINT->cb->getStartInfo()->playerInfos.at(obj->getOwner()).isControlledByHuman())
return false;
}
if(context->isVisible(obj->convertToVisitablePos(from)))
return true;