mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-24 03:47:18 +02:00
Merge pull request #3625 from IvanSavenko/exchange_in_town
Better hero exchange in town
This commit is contained in:
commit
83eb0ea28f
@ -427,7 +427,11 @@ void CHeroGSlot::clickPressed(const Point & cursorPosition)
|
||||
if(hero && isSelected())
|
||||
{
|
||||
setHighlight(false);
|
||||
LOCPLINT->openHeroWindow(hero);
|
||||
|
||||
if(other->hero)
|
||||
LOCPLINT->showHeroExchange(hero->id, other->hero->id);
|
||||
else
|
||||
LOCPLINT->openHeroWindow(hero);
|
||||
}
|
||||
else if(other->hero && other->isSelected())
|
||||
{
|
||||
@ -515,14 +519,6 @@ void HeroSlots::update()
|
||||
visitingHero->set(town->visitingHero);
|
||||
}
|
||||
|
||||
void HeroSlots::splitClicked()
|
||||
{
|
||||
if(!!town->visitingHero && town->garrisonHero && (visitingHero->isSelected() || garrisonedHero->isSelected()))
|
||||
{
|
||||
LOCPLINT->showHeroExchange(town->visitingHero->id, town->garrisonHero->id);
|
||||
}
|
||||
}
|
||||
|
||||
void HeroSlots::swapArmies()
|
||||
{
|
||||
bool allow = true;
|
||||
@ -1217,11 +1213,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
|
||||
exit = std::make_shared<CButton>(Point(744, 544), AnimationPath::builtin("TSBTNS"), CButton::tooltip(CGI->generaltexth->tcommands[8]), [&](){close();}, EShortcut::GLOBAL_RETURN);
|
||||
exit->setImageOrder(4, 5, 6, 7);
|
||||
|
||||
auto split = std::make_shared<CButton>(Point(744, 382), AnimationPath::builtin("TSBTNS"), CButton::tooltip(CGI->generaltexth->tcommands[3]), [&]()
|
||||
{
|
||||
garr->splitClick();
|
||||
heroes->splitClicked();
|
||||
});
|
||||
auto split = std::make_shared<CButton>(Point(744, 382), AnimationPath::builtin("TSBTNS"), CButton::tooltip(CGI->generaltexth->tcommands[3]), [this]() { garr->splitClick(); });
|
||||
garr->addSplitBtn(split);
|
||||
|
||||
Rect barRect(9, 182, 732, 18);
|
||||
|
@ -133,7 +133,6 @@ public:
|
||||
HeroSlots(const CGTownInstance * town, Point garrPos, Point visitPos, std::shared_ptr<CGarrisonInt> Garrison, bool ShowEmpty);
|
||||
~HeroSlots();
|
||||
|
||||
void splitClicked(); //for hero meeting only (splitting stacks is handled by garrison int)
|
||||
void update();
|
||||
void swapArmies(); //exchange garrisoned and visiting heroes or move hero to\from garrison
|
||||
};
|
||||
@ -227,7 +226,6 @@ class CCastleInterface : public CStatusbarWindow, public IGarrisonHolder
|
||||
std::shared_ptr<CTownInfo> fort;
|
||||
|
||||
std::shared_ptr<CButton> exit;
|
||||
std::shared_ptr<CButton> split;
|
||||
std::shared_ptr<CButton> fastTownHall;
|
||||
std::shared_ptr<CButton> fastArmyPurchase;
|
||||
std::shared_ptr<LRClickableArea> fastMarket;
|
||||
|
Loading…
x
Reference in New Issue
Block a user