Changeset - r17176:4980e04e5764
[Not reviewed]
master
0 4 0
alberth - 13 years ago 2011-01-29 21:37:11
alberth@openttd.org
(svn r21925) -Doc: Doxygen additions and markup corrections to vehicle-related functions.
4 files changed with 42 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -155,6 +155,11 @@ void DrawRoadVehEngine(int left, int rig
 
	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 @@ static uint GetRoadVehLength(const RoadV
 
	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);
src/train.h
Show inline comments
 
@@ -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. */
src/vehicle.cpp
Show inline comments
 
@@ -903,6 +903,10 @@ static void DoDrawVehicle(const Vehicle 
 
		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 @@ void ViewportAddVehicles(DrawPixelInfo *
 
	}
 
}
 

	
 
/**
 
 * 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 @@ Vehicle *CheckClickOnVehicle(const ViewP
 
	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 @@ uint8 CalcPercentVehicleFilled(const Veh
 
	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 @@ const GroundVehicleCache *Vehicle::GetGr
 

	
 
/**
 
 * 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)
 
{
src/vehicle_base.h
Show inline comments
 
@@ -118,7 +118,7 @@ extern bool LoadOldVehicle(LoadgameState
 
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 @@ public:
 
	/**
 
	 * 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;
 

	
0 comments (0 inline, 0 general)