mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
show path
This commit is contained in:
@@ -562,6 +562,12 @@ void AdventureMapInterface::onTileLeftClicked(const int3 &targetPosition)
|
||||
if(topBlocking && topBlocking->isVisitable() && !topBlocking->visitableAt(destinationTile) && settings["gameTweaks"]["simpleObjectSelection"].Bool())
|
||||
destinationTile = topBlocking->visitablePos();
|
||||
|
||||
if(!settings["adventure"]["showMovePath"].Bool())
|
||||
{
|
||||
GAME->interface()->localState->setPath(currentHero, destinationTile);
|
||||
onHeroChanged(currentHero);
|
||||
}
|
||||
|
||||
if(GAME->interface()->localState->hasPath(currentHero) &&
|
||||
GAME->interface()->localState->getPath(currentHero).endPos() == destinationTile &&
|
||||
!ENGINE->isKeyboardShiftDown())//we'll be moving
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../render/Colors.h"
|
||||
#include "../render/Graphics.h"
|
||||
|
||||
#include "../../lib/CConfigHandler.h"
|
||||
#include "../../lib/RiverHandler.h"
|
||||
#include "../../lib/RoadHandler.h"
|
||||
#include "../../lib/TerrainHandler.h"
|
||||
@@ -677,7 +678,7 @@ void MapRendererPath::renderTile(IMapRendererContext & context, Canvas & target,
|
||||
{
|
||||
size_t imageID = selectImage(context, coordinates);
|
||||
|
||||
if (imageID < pathNodes->size())
|
||||
if (imageID < pathNodes->size() && settings["adventure"]["showMovePath"].Bool())
|
||||
target.draw(pathNodes->getImage(imageID), Point(0,0));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "AdventureOptionsTab.h"
|
||||
|
||||
#include "../../GameEngine.h"
|
||||
#include "../../GameInstance.h"
|
||||
#include "../../CPlayerInterface.h"
|
||||
#include "../../PlayerLocalState.h"
|
||||
#include "../../eventsSDL/InputHandler.h"
|
||||
#include "../../gui/WindowHandler.h"
|
||||
#include "../../widgets/Buttons.h"
|
||||
@@ -153,6 +156,13 @@ AdventureOptionsTab::AdventureOptionsTab()
|
||||
setBoolSetting("adventure", "minimapShowHeroes", value);
|
||||
ENGINE->windows().totalRedraw();
|
||||
});
|
||||
addCallback("showMovePathChanged", [](bool value)
|
||||
{
|
||||
setBoolSetting("adventure", "showMovePath", value);
|
||||
if (GAME->interface()->makingTurn && GAME->interface()->localState->getCurrentHero())
|
||||
GAME->interface()->localState->erasePath(GAME->interface()->localState->getCurrentHero());
|
||||
ENGINE->windows().totalRedraw();
|
||||
});
|
||||
build(config);
|
||||
|
||||
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
|
||||
@@ -208,4 +218,7 @@ AdventureOptionsTab::AdventureOptionsTab()
|
||||
|
||||
std::shared_ptr<CToggleButton> minimapShowHeroesCheckbox = widget<CToggleButton>("minimapShowHeroesCheckbox");
|
||||
minimapShowHeroesCheckbox->setSelected(settings["adventure"]["minimapShowHeroes"].Bool());
|
||||
|
||||
std::shared_ptr<CToggleButton> showMovePathCheckbox = widget<CToggleButton>("showMovePathCheckbox");
|
||||
showMovePathCheckbox->setSelected(settings["adventure"]["showMovePath"].Bool());
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@
|
||||
"type" : "object",
|
||||
"additionalProperties" : false,
|
||||
"default" : {},
|
||||
"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "rightButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground", "backgroundDimSmallWindows", "tileZoom", "minimapShowHeroes" ],
|
||||
"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "rightButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground", "backgroundDimSmallWindows", "tileZoom", "minimapShowHeroes", "showMovePath" ],
|
||||
"properties" : {
|
||||
"heroMoveTime" : {
|
||||
"type" : "number",
|
||||
@@ -456,10 +456,13 @@
|
||||
"type" : "boolean",
|
||||
"default" : true
|
||||
},
|
||||
|
||||
"tileZoom" : {
|
||||
"type" : "number",
|
||||
"default" : 32
|
||||
},
|
||||
"showMovePath" : {
|
||||
"type" : "boolean",
|
||||
"default" : true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
"items":
|
||||
[
|
||||
{
|
||||
"text": "core.genrltxt.572" // TODO: show move path
|
||||
"text": "core.genrltxt.572" // show move path
|
||||
},
|
||||
{
|
||||
"text": "core.genrltxt.573" // show hero reminder
|
||||
@@ -315,8 +315,9 @@
|
||||
"items":
|
||||
[
|
||||
{
|
||||
"name": "showMovePathPlaceholder",
|
||||
"type": "checkboxFake"
|
||||
"name": "showMovePathCheckbox",
|
||||
"help": "core.help.360",
|
||||
"callback": "showMovePathChanged"
|
||||
},
|
||||
{
|
||||
"name": "heroReminderCheckbox",
|
||||
|
||||
Reference in New Issue
Block a user