Переглянути джерело

dimlevel as class variable

Laserlicht 2 роки тому
батько
коміт
72e4941982

+ 4 - 6
client/adventureMap/AdventureMapInterface.cpp

@@ -51,7 +51,7 @@ AdventureMapInterface::AdventureMapInterface():
 	spellBeingCasted(nullptr),
 	scrollingWasActive(false),
 	scrollingWasBlocked(false),
-	isHotseatMessage(false)
+	backgroundDimLevel(settings["adventure"]["backgroundDimLevel"].Integer())
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
 	pos.x = pos.y = 0;
@@ -172,9 +172,6 @@ void AdventureMapInterface::dim(Canvas & to)
 		std::shared_ptr<AdventureMapInterface> casted = std::dynamic_pointer_cast<AdventureMapInterface>(window);
 		if (!casted && !window->isPopupWindow())
 		{
-			int backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
-			if(isHotseatMessage)
-				backgroundDimLevel = 255;
 			Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
 			ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
 			if(backgroundDimLevel > 0)
@@ -338,7 +335,8 @@ void AdventureMapInterface::onMapTilesChanged(boost::optional<std::unordered_set
 
 void AdventureMapInterface::onHotseatWaitStarted(PlayerColor playerID)
 {
-	isHotseatMessage = true;
+	backgroundDimLevel = 255;
+
 	onCurrentPlayerChanged(playerID);
 	setState(EAdventureState::HOTSEAT_WAIT);
 }
@@ -383,7 +381,7 @@ void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
 
 void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
 {
-	isHotseatMessage = false;
+	backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
 
 	onCurrentPlayerChanged(playerID);
 

+ 2 - 2
client/adventureMap/AdventureMapInterface.h

@@ -59,8 +59,8 @@ private:
 	/// if true, then scrolling was blocked via ctrl and should not restart until player move cursor outside scrolling area
 	bool scrollingWasBlocked;
 
-	/// if true, the hotseat next player is opened
-	bool isHotseatMessage;
+	/// how much should the background dimmed, when windows are on the top
+	int backgroundDimLevel;
 
 	/// spell for which player is selecting target, or nullptr if none
 	const CSpell *spellBeingCasted;