(svn r6694) -Fix: FS#361 Refit-to Order bug (only one of the two bugs mentioned there)
authorbjarni
Sun, 08 Oct 2006 20:54:27 +0000
changeset 4780 307af11a644c
parent 4779 6b3663047652
child 4781 3e0c04509b05
(svn r6694) -Fix: FS#361 Refit-to Order bug (only one of the two bugs mentioned there)
-Now refit orders are copied when copying orders
-Fixed an initilation issue where CT_INVALID was used instead of CT_NO_REFIT (resulted in crashes in the order window)
-Fixed a compiler warning in the function to load TTD savegames
order.h
order_cmd.c
--- a/order.h	Sun Oct 08 19:50:10 2006 +0000
+++ b/order.h	Sun Oct 08 20:54:27 2006 +0000
@@ -191,7 +191,7 @@
 	order.dest    = GB(packed, 16, 16);
 	order.next    = NULL;
 	order.index   = 0; // avoid compiler warning
-	order.refit_cargo   = CT_INVALID;
+	order.refit_cargo   = CT_NO_REFIT;
 	order.refit_subtype = 0;
 	return order;
 }
--- a/order_cmd.c	Sun Oct 08 19:50:10 2006 +0000
+++ b/order_cmd.c	Sun Oct 08 20:54:27 2006 +0000
@@ -50,6 +50,10 @@
 	order.dest    = GB(packed, 8, 8);
 	order.next    = NULL;
 
+	order.refit_cargo   = CT_NO_REFIT;
+	order.refit_subtype = 0;
+	order.index = 0; // avoid compiler warning
+
 	// Sanity check
 	// TTD stores invalid orders as OT_NOTHING with non-zero flags/station
 	if (order.type == OT_NOTHING && (order.flags != 0 || order.dest != 0)) {
@@ -57,9 +61,6 @@
 		order.flags = 0;
 	}
 
-	order.refit_cargo   = CT_INVALID;
-	order.refit_subtype = 0;
-
 	return order;
 }
 
@@ -76,7 +77,7 @@
 	order.dest  = GB(packed, 8, 8);
 	order.next  = NULL;
 	order.index = 0; // avoid compiler warning
-	order.refit_cargo   = CT_INVALID;
+	order.refit_cargo   = CT_NO_REFIT;
 	order.refit_subtype = 0;
 	return order;
 }
@@ -128,6 +129,8 @@
 			memset(order, 0, sizeof(*order));
 			order->index = index;
 			order->next = NULL;
+			order->refit_cargo   = CT_NO_REFIT;
+			order->refit_subtype = 0;
 
 			return order;
 		}
@@ -151,8 +154,8 @@
 	order->flags = data.flags;
 	order->dest  = data.dest;
 
-	order->refit_cargo   = CT_NO_REFIT;
-	order->refit_subtype = CT_NO_REFIT;
+	order->refit_cargo   = data.refit_cargo;
+	order->refit_subtype = data.refit_subtype;
 }