mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
commit
4388e12a3a
@ -575,8 +575,10 @@ void CTradeWindow::showAll(SDL_Surface * to)
|
||||
|
||||
if(readyToTrade)
|
||||
{
|
||||
hLeft->showAllAt(pos.topLeft() + selectionOffset(true), selectionSubtitle(true), to);
|
||||
hRight->showAllAt(pos.topLeft() + selectionOffset(false), selectionSubtitle(false), to);
|
||||
if(hLeft)
|
||||
hLeft->showAllAt(pos.topLeft() + selectionOffset(true), selectionSubtitle(true), to);
|
||||
if(hRight)
|
||||
hRight->showAllAt(pos.topLeft() + selectionOffset(false), selectionSubtitle(false), to);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1314,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;
|
||||
|
@ -141,6 +141,7 @@ public:
|
||||
|
||||
|
||||
void selectionChanged(bool side) override; //true == left
|
||||
void selectOppositeItem(bool side);
|
||||
void SacrificeAll();
|
||||
void SacrificeBackpack();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user