|
@@ -36,6 +36,7 @@
|
|
|
#include "../../lib/texts/CGeneralTextHandler.h"
|
|
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
|
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
|
|
+#include "../../lib/mapObjects/MiscObjects.h"
|
|
|
#include "../../lib/mapping/CMap.h"
|
|
|
#include "../../lib/pathfinder/CGPathNode.h"
|
|
|
#include "../../lib/mapObjectConstructors/CObjectClassesHandler.h"
|
|
@@ -100,7 +101,7 @@ std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
|
|
|
{ EShortcut::ADVENTURE_VIEW_PUZZLE, optionSidePanelActive(),[this]() { this->viewPuzzleMap(); } },
|
|
|
{ EShortcut::ADVENTURE_VISIT_OBJECT, optionCanVisitObject(), [this]() { this->visitObject(); } },
|
|
|
{ EShortcut::ADVENTURE_VIEW_SELECTED, optionInMapView(), [this]() { this->openObject(); } },
|
|
|
- { EShortcut::ADVENTURE_MARKETPLACE, optionInMapView(), [this]() { this->showMarketplace(); } },
|
|
|
+ { EShortcut::ADVENTURE_MARKETPLACE, optionMarketplace(), [this]() { this->showMarketplace(); } },
|
|
|
{ EShortcut::ADVENTURE_ZOOM_IN, optionSidePanelActive(),[this]() { this->zoom(+10); } },
|
|
|
{ EShortcut::ADVENTURE_ZOOM_OUT, optionSidePanelActive(),[this]() { this->zoom(-10); } },
|
|
|
{ EShortcut::ADVENTURE_ZOOM_RESET, optionSidePanelActive(),[this]() { this->zoom( 0); } },
|
|
@@ -641,7 +642,7 @@ bool AdventureMapShortcuts::optionInWorldView()
|
|
|
|
|
|
bool AdventureMapShortcuts::optionSidePanelActive()
|
|
|
{
|
|
|
-return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW;
|
|
|
+ return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW;
|
|
|
}
|
|
|
|
|
|
bool AdventureMapShortcuts::optionMapScrollingActive()
|
|
@@ -653,3 +654,25 @@ bool AdventureMapShortcuts::optionMapViewActive()
|
|
|
{
|
|
|
return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::CASTING_SPELL;
|
|
|
}
|
|
|
+
|
|
|
+bool AdventureMapShortcuts::optionMarketplace()
|
|
|
+{
|
|
|
+ if(state != EAdventureState::MAKING_TURN)
|
|
|
+ return false;
|
|
|
+ for(const CGTownInstance *t : GAME->interface()->cb->getTownsInfo())
|
|
|
+ if(t->hasBuilt(BuildingID::MARKETPLACE))
|
|
|
+ return true;
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+bool AdventureMapShortcuts::optionHeroGround()
|
|
|
+{
|
|
|
+ const CGHeroInstance *hero = GAME->interface()->localState->getCurrentHero();
|
|
|
+ return optionInMapView() && hero && !hero->inBoat();
|
|
|
+}
|
|
|
+
|
|
|
+bool AdventureMapShortcuts::optionHeroBoat(EPathfindingLayer layer)
|
|
|
+{
|
|
|
+ const CGHeroInstance *hero = GAME->interface()->localState->getCurrentHero();
|
|
|
+ return optionInMapView() && hero && hero->inBoat() && hero->getBoat()->layer == layer;
|
|
|
+}
|