diff options
author | rubidium <rubidium@openttd.org> | 2007-06-04 19:32:45 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-04 19:32:45 +0000 |
commit | ad747e3026a3f137f6f06d3e1a6b07a2de503729 (patch) | |
tree | 23a952e411aa1977dbeed8415c8221c18598db03 /src/order_cmd.cpp | |
parent | a816369802a160cfbccbb966a8a402aad350cd73 (diff) | |
download | openttd-ad747e3026a3f137f6f06d3e1a6b07a2de503729.tar.xz |
(svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r-- | src/order_cmd.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index c7d4f7ab7..e6c0f3c84 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -557,29 +557,27 @@ int32 CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) return 0; } -/** Goto next order of order-list. +/** Goto order of order-list. * @param tile unused * @param flags operation to perform * @param p1 The ID of the vehicle which order is skipped - * @param p2 unused + * @param p2 the selected order to which we want to skip */ -int32 CmdSkipOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) +int32 CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) { Vehicle *v; VehicleID veh_id = p1; + VehicleOrderID sel_ord = p2; if (!IsValidVehicleID(veh_id)) return CMD_ERROR; v = GetVehicle(veh_id); - if (!CheckOwnership(v->owner)) return CMD_ERROR; + if (!CheckOwnership(v->owner) || sel_ord == v->cur_order_index || + sel_ord >= v->num_orders || v->num_orders < 2) return CMD_ERROR; if (flags & DC_EXEC) { - /* Goto next order */ - VehicleOrderID b = v->cur_order_index + 1; - if (b >= v->num_orders) b = 0; - - v->cur_order_index = b; + v->cur_order_index = sel_ord; if (v->type == VEH_ROAD) ClearSlot(v); |