AdventureMapShortcuts.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*
  2. * AdventureMapShortcuts.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "AdventureMapShortcuts.h"
  12. #include "../CGameInfo.h"
  13. #include "../CMT.h"
  14. #include "../CPlayerInterface.h"
  15. #include "../CServerHandler.h"
  16. #include "../PlayerLocalState.h"
  17. #include "../gui/CGuiHandler.h"
  18. #include "../gui/Shortcut.h"
  19. #include "../gui/WindowHandler.h"
  20. #include "../lobby/CSavingScreen.h"
  21. #include "../mapView/mapHandler.h"
  22. #include "../windows/CKingdomInterface.h"
  23. #include "../windows/CSpellWindow.h"
  24. #include "../windows/CMarketWindow.h"
  25. #include "../windows/settings/SettingsMainWindow.h"
  26. #include "AdventureMapInterface.h"
  27. #include "AdventureOptions.h"
  28. #include "AdventureState.h"
  29. #include "../../CCallback.h"
  30. #include "../../lib/CConfigHandler.h"
  31. #include "../../lib/CGeneralTextHandler.h"
  32. #include "../../lib/mapObjects/CGHeroInstance.h"
  33. #include "../../lib/mapObjects/CGTownInstance.h"
  34. #include "../../lib/mapping/CMap.h"
  35. #include "../../lib/pathfinder/CGPathNode.h"
  36. AdventureMapShortcuts::AdventureMapShortcuts(AdventureMapInterface & owner)
  37. : owner(owner)
  38. , state(EAdventureState::NOT_INITIALIZED)
  39. , mapLevel(0)
  40. {}
  41. void AdventureMapShortcuts::setState(EAdventureState newState)
  42. {
  43. state = newState;
  44. }
  45. EAdventureState AdventureMapShortcuts::getState() const
  46. {
  47. return state;
  48. }
  49. void AdventureMapShortcuts::onMapViewMoved(const Rect & visibleArea, int newMapLevel)
  50. {
  51. mapLevel = newMapLevel;
  52. }
  53. std::vector<AdventureMapShortcutState> AdventureMapShortcuts::getShortcuts()
  54. {
  55. std::vector<AdventureMapShortcutState> result = {
  56. { EShortcut::ADVENTURE_KINGDOM_OVERVIEW, optionInMapView(), [this]() { this->showOverview(); } },
  57. { EShortcut::ADVENTURE_EXIT_WORLD_VIEW, optionInWorldView(), [this]() { this->worldViewBack(); } },
  58. { EShortcut::ADVENTURE_VIEW_WORLD, optionInMapView(), [this]() { this->worldViewScale1x(); } },
  59. { EShortcut::ADVENTURE_VIEW_WORLD_X1, optionInWorldView(), [this]() { this->worldViewScale1x(); } },
  60. { EShortcut::ADVENTURE_VIEW_WORLD_X2, optionInWorldView(), [this]() { this->worldViewScale2x(); } },
  61. { EShortcut::ADVENTURE_VIEW_WORLD_X4, optionInWorldView(), [this]() { this->worldViewScale4x(); } },
  62. { EShortcut::ADVENTURE_TOGGLE_MAP_LEVEL, optionCanToggleLevel(), [this]() { this->switchMapLevel(); } },
  63. { EShortcut::ADVENTURE_QUEST_LOG, optionCanViewQuests(), [this]() { this->showQuestlog(); } },
  64. { EShortcut::ADVENTURE_TOGGLE_SLEEP, optionHeroSelected(), [this]() { this->toggleSleepWake(); } },
  65. { EShortcut::ADVENTURE_TOGGLE_GRID, optionInMapView(), [this]() { this->toggleGrid(); } },
  66. { EShortcut::ADVENTURE_TRACK_HERO, optionInMapView(), [this]() { this->toggleTrackHero(); } },
  67. { EShortcut::ADVENTURE_SET_HERO_ASLEEP, optionHeroAwake(), [this]() { this->setHeroSleeping(); } },
  68. { EShortcut::ADVENTURE_SET_HERO_AWAKE, optionHeroSleeping(), [this]() { this->setHeroAwake(); } },
  69. { EShortcut::ADVENTURE_MOVE_HERO, optionHeroCanMove(), [this]() { this->moveHeroAlongPath(); } },
  70. { EShortcut::ADVENTURE_CAST_SPELL, optionHeroSelected(), [this]() { this->showSpellbook(); } },
  71. { EShortcut::ADVENTURE_GAME_OPTIONS, optionInMapView(), [this]() { this->adventureOptions(); } },
  72. { EShortcut::GLOBAL_OPTIONS, optionInMapView(), [this]() { this->systemOptions(); } },
  73. { EShortcut::ADVENTURE_FIRST_HERO, optionInMapView(), [this]() { this->firstHero(); } },
  74. { EShortcut::ADVENTURE_NEXT_HERO, optionHasNextHero(), [this]() { this->nextHero(); } },
  75. { EShortcut::ADVENTURE_END_TURN, optionCanEndTurn(), [this]() { this->endTurn(); } },
  76. { EShortcut::ADVENTURE_THIEVES_GUILD, optionInMapView(), [this]() { this->showThievesGuild(); } },
  77. { EShortcut::ADVENTURE_VIEW_SCENARIO, optionInMapView(), [this]() { this->showScenarioInfo(); } },
  78. { EShortcut::ADVENTURE_QUIT_GAME, optionInMapView(), [this]() { this->quitGame(); } },
  79. { EShortcut::ADVENTURE_TO_MAIN_MENU, optionInMapView(), [this]() { this->toMainMenu(); } },
  80. { EShortcut::ADVENTURE_SAVE_GAME, optionInMapView(), [this]() { this->saveGame(); } },
  81. { EShortcut::ADVENTURE_NEW_GAME, optionInMapView(), [this]() { this->newGame(); } },
  82. { EShortcut::ADVENTURE_LOAD_GAME, optionInMapView(), [this]() { this->loadGame(); } },
  83. { EShortcut::ADVENTURE_RESTART_GAME, optionInMapView(), [this]() { this->restartGame(); } },
  84. { EShortcut::ADVENTURE_DIG_GRAIL, optionHeroSelected(), [this]() { this->digGrail(); } },
  85. { EShortcut::ADVENTURE_VIEW_PUZZLE, optionSidePanelActive(),[this]() { this->viewPuzzleMap(); } },
  86. { EShortcut::ADVENTURE_VISIT_OBJECT, optionCanVisitObject(), [this]() { this->visitObject(); } },
  87. { EShortcut::ADVENTURE_VIEW_SELECTED, optionInMapView(), [this]() { this->openObject(); } },
  88. { EShortcut::ADVENTURE_MARKETPLACE, optionInMapView(), [this]() { this->showMarketplace(); } },
  89. { EShortcut::ADVENTURE_ZOOM_IN, optionSidePanelActive(),[this]() { this->zoom(+10); } },
  90. { EShortcut::ADVENTURE_ZOOM_OUT, optionSidePanelActive(),[this]() { this->zoom(-10); } },
  91. { EShortcut::ADVENTURE_ZOOM_RESET, optionSidePanelActive(),[this]() { this->zoom( 0); } },
  92. { EShortcut::ADVENTURE_FIRST_TOWN, optionInMapView(), [this]() { this->firstTown(); } },
  93. { EShortcut::ADVENTURE_NEXT_TOWN, optionInMapView(), [this]() { this->nextTown(); } },
  94. { EShortcut::ADVENTURE_NEXT_OBJECT, optionInMapView(), [this]() { this->nextObject(); } },
  95. { EShortcut::ADVENTURE_MOVE_HERO_SW, optionHeroSelected(), [this]() { this->moveHeroDirectional({-1, +1}); } },
  96. { EShortcut::ADVENTURE_MOVE_HERO_SS, optionHeroSelected(), [this]() { this->moveHeroDirectional({ 0, +1}); } },
  97. { EShortcut::ADVENTURE_MOVE_HERO_SE, optionHeroSelected(), [this]() { this->moveHeroDirectional({+1, +1}); } },
  98. { EShortcut::ADVENTURE_MOVE_HERO_WW, optionHeroSelected(), [this]() { this->moveHeroDirectional({-1, 0}); } },
  99. { EShortcut::ADVENTURE_MOVE_HERO_EE, optionHeroSelected(), [this]() { this->moveHeroDirectional({+1, 0}); } },
  100. { EShortcut::ADVENTURE_MOVE_HERO_NW, optionHeroSelected(), [this]() { this->moveHeroDirectional({-1, -1}); } },
  101. { EShortcut::ADVENTURE_MOVE_HERO_NN, optionHeroSelected(), [this]() { this->moveHeroDirectional({ 0, -1}); } },
  102. { EShortcut::ADVENTURE_MOVE_HERO_NE, optionHeroSelected(), [this]() { this->moveHeroDirectional({+1, -1}); } }
  103. };
  104. return result;
  105. }
  106. void AdventureMapShortcuts::showOverview()
  107. {
  108. GH.windows().createAndPushWindow<CKingdomInterface>();
  109. }
  110. void AdventureMapShortcuts::worldViewBack()
  111. {
  112. owner.hotkeyExitWorldView();
  113. auto hero = LOCPLINT->localState->getCurrentHero();
  114. if (hero)
  115. owner.centerOnObject(hero);
  116. }
  117. void AdventureMapShortcuts::worldViewScale1x()
  118. {
  119. // TODO set corresponding scale button to "selected" mode
  120. owner.openWorldView(7);
  121. }
  122. void AdventureMapShortcuts::worldViewScale2x()
  123. {
  124. owner.openWorldView(11);
  125. }
  126. void AdventureMapShortcuts::worldViewScale4x()
  127. {
  128. owner.openWorldView(16);
  129. }
  130. void AdventureMapShortcuts::switchMapLevel()
  131. {
  132. int maxLevels = LOCPLINT->cb->getMapSize().z;
  133. if (maxLevels < 2)
  134. return;
  135. owner.hotkeySwitchMapLevel();
  136. }
  137. void AdventureMapShortcuts::showQuestlog()
  138. {
  139. LOCPLINT->showQuestLog();
  140. }
  141. void AdventureMapShortcuts::toggleTrackHero()
  142. {
  143. Settings s = settings.write["session"];
  144. s["adventureTrackHero"].Bool() = !settings["session"]["adventureTrackHero"].Bool();
  145. }
  146. void AdventureMapShortcuts::toggleGrid()
  147. {
  148. Settings s = settings.write["gameTweaks"];
  149. s["showGrid"].Bool() = !settings["gameTweaks"]["showGrid"].Bool();
  150. }
  151. void AdventureMapShortcuts::toggleSleepWake()
  152. {
  153. if (!optionHeroSelected())
  154. return;
  155. if (optionHeroAwake())
  156. setHeroSleeping();
  157. else
  158. setHeroAwake();
  159. }
  160. void AdventureMapShortcuts::setHeroSleeping()
  161. {
  162. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  163. if (h)
  164. {
  165. LOCPLINT->localState->setHeroAsleep(h);
  166. owner.onHeroChanged(h);
  167. nextHero();
  168. }
  169. }
  170. void AdventureMapShortcuts::setHeroAwake()
  171. {
  172. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  173. if (h)
  174. {
  175. LOCPLINT->localState->setHeroAwaken(h);
  176. owner.onHeroChanged(h);
  177. }
  178. }
  179. void AdventureMapShortcuts::moveHeroAlongPath()
  180. {
  181. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  182. if (!h || !LOCPLINT->localState->hasPath(h))
  183. return;
  184. LOCPLINT->moveHero(h, LOCPLINT->localState->getPath(h));
  185. }
  186. void AdventureMapShortcuts::showSpellbook()
  187. {
  188. if (!LOCPLINT->localState->getCurrentHero())
  189. return;
  190. owner.centerOnObject(LOCPLINT->localState->getCurrentHero());
  191. GH.windows().createAndPushWindow<CSpellWindow>(LOCPLINT->localState->getCurrentHero(), LOCPLINT, false);
  192. }
  193. void AdventureMapShortcuts::adventureOptions()
  194. {
  195. GH.windows().createAndPushWindow<AdventureOptions>();
  196. }
  197. void AdventureMapShortcuts::systemOptions()
  198. {
  199. GH.windows().createAndPushWindow<SettingsMainWindow>();
  200. }
  201. void AdventureMapShortcuts::firstHero()
  202. {
  203. if (!LOCPLINT->localState->getWanderingHeroes().empty())
  204. {
  205. const auto * hero = LOCPLINT->localState->getWanderingHero(0);
  206. LOCPLINT->localState->setSelection(hero);
  207. owner.centerOnObject(hero);
  208. }
  209. }
  210. void AdventureMapShortcuts::nextHero()
  211. {
  212. const auto * currHero = LOCPLINT->localState->getCurrentHero();
  213. const auto * nextHero = LOCPLINT->localState->getNextWanderingHero(currHero);
  214. if (nextHero)
  215. {
  216. LOCPLINT->localState->setSelection(nextHero);
  217. owner.centerOnObject(nextHero);
  218. }
  219. }
  220. void AdventureMapShortcuts::endTurn()
  221. {
  222. if(!LOCPLINT->makingTurn)
  223. return;
  224. if(settings["adventure"]["heroReminder"].Bool())
  225. {
  226. for(auto hero : LOCPLINT->localState->getWanderingHeroes())
  227. {
  228. if(!LOCPLINT->localState->isHeroSleeping(hero) && hero->movementPointsRemaining() > 0)
  229. {
  230. // Only show hero reminder if conditions met:
  231. // - There still movement points
  232. // - Hero don't have a path or there not points for first step on path
  233. LOCPLINT->localState->verifyPath(hero);
  234. if(!LOCPLINT->localState->hasPath(hero))
  235. {
  236. LOCPLINT->showYesNoDialog( CGI->generaltexth->allTexts[55], [this](){ owner.hotkeyEndingTurn(); }, nullptr);
  237. return;
  238. }
  239. auto path = LOCPLINT->localState->getPath(hero);
  240. if (path.nodes.size() < 2 || path.nodes[path.nodes.size() - 2].turns)
  241. {
  242. LOCPLINT->showYesNoDialog( CGI->generaltexth->allTexts[55], [this](){ owner.hotkeyEndingTurn(); }, nullptr);
  243. return;
  244. }
  245. }
  246. }
  247. }
  248. owner.hotkeyEndingTurn();
  249. }
  250. void AdventureMapShortcuts::showThievesGuild()
  251. {
  252. //find first town with tavern
  253. auto itr = range::find_if(LOCPLINT->localState->getOwnedTowns(), [](const CGTownInstance * town)
  254. {
  255. return town->hasBuilt(BuildingID::TAVERN);
  256. });
  257. if(itr != LOCPLINT->localState->getOwnedTowns().end())
  258. LOCPLINT->showThievesGuildWindow(*itr);
  259. else
  260. LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithTavern"));
  261. }
  262. void AdventureMapShortcuts::showScenarioInfo()
  263. {
  264. AdventureOptions::showScenarioInfo();
  265. }
  266. void AdventureMapShortcuts::toMainMenu()
  267. {
  268. LOCPLINT->showYesNoDialog(
  269. CGI->generaltexth->allTexts[578],
  270. []()
  271. {
  272. CSH->endGameplay();
  273. GH.defActionsDef = 63;
  274. CMM->menu->switchToTab("main");
  275. },
  276. 0
  277. );
  278. }
  279. void AdventureMapShortcuts::newGame()
  280. {
  281. LOCPLINT->showYesNoDialog(
  282. CGI->generaltexth->allTexts[578],
  283. []()
  284. {
  285. CSH->endGameplay();
  286. GH.defActionsDef = 63;
  287. CMM->menu->switchToTab("new");
  288. },
  289. nullptr
  290. );
  291. }
  292. void AdventureMapShortcuts::quitGame()
  293. {
  294. LOCPLINT->showYesNoDialog(
  295. CGI->generaltexth->allTexts[578],
  296. []()
  297. {
  298. GH.dispatchMainThread( []()
  299. {
  300. handleQuit(false);
  301. });
  302. },
  303. 0
  304. );
  305. }
  306. void AdventureMapShortcuts::saveGame()
  307. {
  308. GH.windows().createAndPushWindow<CSavingScreen>();
  309. }
  310. void AdventureMapShortcuts::loadGame()
  311. {
  312. LOCPLINT->proposeLoadingGame();
  313. }
  314. void AdventureMapShortcuts::digGrail()
  315. {
  316. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  317. if(h && LOCPLINT->makingTurn)
  318. LOCPLINT->tryDigging(h);
  319. }
  320. void AdventureMapShortcuts::viewPuzzleMap()
  321. {
  322. LOCPLINT->showPuzzleMap();
  323. }
  324. void AdventureMapShortcuts::restartGame()
  325. {
  326. LOCPLINT->showYesNoDialog(
  327. CGI->generaltexth->translate("vcmi.adventureMap.confirmRestartGame"),
  328. []()
  329. {
  330. GH.dispatchMainThread(
  331. []()
  332. {
  333. CSH->sendRestartGame();
  334. }
  335. );
  336. },
  337. nullptr
  338. );
  339. }
  340. void AdventureMapShortcuts::visitObject()
  341. {
  342. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  343. if(h)
  344. LOCPLINT->cb->moveHero(h, h->pos, false);
  345. }
  346. void AdventureMapShortcuts::openObject()
  347. {
  348. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  349. const CGTownInstance *t = LOCPLINT->localState->getCurrentTown();
  350. if(h)
  351. LOCPLINT->openHeroWindow(h);
  352. if(t)
  353. LOCPLINT->openTownWindow(t);
  354. }
  355. void AdventureMapShortcuts::showMarketplace()
  356. {
  357. //check if we have any marketplace
  358. const CGTownInstance *townWithMarket = nullptr;
  359. for(const CGTownInstance *t : LOCPLINT->cb->getTownsInfo())
  360. {
  361. if(t->hasBuilt(BuildingID::MARKETPLACE))
  362. {
  363. townWithMarket = t;
  364. break;
  365. }
  366. }
  367. if(townWithMarket) //if any town has marketplace, open window
  368. GH.windows().createAndPushWindow<CMarketWindow>(townWithMarket, nullptr, nullptr, EMarketMode::RESOURCE_RESOURCE);
  369. else //if not - complain
  370. LOCPLINT->showInfoDialog(CGI->generaltexth->translate("vcmi.adventureMap.noTownWithMarket"));
  371. }
  372. void AdventureMapShortcuts::firstTown()
  373. {
  374. if (!LOCPLINT->localState->getOwnedTowns().empty())
  375. {
  376. const auto * town = LOCPLINT->localState->getOwnedTown(0);
  377. LOCPLINT->localState->setSelection(town);
  378. owner.centerOnObject(town);
  379. }
  380. }
  381. void AdventureMapShortcuts::nextTown()
  382. {
  383. owner.hotkeyNextTown();
  384. }
  385. void AdventureMapShortcuts::zoom( int distance)
  386. {
  387. owner.hotkeyZoom(distance, false);
  388. }
  389. void AdventureMapShortcuts::nextObject()
  390. {
  391. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero();
  392. const CGTownInstance *t = LOCPLINT->localState->getCurrentTown();
  393. if(h)
  394. nextHero();
  395. if(t)
  396. nextTown();
  397. }
  398. void AdventureMapShortcuts::moveHeroDirectional(const Point & direction)
  399. {
  400. const CGHeroInstance *h = LOCPLINT->localState->getCurrentHero(); //selected hero
  401. if(!h)
  402. return;
  403. if (CGI->mh->hasOngoingAnimations())
  404. return;
  405. int3 dst = h->visitablePos() + int3(direction.x, direction.y, 0);
  406. if (!CGI->mh->isInMap((dst)))
  407. return;
  408. if ( !LOCPLINT->localState->setPath(h, dst))
  409. return;
  410. const CGPath & path = LOCPLINT->localState->getPath(h);
  411. if (path.nodes.size() > 2)
  412. owner.onHeroChanged(h);
  413. else
  414. if(path.nodes[0].turns == 0)
  415. LOCPLINT->moveHero(h, path);
  416. }
  417. bool AdventureMapShortcuts::optionCanViewQuests()
  418. {
  419. return optionInMapView() && !CGI->mh->getMap()->quests.empty();
  420. }
  421. bool AdventureMapShortcuts::optionCanToggleLevel()
  422. {
  423. return optionSidePanelActive() && LOCPLINT->cb->getMapSize().z > 1;
  424. }
  425. bool AdventureMapShortcuts::optionMapLevelSurface()
  426. {
  427. return mapLevel == 0;
  428. }
  429. bool AdventureMapShortcuts::optionHeroSleeping()
  430. {
  431. const CGHeroInstance *hero = LOCPLINT->localState->getCurrentHero();
  432. return optionInMapView() && hero && LOCPLINT->localState->isHeroSleeping(hero);
  433. }
  434. bool AdventureMapShortcuts::optionHeroAwake()
  435. {
  436. const CGHeroInstance *hero = LOCPLINT->localState->getCurrentHero();
  437. return optionInMapView() && hero && !LOCPLINT->localState->isHeroSleeping(hero);
  438. }
  439. bool AdventureMapShortcuts::optionCanVisitObject()
  440. {
  441. if (!optionHeroSelected())
  442. return false;
  443. auto * hero = LOCPLINT->localState->getCurrentHero();
  444. auto objects = LOCPLINT->cb->getVisitableObjs(hero->visitablePos());
  445. assert(vstd::contains(objects,hero));
  446. return objects.size() > 1; // there is object other than our hero
  447. }
  448. bool AdventureMapShortcuts::optionHeroSelected()
  449. {
  450. return optionInMapView() && LOCPLINT->localState->getCurrentHero() != nullptr;
  451. }
  452. bool AdventureMapShortcuts::optionHeroCanMove()
  453. {
  454. const auto * hero = LOCPLINT->localState->getCurrentHero();
  455. return optionInMapView() && hero && LOCPLINT->localState->hasPath(hero) && LOCPLINT->localState->getPath(hero).nextNode().turns == 0;
  456. }
  457. bool AdventureMapShortcuts::optionHasNextHero()
  458. {
  459. const auto * hero = LOCPLINT->localState->getCurrentHero();
  460. const auto * nextSuitableHero = LOCPLINT->localState->getNextWanderingHero(hero);
  461. return optionInMapView() && nextSuitableHero != nullptr;
  462. }
  463. bool AdventureMapShortcuts::optionCanEndTurn()
  464. {
  465. return optionInMapView() && LOCPLINT->makingTurn;
  466. }
  467. bool AdventureMapShortcuts::optionSpellcasting()
  468. {
  469. return state == EAdventureState::CASTING_SPELL;
  470. }
  471. bool AdventureMapShortcuts::optionInMapView()
  472. {
  473. return state == EAdventureState::MAKING_TURN;
  474. }
  475. bool AdventureMapShortcuts::optionInWorldView()
  476. {
  477. return state == EAdventureState::WORLD_VIEW;
  478. }
  479. bool AdventureMapShortcuts::optionSidePanelActive()
  480. {
  481. return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::OTHER_HUMAN_PLAYER_TURN;
  482. }
  483. bool AdventureMapShortcuts::optionMapScrollingActive()
  484. {
  485. return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::OTHER_HUMAN_PLAYER_TURN;
  486. }
  487. bool AdventureMapShortcuts::optionMapViewActive()
  488. {
  489. return state == EAdventureState::MAKING_TURN || state == EAdventureState::WORLD_VIEW || state == EAdventureState::CASTING_SPELL
  490. || state == EAdventureState::OTHER_HUMAN_PLAYER_TURN;
  491. }