diff options
author | rubidium <rubidium@openttd.org> | 2007-05-07 16:21:34 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-05-07 16:21:34 +0000 |
commit | a84ca16dc4f2c9d84bd5c7ae1c69ff7c321b067e (patch) | |
tree | 7d799b24ea0e76722a37e235c563ee818db1da54 /src/vehicle.cpp | |
parent | 2813b4440baec0866b243b83c45211b8b1fd3dec (diff) | |
download | openttd-a84ca16dc4f2c9d84bd5c7ae1c69ff7c321b067e.tar.xz |
(svn r9808) -Codechange: unify the Handle<VehicleType>Loading functions.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r-- | src/vehicle.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 745ca776a..89757e7e7 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2929,6 +2929,40 @@ void Vehicle::LeaveStation() } +void Vehicle::HandleLoading(bool mode) +{ + switch (this->current_order.type) { + case OT_LOADING: { + /* Not the first call for this tick */ + if (mode) return; + + /* We have not waited enough time till the next round of loading/unloading */ + if (--this->load_unload_time_rem) return; + + /* Load/unload the vehicle; when it actually did something + * we do not leave the station. */ + if (LoadUnloadVehicle(this)) return; + + this->PlayLeaveStationSound(); + + Order b = this->current_order; + this->LeaveStation(); + + /* If this was not the final order, don't remove it from the list. */ + if (!(b.flags & OF_NON_STOP)) return; + break; + } + + case OT_DUMMY: break; + + default: return; + } + + this->cur_order_index++; + InvalidateVehicleOrder(this); +} + + void SpecialVehicle::UpdateDeltaXY(Direction direction) { this->x_offs = 0; |