Codechange: Use GetString() with argument parameters in simple cases. (#13551)

Avoids using global string parameters.
This commit is contained in:
Peter Nelson
2025-02-14 00:10:56 +00:00
committed by GitHub
parent c3d5e6d2a0
commit 20e57a02a2
26 changed files with 79 additions and 170 deletions

View File

@@ -146,14 +146,12 @@ static bool EngineNameSorter(const GUIEngineListItem &a, const GUIEngineListItem
if (a.engine_id != _last_engine[0]) {
_last_engine[0] = a.engine_id;
SetDParam(0, PackEngineNameDParam(a.engine_id, EngineNameContext::PurchaseList));
last_name[0] = GetString(STR_ENGINE_NAME);
last_name[0] = GetString(STR_ENGINE_NAME, PackEngineNameDParam(a.engine_id, EngineNameContext::PurchaseList));
}
if (b.engine_id != _last_engine[1]) {
_last_engine[1] = b.engine_id;
SetDParam(0, PackEngineNameDParam(b.engine_id, EngineNameContext::PurchaseList));
last_name[1] = GetString(STR_ENGINE_NAME);
last_name[1] = GetString(STR_ENGINE_NAME, PackEngineNameDParam(b.engine_id, EngineNameContext::PurchaseList));
}
int r = StrNaturalCompare(last_name[0], last_name[1]); // Sort by name (natural sorting).
@@ -1369,8 +1367,7 @@ struct BuildVehicleWindow : Window {
/* Filter engine name */
this->string_filter.ResetState();
SetDParam(0, PackEngineNameDParam(e->index, EngineNameContext::PurchaseList));
this->string_filter.AddLine(GetString(STR_ENGINE_NAME));
this->string_filter.AddLine(GetString(STR_ENGINE_NAME, PackEngineNameDParam(e->index, EngineNameContext::PurchaseList)));
/* Filter NewGRF extra text */
auto text = GetNewGRFAdditionalText(e->index);