summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/api/ai_vehicle.cpp2
-rw-r--r--src/autoreplace_cmd.cpp2
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/group_cmd.cpp2
-rw-r--r--src/train_cmd.cpp18
-rw-r--r--src/vehicle_cmd.cpp2
6 files changed, 14 insertions, 14 deletions
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index 73ad3e928..bacf10935 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -102,7 +102,7 @@
while (dest_wagon-- > 0) w = w->GetNextUnit();
}
- return AIObject::DoCommand(0, v->index | ((w == NULL ? ::INVALID_VEHICLE : w->index) << 16), move_attached_wagons ? 1 : 0, CMD_MOVE_RAIL_VEHICLE);
+ return AIObject::DoCommand(0, v->index | (move_attached_wagons ? 1 : 0) << 20, w == NULL ? ::INVALID_VEHICLE : w->index, CMD_MOVE_RAIL_VEHICLE);
}
/* static */ bool AIVehicle::MoveWagon(VehicleID source_vehicle_id, int source_wagon, int dest_vehicle_id, int dest_wagon)
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 5883fb035..8771ef936 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -309,7 +309,7 @@ static inline CommandCost StartStopVehicle(const Vehicle *v, bool evaluate_callb
*/
static inline CommandCost MoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
{
- return DoCommand(0, v->index | (after != NULL ? after->index : INVALID_VEHICLE) << 16, whole_chain ? 1 : 0, flags, CMD_MOVE_RAIL_VEHICLE);
+ return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags, CMD_MOVE_RAIL_VEHICLE);
}
/**
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 199971ac2..7fc07fcae 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -163,7 +163,7 @@ static void TrainDepotMoveVehicle(const Vehicle *wagon, VehicleID sel, const Veh
if (wagon == v) return;
- DoCommandP(v->tile, v->index + ((wagon == NULL ? INVALID_VEHICLE : wagon->index) << 16), _ctrl_pressed ? 1 : 0, CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE));
+ DoCommandP(v->tile, v->index | (_ctrl_pressed ? 1 : 0) << 20, wagon == NULL ? INVALID_VEHICLE : wagon->index, CMD_MOVE_RAIL_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_MOVE_VEHICLE));
}
/**
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 725acab3e..d10c24f9d 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -205,7 +205,7 @@ CommandCost CmdRenameGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
* @param p1 index of array group
* - p1 bit 0-15 : GroupID
* @param p2 vehicle to add to a group
- * - p2 bit 0-15 : VehicleID
+ * - p2 bit 0-19 : VehicleID
* @param text unused
* @return the cost of this operation or an error
*/
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index ece8cb5cf..562801ef7 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -583,7 +583,7 @@ void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engin
* @param ret[out] the vehicle that has been built.
* @return the cost of this operation or an error.
*/
-CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **ret)
+static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **ret)
{
const RailVehicleInfo *rvi = &e->u.rail;
@@ -647,7 +647,7 @@ CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const Engine
w->engine_type == e->index && ///< Same type
w->First() != v && ///< Don't connect to ourself
!(w->vehstatus & VS_CRASHED)) { ///< Not crashed/flooded
- DoCommand(0, v->index | (w->Last()->index << 16), 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
+ DoCommand(0, v->index | 1 << 20, w->Last()->index, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
break;
}
}
@@ -663,7 +663,7 @@ static void NormalizeTrainVehInDepot(const Train *u)
FOR_ALL_TRAINS(v) {
if (v->IsFreeWagon() && v->tile == u->tile &&
v->track == TRACK_BIT_DEPOT) {
- if (DoCommand(0, v->index | (u->index << 16), 1, DC_EXEC,
+ if (DoCommand(0, v->index | 1 << 20, u->index, DC_EXEC,
CMD_MOVE_RAIL_VEHICLE).Failed())
break;
}
@@ -1143,17 +1143,17 @@ static void NormaliseTrainHead(Train *head)
* @param flags type of operation
* Note: DC_AUTOREPLACE is set when autoreplace tries to undo its modifications or moves vehicles to temporary locations inside the depot.
* @param p1 various bitstuffed elements
- * - p1 (bit 0 - 15) source vehicle index
- * - p1 (bit 16 - 31) what wagon to put the source wagon AFTER, XXX - INVALID_VEHICLE to make a new line
- * @param p2 (bit 0) move all vehicles following the source vehicle
+ * - p1 (bit 0 - 19) source vehicle index
+ * - p1 (bit 20) move all vehicles following the source vehicle
+ * @param p2 what wagon to put the source wagon AFTER, XXX - INVALID_VEHICLE to make a new line
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID s = GB(p1, 0, 16);
- VehicleID d = GB(p1, 16, 16);
- bool move_chain = HasBit(p2, 0);
+ VehicleID s = GB(p1, 0, 20);
+ VehicleID d = GB(p2, 0, 20);
+ bool move_chain = HasBit(p1, 20);
Train *src = Train::GetIfValid(s);
if (src == NULL) return CMD_ERROR;
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index bb96a7315..6be4aea58 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -700,7 +700,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
if (v->type == VEH_TRAIN && !Train::From(v)->IsFrontEngine()) {
/* this s a train car
* add this unit to the end of the train */
- CommandCost result = DoCommand(0, (w_rear->index << 16) | w->index, 1, flags, CMD_MOVE_RAIL_VEHICLE);
+ CommandCost result = DoCommand(0, w->index | 1 << 20, w_rear->index, flags, CMD_MOVE_RAIL_VEHICLE);
if (result.Failed()) {
/* The train can't be joined to make the same consist as the original.
* Sell what we already made (clean up) and return an error. */