diff src/train_cmd.cpp @ 7493:2068a51c2e6c draft

(svn r11004) -Codechange: some reworks of the saveload mechanism to be able to save and load private and protected variables in the vehicle struct.
author rubidium <rubidium@openttd.org>
date Thu, 30 Aug 2007 13:09:44 +0000 (2007-08-30)
parents 09743324277c
children 797ff0b0e0a5
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -558,7 +558,7 @@
 			SetTrainWagon(v);
 
 			if (u != NULL) {
-				u->next = v;
+				u->SetNext(v);
 			} else {
 				SetFreeWagon(v);
 				InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
@@ -636,7 +636,7 @@
 	u->cargo_subtype = v->cargo_subtype;
 	u->cargo_cap = v->cargo_cap;
 	u->u.rail.railtype = v->u.rail.railtype;
-	if (building) v->next = u;
+	if (building) v->SetNext(u);
 	u->engine_type = v->engine_type;
 	u->build_year = v->build_year;
 	if (building) v->value >>= 1;
@@ -840,7 +840,7 @@
 
 	Vehicle *u;
 	for (u = first; GetNextVehicle(u) != v; u = GetNextVehicle(u)) {}
-	GetLastEnginePart(u)->next = GetNextVehicle(v);
+	GetLastEnginePart(u)->SetNext(GetNextVehicle(v));
 	v->first = NULL; // we shouldn't point to the old first, since the vehicle isn't in that chain anymore
 	return first;
 }
@@ -1041,7 +1041,7 @@
 			if (src != src_head) {
 				Vehicle *v = src_head;
 				while (GetNextVehicle(v) != src) v = GetNextVehicle(v);
-				GetLastEnginePart(v)->next = NULL;
+				GetLastEnginePart(v)->SetNext(NULL);
 			} else {
 				InvalidateWindowData(WC_VEHICLE_DEPOT, src_head->tile); // We removed a line
 				src_head = NULL;
@@ -1051,7 +1051,7 @@
 			if (src_head == dst_head) dst_head = NULL;
 			/* unlink single wagon from linked list */
 			src_head = UnlinkWagon(src, src_head);
-			GetLastEnginePart(src)->next = NULL;
+			GetLastEnginePart(src)->SetNext(NULL);
 		}
 
 		if (dst == NULL) {