From 5481dcd191a1b763330345d11264de6eac91a106 Mon Sep 17 00:00:00 2001 From: bjarni Date: Mon, 7 Nov 2005 23:20:47 +0000 Subject: (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 --- openttd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'openttd.c') diff --git a/openttd.c b/openttd.c index f6f3a61f6..1229b24f9 100644 --- a/openttd.c +++ b/openttd.c @@ -1300,6 +1300,23 @@ bool AfterLoadGame(uint version) } } + /* In version 16.1 of the savegame, trains became aware of station lengths + need to initialized to the invalid state + players needs to set renew_keep_length too */ + if (version < 0x1001) { + Vehicle *v; + FOR_ALL_PLAYERS(p) { + p->renew_keep_length = false; + } + + FOR_ALL_VEHICLES(v) { + if (v->type == VEH_Train) { + v->u.rail.shortest_platform[0] = 255; + v->u.rail.shortest_platform[1] = 0; + } + } + } + FOR_ALL_PLAYERS(p) { p->avail_railtypes = GetPlayerRailtypes(p->index); } -- cgit v1.2.3-54-g00ecf