diff src/train_cmd.cpp @ 8840:c3d2f0eb69a1 draft

(svn r12588) -Codechange: do not access the destination of an order directly.
author rubidium <rubidium@openttd.org>
date Sun, 06 Apr 2008 07:48:51 +0000
parents 890a77315801
children 1f412a20da48
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2342,7 +2342,7 @@
 static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
 {
 	fd->dest_coords = v->dest_tile;
-	fd->station_index = v->current_order.IsType(OT_GOTO_STATION) ? v->current_order.dest : INVALID_STATION;
+	fd->station_index = v->current_order.IsType(OT_GOTO_STATION) ? v->current_order.GetDestination() : INVALID_STATION;
 }
 
 static const byte _initial_tile_subcoord[6][4][3] = {
@@ -2658,7 +2658,6 @@
 	}
 
 	v->BeginLoading();
-	v->current_order.dest = 0;
 }
 
 static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
@@ -3559,7 +3558,7 @@
 	const Depot* depot = GetDepotByTile(tfdd.tile);
 
 	if (v->current_order.IsType(OT_GOTO_DEPOT) &&
-			v->current_order.dest != depot->index &&
+			v->current_order.GetDestination() != depot->index &&
 			!Chance16(3, 16)) {
 		return;
 	}
@@ -3583,7 +3582,7 @@
 
 		/* update destination */
 		if (this->current_order.IsType(OT_GOTO_STATION)) {
-			TileIndex tile = GetStation(this->current_order.dest)->train_tile;
+			TileIndex tile = GetStation(this->current_order.GetDestination())->train_tile;
 			if (tile != 0) this->dest_tile = tile;
 		}