Laserlicht 1 week ago
parent
commit
7a7ba74907
3 changed files with 7 additions and 10 deletions
  1. 4 8
      client/mapView/MapRenderer.cpp
  2. 0 1
      client/mapView/MapRenderer.h
  3. 3 1
      docs/players/Cheat_Codes.md

+ 4 - 8
client/mapView/MapRenderer.cpp

@@ -14,6 +14,7 @@
 #include "IMapRendererContext.h"
 #include "mapHandler.h"
 
+#include "../CPlayerInterface.h"
 #include "../CServerHandler.h"
 #include "../GameInstance.h"
 #include "../Client.h"
@@ -601,11 +602,6 @@ MapRendererOverlay::MapRendererOverlay()
 	, imageGrail(ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("AVZgrail"), EImageBlitMode::COLORKEY)->getImage(0))
 	, grailPos(GAME->server().client->gameState().getMap().grailPos)
 {
-	int humanPlayer = 0;
-	for (const auto & pi : GAME->server().client->gameState().getStartInfo()->playerInfos)
-		if(pi.second.isControlledByHuman())
-			humanPlayer++;
-	isSinglePlayer = humanPlayer < 2;
 }
 
 void MapRendererOverlay::renderTile(IMapRendererContext & context, Canvas & target, const int3 & coordinates)
@@ -613,7 +609,7 @@ void MapRendererOverlay::renderTile(IMapRendererContext & context, Canvas & targ
 	if(context.showGrid())
 		target.draw(imageGrid, Point(0,0));
 
-	if(context.showVisitable() || context.showBlocked() || context.showInvisible())
+	if(GAME->interface()->cb->getStartInfo()->extraOptionsInfo.cheatsAllowed && (context.showVisitable() || context.showBlocked() || context.showInvisible()))
 	{
 		bool blocking = false;
 		bool visitable = false;
@@ -622,10 +618,10 @@ void MapRendererOverlay::renderTile(IMapRendererContext & context, Canvas & targ
 		{
 			const auto * object = context.getObject(objectID);
 
-			if(object->ID == Obj::EVENT && context.showInvisible() && isSinglePlayer)
+			if(object->ID == Obj::EVENT && context.showInvisible())
 				target.draw(imageEvent, Point(0,0));
 			
-			if(grailPos == coordinates && context.showInvisible() && isSinglePlayer)
+			if(grailPos == coordinates && context.showInvisible())
 				target.draw(imageGrail, Point(0,0));
 
 			if(context.objectTransparency(objectID, coordinates) > 0 && !context.isActiveHero(object))

+ 0 - 1
client/mapView/MapRenderer.h

@@ -142,7 +142,6 @@ class MapRendererOverlay
 	std::shared_ptr<IImage> imageEvent;
 	std::shared_ptr<IImage> imageGrail;
 
-	bool isSinglePlayer;
 	int3 grailPos;
 public:
 	MapRendererOverlay();

+ 3 - 1
docs/players/Cheat_Codes.md

@@ -169,10 +169,12 @@ Below a list of supported commands, with their arguments wrapped in `<>`
 - `showGrid` - display a square grid overlay on top of adventure map
 - `showBlocked` - show blocked tiles on map
 - `showVisitable` - show visitable tiles on map
-- `showInvisible` - show invisible tiles (events, grail) on map (only singleplayer)
+- `showInvisible` - show invisible tiles (events, grail) on map
 - `hideSystemMessages` - suppress server messages in chat
 - `antilag` - toggles network lag compensation in multiplayer on or off
 
+`showBlocked`, `showVisitable` and `showInvisible` only works if cheats are enabled.
+
 #### Developer Commands
 
 - `crash` - force a game crash. It is sometimes useful to generate memory dump file in certain situations, for example game freeze