Browse Source

Merge pull request #74 from ArseniyShestakov/fixHillFortCrashIssue1899

Thanks :) WIll grant you direct access since you know what you're doing.
DjWarmonger 10 years ago
parent
commit
a6bf55227d
1 changed files with 2 additions and 3 deletions
  1. 2 3
      client/windows/GUIClasses.cpp

+ 2 - 3
client/windows/GUIClasses.cpp

@@ -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)));
 	}