Fix: Don't restore backed up vehicle name if it's no longer unique. (#10979)

This commit is contained in:
PeterN
2023-06-09 22:18:55 +01:00
committed by GitHub
parent 6d597879d0
commit 2097719f26
3 changed files with 7 additions and 1 deletions

View File

@@ -18,6 +18,7 @@
#include "station_map.h"
#include "order_cmd.h"
#include "group_cmd.h"
#include "vehicle_func.h"
#include "safeguards.h"
@@ -83,6 +84,9 @@ void OrderBackup::DoRestore(Vehicle *v)
InvalidateWindowClassesData(WC_STATION_LIST, 0);
}
/* Remove backed up name if it's no longer unique. */
if (!IsUniqueVehicleName(this->name)) this->name.clear();
v->CopyConsistPropertiesFrom(this);
/* Make sure orders are in range */