فهرست منبع

Merge pull request #68 from ArseniyShestakov/smallFixesGUI

This looks innocent enought to be pulled. Thanks!
DjWarmonger 10 سال پیش
والد
کامیت
5995c975d3
4فایلهای تغییر یافته به همراه25 افزوده شده و 14 حذف شده
  1. 2 2
      client/windows/CCreatureWindow.cpp
  2. 2 2
      client/windows/CKingdomInterface.cpp
  3. 4 4
      client/windows/CTradeWindow.cpp
  4. 17 6
      client/windows/GUIClasses.cpp

+ 2 - 2
client/windows/CCreatureWindow.cpp

@@ -528,7 +528,7 @@ void CStackWindow::CWindowSection::createButtonPanel()
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
 	createBackground("button-panel");
 
-	if (parent->info->dismissInfo)
+	if (parent->info->dismissInfo->callback)
 	{
 		auto onDismiss = [=]()
 		{
@@ -597,7 +597,7 @@ void CStackWindow::CWindowSection::createButtonPanel()
 		parent->switchButtons[parent->activeTab]->disable();
 	}
 
-	auto exitBtn = new CButton(Point(382, 5), "hsbtns.def", CGI->generaltexth->zelp[445], [=]{ parent->close(); }, SDLK_RETURN);
+	auto exitBtn = new CButton(Point(382, 5), "hsbtns.def", CGI->generaltexth->zelp[447], [=]{ parent->close(); }, SDLK_RETURN);
 	exitBtn->assignedKeys.insert(SDLK_ESCAPE);
 }
 

+ 2 - 2
client/windows/CKingdomInterface.cpp

@@ -782,7 +782,7 @@ CTownItem::CTownItem(const CGTownInstance* Town):
 	background =  new CAnimImage("OVSLOT", 6);
 	name = new CLabel(74, 8, FONT_SMALL, TOPLEFT, Colors::WHITE, town->name);
 
-	income = new CLabel( 190, 60, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()));
+	income = new CLabel( 190, 60, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD]));
 	hall = new CTownInfo( 69, 31, town, true);
 	fort = new CTownInfo(111, 31, town, false);
 
@@ -813,7 +813,7 @@ void CTownItem::updateGarrisons()
 
 void CTownItem::update()
 {
-	std::string incomeVal = boost::lexical_cast<std::string>(town->dailyIncome());
+	std::string incomeVal = boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD]);
 	if (incomeVal != income->text)
 		income->setText(incomeVal);
 

+ 4 - 4
client/windows/CTradeWindow.cpp

@@ -734,8 +734,8 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
 		break;
 	case EMarketMode::ARTIFACT_RESOURCE:
 		//%s's Artifacts
-		new CLabel(152, 102, FONT_SMALL, CENTER, Colors::WHITE,
-		           boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name));
+		new CLabel(152, 56, FONT_SMALL, CENTER, Colors::WHITE,
+		           boost::str(boost::format(CGI->generaltexth->allTexts[271]) % hero->name));
 		break;
 	}
 
@@ -1011,8 +1011,8 @@ void CMarketplaceWindow::getBaseForPositions(EType type, int &dx, int &dy, int &
 		dy = 79;
 		x = 39;
 		y = 180;
-		h = 66;
-		w = 74;
+		h = 68;
+		w = 70;
 		break;
 	case PLAYER:
 		dx = 83;

+ 17 - 6
client/windows/GUIClasses.cpp

@@ -400,14 +400,25 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, i
 
 void CSplitWindow::setAmountText(std::string text, bool left)
 {
-	try
-	{
-		setAmount(boost::lexical_cast<int>(text), left);
-		slider->moveTo(rightAmount - rightMin);
-	}
-	catch(boost::bad_lexical_cast &)
+	int amount = 0;
+	if (text.length())
 	{
+		try
+		{
+			amount = boost::lexical_cast<int>(text);
+		}
+		catch(boost::bad_lexical_cast &)
+		{
+			amount = left ? leftAmount : rightAmount;
+		}
+
+		int total = leftAmount + rightAmount;
+		if (amount > total)
+			amount = total;
 	}
+
+	setAmount(amount, left);
+	slider->moveTo(rightAmount - rightMin);
 }
 
 void CSplitWindow::setAmount(int value, bool left)