summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-04 19:32:45 +0000
committerrubidium <rubidium@openttd.org>2007-06-04 19:32:45 +0000
commitc4806955e5961f0d16d137997b1baa003b81f408 (patch)
tree23a952e411aa1977dbeed8415c8221c18598db03 /src/order_cmd.cpp
parentcb340626cafacd29c41580141fb00d137891b6a5 (diff)
downloadopenttd-c4806955e5961f0d16d137997b1baa003b81f408.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.cpp16
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);