1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fix crash on opening of Hill Fort window and attempt to upgrade one stack

This one fixes issue 1899
This commit is contained in:
ArseniyShestakov 2015-01-07 13:10:48 +03:00
parent 8deee7610c
commit 3466457d69

View File

@ -1392,10 +1392,9 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance *visitor, const CGObjectIn
for (int i = 0; i < slotsCount; i++)
{
currState[i] = getState(SlotID(i));
upgrade[i] = new CButton(Point(107 + i * 76, 171), "", CButton::tooltip(getTextForSlot(SlotID(i))), [&]{ makeDeal(SlotID(i)); }, SDLK_1 + i);
upgrade[i] = new CButton(Point(107 + i * 76, 171), "", CButton::tooltip(getTextForSlot(SlotID(i))), [=]{ makeDeal(SlotID(i)); }, SDLK_1 + i);
for (auto image : { "APHLF1R.DEF", "APHLF1Y.DEF", "APHLF1G.DEF" })
upgrade[i]->addImage(image);
upgrade[i]->block(currState[i] == -1);
}
currState[slotsCount] = getState(SlotID(slotsCount));
@ -1431,7 +1430,7 @@ void CHillFortWindow::updateGarrisons()
}
currState[i] = newState;
upgrade[i]->setIndex(newState);
upgrade[i]->setIndex(currState[i] == -1 ? 0 : currState[i]);
upgrade[i]->block(currState[i] == -1);
upgrade[i]->addHoverText(CButton::NORMAL, getTextForSlot(SlotID(i)));
}