summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-19 20:39:12 +0000
committerrubidium <rubidium@openttd.org>2010-08-19 20:39:12 +0000
commite89a0fb7f9059c995383d91a6aa16edac5ad841e (patch)
tree12dcf0c089ab3c85d1ee103dc28081bd74f766b3
parent983883a2b91b161035842a2b50e134136ea0fd64 (diff)
downloadopenttd-e89a0fb7f9059c995383d91a6aa16edac5ad841e.tar.xz
(svn r20571) -Codechange: free/reserve some bits in the order commands to increase the vehicle pool limit
-rw-r--r--src/ai/api/ai_order.cpp28
-rw-r--r--src/autoreplace_cmd.cpp2
-rw-r--r--src/order_backup.cpp2
-rw-r--r--src/order_cmd.cpp44
-rw-r--r--src/order_gui.cpp24
-rw-r--r--src/vehicle_cmd.cpp2
6 files changed, 51 insertions, 51 deletions
diff --git a/src/ai/api/ai_order.cpp b/src/ai/api/ai_order.cpp
index 370cff4f6..02d6a701b 100644
--- a/src/ai/api/ai_order.cpp
+++ b/src/ai/api/ai_order.cpp
@@ -309,7 +309,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, jump_to) && jump_to != ORDER_CURRENT);
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), MOF_COND_DESTINATION | (jump_to << 4), CMD_MODIFY_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), MOF_COND_DESTINATION | (jump_to << 4), CMD_MODIFY_ORDER);
}
/* static */ bool AIOrder::SetOrderCondition(VehicleID vehicle_id, OrderPosition order_position, OrderCondition condition)
@@ -318,7 +318,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
EnforcePrecondition(false, condition >= OC_LOAD_PERCENTAGE && condition <= OC_UNCONDITIONALLY);
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), MOF_COND_VARIABLE | (condition << 4), CMD_MODIFY_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), MOF_COND_VARIABLE | (condition << 4), CMD_MODIFY_ORDER);
}
/* static */ bool AIOrder::SetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position, CompareFunction compare)
@@ -327,7 +327,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
EnforcePrecondition(false, order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position));
EnforcePrecondition(false, compare >= CF_EQUALS && compare <= CF_IS_FALSE);
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), MOF_COND_COMPARATOR | (compare << 4), CMD_MODIFY_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), MOF_COND_COMPARATOR | (compare << 4), CMD_MODIFY_ORDER);
}
/* static */ bool AIOrder::SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, int32 value)
@@ -337,7 +337,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
EnforcePrecondition(false, value >= 0 && value < 2048);
if (GetOrderCondition(vehicle_id, order_position) == OC_MAX_SPEED) value = value * 10 / 16;
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), MOF_COND_VALUE | (value << 4), CMD_MODIFY_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), MOF_COND_VALUE | (value << 4), CMD_MODIFY_ORDER);
}
/* static */ bool AIOrder::SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location)
@@ -347,7 +347,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
EnforcePrecondition(false, IsGotoStationOrder(vehicle_id, order_position));
EnforcePrecondition(false, stop_location >= STOPLOCATION_NEAR && stop_location <= STOPLOCATION_FAR);
- uint32 p1 = vehicle_id | (order_position << 16);
+ uint32 p1 = vehicle_id | (order_position << 20);
uint32 p2 = MOF_STOP_LOCATION | (stop_location << 4);
return AIObject::DoCommand(0, p1, p2, CMD_MODIFY_ORDER);
}
@@ -418,7 +418,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
order.SetNonStopType((OrderNonStopFlags)GB(order_flags, 0, 2));
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), order.Pack(), CMD_INSERT_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), order.Pack(), CMD_INSERT_ORDER);
}
/* static */ bool AIOrder::InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to)
@@ -432,7 +432,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
Order order;
order.MakeConditional(jump_to);
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), order.Pack(), CMD_INSERT_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), order.Pack(), CMD_INSERT_ORDER);
}
/* static */ bool AIOrder::RemoveOrder(VehicleID vehicle_id, OrderPosition order_position)
@@ -491,7 +491,7 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
AIOrderFlags current = GetOrderFlags(vehicle_id, order_position);
if ((current & AIOF_NON_STOP_FLAGS) != (order_flags & AIOF_NON_STOP_FLAGS)) {
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), (order_flags & AIOF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), (order_flags & AIOF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
}
switch (order->GetType()) {
@@ -500,16 +500,16 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
uint data = DA_ALWAYS_GO;
if (order_flags & AIOF_SERVICE_IF_NEEDED) data = DA_SERVICE;
if (order_flags & AIOF_STOP_IN_DEPOT) data = DA_STOP;
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
}
break;
case OT_GOTO_STATION:
if ((current & AIOF_UNLOAD_FLAGS) != (order_flags & AIOF_UNLOAD_FLAGS)) {
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), (order_flags & AIOF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), (order_flags & AIOF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
}
if ((current & AIOF_LOAD_FLAGS) != (order_flags & AIOF_LOAD_FLAGS)) {
- return AIObject::DoCommand(0, vehicle_id | (order_position << 16), (order_flags & AIOF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
+ return AIObject::DoCommand(0, vehicle_id | (order_position << 20), (order_flags & AIOF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
}
break;
@@ -548,7 +548,7 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
EnforcePrecondition(false, AIVehicle::IsValidVehicle(main_vehicle_id));
- return AIObject::DoCommand(0, vehicle_id | (main_vehicle_id << 16), CO_COPY, CMD_CLONE_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | CO_COPY << 30, main_vehicle_id, CMD_CLONE_ORDER);
}
/* static */ bool AIOrder::ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id)
@@ -556,12 +556,12 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
EnforcePrecondition(false, AIVehicle::IsValidVehicle(main_vehicle_id));
- return AIObject::DoCommand(0, vehicle_id | (main_vehicle_id << 16), CO_SHARE, CMD_CLONE_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | CO_SHARE << 30, main_vehicle_id, CMD_CLONE_ORDER);
}
/* static */ bool AIOrder::UnshareOrders(VehicleID vehicle_id)
{
EnforcePrecondition(false, AIVehicle::IsValidVehicle(vehicle_id));
- return AIObject::DoCommand(0, vehicle_id, CO_UNSHARE, CMD_CLONE_ORDER);
+ return AIObject::DoCommand(0, vehicle_id | CO_UNSHARE << 30, 0, CMD_CLONE_ORDER);
}
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 483fb445a..5883fb035 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -323,7 +323,7 @@ static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head,
CommandCost cost = CommandCost();
/* Share orders */
- if (cost.Succeeded() && old_head != new_head) cost.AddCost(DoCommand(0, (old_head->index << 16) | new_head->index, CO_SHARE, DC_EXEC, CMD_CLONE_ORDER));
+ if (cost.Succeeded() && old_head != new_head) cost.AddCost(DoCommand(0, new_head->index | CO_SHARE << 30, old_head->index, DC_EXEC, CMD_CLONE_ORDER));
/* Copy group membership */
if (cost.Succeeded() && old_head != new_head) cost.AddCost(DoCommand(0, old_head->group_id, new_head->index, DC_EXEC, CMD_ADD_VEHICLE_GROUP));
diff --git a/src/order_backup.cpp b/src/order_backup.cpp
index 0d54d5337..162b472a2 100644
--- a/src/order_backup.cpp
+++ b/src/order_backup.cpp
@@ -72,7 +72,7 @@ void OrderBackup::DoRestore(Vehicle *v)
/* If we had shared orders, recover that */
if (this->clone != NULL) {
- DoCommand(0, v->index | (this->clone->index << 16), CO_SHARE, DC_EXEC, CMD_CLONE_ORDER);
+ DoCommand(0, v->index | CO_SHARE << 30, this->clone->index, DC_EXEC, CMD_CLONE_ORDER);
} else if (this->orders != NULL && OrderList::CanAllocateItem()) {
v->orders.list = new OrderList(this->orders, v);
this->orders = NULL;
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 050ac366b..59e5c37f0 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -452,8 +452,8 @@ static uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle
* @param tile unused
* @param flags operation to perform
* @param p1 various bitstuffed elements
- * - p1 = (bit 0 - 15) - ID of the vehicle
- * - p1 = (bit 16 - 31) - the selected order (if any). If the last order is given,
+ * - p1 = (bit 0 - 19) - ID of the vehicle
+ * - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
* the order will be inserted before that one
* the maximum vehicle order id is 254.
* @param p2 packed order to insert
@@ -462,8 +462,8 @@ static uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle
*/
CommandCost CmdInsertOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID veh = GB(p1, 0, 16);
- VehicleOrderID sel_ord = GB(p1, 16, 16);
+ VehicleID veh = GB(p1, 0, 20);
+ VehicleOrderID sel_ord = GB(p1, 20, 8);
Order new_order(p2);
Vehicle *v = Vehicle::GetIfValid(veh);
@@ -742,8 +742,8 @@ static CommandCost DecloneOrder(Vehicle *dst, DoCommandFlag flags)
*/
CommandCost CmdDeleteOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID veh_id = p1;
- VehicleOrderID sel_ord = p2;
+ VehicleID veh_id = GB(p1, 0, 20);
+ VehicleOrderID sel_ord = GB(p2, 0, 8);
Order *order;
Vehicle *v = Vehicle::GetIfValid(veh_id);
@@ -811,8 +811,8 @@ CommandCost CmdDeleteOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
*/
CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID veh_id = p1;
- VehicleOrderID sel_ord = p2;
+ VehicleID veh_id = GB(p1, 0, 20);
+ VehicleOrderID sel_ord = GB(p2, 0, 8);
Vehicle *v = Vehicle::GetIfValid(veh_id);
@@ -851,7 +851,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
*/
CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID veh = p1;
+ VehicleID veh = GB(p1, 0, 20);
VehicleOrderID moving_order = GB(p2, 0, 16);
VehicleOrderID target_order = GB(p2, 16, 16);
@@ -920,10 +920,10 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
* @param tile unused
* @param flags operation to perform
* @param p1 various bitstuffed elements
- * - p1 = (bit 0 - 15) - ID of the vehicle
- * - p1 = (bit 16 - 31) - the selected order (if any). If the last order is given,
+ * - p1 = (bit 0 - 19) - ID of the vehicle
+ * - p1 = (bit 24 - 31) - the selected order (if any). If the last order is given,
* the order will be inserted before that one
- * only the first 8 bits used currently (bit 16 - 23) (max 255)
+ * the maximum vehicle order id is 254.
* @param p2 various bitstuffed elements
* - p2 = (bit 0 - 3) - what data to modify (@see ModifyOrderFlags)
* - p2 = (bit 4 - 15) - the data to modify
@@ -932,10 +932,10 @@ CommandCost CmdMoveOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
*/
CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleOrderID sel_ord = GB(p1, 16, 16); // XXX - automatically truncated to 8 bits.
- VehicleID veh = GB(p1, 0, 16);
+ VehicleOrderID sel_ord = GB(p1, 20, 8);
+ VehicleID veh = GB(p1, 0, 20);
ModifyOrderFlags mof = Extract<ModifyOrderFlags, 0, 4>(p2);
- uint16 data = GB(p2, 4, 11);
+ uint16 data = GB(p2, 4, 11);
if (mof >= MOF_END) return CMD_ERROR;
@@ -1157,16 +1157,16 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
* @param tile unused
* @param flags operation to perform
* @param p1 various bitstuffed elements
- * - p1 = (bit 0-15) - destination vehicle to clone orders to (p1 & 0xFFFF)
- * - p1 = (bit 16-31) - source vehicle to clone orders from, if any (none for CO_UNSHARE)
- * @param p2 mode of cloning: CO_SHARE, CO_COPY, or CO_UNSHARE
+ * - p1 = (bit 0-19) - destination vehicle to clone orders to
+ * - p1 = (bit 30-31) - action to perform
+ * @param p2 source vehicle to clone orders from, if any (none for CO_UNSHARE)
* @param text unused
* @return the cost of this operation or an error
*/
CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID veh_src = GB(p1, 16, 16);
- VehicleID veh_dst = GB(p1, 0, 16);
+ VehicleID veh_src = GB(p2, 0, 20);
+ VehicleID veh_dst = GB(p1, 0, 20);
Vehicle *dst = Vehicle::GetIfValid(veh_dst);
if (dst == NULL || !dst->IsPrimaryVehicle()) return CMD_ERROR;
@@ -1174,7 +1174,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
CommandCost ret = CheckOwnership(dst->owner);
if (ret.Failed()) return ret;
- switch (p2) {
+ switch (GB(p1, 30, 2)) {
case CO_SHARE: {
Vehicle *src = Vehicle::GetIfValid(veh_src);
@@ -1295,7 +1295,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
*/
CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
- VehicleID veh = GB(p1, 0, 16);
+ VehicleID veh = GB(p1, 0, 20);
VehicleOrderID order_number = GB(p2, 16, 8);
CargoID cargo = GB(p2, 0, 8);
byte subtype = GB(p2, 8, 8);
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 3bedfd063..21cf68573 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -512,7 +512,7 @@ private:
* obviously if you press CTRL on a non-empty orders vehicle you know what you are doing */
if (this->vehicle->GetNumOrders() != 0 && _ctrl_pressed == 0) return false;
- if (DoCommandP(this->vehicle->tile, this->vehicle->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY,
+ if (DoCommandP(this->vehicle->tile, this->vehicle->index | (_ctrl_pressed ? CO_SHARE : CO_COPY) << 30, u->index,
_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) {
this->selected_order = -1;
ResetObjectToPlace();
@@ -552,7 +552,7 @@ private:
if (load_type < 0) {
load_type = order->GetLoadType() == OLF_LOAD_IF_POSSIBLE ? OLF_FULL_LOAD_ANY : OLF_LOAD_IF_POSSIBLE;
}
- DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
}
/**
@@ -575,7 +575,7 @@ private:
if (order == NULL) return;
i = (order->GetDepotOrderType() & ODTFB_SERVICE) ? DA_ALWAYS_GO : DA_SERVICE;
}
- DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_DEPOT_ACTION | (i << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_DEPOT_ACTION | (i << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
}
/**
@@ -591,7 +591,7 @@ private:
_settings_client.gui.new_nonstop && (this->vehicle->type == VEH_TRAIN || this->vehicle->type == VEH_ROAD) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
order.SetDepotActionType(ODATFB_NEAREST_DEPOT);
- DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
}
/**
@@ -620,7 +620,7 @@ private:
unload_type = order->GetUnloadType() == OUF_UNLOAD_IF_POSSIBLE ? OUFB_UNLOAD : OUF_UNLOAD_IF_POSSIBLE;
}
- DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
}
/**
@@ -658,7 +658,7 @@ private:
}
this->SetWidgetDirty(ORDER_WIDGET_NON_STOP);
- DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 20), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
}
/**
@@ -1061,7 +1061,7 @@ public:
this->selected_order = -1;
} else if (sel == this->selected_order) {
if (this->vehicle->type == VEH_TRAIN && sel < this->vehicle->GetNumOrders()) {
- DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 16),
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 20),
MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
}
@@ -1180,7 +1180,7 @@ public:
default:
break;
}
- DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 16), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 20), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
}
}
@@ -1213,11 +1213,11 @@ public:
break;
case ORDER_WIDGET_COND_VARIABLE:
- DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), MOF_COND_VARIABLE | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_VARIABLE | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
break;
case ORDER_WIDGET_COND_COMPARATOR:
- DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), MOF_COND_COMPARATOR | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_COMPARATOR | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
break;
}
}
@@ -1269,7 +1269,7 @@ public:
const Order cmd = GetOrderCmdFromTile(this->vehicle, tile);
if (cmd.IsType(OT_NOTHING)) return;
- if (DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), cmd.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER))) {
+ if (DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), cmd.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER))) {
/* With quick goto the Go To button stays active */
if (!_settings_client.gui.quick_goto) ResetObjectToPlace();
}
@@ -1289,7 +1289,7 @@ public:
order.index = 0;
order.MakeConditional(order_id);
- DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
+ DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER));
}
}
}
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index e5b5df6cd..bb96a7315 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -784,7 +784,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
* the vehicle refitted before doing this, otherwise the moved
* cargo types might not match (passenger vs non-passenger)
*/
- DoCommand(0, (v_front->index << 16) | w_front->index, p2 & 1 ? CO_SHARE : CO_COPY, flags, CMD_CLONE_ORDER);
+ DoCommand(0, w_front->index | (p2 & 1 ? CO_SHARE : CO_COPY) << 30, v_front->index, flags, CMD_CLONE_ORDER);
/* Now clone the vehicle's name, if it has one. */
if (v_front->name != NULL) CloneVehicleName(v_front, w_front);