1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Merge pull request #5428 from Laserlicht/patch-2

[1.6.6] multiple fixes
This commit is contained in:
Ivan Savenko 2025-02-15 11:14:50 +02:00 committed by GitHub
commit 87dec3c1df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 4 deletions

View File

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

View File

@ -114,6 +114,7 @@ CBonusSelection::CBonusSelection()
for(size_t b = 0; b < difficultyIcons.size(); ++b) 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); 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()) if(getCampaign()->playerSelectedDifficulty())
@ -377,9 +378,16 @@ void CBonusSelection::updateAfterStateChange()
for(size_t i = 0; i < difficultyIcons.size(); i++) for(size_t i = 0; i < difficultyIcons.size(); i++)
{ {
if(i == CSH->si->difficulty) if(i == CSH->si->difficulty)
{
difficultyIcons[i]->enable(); difficultyIcons[i]->enable();
difficultyIconAreas[i]->enable();
}
else else
{
difficultyIcons[i]->disable(); difficultyIcons[i]->disable();
difficultyIconAreas[i]->disable();
}
} }
flagbox->recreate(); flagbox->recreate();
createBonusesIcons(); createBonusesIcons();

View File

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

View File

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