1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Show stacks selected to sacrifice

This commit is contained in:
Piotr Wójcik 2017-08-01 17:17:46 +02:00
parent 137b9cde19
commit 886c8f63c6
2 changed files with 19 additions and 0 deletions

View File

@ -1316,10 +1316,28 @@ void CAltarWindow::selectionChanged(bool side)
slider->block(!slider->getAmount());
slider->moveTo(sacrificedUnits[hLeft->serial]);
max->block(!slider->getAmount());
selectOppositeItem(side);
readyToTrade = true;
redraw();
}
void CAltarWindow::selectOppositeItem(bool side)
{
bool oppositeSide = !side;
int pos = vstd::find_pos(items[side], side ? hLeft : hRight);
int oppositePos = vstd::find_pos(items[oppositeSide], oppositeSide ? hLeft : hRight);
if(pos >= 0 && pos != oppositePos)
{
if(oppositeSide)
hLeft = items[oppositeSide][pos];
else
hRight = items[oppositeSide][pos];
selectionChanged(oppositeSide);
}
}
void CAltarWindow::mimicCres()
{
std::vector<Rect> positions;

View File

@ -141,6 +141,7 @@ public:
void selectionChanged(bool side) override; //true == left
void selectOppositeItem(bool side);
void SacrificeAll();
void SacrificeBackpack();