summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-22 15:13:50 +0000
committersmatz <smatz@openttd.org>2009-05-22 15:13:50 +0000
commit62a7948af0ca9eb3b190a54918201e1075edcbbc (patch)
tree27a79b7850682cd43cac2462c3410ed8b567c4b2 /src/train_cmd.cpp
parent04723b240ebc7384954f73590be517ad2a47ce04 (diff)
downloadopenttd-62a7948af0ca9eb3b190a54918201e1075edcbbc.tar.xz
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index e60df0daf..a2e731c65 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -4282,7 +4282,7 @@ static bool TrainLocoHandler(Vehicle *v, bool mode)
/* exit if train is stopped */
if (v->vehstatus & VS_STOPPED && v->cur_speed == 0) return true;
- bool valid_order = v->current_order.IsValid() && v->current_order.GetType() != OT_CONDITIONAL;
+ bool valid_order = !v->current_order.IsType(OT_NOTHING) && v->current_order.GetType() != OT_CONDITIONAL;
if (ProcessOrders(v) && CheckReverseTrain(v)) {
v->load_unload_time_rem = 0;
v->cur_speed = 0;
@@ -4300,7 +4300,7 @@ static bool TrainLocoHandler(Vehicle *v, bool mode)
if (!mode) HandleLocomotiveSmokeCloud(v);
/* We had no order but have an order now, do look ahead. */
- if (!valid_order && v->current_order.IsValid()) {
+ if (!valid_order && !v->current_order.IsType(OT_NOTHING)) {
CheckNextTrainTile(v);
}
@@ -4428,10 +4428,12 @@ bool Train::Tick()
this->current_order_time++;
+ VehicleID index = this->index;
+
if (!TrainLocoHandler(this, false)) return false;
/* make sure vehicle wasn't deleted. */
- assert(this->IsValid());
+ assert(Vehicle::Get(index) == this);
assert(IsFrontEngine(this));
return TrainLocoHandler(this, true);