mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
TOWN_PORTAL callback is too specific to ba part on spellwindow class
This commit is contained in:
@@ -593,12 +593,6 @@ Uint8 CSpellWindow::pagesWithinCurrentTab()
|
||||
return battleSpellsOnly ? sitesPerTabBattle[selectedTab] : sitesPerTabAdv[selectedTab];
|
||||
}
|
||||
|
||||
void CSpellWindow::teleportTo( int town, const CGHeroInstance * hero )
|
||||
{
|
||||
const CGTownInstance * dest = LOCPLINT->cb->getTown(ObjectInstanceID(town));
|
||||
LOCPLINT->cb->castSpell(hero, SpellID::TOWN_PORTAL, dest->visitablePos());
|
||||
}
|
||||
|
||||
CSpellWindow::SpellArea::SpellArea(SDL_Rect pos, CSpellWindow * owner)
|
||||
{
|
||||
this->pos = pos;
|
||||
@@ -755,13 +749,20 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
||||
availableTowns.push_back(t->id.getNum());//add to the list
|
||||
}
|
||||
}
|
||||
|
||||
auto castTownPortal = [h](int townId)
|
||||
{
|
||||
const CGTownInstance * dest = LOCPLINT->cb->getTown(ObjectInstanceID(townId));
|
||||
LOCPLINT->cb->castSpell(h, SpellID::TOWN_PORTAL, dest->visitablePos());
|
||||
};
|
||||
|
||||
if (availableTowns.empty())
|
||||
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[124]);
|
||||
else
|
||||
GH.pushInt (new CObjectListWindow(availableTowns,
|
||||
new CAnimImage("SPELLSCR",mySpell),
|
||||
CGI->generaltexth->jktexts[40], CGI->generaltexth->jktexts[41],
|
||||
std::bind (&CSpellWindow::teleportTo, owner, _1, h)));
|
||||
castTownPortal));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -780,8 +781,7 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
||||
|
||||
if(sp->getTargetType() == CSpell::LOCATION)
|
||||
{
|
||||
adventureInt->enterCastingMode(sp);
|
||||
return;
|
||||
adventureInt->enterCastingMode(sp);
|
||||
}
|
||||
else if(sp->getTargetType() == CSpell::NO_TARGET)
|
||||
{
|
||||
|
@@ -112,6 +112,4 @@ public:
|
||||
void deactivate();
|
||||
void showAll(SDL_Surface * to);
|
||||
void show(SDL_Surface * to);
|
||||
|
||||
void teleportTo(int town, const CGHeroInstance * hero);
|
||||
};
|
||||
|
Reference in New Issue
Block a user