1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Configurable icons for bonuses

It is now possible for mods (e.g. vcmi extras) to provide custom icons
for bonuses subtypes or for custom bonuses values without requiring
hardcoded check in vcmi.

All existing hardcoded checks have been removed.

Bonuses config json from mods is now actually loaded.
This commit is contained in:
Ivan Savenko
2025-02-11 22:08:45 +00:00
parent 8f074490a7
commit 07a46ed03b
7 changed files with 58 additions and 462 deletions

View File

@@ -310,7 +310,8 @@ CStackWindow::BonusLineSection::BonusLineSection(CStackWindow * owner, size_t li
if(parent->activeBonuses.size() > bonusIndex)
{
BonusInfo & bi = parent->activeBonuses[bonusIndex];
icon[leftRight] = std::make_shared<CPicture>(bi.imagePath, position.x, position.y);
if (!bi.imagePath.empty())
icon[leftRight] = std::make_shared<CPicture>(bi.imagePath, position.x, position.y);
name[leftRight] = std::make_shared<CLabel>(position.x + 60, position.y + 2, FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, bi.name, 137);
description[leftRight] = std::make_shared<CMultiLineLabel>(Rect(position.x + 60, position.y + 20, 137, 26), FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, bi.description);
drawBonusSource(leftRight, Point(position.x - 1, position.y - 1), bi);