From 7a7ba749079518bdc019cdc2409857965220120f Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Tue, 21 Oct 2025 22:30:32 +0200 Subject: [PATCH] review --- client/mapView/MapRenderer.cpp | 12 ++++-------- client/mapView/MapRenderer.h | 1 - docs/players/Cheat_Codes.md | 4 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/client/mapView/MapRenderer.cpp b/client/mapView/MapRenderer.cpp index d85b5ae53..3fa453ce3 100644 --- a/client/mapView/MapRenderer.cpp +++ b/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)) diff --git a/client/mapView/MapRenderer.h b/client/mapView/MapRenderer.h index c6e014fc1..880524c48 100644 --- a/client/mapView/MapRenderer.h +++ b/client/mapView/MapRenderer.h @@ -142,7 +142,6 @@ class MapRendererOverlay std::shared_ptr imageEvent; std::shared_ptr imageGrail; - bool isSinglePlayer; int3 grailPos; public: MapRendererOverlay(); diff --git a/docs/players/Cheat_Codes.md b/docs/players/Cheat_Codes.md index 302b1ac8c..42dd2887b 100644 --- a/docs/players/Cheat_Codes.md +++ b/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