summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-31 20:27:33 +0000
committerrubidium <rubidium@openttd.org>2011-01-31 20:27:33 +0000
commit67a5cd0b185158ca4926c8cb45f1735a1001e00b (patch)
tree9c1da7950e0954846792a820537dbd4778932e19 /src/vehicle.cpp
parent8f67baae2e5766300442f9ca5c962dbbce848ad4 (diff)
downloadopenttd-67a5cd0b185158ca4926c8cb45f1735a1001e00b.tar.xz
(svn r21932) -Document: some tidbits related to vehicles
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index d2e4556d4..50aa1c5c5 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -63,7 +63,7 @@ uint16 _returned_mail_refit_capacity; ///< Stores the mail capacity after a refi
byte _age_cargo_skip_counter; ///< Skip aging of cargo?
-/* Initialize the vehicle-pool */
+/** The pool with all our precious vehicles. */
VehiclePool _vehicle_pool("Vehicle");
INSTANTIATE_POOL_METHODS(Vehicle)
@@ -1805,9 +1805,13 @@ void Vehicle::DeleteUnreachedAutoOrders()
}
}
+/**
+ * Prepare everything to begin the loading when arriving at a station.
+ * @pre IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP.
+ */
void Vehicle::BeginLoading()
{
- assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
+ assert(IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP);
if (this->current_order.IsType(OT_GOTO_STATION) &&
this->current_order.GetDestination() == this->last_station_visited) {
@@ -1854,16 +1858,20 @@ void Vehicle::BeginLoading()
this->MarkDirty();
}
+/**
+ * Perform all actions when leaving a station.
+ * @pre this->current_order.IsType(OT_LOADING)
+ */
void Vehicle::LeaveStation()
{
- assert(current_order.IsType(OT_LOADING));
+ assert(this->current_order.IsType(OT_LOADING));
delete this->cargo_payment;
/* Only update the timetable if the vehicle was supposed to stop here. */
- if (current_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) UpdateVehicleTimetable(this, false);
+ if (this->current_order.GetNonStopType() != ONSF_STOP_EVERYWHERE) UpdateVehicleTimetable(this, false);
- current_order.MakeLeaveStation();
+ this->current_order.MakeLeaveStation();
Station *st = Station::Get(this->last_station_visited);
st->loading_vehicles.remove(this);