Browse Source

optimize if disabled

Michael 2 years ago
parent
commit
1721fe1ad6
1 changed files with 4 additions and 2 deletions
  1. 4 2
      client/adventureMap/AdventureMapInterface.cpp

+ 4 - 2
client/adventureMap/AdventureMapInterface.cpp

@@ -171,9 +171,11 @@ 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();
 			Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
-			ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(settings["adventure"]["backgroundDimLevel"].Integer(), 0, 255));
-			to.drawColor(targetRect, colorToFill);
+			ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
+			if(backgroundDimLevel > 0)
+				to.drawColor(targetRect, colorToFill);
 			return;
 		}
 	}