summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-01-13 18:55:54 +0000
committerKUDr <kudr@openttd.org>2007-01-13 18:55:54 +0000
commit9bfb3f08d95bf308eb5da9e59b9dc9fb214de6a1 (patch)
treeffa45998168a4f37d45b9d9d3e429ee18cc906c0 /src/vehicle.cpp
parent1f0206f62d478540f7b96a86999944b0cdac7492 (diff)
downloadopenttd-9bfb3f08d95bf308eb5da9e59b9dc9fb214de6a1.tar.xz
(svn r8110) -Codechange: direct Vehicle::current_order.type changes (to OT_LOADING and OT_LEAVESTATION) replaced by v->BeginLoading() and v->LeaveStation() calls. This should allow easy hooking of those state transitions in order to maintain vehicle loading queue.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 6e5b08160..c068488f3 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -3227,3 +3227,17 @@ static void Load_VEHS(void)
extern const ChunkHandler _veh_chunk_handlers[] = {
{ 'VEHS', Save_VEHS, Load_VEHS, CH_SPARSE_ARRAY | CH_LAST},
};
+
+void Vehicle::BeginLoading()
+{
+ assert(IsTileType(tile, MP_STATION) || type == VEH_Ship);
+ current_order.type = OT_LOADING;
+}
+
+void Vehicle::LeaveStation()
+{
+ assert(IsTileType(tile, MP_STATION) || type == VEH_Ship);
+ assert(current_order.type == OT_LOADING);
+ current_order.type = OT_LEAVESTATION;
+ current_order.flags = 0;
+}