From 73fd0db237b39971690b686746da5cb146d6ae68 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 3 May 2009 11:57:01 +0000 Subject: (svn r16214) -Fix [FS#2878]: shared orders without orders weren't properly converted causing corrupt/invalid orders when loading pre 0.7 savegames. --- src/saveload/vehicle_sl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2