diff options
-rw-r--r-- | src/vehicle_cmd.cpp | 14 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index b0766d349..0c3ec7f34 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -316,10 +316,10 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles, * @param flags type of operation * @param p1 vehicle ID to refit * @param p2 various bitstuffed elements - * - p2 = (bit 0-7) - New cargo type to refit to. + * - p2 = (bit 0-4) - New cargo type to refit to. + * - p2 = (bit 7) - Refit only this vehicle. Used only for cloning vehicles. * - p2 = (bit 8-15) - New cargo subtype to refit to. - * - p2 = (bit 16) - Refit only this vehicle. Used only for cloning vehicles. - * - p2 = (bit 17-24) - Number of vehicles to refit. Zero means all vehicles. Only used if "refit only this vehicle" is false. + * - p2 = (bit 16-23) - Number of vehicles to refit. Zero means all vehicles. Only used if "refit only this vehicle" is false. * @param text unused * @return the cost of this operation or an error */ @@ -343,13 +343,13 @@ CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint if (front->vehstatus & VS_CRASHED) return_cmd_error(STR_ERROR_VEHICLE_IS_DESTROYED); /* Check cargo */ - CargoID new_cid = GB(p2, 0, 8); + CargoID new_cid = GB(p2, 0, 5); byte new_subtype = GB(p2, 8, 8); if (new_cid >= NUM_CARGO) return CMD_ERROR; /* For ships and aircrafts there is always only one. */ - bool only_this = HasBit(p2, 16) || front->type == VEH_SHIP || front->type == VEH_AIRCRAFT; - uint8 num_vehicles = GB(p2, 17, 8); + bool only_this = HasBit(p2, 7) || front->type == VEH_SHIP || front->type == VEH_AIRCRAFT; + uint8 num_vehicles = GB(p2, 16, 8); CommandCost cost = RefitVehicle(v, only_this, num_vehicles, new_cid, new_subtype, flags); @@ -759,7 +759,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint /* Find out what's the best sub type */ byte subtype = GetBestFittingSubType(v, w); if (w->cargo_type != v->cargo_type || w->cargo_subtype != subtype) { - CommandCost cost = DoCommand(0, w->index, v->cargo_type | (subtype << 8) | 1U << 16, flags, GetCmdRefitVeh(v)); + CommandCost cost = DoCommand(0, w->index, v->cargo_type | 1U << 7 | (subtype << 8), flags, GetCmdRefitVeh(v)); if (cost.Succeeded()) total_cost.AddCost(cost); } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 021dda94a..5bd5f18ef 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -587,7 +587,7 @@ struct RefitWindow : public Window { { Vehicle *v = Vehicle::Get(this->window_number); CommandCost cost = DoCommand(v->tile, this->selected_vehicle, option->cargo | option->subtype << 8 | - this->num_vehicles << 17, DC_QUERY_COST, GetCmdRefitVeh(v->type)); + this->num_vehicles << 16, DC_QUERY_COST, GetCmdRefitVeh(v->type)); if (cost.Failed()) return INVALID_STRING_ID; @@ -810,7 +810,7 @@ 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 << 17, GetCmdRefitVeh(v)) && delete_window) delete this; + if (DoCommandP(v->tile, this->selected_vehicle, this->cargo->cargo | this->cargo->subtype << 8 | this->num_vehicles << 16, GetCmdRefitVeh(v)) && delete_window) delete this; } else { if (DoCommandP(v->tile, v->index, this->cargo->cargo | this->cargo->subtype << 8 | this->order << 16, CMD_ORDER_REFIT)) delete this; } |