diff --git a/src/lang/english.txt b/src/lang/english.txt index 93bb798c86..3e69c07d92 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3657,7 +3657,6 @@ STR_INVALID_VEHICLE :num_scanned++; - const char *name = nullptr; - if (grfconfig->name != nullptr) name = GetGRFStringFromGRFText(grfconfig->name); - if (name == nullptr) name = grfconfig->filename.c_str(); - UpdateNewGRFScanStatus(this->num_scanned, name); + std::string name = grfconfig->GetName(); + UpdateNewGRFScanStatus(this->num_scanned, std::move(name)); VideoDriver::GetInstance()->GameLoopPause(); return added; diff --git a/src/newgrf_config.h b/src/newgrf_config.h index b8d50448af..337058f6b6 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -242,7 +242,7 @@ std::string GRFBuildParamList(const GRFConfig &c); void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfigList &config); void OpenGRFParameterWindow(bool is_baseset, GRFConfig &c, bool editable); -void UpdateNewGRFScanStatus(uint num, const char *name); +void UpdateNewGRFScanStatus(uint num, std::string &&name); void UpdateNewGRFConfigPalette(int32_t new_value = 0); #endif /* NEWGRF_CONFIG_H */ diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index fdc55e6b24..07db9487fe 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -2209,13 +2209,9 @@ struct ScanProgressWindow : public Window { * @param num The number of NewGRFs scanned so far. * @param name The name of the last scanned NewGRF. */ - void UpdateNewGRFScanStatus(uint num, const char *name) + void UpdateNewGRFScanStatus(uint num, std::string &&name) { - if (name == nullptr) { - this->last_name = GetString(STR_NEWGRF_SCAN_ARCHIVES); - } else { - this->last_name = name; - } + this->last_name = std::move(name); this->scanned = num; if (num > _settings_client.gui.last_newgrf_count) _settings_client.gui.last_newgrf_count = num; @@ -2228,9 +2224,9 @@ struct ScanProgressWindow : public Window { * @param num The number of NewGRFs scanned so far. * @param name The name of the last scanned NewGRF. */ -void UpdateNewGRFScanStatus(uint num, const char *name) +void UpdateNewGRFScanStatus(uint num, std::string &&name) { ScanProgressWindow *w = dynamic_cast(FindWindowByClass(WC_MODAL_PROGRESS)); if (w == nullptr) w = new ScanProgressWindow(); - w->UpdateNewGRFScanStatus(num, name); + w->UpdateNewGRFScanStatus(num, std::move(name)); }