|
@@ -182,12 +182,14 @@ void RoadVehUpdateCache(RoadVehicle *v)
|
|
|
|
|
|
/** 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 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdBuildRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
if (!IsEngineBuildable(p1, VEH_ROAD, _current_company)) return_cmd_error(STR_ERROR_ROAD_VEHICLE_NOT_AVAILABLE);
|
|
|
|
|
|
const Engine *e = Engine::Get(p1);
|
|
@@ -337,12 +339,14 @@ bool RoadVehicle::IsStoppedInDepot() con
|
|
|
|
|
|
/** Sell a road vehicle.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 vehicle ID to be sold
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdSellRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
|
|
|
if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
|
|
|
|
|
@@ -445,12 +449,14 @@ bool RoadVehicle::FindClosestDepot(TileI
|
|
|
* @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)
|
|
|
* - p2 bit 8-10 - VLW flag (for mass goto depot)
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdSendRoadVehToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
if (p2 & DEPOT_MASS_SEND) {
|
|
|
/* Mass goto depot requested */
|
|
|
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
|
|
@@ -465,12 +471,14 @@ CommandCost CmdSendRoadVehToDepot(TileIn
|
|
|
|
|
|
/** Turn a roadvehicle around.
|
|
|
* @param tile unused
|
|
|
* @param flags operation to perform
|
|
|
* @param p1 vehicle ID to turn
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
RoadVehicle *v = RoadVehicle::GetIfValid(p1);
|
|
|
if (v == NULL || !CheckOwnership(v->owner)) return CMD_ERROR;
|
|
|
|
|
@@ -1989,13 +1997,14 @@ Trackdir RoadVehicle::GetVehicleTrackdir
|
|
|
* @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
|
|
|
* - p2 = (bit 8-15) - the new cargo subtype to refit to
|
|
|
* - p2 = (bit 16) - refit only this vehicle
|
|
|
* @return cost of refit or error
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdRefitRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
CommandCost cost(EXPENSES_ROADVEH_RUN);
|
|
|
CargoID new_cid = GB(p2, 0, 8);
|
|
|
byte new_subtype = GB(p2, 8, 8);
|