Codechange: Un-bitstuff vehicle/engine commands.

This commit is contained in:
Michael Lutz
2021-11-05 23:55:23 +01:00
parent 2637c06f88
commit 21675ec7e2
25 changed files with 221 additions and 268 deletions

View File

@@ -1565,7 +1565,7 @@ void VehicleEnterDepot(Vehicle *v)
if (v->current_order.IsRefit()) {
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
CommandCost cost = Command<CMD_REFIT_VEHICLE>::Do(DC_EXEC, v->tile, v->index, v->current_order.GetRefitCargo() | 0xFF << 8, {});
CommandCost cost = Command<CMD_REFIT_VEHICLE>::Do(DC_EXEC, v->index, v->current_order.GetRefitCargo(), 0xFF, false, false, 0);
cur_company.Restore();
if (cost.Failed()) {
@@ -2397,7 +2397,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (this->current_order.IsType(OT_GOTO_DEPOT)) {
bool halt_in_depot = (this->current_order.GetDepotActionType() & ODATFB_HALT) != 0;
if (!!(command & DEPOT_SERVICE) == halt_in_depot) {
if (((command & DepotCommand::Service) != DepotCommand::None) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
@@ -2409,7 +2409,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
return CommandCost();
}
if (command & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancellation of depot orders
if ((command & DepotCommand::DontCancel) != DepotCommand::None) return CMD_ERROR; // Requested no cancellation of depot orders
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
@@ -2442,12 +2442,12 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
this->SetDestTile(location);
this->current_order.MakeGoToDepot(destination, ODTF_MANUAL);
if (!(command & DEPOT_SERVICE)) this->current_order.SetDepotActionType(ODATFB_HALT);
if ((command & DepotCommand::Service) == DepotCommand::None) this->current_order.SetDepotActionType(ODATFB_HALT);
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
/* If there is no depot in front and the train is not already reversing, reverse automatically (trains only) */
if (this->type == VEH_TRAIN && (reverse ^ HasBit(Train::From(this)->flags, VRF_REVERSING))) {
Command<CMD_REVERSE_TRAIN_DIRECTION>::Do(DC_EXEC, this->tile, this->index, 0, {});
Command<CMD_REVERSE_TRAIN_DIRECTION>::Do(DC_EXEC, this->index, false);
}
if (this->type == VEH_AIRCRAFT) {