mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Pass GRF name as std::string to UpdateNewGRFScanStatus. (#13870)
parent
8b4114d709
commit
84f785b06b
|
@ -3657,7 +3657,6 @@ STR_INVALID_VEHICLE :<invalid vehicl
|
|||
STR_NEWGRF_SCAN_CAPTION :{WHITE}Scanning NewGRFs
|
||||
STR_NEWGRF_SCAN_MESSAGE :{BLACK}Scanning NewGRFs. Depending on the amount this can take a while...
|
||||
STR_NEWGRF_SCAN_STATUS :{BLACK}{NUM} NewGRF{P "" s} scanned out of an estimated {NUM} NewGRF{P "" s}
|
||||
STR_NEWGRF_SCAN_ARCHIVES :Scanning for archives
|
||||
|
||||
# Sign list window
|
||||
STR_SIGN_LIST_CAPTION :{WHITE}Sign List - {COMMA} Sign{P "" s}
|
||||
|
|
|
@ -536,10 +536,8 @@ bool GRFFileScanner::AddFile(const std::string &filename, size_t basepath_length
|
|||
|
||||
this->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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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<ScanProgressWindow *>(FindWindowByClass(WC_MODAL_PROGRESS));
|
||||
if (w == nullptr) w = new ScanProgressWindow();
|
||||
w->UpdateNewGRFScanStatus(num, name);
|
||||
w->UpdateNewGRFScanStatus(num, std::move(name));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue