mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +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())
|
if(topBlocking && topBlocking->isVisitable() && !topBlocking->visitableAt(destinationTile) && settings["gameTweaks"]["simpleObjectSelection"].Bool())
|
||||||
destinationTile = topBlocking->visitablePos();
|
destinationTile = topBlocking->visitablePos();
|
||||||
|
|
||||||
|
if(!settings["adventure"]["showMovePath"].Bool())
|
||||||
|
{
|
||||||
|
GAME->interface()->localState->setPath(currentHero, destinationTile);
|
||||||
|
onHeroChanged(currentHero);
|
||||||
|
}
|
||||||
|
|
||||||
if(GAME->interface()->localState->hasPath(currentHero) &&
|
if(GAME->interface()->localState->hasPath(currentHero) &&
|
||||||
GAME->interface()->localState->getPath(currentHero).endPos() == destinationTile &&
|
GAME->interface()->localState->getPath(currentHero).endPos() == destinationTile &&
|
||||||
!ENGINE->isKeyboardShiftDown())//we'll be moving
|
!ENGINE->isKeyboardShiftDown())//we'll be moving
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "../render/Colors.h"
|
#include "../render/Colors.h"
|
||||||
#include "../render/Graphics.h"
|
#include "../render/Graphics.h"
|
||||||
|
|
||||||
|
#include "../../lib/CConfigHandler.h"
|
||||||
#include "../../lib/RiverHandler.h"
|
#include "../../lib/RiverHandler.h"
|
||||||
#include "../../lib/RoadHandler.h"
|
#include "../../lib/RoadHandler.h"
|
||||||
#include "../../lib/TerrainHandler.h"
|
#include "../../lib/TerrainHandler.h"
|
||||||
@@ -677,7 +678,7 @@ void MapRendererPath::renderTile(IMapRendererContext & context, Canvas & target,
|
|||||||
{
|
{
|
||||||
size_t imageID = selectImage(context, coordinates);
|
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));
|
target.draw(pathNodes->getImage(imageID), Point(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
#include "AdventureOptionsTab.h"
|
#include "AdventureOptionsTab.h"
|
||||||
|
|
||||||
#include "../../GameEngine.h"
|
#include "../../GameEngine.h"
|
||||||
|
#include "../../GameInstance.h"
|
||||||
|
#include "../../CPlayerInterface.h"
|
||||||
|
#include "../../PlayerLocalState.h"
|
||||||
#include "../../eventsSDL/InputHandler.h"
|
#include "../../eventsSDL/InputHandler.h"
|
||||||
#include "../../gui/WindowHandler.h"
|
#include "../../gui/WindowHandler.h"
|
||||||
#include "../../widgets/Buttons.h"
|
#include "../../widgets/Buttons.h"
|
||||||
@@ -153,6 +156,13 @@ AdventureOptionsTab::AdventureOptionsTab()
|
|||||||
setBoolSetting("adventure", "minimapShowHeroes", value);
|
setBoolSetting("adventure", "minimapShowHeroes", value);
|
||||||
ENGINE->windows().totalRedraw();
|
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);
|
build(config);
|
||||||
|
|
||||||
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
|
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
|
||||||
@@ -208,4 +218,7 @@ AdventureOptionsTab::AdventureOptionsTab()
|
|||||||
|
|
||||||
std::shared_ptr<CToggleButton> minimapShowHeroesCheckbox = widget<CToggleButton>("minimapShowHeroesCheckbox");
|
std::shared_ptr<CToggleButton> minimapShowHeroesCheckbox = widget<CToggleButton>("minimapShowHeroesCheckbox");
|
||||||
minimapShowHeroesCheckbox->setSelected(settings["adventure"]["minimapShowHeroes"].Bool());
|
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",
|
"type" : "object",
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"default" : {},
|
"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" : {
|
"properties" : {
|
||||||
"heroMoveTime" : {
|
"heroMoveTime" : {
|
||||||
"type" : "number",
|
"type" : "number",
|
||||||
@@ -456,10 +456,13 @@
|
|||||||
"type" : "boolean",
|
"type" : "boolean",
|
||||||
"default" : true
|
"default" : true
|
||||||
},
|
},
|
||||||
|
|
||||||
"tileZoom" : {
|
"tileZoom" : {
|
||||||
"type" : "number",
|
"type" : "number",
|
||||||
"default" : 32
|
"default" : 32
|
||||||
|
},
|
||||||
|
"showMovePath" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"default" : true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -289,7 +289,7 @@
|
|||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"text": "core.genrltxt.572" // TODO: show move path
|
"text": "core.genrltxt.572" // show move path
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "core.genrltxt.573" // show hero reminder
|
"text": "core.genrltxt.573" // show hero reminder
|
||||||
@@ -315,8 +315,9 @@
|
|||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "showMovePathPlaceholder",
|
"name": "showMovePathCheckbox",
|
||||||
"type": "checkboxFake"
|
"help": "core.help.360",
|
||||||
|
"callback": "showMovePathChanged"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "heroReminderCheckbox",
|
"name": "heroReminderCheckbox",
|
||||||
|
|||||||
Reference in New Issue
Block a user