src/openttd.cpp
branchnoai
changeset 10142 56ee7da4ad56
parent 9869 6404afe43575
child 10181 54df587fef5d
--- a/src/openttd.cpp	Tue Apr 08 11:54:53 2008 +0000
+++ b/src/openttd.cpp	Sat Apr 12 21:38:49 2008 +0000
@@ -2316,8 +2316,8 @@
 		Order *order;
 		FOR_ALL_ORDERS(order) {
 			if (order->IsType(OT_GOTO_STATION) && GetStation(order->GetDestination())->IsBuoy()) {
-				order->SetLoadType(0);
-				order->SetUnloadType(0);
+				order->SetLoadType(OLF_LOAD_IF_POSSIBLE);
+				order->SetUnloadType(OUF_UNLOAD_IF_POSSIBLE);
 			}
 		}
 
@@ -2455,6 +2455,32 @@
 		}
 	}
 
+	if (CheckSavegameVersion(93)) {
+		/* Rework of orders. */
+		Order *order;
+		FOR_ALL_ORDERS(order) order->ConvertFromOldSavegame();
+
+		Vehicle *v;
+		FOR_ALL_VEHICLES(v) v->current_order.ConvertFromOldSavegame();
+	} else if (CheckSavegameVersion(94)) {
+		/* Unload and transfer are now mutual exclusive. */
+		Order *order;
+		FOR_ALL_ORDERS(order) {
+			if ((order->GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) == (OUFB_UNLOAD | OUFB_TRANSFER)) {
+				order->SetUnloadType(OUFB_TRANSFER);
+				order->SetLoadType(OLFB_NO_LOAD);
+			}
+		}
+
+		Vehicle *v;
+		FOR_ALL_VEHICLES(v) {
+			if ((v->current_order.GetUnloadType() & (OUFB_UNLOAD | OUFB_TRANSFER)) == (OUFB_UNLOAD | OUFB_TRANSFER)) {
+				v->current_order.SetUnloadType(OUFB_TRANSFER);
+				v->current_order.SetLoadType(OLFB_NO_LOAD);
+			}
+		}
+	}
+
 	return InitializeWindowsAndCaches();
 }