changeset 17186:f178a71a6670 draft

(svn r21925) -Doc: Doxygen additions and markup corrections to vehicle-related functions.
author alberth <alberth@openttd.org>
date Sat, 29 Jan 2011 21:37:11 +0000
parents ccebafd2a9ba
children 7df585cf4e19
files src/roadveh_cmd.cpp src/train.h src/vehicle.cpp src/vehicle_base.h
diffstat 4 files changed, 42 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -155,6 +155,11 @@
 	DrawSprite(sprite, pal, preferred_x, y);
 }
 
+/**
+ * Get length of a road vehicle.
+ * @param v Road vehicle to query length.
+ * @return Length of the given road vehicle.
+ */
 static uint GetRoadVehLength(const RoadVehicle *v)
 {
 	uint length = 8;
@@ -167,6 +172,11 @@
 	return length;
 }
 
+/**
+ * Update the cache of a road vehicle.
+ * @param v Road vehicle needing an update of its cache.
+ * @pre \a v must be first road vehicle.
+ */
 void RoadVehUpdateCache(RoadVehicle *v)
 {
 	assert(v->type == VEH_ROAD);
--- a/src/train.h
+++ b/src/train.h
@@ -21,26 +21,16 @@
 
 struct Train;
 
+/** Rail vehicle flags. */
 enum VehicleRailFlags {
-	VRF_REVERSING         = 0,
-
-	/* used to store if a wagon is powered or not */
-	VRF_POWEREDWAGON      = 3,
-
-	/* used to reverse the visible direction of the vehicle */
-	VRF_REVERSE_DIRECTION = 4,
+	VRF_REVERSING                     = 0,
+	VRF_POWEREDWAGON                  = 3, ///< Wagon is powered.
+	VRF_REVERSE_DIRECTION             = 4, ///< Reverse the visible direction of the vehicle.
 
-	/* used to mark that electric train engine is allowed to run on normal rail */
-	VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
-
-	/* used for vehicle var 0xFE bit 8 (toggled each time the train is reversed, accurate for first vehicle only) */
-	VRF_TOGGLE_REVERSE = 7,
-
-	/* used to mark a train that can't get a path reservation */
-	VRF_TRAIN_STUCK    = 8,
-
-	/* used to mark a train that is just leaving a station */
-	VRF_LEAVING_STATION = 9,
+	VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6, ///< Electric train engine is allowed to run on normal rail. */
+	VRF_TOGGLE_REVERSE                = 7, ///< Used for vehicle var 0xFE bit 8 (toggled each time the train is reversed, accurate for first vehicle only).
+	VRF_TRAIN_STUCK                   = 8, ///< Train can't get a path reservation.
+	VRF_LEAVING_STATION               = 9, ///< Train is just leaving a station.
 };
 
 /** Modes for ignoring signals. */
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -903,6 +903,10 @@
 		v->x_extent, v->y_extent, v->z_extent, v->z_pos, (v->vehstatus & VS_SHADOW) != 0);
 }
 
+/**
+ * Add the vehicle sprites that should be drawn at a part of the screen.
+ * @param dpi Rectangle being drawn.
+ */
 void ViewportAddVehicles(DrawPixelInfo *dpi)
 {
 	/* The bounding rectangle */
@@ -954,6 +958,13 @@
 	}
 }
 
+/**
+ * Find the vehicle close to the clicked coordinates.
+ * @param vp Viewport clicked in.
+ * @param x  X coordinate in the viewport.
+ * @param y  Y coordinate in the viewport.
+ * @return Closest vehicle, or \c NULL if none found.
+ */
 Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y)
 {
 	Vehicle *found = NULL, *v;
@@ -984,6 +995,10 @@
 	return found;
 }
 
+/**
+ * Decrease the value of a vehicle.
+ * @param v %Vehicle to devaluate.
+ */
 void DecreaseVehicleValue(Vehicle *v)
 {
 	v->value -= v->value >> 8;
@@ -1187,6 +1202,10 @@
 	return (count * 100) / max;
 }
 
+/**
+ * Vehicle entirely entered the depot, update its status, orders, vehicle windows, service it, etc.
+ * @param v Vehicle that entered a depot.
+ */
 void VehicleEnterDepot(Vehicle *v)
 {
 	/* Always work with the front of the vehicle */
@@ -2357,11 +2376,11 @@
 
 /**
  * Calculates the set of vehicles that will be affected by a given selection.
- * @param set Set of affected vehicles.
+ * @param set [inout] Set of affected vehicles.
  * @param v First vehicle of the selection.
  * @param num_vehicles Number of vehicles in the selection (not counting articulated parts).
- * @pre \c set must be empty.
- * @post \c set will contain the vehicles that will be refitted.
+ * @pre \a set must be empty.
+ * @post \a set will contain the vehicles that will be refitted.
  */
 void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8 num_vehicles)
 {
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -118,7 +118,7 @@
 extern bool AfterLoadGame();
 extern void FixOldVehicles();
 
-/** Vehicle data structure. */
+/** %Vehicle data structure. */
 struct Vehicle : VehiclePool::PoolItem<&_vehicle_pool>, BaseVehicle {
 private:
 	Vehicle *next;                      ///< pointer to the next vehicle in the chain
@@ -141,7 +141,7 @@
 	/**
 	 * Heading for this tile.
 	 * For airports and train stations this tile does not necessarily belong to the destination station,
-	 * but it can be used for heuristical purposes to estimate the distance.
+	 * but it can be used for heuristic purposes to estimate the distance.
 	 */
 	TileIndex dest_tile;