فهرست منبع

Fix removal of fully sacrificed stacks from heroes garrison slots

This one fixes issue 2010. Though CAltarWindow need proper refactoring.
ArseniyShestakov 11 سال پیش
والد
کامیت
27705e1ac6
1فایلهای تغییر یافته به همراه6 افزوده شده و 9 حذف شده
  1. 6 9
      client/windows/CTradeWindow.cpp

+ 6 - 9
client/windows/CTradeWindow.cpp

@@ -1201,8 +1201,11 @@ void CAltarWindow::getBaseForPositions(EType type, int &dx, int &dy, int &x, int
 
 void CAltarWindow::sliderMoved(int to)
 {
-	sacrificedUnits[hLeft->serial] = to;
-	updateRight(hRight);
+	if(hLeft)
+		sacrificedUnits[hLeft->serial] = to;
+	if(hRight)
+		updateRight(hRight);
+
 	deal->block(!to);
 	calcTotalExp();
 	redraw();
@@ -1356,13 +1359,7 @@ void CAltarWindow::garrisonChanged()
 	std::set<CTradeableItem *> empty;
 	getEmptySlots(empty);
 
-	for(CTradeableItem *t : empty)
-	{
-		removeItem(*std::find_if(items[0].begin(), items[0].end(), [&](const CTradeableItem * item)
-		{
-			return item->serial == t->serial;
-		}));
-	}
+	removeItems(empty);
 
 	initSubs(true);
 	getExpValues();