diff options
author | rubidium <rubidium@openttd.org> | 2009-05-03 11:57:01 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-03 11:57:01 +0000 |
commit | 73fd0db237b39971690b686746da5cb146d6ae68 (patch) | |
tree | e77fec02d52d2ff19b358cf71d2bf5edae5bb6c6 /src | |
parent | 4cd689035dd4239aa47105f5d20dbf25ccb7affc (diff) | |
download | openttd-73fd0db237b39971690b686746da5cb146d6ae68.tar.xz |
(svn r16214) -Fix [FS#2878]: shared orders without orders weren't properly converted causing corrupt/invalid orders when loading pre 0.7 savegames.
Diffstat (limited to 'src')
-rw-r--r-- | src/saveload/vehicle_sl.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index 4d55a56a6..a05987a27 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -298,6 +298,18 @@ void AfterLoadVehicles(bool part_of_load) } } + if (CheckSavegameVersion(105)) { + /* Before 105 there was no order for shared orders, thus it messed up horribly */ + FOR_ALL_VEHICLES(v) { + if (v->First() != v || v->orders.list != NULL || v->previous_shared != NULL || v->next_shared == NULL) continue; + + v->orders.list = new OrderList(NULL, v); + for (Vehicle *u = v; u != NULL; u = u->next_shared) { + u->orders.list = v->orders.list; + } + } + } + CheckValidVehicles(); FOR_ALL_VEHICLES(v) { |