Quellcode durchsuchen

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

Multiplayer adventure map responsiveness
Ivan Savenko vor 2 Jahren
Ursprung
Commit
dd88d39a82

+ 2 - 2
client/adventureMap/AdventureMapInterface.cpp

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

+ 7 - 1
client/adventureMap/AdventureMapShortcuts.cpp

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

+ 1 - 0
client/adventureMap/AdventureMapShortcuts.h

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

+ 2 - 1
client/adventureMap/AdventureState.h

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