Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with effects in help dialog #2435

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions common/effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,10 @@ QString effect_type_unit_text(effect_type type, int value)
float factor = 1.0f + value / 1000.0f;
return QString(PL_("**%1", "**%1", factor)).arg(factor);
}
case EFT_OUTPUT_WASTE_BY_DISTANCE:
return QString(PL_("%1%/tile", "%1%/tile", value)).arg(value);
case EFT_OUTPUT_WASTE_BY_DISTANCE: {
float waste = value / 100.0f;
return QString(PL_("%1%/tile", "%1%/tile", waste)).arg(waste);
}
case EFT_CITY_BUILD_SLOTS:
return QString(PL_("%1 slot", "%1 slots", value)).arg(value);
case EFT_MAX_TRADE_ROUTES:
Expand Down
12 changes: 10 additions & 2 deletions common/helpdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,9 @@ void boot_help_texts(const nation_set *nations_to_show,
}
multipliers_iterate_end;
break;
case HELP_EFFECT:
case HELP_EFFECT: {
std::list<help_item *> effect_help;

for (int i = 0; i < EFT_COUNT; ++i) {
auto effects = get_effects(static_cast<effect_type>(i));
if (effect_list_size(effects) > 0) {
Expand Down Expand Up @@ -1034,10 +1036,16 @@ void boot_help_texts(const nation_set *nations_to_show,
effect_list_iterate_end;

pitem->text = qstrdup(qUtf8Printable(all_text));
help_nodes->append(pitem);
effect_help.push_back(pitem);
}
}

effect_help.sort(help_item_compar);
for (auto pitem : effect_help) {
help_nodes->append(pitem);
}
break;
}
default:
qCritical("Bad current_type: %d.", current_type);
break;
Expand Down
Loading