Codechange: Use GetString() with argument parameters in simple cases. (#13551)
Avoids using global string parameters.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user