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