comparison src/roadveh_cmd.cpp @ 8302:56a9dfa21fe7 draft

(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
author rubidium <rubidium@openttd.org>
date Tue, 15 Jan 2008 18:44:22 +0000
parents 5613b863190d
children 7ce2445db70c
comparison
equal deleted inserted replaced
8301:c1ae8f75ad7f 8302:56a9dfa21fe7
477 477
478 if (v->IsInDepot()) return CMD_ERROR; 478 if (v->IsInDepot()) return CMD_ERROR;
479 479
480 /* If the current orders are already goto-depot */ 480 /* If the current orders are already goto-depot */
481 if (v->current_order.type == OT_GOTO_DEPOT) { 481 if (v->current_order.type == OT_GOTO_DEPOT) {
482 if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) { 482 if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
483 /* We called with a different DEPOT_SERVICE setting. 483 /* We called with a different DEPOT_SERVICE setting.
484 * Now we change the setting to apply the new one and let the vehicle head for the same depot. 484 * Now we change the setting to apply the new one and let the vehicle head for the same depot.
485 * Note: the if is (true for requesting service == true for ordered to stop in depot) */ 485 * Note: the if is (true for requesting service == true for ordered to stop in depot) */
486 if (flags & DC_EXEC) { 486 if (flags & DC_EXEC) {
487 ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS); 487 ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
488 ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT); 488 ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
489 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); 489 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
490 } 490 }
491 return CommandCost(); 491 return CommandCost();
492 } 492 }
493 493
494 if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders 494 if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
495 if (flags & DC_EXEC) { 495 if (flags & DC_EXEC) {
496 /* If the orders to 'goto depot' are in the orders list (forced servicing), 496 /* If the orders to 'goto depot' are in the orders list (forced servicing),
497 * then skip to the next order; effectively cancelling this forced service */ 497 * then skip to the next order; effectively cancelling this forced service */
498 if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) 498 if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
499 v->cur_order_index++; 499 v->cur_order_index++;
500 500
501 v->current_order.type = OT_DUMMY; 501 v->current_order.type = OT_DUMMY;
502 v->current_order.flags = 0; 502 v->current_order.flags = 0;
503 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); 503 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
511 if (flags & DC_EXEC) { 511 if (flags & DC_EXEC) {
512 if (v->current_order.type == OT_LOADING) v->LeaveStation(); 512 if (v->current_order.type == OT_LOADING) v->LeaveStation();
513 513
514 ClearSlot(v); 514 ClearSlot(v);
515 v->current_order.type = OT_GOTO_DEPOT; 515 v->current_order.type = OT_GOTO_DEPOT;
516 v->current_order.flags = OF_NON_STOP; 516 v->current_order.flags = OFB_NON_STOP;
517 if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT); 517 if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
518 v->current_order.refit_cargo = CT_INVALID; 518 v->current_order.refit_cargo = CT_INVALID;
519 v->current_order.dest = dep->index; 519 v->current_order.dest = dep->index;
520 v->dest_tile = dep->xy; 520 v->dest_tile = dep->xy;
521 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); 521 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
522 } 522 }
762 const Order *order; 762 const Order *order;
763 763
764 switch (v->current_order.type) { 764 switch (v->current_order.type) {
765 case OT_GOTO_DEPOT: 765 case OT_GOTO_DEPOT:
766 /* Let a depot order in the orderlist interrupt. */ 766 /* Let a depot order in the orderlist interrupt. */
767 if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return; 767 if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
768 if (v->current_order.flags & OF_SERVICE_IF_NEEDED && 768 if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
769 !VehicleNeedsService(v)) { 769 !VehicleNeedsService(v)) {
770 UpdateVehicleTimetable(v, true); 770 UpdateVehicleTimetable(v, true);
771 v->cur_order_index++; 771 v->cur_order_index++;
772 } 772 }
773 break; 773 break;
1988 } 1988 }
1989 return; 1989 return;
1990 } 1990 }
1991 1991
1992 if (v->current_order.type == OT_GOTO_DEPOT && 1992 if (v->current_order.type == OT_GOTO_DEPOT &&
1993 v->current_order.flags & OF_NON_STOP && 1993 v->current_order.flags & OFB_NON_STOP &&
1994 !Chance16(1, 20)) { 1994 !Chance16(1, 20)) {
1995 return; 1995 return;
1996 } 1996 }
1997 1997
1998 if (v->current_order.type == OT_LOADING) v->LeaveStation(); 1998 if (v->current_order.type == OT_LOADING) v->LeaveStation();
1999 ClearSlot(v); 1999 ClearSlot(v);
2000 2000
2001 v->current_order.type = OT_GOTO_DEPOT; 2001 v->current_order.type = OT_GOTO_DEPOT;
2002 v->current_order.flags = OF_NON_STOP; 2002 v->current_order.flags = OFB_NON_STOP;
2003 v->current_order.dest = depot->index; 2003 v->current_order.dest = depot->index;
2004 v->dest_tile = depot->xy; 2004 v->dest_tile = depot->xy;
2005 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); 2005 InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
2006 } 2006 }
2007 2007