Codechange: Move command arguments to the back of the networked command function calls.
This commit is contained in:
@@ -1033,9 +1033,9 @@ struct RefitWindow : public Window {
|
||||
|
||||
if (this->order == INVALID_VEH_ORDER_ID) {
|
||||
bool delete_window = this->selected_vehicle == v->index && this->num_vehicles == UINT8_MAX;
|
||||
if (DoCommandP(v->tile, this->selected_vehicle, this->cargo->cargo | this->cargo->subtype << 8 | this->num_vehicles << 16, GetCmdRefitVeh(v)) && delete_window) this->Close();
|
||||
if (DoCommandP(GetCmdRefitVeh(v), v->tile, this->selected_vehicle, this->cargo->cargo | this->cargo->subtype << 8 | this->num_vehicles << 16) && delete_window) this->Close();
|
||||
} else {
|
||||
if (DoCommandP(v->tile, v->index, this->cargo->cargo | this->order << 16, CMD_ORDER_REFIT)) this->Close();
|
||||
if (DoCommandP(CMD_ORDER_REFIT, v->tile, v->index, this->cargo->cargo | this->order << 16)) this->Close();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1894,7 +1894,7 @@ public:
|
||||
|
||||
case WID_VL_STOP_ALL:
|
||||
case WID_VL_START_ALL:
|
||||
DoCommandP(0, (1 << 1) | (widget == WID_VL_START_ALL ? (1 << 0) : 0), this->window_number, CMD_MASS_START_STOP);
|
||||
DoCommandP(CMD_MASS_START_STOP, 0, (1 << 1) | (widget == WID_VL_START_ALL ? (1 << 0) : 0), this->window_number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1919,7 +1919,7 @@ public:
|
||||
break;
|
||||
case ADI_SERVICE: // Send for servicing
|
||||
case ADI_DEPOT: // Send to Depots
|
||||
DoCommandP(0, DEPOT_MASS_SEND | (index == ADI_SERVICE ? DEPOT_SERVICE : (DepotCommand)0), this->window_number, GetCmdSendToDepot(this->vli.vtype));
|
||||
DoCommandP(GetCmdSendToDepot(this->vli.vtype), 0, DEPOT_MASS_SEND | (index == ADI_SERVICE ? DEPOT_SERVICE : (DepotCommand)0), this->window_number);
|
||||
break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
@@ -2422,7 +2422,7 @@ struct VehicleDetailsWindow : Window {
|
||||
mod = GetServiceIntervalClamped(mod + v->GetServiceInterval(), v->ServiceIntervalIsPercent());
|
||||
if (mod == v->GetServiceInterval()) return;
|
||||
|
||||
DoCommandP(v->tile, v->index, mod | (1 << 16) | (v->ServiceIntervalIsPercent() << 17), CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_SERVICING));
|
||||
DoCommandP(CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_SERVICING), v->tile, v->index, mod | (1 << 16) | (v->ServiceIntervalIsPercent() << 17));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2458,7 +2458,7 @@ struct VehicleDetailsWindow : Window {
|
||||
bool iscustom = index != 0;
|
||||
bool ispercent = iscustom ? (index == 2) : Company::Get(v->owner)->settings.vehicle.servint_ispercent;
|
||||
uint16 interval = GetServiceIntervalClamped(v->GetServiceInterval(), ispercent);
|
||||
DoCommandP(v->tile, v->index, interval | (iscustom << 16) | (ispercent << 17), CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_SERVICING));
|
||||
DoCommandP(CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_SERVICING), v->tile, v->index, interval | (iscustom << 16) | (ispercent << 17));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2639,7 +2639,7 @@ void CcStartStopVehicle(const CommandCost &result, TileIndex tile, uint32 p1, ui
|
||||
void StartStopVehicle(const Vehicle *v, bool texteffect)
|
||||
{
|
||||
assert(v->IsPrimaryVehicle());
|
||||
DoCommandP(v->tile, v->index, 0, _vehicle_command_translation_table[VCT_CMD_START_STOP][v->type], texteffect ? CcStartStopVehicle : nullptr);
|
||||
DoCommandP(_vehicle_command_translation_table[VCT_CMD_START_STOP][v->type], texteffect ? CcStartStopVehicle : nullptr, v->tile, v->index, 0);
|
||||
}
|
||||
|
||||
/** Checks whether the vehicle may be refitted at the moment.*/
|
||||
@@ -2963,7 +2963,7 @@ public:
|
||||
break;
|
||||
|
||||
case WID_VV_GOTO_DEPOT: // goto hangar
|
||||
DoCommandP(v->tile, v->index | (_ctrl_pressed ? DEPOT_SERVICE : 0U), 0, GetCmdSendToDepot(v));
|
||||
DoCommandP(GetCmdSendToDepot(v), v->tile, v->index | (_ctrl_pressed ? DEPOT_SERVICE : 0U), 0);
|
||||
break;
|
||||
case WID_VV_REFIT: // refit
|
||||
ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID, this);
|
||||
@@ -2987,18 +2987,17 @@ public:
|
||||
* There is no point to it except for starting the vehicle.
|
||||
* For starting the vehicle the player has to open the depot GUI, which is
|
||||
* most likely already open, but is also visible in the vehicle viewport. */
|
||||
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0,
|
||||
_vehicle_command_translation_table[VCT_CMD_CLONE_VEH][v->type],
|
||||
_ctrl_pressed ? nullptr : CcCloneVehicle);
|
||||
DoCommandP(_vehicle_command_translation_table[VCT_CMD_CLONE_VEH][v->type],
|
||||
_ctrl_pressed ? nullptr : CcCloneVehicle,
|
||||
v->tile, v->index, _ctrl_pressed ? 1 : 0);
|
||||
break;
|
||||
case WID_VV_TURN_AROUND: // turn around
|
||||
assert(v->IsGroundVehicle());
|
||||
DoCommandP(v->tile, v->index, 0,
|
||||
_vehicle_command_translation_table[VCT_CMD_TURN_AROUND][v->type]);
|
||||
DoCommandP(_vehicle_command_translation_table[VCT_CMD_TURN_AROUND][v->type], v->tile, v->index, 0);
|
||||
break;
|
||||
case WID_VV_FORCE_PROCEED: // force proceed
|
||||
assert(v->type == VEH_TRAIN);
|
||||
DoCommandP(v->tile, v->index, 0, CMD_FORCE_TRAIN_PROCEED | CMD_MSG(STR_ERROR_CAN_T_MAKE_TRAIN_PASS_SIGNAL));
|
||||
DoCommandP(CMD_FORCE_TRAIN_PROCEED | CMD_MSG(STR_ERROR_CAN_T_MAKE_TRAIN_PASS_SIGNAL), v->tile, v->index, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3007,7 +3006,7 @@ public:
|
||||
{
|
||||
if (str == nullptr) return;
|
||||
|
||||
DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type), nullptr, str);
|
||||
DoCommandP(CMD_RENAME_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type), 0, this->window_number, 0, str);
|
||||
}
|
||||
|
||||
void OnMouseOver(Point pt, int widget) override
|
||||
|
Reference in New Issue
Block a user