summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-01-30 19:51:39 +0000
committercelestar <celestar@openttd.org>2005-01-30 19:51:39 +0000
commit94f6208bde203b8c39f0de43deaebdcf7efa4bb6 (patch)
tree3e32dd9feb391514647c8d0d81454036857e7cdf
parent55e1eab1a212108d5aed57ffe0b98146f52d430c (diff)
downloadopenttd-94f6208bde203b8c39f0de43deaebdcf7efa4bb6.tar.xz
(svn r1740) -Fix: [ 1112342 ] Realistic acceleration works properly with TTDPatch non-stop handling behaviour
-rw-r--r--train_cmd.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/train_cmd.c b/train_cmd.c
index f5fa01fe8..b0951b53e 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -62,6 +62,25 @@ enum AccelType {
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 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
{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;