# HG changeset patch # User celestar # Date 1107114699 0 # Node ID 394a1b3d6f3e6417d3b7a35f8a4c0490cedf1ced # Parent 12e2f93d0a94169bdacf056fd6a59a728c245af1 (svn r1740) -Fix: [ 1112342 ] Realistic acceleration works properly with TTDPatch non-stop handling behaviour diff -r 12e2f93d0a94 -r 394a1b3d6f3e train_cmd.c --- a/train_cmd.c Sun Jan 30 18:51:08 2005 +0000 +++ b/train_cmd.c Sun Jan 30 19:51:39 2005 +0000 @@ -62,6 +62,25 @@ AM_BRAKE }; +static bool TrainShouldStop(Vehicle *v, TileIndex tile) +{ + Order *o = &v->current_order; + assert(v->type == VEH_Train); + assert(IsTileType(v->tile, MP_STATION)); + //When does a train drive through a station + //first we deal with the "new nonstop handling" + if ( _patches.new_nonstop && o->flags & OF_NON_STOP && _map2[tile] == o->station ) + return false; + + if (v->last_station_visited == _map2[tile]) + return false; + + if ( _map2[tile] != o->station && (o->flags & OF_NON_STOP || _patches.new_nonstop)) + return false; + + return true; +} + //new acceleration static int GetTrainAcceleration(Vehicle *v, bool mode) { @@ -137,7 +156,7 @@ {0, 0}, {-1, 0}, {0, 0}, {0, 1}, {0, 0}, {1, 0}, {0, 0}, {0, -1} }; - if (((v->current_order.station == _map2[v->tile]) || !(v->current_order.flags & OF_NON_STOP)) && v->last_station_visited != _map2[v->tile]) { + if (TrainShouldStop(v, v->tile)) { int station_length = 0; TileIndex tile = v->tile; int delta_v;