summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-05 15:30:15 +0000
committerrubidium <rubidium@openttd.org>2008-04-05 15:30:15 +0000
commitaef20ec54d501e176d2607096da2df2263bc0822 (patch)
tree57bb3ebb25557e1d6fcad5c15f3dac0e731a4475 /src/train_cmd.cpp
parentd977461d1004102e19a210b26d5080475aff62f8 (diff)
downloadopenttd-aef20ec54d501e176d2607096da2df2263bc0822.tar.xz
(svn r12580) -Codechange: merge some logical related to non-stop orders.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 314af0090..87099c28d 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -302,27 +302,6 @@ enum AccelType {
AM_BRAKE
};
-static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
-{
- const Order* o = &v->current_order;
- StationID sid = GetStationIndex(tile);
-
- assert(v->type == VEH_TRAIN);
- /* When does a train drive through a station
- * first we deal with the "new nonstop handling" */
- if (_patches.new_nonstop && o->flags & OFB_NON_STOP && sid == o->dest) {
- return false;
- }
-
- if (v->last_station_visited == sid) return false;
-
- if (sid != o->dest && (o->flags & OFB_NON_STOP || _patches.new_nonstop)) {
- return false;
- }
-
- return true;
-}
-
/** new acceleration*/
static int GetTrainAcceleration(Vehicle *v, bool mode)
{
@@ -385,7 +364,7 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
}
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
- if (TrainShouldStop(v, v->tile)) {
+ if (v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile))) {
int station_length = GetStationByTile(v->tile)->GetPlatformLength(v->tile, DirToDiagDir(v->direction));
int st_max_speed = 120;