summaryrefslogtreecommitdiff
path: root/order_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-11-07 23:20:47 +0000
committerbjarni <bjarni@openttd.org>2005-11-07 23:20:47 +0000
commit5481dcd191a1b763330345d11264de6eac91a106 (patch)
tree419d4e9a7f19cca429bc209799068506c9d20f9d /order_cmd.c
parent723e789b2f1ac1d6f8eaa122d9626f41595c51cf (diff)
downloadopenttd-5481dcd191a1b763330345d11264de6eac91a106.tar.xz
(svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too long trains
-Trains will now remember the length of stations it visits and sell cars when being autoreplaced if they became too long -If it needs to remove cars, then it starts from the front and sells all it can find until the train is short enough -This only works for trains, that knows the station length of the route so a full uninterrupted run is needed -a train needs 1-2 runs to detect if the shortest station is expanded -This feature can be turned on and off in the train replace window and each company can have it's own setting -NOTE: minor savegame version bump
Diffstat (limited to 'order_cmd.c')
-rw-r--r--order_cmd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/order_cmd.c b/order_cmd.c
index 227152cde..fda452ba8 100644
--- a/order_cmd.c
+++ b/order_cmd.c
@@ -388,6 +388,7 @@ int32 CmdInsertOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
/* Update any possible open window of the vehicle */
InvalidateVehicleOrder(u);
+ if (u->type == VEH_Train) u->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
u = u->next_shared;
}
@@ -520,6 +521,7 @@ int32 CmdSkipOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (v->current_order.type == OT_LOADING && HASBIT(v->current_order.flags, OFB_NON_STOP))
v->current_order.flags = 0;
+ if (v->type == VEH_Train) v->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
InvalidateVehicleOrder(v);
}
@@ -663,6 +665,7 @@ int32 CmdCloneOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(src);
RebuildVehicleLists();
+ if (dst->type == VEH_Train) dst->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
}
} break;
@@ -722,6 +725,7 @@ int32 CmdCloneOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(dst);
RebuildVehicleLists();
+ if (dst->type == VEH_Train) dst->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
}
} break;