summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-06-04 17:38:48 +0000
committerpeter1138 <peter1138@openttd.org>2006-06-04 17:38:48 +0000
commitf00c3e7e25a5a31b31eeaf369feaa789956306d8 (patch)
tree21e6459184d1403a93b6f2efa6de0a74283360cb /ship_cmd.c
parentfa740023567157cf18d4dd06880307e7b08b7c77 (diff)
downloadopenttd-f00c3e7e25a5a31b31eeaf369feaa789956306d8.tar.xz
(svn r5103) - Add cargo subtype parameter to refit commands (mart3p)
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index e86aae54a..424d484fb 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1030,12 +1030,14 @@ int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* @param p1 vehicle ID of the ship to refit
* @param p2 various bitstuffed elements
* - p2 = (bit 0-7) - the new cargo type to refit to (p2 & 0xFF)
+ * - p2 = (bit 8-15) - the new cargo subtype to refit to
*/
int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Vehicle *v;
int32 cost;
- CargoID new_cid = p2 & 0xFF; //gets the cargo number
+ CargoID new_cid = GB(p2, 0, 8); //gets the cargo number
+ byte new_subtype = GB(p2, 8, 8);
if (!IsVehicleIndex(p1)) return CMD_ERROR;
@@ -1061,7 +1063,10 @@ int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
v->cargo_count = 0;
v->cargo_type = new_cid;
+ v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+ InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+ RebuildVehicleLists();
}
return cost;