Fix #8846: When upgrading NewGRF presets, copy NewGRF parameters only if the NewGRF are compatible. Otherwise reset to defaults.

This commit is contained in:
frosch
2023-10-01 15:21:57 +02:00
committed by frosch
parent d75a5e1a9a
commit 82c8720814
3 changed files with 15 additions and 2 deletions

View File

@@ -723,7 +723,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback {
while (*c != iter->second) c = &(*c)->next;
GRFConfig *d = new GRFConfig(*a);
d->next = (*c)->next;
d->CopyParams(**c);
if (d->IsCompatible((*c)->version)) {
d->CopyParams(**c);
} else {
d->SetParameterDefaults();
}
if (this->active_sel == *c) {
CloseWindowByClass(WC_GRF_PARAMETERS);
CloseWindowByClass(WC_TEXTFILE);