summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-22 22:55:41 +0000
committerrubidium <rubidium@openttd.org>2009-05-22 22:55:41 +0000
commitda5661a0c8870c532c393ec3d330c3fbb44eb8ac (patch)
tree93b9332d7e83e012a46777e2baf91bf323ea9fe9 /src/autoreplace_cmd.cpp
parentc4b627af422075ce4a0e1026c52f871dd3f146c0 (diff)
downloadopenttd-da5661a0c8870c532c393ec3d330c3fbb44eb8ac.tar.xz
(svn r16393) -Codechange: move VehicleRail to Train.
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index aaec89aa4..fd1228501 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -403,7 +403,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if (old_head->type == VEH_TRAIN) {
/* Store the length of the old vehicle chain, rounded up to whole tiles */
- uint16 old_total_length = (old_head->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE * TILE_SIZE;
+ uint16 old_total_length = (((Train *)old_head)->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE * TILE_SIZE;
int num_units = 0; ///< Number of units in the chain
for (Train *w = (Train *)old_head; w != NULL; w = GetNextUnit(w)) num_units++;
@@ -455,7 +455,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
}
/* When wagon removal is enabled and the new engines without any wagons are already longer than the old, we have to fail */
- if (cost.Succeeded() && wagon_removal && new_head->u.rail.cached_total_length > old_total_length) cost = CommandCost(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT);
+ if (cost.Succeeded() && wagon_removal && new_head->tcache.cached_total_length > old_total_length) cost = CommandCost(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT);
/* Append/insert wagons into the new vehicle chain
* We do this from back to front, so we can stop when wagon removal or maximum train length (i.e. from mammoth-train setting) is triggered.
@@ -469,7 +469,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
/* Insert wagon after 'last_engine' */
CommandCost res = MoveVehicle(append, last_engine, DC_EXEC, false);
- if (res.Succeeded() && wagon_removal && new_head->u.rail.cached_total_length > old_total_length) {
+ if (res.Succeeded() && wagon_removal && new_head->tcache.cached_total_length > old_total_length) {
MoveVehicle(append, NULL, DC_EXEC | DC_AUTOREPLACE, false);
break;
}