From 6dd89efc9ac744bca2e2165470aae9faa1b86540 Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Mon, 3 Jul 2017 21:38:00 +0300 Subject: [PATCH] tweaks --- client/CPlayerInterface.cpp | 7 ++++++- client/windows/CSpellWindow.cpp | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 6f57114d8..de214d160 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -15,6 +15,7 @@ #include "gui/SDL_Extensions.h" #include "widgets/CComponent.h" #include "windows/CTradeWindow.h" +#include "windows/CSpellWindow.h" #include "../lib/CConfigHandler.h" #include "battle/CCreatureAnimation.h" #include "Graphics.h" @@ -2244,11 +2245,15 @@ void CPlayerInterface::viewWorldMap() void CPlayerInterface::advmapSpellCast(const CGHeroInstance * caster, int spellID) { EVENT_HANDLER_CALLED_BY_CLIENT; + + if(dynamic_cast(GH.topInt())) + GH.popIntTotally(GH.topInt()); + if (spellID == SpellID::FLY || spellID == SpellID::WATER_WALK) { eraseCurrentPathOf(caster, false); } - const CSpell * spell = CGI->spellh->objects[spellID]; + const CSpell * spell = CGI->spellh->objects.at(spellID); if (spellID == SpellID::VIEW_EARTH) { diff --git a/client/windows/CSpellWindow.cpp b/client/windows/CSpellWindow.cpp index 3ddea1708..155679b07 100644 --- a/client/windows/CSpellWindow.cpp +++ b/client/windows/CSpellWindow.cpp @@ -636,9 +636,8 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState) auto guard = vstd::makeScopeGuard([this] { - (owner->myInt->battleInt ? owner->myInt->spellbookSettings.spellbookLastTabBattle : owner->myInt->spellbookSettings.spellbookLastTabAdvmap) = owner->selectedTab; - (owner->myInt->battleInt ? owner->myInt->spellbookSettings.spellbookLastPageBattle : owner->myInt->spellbookSettings.spellbokLastPageAdvmap) = owner->currentPage; - delete owner; + owner->myInt->spellbookSettings.spellbookLastTabAdvmap = owner->selectedTab; + owner->myInt->spellbookSettings.spellbokLastPageAdvmap = owner->currentPage; }); if(mySpell->getTargetType() == CSpell::LOCATION)