Mercurial > hg > openttd
changeset 4510:66e30c25ca37 draft
(svn r6295) -Feature: using goto depot with a different control selection will now alter the service/stopping in depot flag instead of cancelling the goto depot order
author | bjarni <bjarni@openttd.org> |
---|---|
date | Fri, 01 Sep 2006 12:37:03 +0000 |
parents | a363ea5b1b65 |
children | ab5d212aa7dd |
files | aircraft_cmd.c roadveh_cmd.c ship_cmd.c train_cmd.c |
diffstat | 4 files changed, 44 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -512,6 +512,17 @@ if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR; if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) { + if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_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 hangar. + * Note: the if is (true for requesting service == true for ordered to stop in hangar) */ + if (flags & DC_EXEC) { + TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); + InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); + } + return 0; + } + if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders if (flags & DC_EXEC) { if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
--- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -382,6 +382,17 @@ /* If the current orders are already goto-depot */ if (v->current_order.type == OT_GOTO_DEPOT) { + if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_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) */ + if (flags & DC_EXEC) { + TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); + InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); + } + return 0; + } + if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders if (flags & DC_EXEC) { /* If the orders to 'goto depot' are in the orders list (forced servicing),
--- a/ship_cmd.c +++ b/ship_cmd.c @@ -1020,6 +1020,17 @@ /* If the current orders are already goto-depot */ if (v->current_order.type == OT_GOTO_DEPOT) { + if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_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) */ + if (flags & DC_EXEC) { + TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); + InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); + } + return 0; + } + if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders if (flags & DC_EXEC) { /* If the orders to 'goto depot' are in the orders list (forced servicing),
--- a/train_cmd.c +++ b/train_cmd.c @@ -1948,6 +1948,17 @@ if (v->vehstatus & VS_CRASHED) return CMD_ERROR; if (v->current_order.type == OT_GOTO_DEPOT) { + if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_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) */ + if (flags & DC_EXEC) { + TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT); + InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); + } + return 0; + } + if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders if (flags & DC_EXEC) { if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) {