src/roadveh_cmd.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6307 f40e88cff863
--- a/src/roadveh_cmd.cpp	Sun Apr 15 17:04:44 2007 +0000
+++ b/src/roadveh_cmd.cpp	Sat Apr 21 08:23:57 2007 +0000
@@ -122,6 +122,7 @@
 
 /** Build a road vehicle.
  * @param tile tile of depot where road vehicle is built
+ * @param flags operation to perform
  * @param p1 bus/truck type being built (engine)
  * @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number
  */
@@ -167,11 +168,11 @@
 		y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
 		v->x_pos = x;
 		v->y_pos = y;
-		v->z_pos = GetSlopeZ(x,y);
+		v->z_pos = GetSlopeZ(x, y);
 		v->z_height = 6;
 
 		v->u.road.state = RVSB_IN_DEPOT;
-		v->vehstatus = VS_HIDDEN|VS_STOPPED|VS_DEFPAL;
+		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 
 		v->spritenum = rvi->image_index;
 		v->cargo_type = rvi->cargo_type;
@@ -227,6 +228,7 @@
 
 /** Start/Stop a road vehicle.
  * @param tile unused
+ * @param flags operation to perform
  * @param p1 road vehicle ID to start/stop
  * @param p2 unused
  */
@@ -278,6 +280,7 @@
 
 /** Sell a road vehicle.
  * @param tile unused
+ * @param flags operation to perform
  * @param p1 vehicle ID to be sold
  * @param p2 unused
  */
@@ -375,6 +378,7 @@
 
 /** Send a road vehicle to the depot.
  * @param tile unused
+ * @param flags operation to perform
  * @param p1 vehicle ID to send to the depot
  * @param p2 various bitmasked elements
  * - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
@@ -432,6 +436,8 @@
 	if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
 
 	if (flags & DC_EXEC) {
+		if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
 		ClearSlot(v);
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
@@ -447,6 +453,7 @@
 
 /** Turn a roadvehicle around.
  * @param tile unused
+ * @param flags operation to perform
  * @param p1 vehicle ID to turn
  * @param p2 unused
  */
@@ -1066,10 +1073,10 @@
 /**
  * Returns direction to for a road vehicle to take or
  * INVALID_TRACKDIR if the direction is currently blocked
- * @param v        the vehicle to do the pathfinding for
+ * @param v        the Vehicle to do the pathfinding for
  * @param tile     the where to start the pathfinding
  * @param enterdir the direction the vehicle enters the tile from
- * @return the trackdir to take
+ * @return the Trackdir to take
  */
 static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection enterdir)
 {
@@ -1841,6 +1848,7 @@
 
 /** Refit a road vehicle to the specified cargo type
  * @param tile unused
+ * @param flags operation to perform
  * @param p1 Vehicle ID of the vehicle to refit
  * @param p2 Bitstuffed elements
  * - p2 = (bit 0-7) - the new cargo type to refit to