Jelajahi Sumber

Merge pull request #5428 from Laserlicht/patch-2

[1.6.6] multiple fixes
Ivan Savenko 8 bulan lalu
induk
melakukan
87dec3c1df

+ 1 - 0
client/CPlayerInterface.cpp

@@ -505,6 +505,7 @@ void CPlayerInterface::heroMovePointsChanged(const CGHeroInstance * hero)
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	if (makingTurn && hero->tempOwner == playerID)
 		adventureInt->onHeroChanged(hero);
+	invalidatePaths();
 }
 void CPlayerInterface::receivedResource()
 {

+ 8 - 0
client/lobby/CBonusSelection.cpp

@@ -114,6 +114,7 @@ CBonusSelection::CBonusSelection()
 	for(size_t b = 0; b < difficultyIcons.size(); ++b)
 	{
 		difficultyIcons[b] = std::make_shared<CAnimImage>(AnimationPath::builtinTODO("GSPBUT" + std::to_string(b + 3) + ".DEF"), 0, 0, 709, settings["general"]["enableUiEnhancements"].Bool() ? 480 : 455);
+		difficultyIconAreas[b] = std::make_shared<LRClickableArea>(difficultyIcons[b]->pos - pos.topLeft(), nullptr, [b]() { CRClickPopup::createAndPush(CGI->generaltexth->zelp[24 + b].second); });
 	}
 
 	if(getCampaign()->playerSelectedDifficulty())
@@ -377,9 +378,16 @@ void CBonusSelection::updateAfterStateChange()
 	for(size_t i = 0; i < difficultyIcons.size(); i++)
 	{
 		if(i == CSH->si->difficulty)
+		{
 			difficultyIcons[i]->enable();
+			difficultyIconAreas[i]->enable();
+
+		}
 		else
+		{
 			difficultyIcons[i]->disable();
+			difficultyIconAreas[i]->disable();
+		}
 	}
 	flagbox->recreate();
 	createBonusesIcons();

+ 2 - 0
client/lobby/CBonusSelection.h

@@ -31,6 +31,7 @@ class ISelectionScreenInfo;
 class ExtraOptionsTab;
 class VideoWidgetOnce;
 class CBonusSelection;
+class LRClickableArea;
 
 
 /// Campaign screen where you can choose one out of three starting bonuses
@@ -93,6 +94,7 @@ public:
 	std::shared_ptr<CToggleGroup> groupBonuses;
 	std::shared_ptr<CLabel> labelDifficulty;
 	std::array<std::shared_ptr<CAnimImage>, 5> difficultyIcons;
+	std::array<std::shared_ptr<LRClickableArea>, 5> difficultyIconAreas;
 	std::shared_ptr<CButton> buttonDifficultyLeft;
 	std::shared_ptr<CButton> buttonDifficultyRight;
 	std::shared_ptr<CAnimImage> iconsMapSizes;

+ 1 - 4
lib/bonuses/Bonus.cpp

@@ -149,10 +149,7 @@ std::string Bonus::Description(const IGameInfoCallback * cb, std::optional<si32>
 		// there is one known string that uses '%s' placeholder for bonus value:
 		// "core.arraytxt.69" : "\nFountain of Fortune Visited %s",
 		// So also add string replacement to handle this case
-		if (valueToShow > 0)
-			descriptionHelper.replaceRawString(std::to_string(valueToShow));
-		else
-			descriptionHelper.replaceRawString("-" + std::to_string(valueToShow));
+		descriptionHelper.replaceRawString(std::to_string(valueToShow));
 
 		if(type == BonusType::CREATURE_GROWTH_PERCENT)
 			descriptionHelper.appendRawString(" +" + std::to_string(valueToShow));