1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #2419 from dydzio0614/multiplayer-adventure-map-responsiveness

Multiplayer adventure map responsiveness
This commit is contained in:
Ivan Savenko 2023-07-28 13:39:02 +03:00 committed by GitHub
commit dd88d39a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -192,7 +192,7 @@ void AdventureMapInterface::handleMapScrollingUpdate(uint32_t timePassed)
Point scrollDelta = scrollDirection * scrollDistance;
bool cursorInScrollArea = scrollDelta != Point(0,0);
bool scrollingActive = cursorInScrollArea && isActive() && shortcuts->optionSidePanelActive() && !scrollingWasBlocked;
bool scrollingActive = cursorInScrollArea && shortcuts->optionMapScrollingActive() && !scrollingWasBlocked;
bool scrollingBlocked = GH.isKeyboardCtrlDown() || !settings["adventure"]["borderScroll"].Bool();
if (!scrollingWasActive && scrollingBlocked)
@ -323,7 +323,7 @@ void AdventureMapInterface::onEnemyTurnStarted(PlayerColor playerID, bool isHuma
mapAudio->onEnemyTurnStarted();
widget->getMinimap()->setAIRadar(!isHuman);
widget->getInfoBar()->startEnemyTurn(LOCPLINT->cb->getCurrentPlayer());
setState(EAdventureState::ENEMY_TURN);
setState(isHuman ? EAdventureState::OTHER_HUMAN_PLAYER_TURN : EAdventureState::AI_PLAYER_TURN);
}
void AdventureMapInterface::setState(EAdventureState state)

View File

@ -461,7 +461,13 @@ bool AdventureMapShortcuts::optionSidePanelActive()
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW;
}
bool AdventureMapShortcuts::optionMapScrollingActive()
{
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;
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::CASTING_SPELL
|| (state == EAdventureState::OTHER_HUMAN_PLAYER_TURN);
}

View File

@ -81,6 +81,7 @@ public:
bool optionInMapView();
bool optionInWorldView();
bool optionSidePanelActive();
bool optionMapScrollingActive();
bool optionMapViewActive();
void setState(EAdventureState newState);

View File

@ -14,7 +14,8 @@ enum class EAdventureState
NOT_INITIALIZED,
HOTSEAT_WAIT,
MAKING_TURN,
ENEMY_TURN,
AI_PLAYER_TURN,
OTHER_HUMAN_PLAYER_TURN,
CASTING_SPELL,
WORLD_VIEW
};