(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.

This commit is contained in:
rubidium 2008-01-15 18:44:22 +00:00
parent ab7cb0804d
commit 576f8ad93e
16 changed files with 144 additions and 144 deletions

View File

@ -2516,9 +2516,9 @@ handle_nocash:
order.flags = 0; order.flags = 0;
order.dest = AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule); order.dest = AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule);
if (!is_pass && i == 1) order.flags |= OF_UNLOAD; if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0)) if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OF_FULL_LOAD; order.flags |= OFB_FULL_LOAD;
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
} }
@ -3258,9 +3258,9 @@ static void AiStateBuildRoadVehicles(Player *p)
order.flags = 0; order.flags = 0;
order.dest = AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule); order.dest = AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule);
if (!is_pass && i == 1) order.flags |= OF_UNLOAD; if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0)) if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OF_FULL_LOAD; order.flags |= OFB_FULL_LOAD;
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
} }
@ -3526,9 +3526,9 @@ static void AiStateBuildAircraftVehicles(Player *p)
order.flags = 0; order.flags = 0;
order.dest = AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule); order.dest = AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule);
if (!is_pass && i == 1) order.flags |= OF_UNLOAD; if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0)) if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OF_FULL_LOAD; order.flags |= OFB_FULL_LOAD;
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
} }

View File

@ -1187,7 +1187,7 @@ static void AiNew_State_GiveOrders(Player *p)
if (_patches.gotodepot) { if (_patches.gotodepot) {
idx = 0; idx = 0;
order.type = OT_GOTO_DEPOT; order.type = OT_GOTO_DEPOT;
order.flags = OF_UNLOAD; order.flags = OFB_UNLOAD;
order.dest = GetDepotByTile(_players_ainew[p->index].depot_tile)->index; order.dest = GetDepotByTile(_players_ainew[p->index].depot_tile)->index;
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
} }
@ -1197,7 +1197,7 @@ static void AiNew_State_GiveOrders(Player *p)
order.flags = 0; order.flags = 0;
order.dest = GetStationIndex(_players_ainew[p->index].to_tile); order.dest = GetStationIndex(_players_ainew[p->index].to_tile);
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver) if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver)
order.flags |= OF_FULL_LOAD; order.flags |= OFB_FULL_LOAD;
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
idx = 0; idx = 0;
@ -1205,7 +1205,7 @@ static void AiNew_State_GiveOrders(Player *p)
order.flags = 0; order.flags = 0;
order.dest = GetStationIndex(_players_ainew[p->index].from_tile); order.dest = GetStationIndex(_players_ainew[p->index].from_tile);
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver) if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver)
order.flags |= OF_FULL_LOAD; order.flags |= OFB_FULL_LOAD;
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER); AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
// Start the engines! // Start the engines!

View File

@ -569,13 +569,13 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR; if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) { if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) { if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting. /* 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. * 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) */ * Note: the if is (true for requesting service == true for ordered to stop in hangar) */
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} }
return CommandCost(); return CommandCost();
@ -583,7 +583,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++; if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++;
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@ -606,8 +606,8 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (v->current_order.type == OT_LOADING) v->LeaveStation(); if (v->current_order.type == OT_LOADING) v->LeaveStation();
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = next_airport_index; v->current_order.dest = next_airport_index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@ -714,7 +714,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index); // printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
// v->u.air.targetairport = st->index; // v->u.air.targetairport = st->index;
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} else if (v->current_order.type == OT_GOTO_DEPOT) { } else if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
@ -1347,8 +1347,8 @@ static void ProcessAircraftOrder(Vehicle *v)
{ {
switch (v->current_order.type) { switch (v->current_order.type) {
case OT_GOTO_DEPOT: case OT_GOTO_DEPOT:
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return; if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
if (v->current_order.flags & OF_SERVICE_IF_NEEDED && if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
!VehicleNeedsService(v)) { !VehicleNeedsService(v)) {
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
v->cur_order_index++; v->cur_order_index++;

View File

@ -1475,7 +1475,7 @@ void VehiclePayment(Vehicle *front_v)
if (!cp->paid_for && if (!cp->paid_for &&
cp->source != last_visited && cp->source != last_visited &&
HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
(front_v->current_order.flags & OF_TRANSFER) == 0) { (front_v->current_order.flags & OFB_TRANSFER) == 0) {
/* Deliver goods to the station */ /* Deliver goods to the station */
st->time_since_unload = 0; st->time_since_unload = 0;
@ -1488,8 +1488,8 @@ void VehiclePayment(Vehicle *front_v)
result |= 1; result |= 1;
SetBit(v->vehicle_flags, VF_CARGO_UNLOADING); SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
} else if (front_v->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) { } else if (front_v->current_order.flags & (OFB_UNLOAD | OFB_TRANSFER)) {
if (!cp->paid_for && (front_v->current_order.flags & OF_TRANSFER) != 0) { if (!cp->paid_for && (front_v->current_order.flags & OFB_TRANSFER) != 0) {
Money profit = GetTransportedGoodsIncome( Money profit = GetTransportedGoodsIncome(
cp->count, cp->count,
/* pay transfer vehicle for only the part of transfer it has done: ie. cargo_loaded_at_xy to here */ /* pay transfer vehicle for only the part of transfer it has done: ie. cargo_loaded_at_xy to here */
@ -1542,7 +1542,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* We have not waited enough time till the next round of loading/unloading */ /* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) { if (--v->load_unload_time_rem != 0) {
if (_patches.improved_load && HasBit(v->current_order.flags, OFB_FULL_LOAD)) { if (_patches.improved_load && HasBit(v->current_order.flags, OF_FULL_LOAD)) {
/* 'Reserve' this cargo for this vehicle, because we were first. */ /* 'Reserve' this cargo for this vehicle, because we were first. */
for (; v != NULL; v = v->Next()) { for (; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count(); if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@ -1590,12 +1590,12 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count; uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here? bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OF_TRANSFER)) { if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OFB_TRANSFER)) {
/* The cargo has reached it's final destination, the packets may now be destroyed */ /* The cargo has reached it's final destination, the packets may now be destroyed */
remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited); remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
result |= 1; result |= 1;
} else if (u->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) { } else if (u->current_order.flags & (OFB_UNLOAD | OFB_TRANSFER)) {
remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded); remaining = v->cargo.MoveTo(&ge->cargo, amount_unloaded);
SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP); SetBit(ge->acceptance_pickup, GoodsEntry::PICKUP);
@ -1624,7 +1624,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
} }
/* Do not pick up goods that we unloaded */ /* Do not pick up goods that we unloaded */
if (u->current_order.flags & OF_UNLOAD) continue; if (u->current_order.flags & OFB_UNLOAD) continue;
/* update stats */ /* update stats */
int t; int t;
@ -1696,7 +1696,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
* all wagons at the same time instead of using the same 'improved' * all wagons at the same time instead of using the same 'improved'
* loading algorithm for the wagons (only fill wagon when there is * loading algorithm for the wagons (only fill wagon when there is
* enough to fill the previous wagons) */ * enough to fill the previous wagons) */
if (_patches.improved_load && HasBit(u->current_order.flags, OFB_FULL_LOAD)) { if (_patches.improved_load && HasBit(u->current_order.flags, OF_FULL_LOAD)) {
/* Update left cargo */ /* Update left cargo */
for (v = u; v != NULL; v = v->Next()) { for (v = u; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count(); if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@ -1715,7 +1715,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
} }
} else { } else {
bool finished_loading = true; bool finished_loading = true;
if (HasBit(v->current_order.flags, OFB_FULL_LOAD)) { if (HasBit(v->current_order.flags, OF_FULL_LOAD)) {
if (_patches.full_load_any) { if (_patches.full_load_any) {
/* if the aircraft carries passengers and is NOT full, then /* if the aircraft carries passengers and is NOT full, then
* continue loading, no matter how much mail is in */ * continue loading, no matter how much mail is in */

View File

@ -1951,13 +1951,13 @@ int WhoCanServiceIndustry(Industry* ind)
*/ */
const Order *o; const Order *o;
FOR_VEHICLE_ORDERS(v, o) { FOR_VEHICLE_ORDERS(v, o) {
if (o->type == OT_GOTO_STATION && !HasBit(o->flags, OFB_TRANSFER)) { if (o->type == OT_GOTO_STATION && !HasBit(o->flags, OF_TRANSFER)) {
/* Vehicle visits a station to load or unload */ /* Vehicle visits a station to load or unload */
Station *st = GetStation(o->dest); Station *st = GetStation(o->dest);
if (!st->IsValid()) continue; if (!st->IsValid()) continue;
/* Same cargo produced by industry is dropped here => not serviced by vehicle v */ /* Same cargo produced by industry is dropped here => not serviced by vehicle v */
if (HasBit(o->flags, OFB_UNLOAD) && !c_accepts) break; if (HasBit(o->flags, OF_UNLOAD) && !c_accepts) break;
if (stations.find(st) != stations.end()) { if (stations.find(st) != stations.end()) {
if (v->owner == _local_player) return 2; // Player services industry if (v->owner == _local_player) return 2; // Player services industry

View File

@ -37,32 +37,32 @@ template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BE
typedef TinyEnumT<OrderType> OrderTypeByte; typedef TinyEnumT<OrderType> OrderTypeByte;
/* Order flags -- please use OFB instead OF and use HASBIT/SETBIT/CLEARBIT */ /* Order flags -- please use OF instead OF and use HASBIT/SETBIT/CLEARBIT */
/** Order flag masks - these are for direct bit operations */ /** Order flag masks - these are for direct bit operations */
enum OrderFlagMasks { enum OrderFlagMasks {
//Flags for stations: //Flags for stations:
/** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */ /** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */
OF_TRANSFER = 0x1, OFB_TRANSFER = 0x1,
/** If OF_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station. /** If OFB_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station.
* No new cargo is loaded onto the vehicle whatsoever */ * No new cargo is loaded onto the vehicle whatsoever */
OF_UNLOAD = 0x2, OFB_UNLOAD = 0x2,
/** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting /** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting
* @todo make this two different flags */ * @todo make this two different flags */
OF_FULL_LOAD = 0x4, OFB_FULL_LOAD = 0x4,
//Flags for depots: //Flags for depots:
/** The current depot-order was initiated because it was in the vehicle's order list */ /** The current depot-order was initiated because it was in the vehicle's order list */
OF_PART_OF_ORDERS = 0x2, OFB_PART_OF_ORDERS = 0x2,
/** if OF_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */ /** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
OF_HALT_IN_DEPOT = 0x4, OFB_HALT_IN_DEPOT = 0x4,
/** if OF_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */ /** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
OF_SERVICE_IF_NEEDED = 0x4, //used when OF_PART_OF_ORDERS is set. OFB_SERVICE_IF_NEEDED = 0x4, //used when OFB_PART_OF_ORDERS is set.
//Common flags //Common flags
/** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings) /** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings)
* @todo make this two different flags */ * @todo make this two different flags */
OF_NON_STOP = 0x8 OFB_NON_STOP = 0x8
}; };
/** Order flags bits - these are for the *BIT macros /** Order flags bits - these are for the *BIT macros
@ -70,13 +70,13 @@ enum OrderFlagMasks {
* @see OrderFlagMasks * @see OrderFlagMasks
*/ */
enum { enum {
OFB_TRANSFER = 0, OF_TRANSFER = 0,
OFB_UNLOAD = 1, OF_UNLOAD = 1,
OFB_FULL_LOAD = 2, OF_FULL_LOAD = 2,
OFB_PART_OF_ORDERS = 1, OF_PART_OF_ORDERS = 1,
OFB_HALT_IN_DEPOT = 2, OF_HALT_IN_DEPOT = 2,
OFB_SERVICE_IF_NEEDED = 2, OF_SERVICE_IF_NEEDED = 2,
OFB_NON_STOP = 3 OF_NON_STOP = 3
}; };

View File

@ -219,19 +219,19 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* non-stop orders (if any) are only valid for trains */ * non-stop orders (if any) are only valid for trains */
switch (new_order.flags) { switch (new_order.flags) {
case 0: case 0:
case OF_FULL_LOAD: case OFB_FULL_LOAD:
case OF_FULL_LOAD | OF_TRANSFER: case OFB_FULL_LOAD | OFB_TRANSFER:
case OF_UNLOAD: case OFB_UNLOAD:
case OF_UNLOAD | OF_TRANSFER: case OFB_UNLOAD | OFB_TRANSFER:
case OF_TRANSFER: case OFB_TRANSFER:
break; break;
case OF_NON_STOP: case OFB_NON_STOP:
case OF_NON_STOP | OF_FULL_LOAD: case OFB_NON_STOP | OFB_FULL_LOAD:
case OF_NON_STOP | OF_FULL_LOAD | OF_TRANSFER: case OFB_NON_STOP | OFB_FULL_LOAD | OFB_TRANSFER:
case OF_NON_STOP | OF_UNLOAD: case OFB_NON_STOP | OFB_UNLOAD:
case OF_NON_STOP | OF_UNLOAD | OF_TRANSFER: case OFB_NON_STOP | OFB_UNLOAD | OFB_TRANSFER:
case OF_NON_STOP | OF_TRANSFER: case OFB_NON_STOP | OFB_TRANSFER:
if (v->type != VEH_TRAIN) return CMD_ERROR; if (v->type != VEH_TRAIN) return CMD_ERROR;
break; break;
@ -282,12 +282,12 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* order [+ halt] [+ non-stop] * order [+ halt] [+ non-stop]
* non-stop orders (if any) are only valid for trains */ * non-stop orders (if any) are only valid for trains */
switch (new_order.flags) { switch (new_order.flags) {
case OF_PART_OF_ORDERS: case OFB_PART_OF_ORDERS:
case OF_PART_OF_ORDERS | OF_HALT_IN_DEPOT: case OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
break; break;
case OF_NON_STOP | OF_PART_OF_ORDERS: case OFB_NON_STOP | OFB_PART_OF_ORDERS:
case OF_NON_STOP | OF_PART_OF_ORDERS | OF_HALT_IN_DEPOT: case OFB_NON_STOP | OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
if (v->type != VEH_TRAIN) return CMD_ERROR; if (v->type != VEH_TRAIN) return CMD_ERROR;
break; break;
@ -312,7 +312,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
switch (new_order.flags) { switch (new_order.flags) {
case 0: break; case 0: break;
case OF_NON_STOP: case OFB_NON_STOP:
if (v->type != VEH_TRAIN) return CMD_ERROR; if (v->type != VEH_TRAIN) return CMD_ERROR;
break; break;
@ -514,7 +514,7 @@ CommandCost CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* NON-stop flag is misused to see if a train is in a station that is /* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */ * on his order list or not */
if (sel_ord == u->cur_order_index && u->current_order.type == OT_LOADING && if (sel_ord == u->cur_order_index && u->current_order.type == OT_LOADING &&
HasBit(u->current_order.flags, OFB_NON_STOP)) { HasBit(u->current_order.flags, OF_NON_STOP)) {
u->current_order.flags = 0; u->current_order.flags = 0;
} }
@ -556,7 +556,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->LeaveStation(); v->LeaveStation();
/* NON-stop flag is misused to see if a train is in a station that is /* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */ * on his order list or not */
if (HasBit(v->current_order.flags, OFB_NON_STOP)) v->current_order.flags = 0; if (HasBit(v->current_order.flags, OF_NON_STOP)) v->current_order.flags = 0;
} }
InvalidateVehicleOrder(v); InvalidateVehicleOrder(v);
@ -673,7 +673,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
VehicleID veh = GB(p1, 0, 16); VehicleID veh = GB(p1, 0, 16);
if (!IsValidVehicleID(veh)) return CMD_ERROR; if (!IsValidVehicleID(veh)) return CMD_ERROR;
if (p2 != OFB_FULL_LOAD && p2 != OFB_UNLOAD && p2 != OFB_NON_STOP && p2 != OFB_TRANSFER) return CMD_ERROR; if (p2 != OF_FULL_LOAD && p2 != OF_UNLOAD && p2 != OF_NON_STOP && p2 != OF_TRANSFER) return CMD_ERROR;
v = GetVehicle(veh); v = GetVehicle(veh);
@ -684,26 +684,26 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
order = GetVehicleOrder(v, sel_ord); order = GetVehicleOrder(v, sel_ord);
if ((order->type != OT_GOTO_STATION || GetStation(order->dest)->IsBuoy()) && if ((order->type != OT_GOTO_STATION || GetStation(order->dest)->IsBuoy()) &&
(order->type != OT_GOTO_DEPOT || p2 == OFB_UNLOAD) && (order->type != OT_GOTO_DEPOT || p2 == OF_UNLOAD) &&
(order->type != OT_GOTO_WAYPOINT || p2 != OFB_NON_STOP)) { (order->type != OT_GOTO_WAYPOINT || p2 != OF_NON_STOP)) {
return CMD_ERROR; return CMD_ERROR;
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
switch (p2) { switch (p2) {
case OFB_FULL_LOAD: case OF_FULL_LOAD:
ToggleBit(order->flags, OFB_FULL_LOAD); ToggleBit(order->flags, OF_FULL_LOAD);
if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OFB_UNLOAD); if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OF_UNLOAD);
break; break;
case OFB_UNLOAD: case OF_UNLOAD:
ToggleBit(order->flags, OFB_UNLOAD); ToggleBit(order->flags, OF_UNLOAD);
ClrBit(order->flags, OFB_FULL_LOAD); ClrBit(order->flags, OF_FULL_LOAD);
break; break;
case OFB_NON_STOP: case OF_NON_STOP:
ToggleBit(order->flags, OFB_NON_STOP); ToggleBit(order->flags, OF_NON_STOP);
break; break;
case OFB_TRANSFER: case OF_TRANSFER:
ToggleBit(order->flags, OFB_TRANSFER); ToggleBit(order->flags, OF_TRANSFER);
break; break;
default: NOT_REACHED(); default: NOT_REACHED();
} }
@ -726,8 +726,8 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
*/ */
if (sel_ord == u->cur_order_index && if (sel_ord == u->cur_order_index &&
u->current_order.type != OT_GOTO_DEPOT && u->current_order.type != OT_GOTO_DEPOT &&
HasBit(u->current_order.flags, OFB_FULL_LOAD) != HasBit(order->flags, OFB_FULL_LOAD)) { HasBit(u->current_order.flags, OF_FULL_LOAD) != HasBit(order->flags, OF_FULL_LOAD)) {
ToggleBit(u->current_order.flags, OFB_FULL_LOAD); ToggleBit(u->current_order.flags, OF_FULL_LOAD);
} }
InvalidateVehicleOrder(u); InvalidateVehicleOrder(u);
} }
@ -909,7 +909,7 @@ CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(u); InvalidateVehicleOrder(u);
/* If the vehicle already got the current depot set as current order, then update current order as well */ /* If the vehicle already got the current depot set as current order, then update current order as well */
if (u->cur_order_index == order_number && HasBit(u->current_order.flags, OFB_PART_OF_ORDERS)) { if (u->cur_order_index == order_number && HasBit(u->current_order.flags, OF_PART_OF_ORDERS)) {
u->current_order.refit_cargo = cargo; u->current_order.refit_cargo = cargo;
u->current_order.refit_subtype = subtype; u->current_order.refit_subtype = subtype;
} }

View File

@ -215,14 +215,14 @@ static void DrawOrdersWindow(Window *w)
SetDParam(2, GetDepot(order->dest)->town_index); SetDParam(2, GetDepot(order->dest)->town_index);
switch (v->type) { switch (v->type) {
case VEH_TRAIN: s = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break; case VEH_TRAIN: s = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
case VEH_ROAD: s = STR_9038_GO_TO_ROADVEH_DEPOT; break; case VEH_ROAD: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
case VEH_SHIP: s = STR_GO_TO_SHIP_DEPOT; break; case VEH_SHIP: s = STR_GO_TO_SHIP_DEPOT; break;
default: break; default: break;
} }
} }
if (order->flags & OF_FULL_LOAD) s++; /* service at */ if (order->flags & OFB_FULL_LOAD) s++; /* service at */
SetDParam(1, s); SetDParam(1, s);
if (order->refit_cargo < NUM_CARGO) { if (order->refit_cargo < NUM_CARGO) {
@ -235,7 +235,7 @@ static void DrawOrdersWindow(Window *w)
} }
case OT_GOTO_WAYPOINT: case OT_GOTO_WAYPOINT:
SetDParam(1, (order->flags & OF_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT); SetDParam(1, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
SetDParam(2, order->dest); SetDParam(2, order->dest);
break; break;
@ -273,7 +273,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) { if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
if (IsRailDepot(tile)) { if (IsRailDepot(tile)) {
order.type = OT_GOTO_DEPOT; order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS; order.flags = OFB_PART_OF_ORDERS;
order.dest = GetDepotByTile(tile)->index; order.dest = GetDepotByTile(tile)->index;
return order; return order;
} }
@ -283,7 +283,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_ROAD: case MP_ROAD:
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) { if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
order.type = OT_GOTO_DEPOT; order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS; order.flags = OFB_PART_OF_ORDERS;
order.dest = GetDepotByTile(tile)->index; order.dest = GetDepotByTile(tile)->index;
return order; return order;
} }
@ -293,7 +293,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (v->type != VEH_AIRCRAFT) break; if (v->type != VEH_AIRCRAFT) break;
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) { if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
order.type = OT_GOTO_DEPOT; order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS; order.flags = OFB_PART_OF_ORDERS;
order.dest = GetStationIndex(tile); order.dest = GetStationIndex(tile);
return order; return order;
} }
@ -306,7 +306,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
TileIndex tile2 = GetOtherShipDepotTile(tile); TileIndex tile2 = GetOtherShipDepotTile(tile);
order.type = OT_GOTO_DEPOT; order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS; order.flags = OFB_PART_OF_ORDERS;
order.dest = GetDepotByTile(tile < tile2 ? tile : tile2)->index; order.dest = GetDepotByTile(tile < tile2 ? tile : tile2)->index;
return order; return order;
} }
@ -419,7 +419,7 @@ static void OrderClick_Goto(Window *w, const Vehicle *v)
*/ */
static void OrderClick_FullLoad(Window *w, const Vehicle *v) static void OrderClick_FullLoad(Window *w, const Vehicle *v)
{ {
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
} }
/** /**
@ -430,7 +430,7 @@ static void OrderClick_FullLoad(Window *w, const Vehicle *v)
*/ */
static void OrderClick_Unload(Window *w, const Vehicle *v) static void OrderClick_Unload(Window *w, const Vehicle *v)
{ {
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_UNLOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_UNLOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
} }
/** /**
@ -441,7 +441,7 @@ static void OrderClick_Unload(Window *w, const Vehicle *v)
*/ */
static void OrderClick_Nonstop(Window *w, const Vehicle *v) static void OrderClick_Nonstop(Window *w, const Vehicle *v)
{ {
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
} }
/** /**
@ -452,7 +452,7 @@ static void OrderClick_Nonstop(Window *w, const Vehicle *v)
*/ */
static void OrderClick_Transfer(Window* w, const Vehicle* v) static void OrderClick_Transfer(Window* w, const Vehicle* v)
{ {
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OFB_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
} }
/** /**

View File

@ -479,13 +479,13 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
/* If the current orders are already goto-depot */ /* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) { if (v->current_order.type == OT_GOTO_DEPOT) {
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) { if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting. /* 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. * 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) */ * Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} }
return CommandCost(); return CommandCost();
@ -495,7 +495,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing), /* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */ * then skip to the next order; effectively cancelling this forced service */
if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
v->cur_order_index++; v->cur_order_index++;
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
@ -513,8 +513,8 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
ClearSlot(v); ClearSlot(v);
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = dep->index; v->current_order.dest = dep->index;
v->dest_tile = dep->xy; v->dest_tile = dep->xy;
@ -764,8 +764,8 @@ static void ProcessRoadVehOrder(Vehicle *v)
switch (v->current_order.type) { switch (v->current_order.type) {
case OT_GOTO_DEPOT: case OT_GOTO_DEPOT:
/* Let a depot order in the orderlist interrupt. */ /* Let a depot order in the orderlist interrupt. */
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return; if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
if (v->current_order.flags & OF_SERVICE_IF_NEEDED && if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
!VehicleNeedsService(v)) { !VehicleNeedsService(v)) {
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
v->cur_order_index++; v->cur_order_index++;
@ -1990,7 +1990,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
} }
if (v->current_order.type == OT_GOTO_DEPOT && if (v->current_order.type == OT_GOTO_DEPOT &&
v->current_order.flags & OF_NON_STOP && v->current_order.flags & OFB_NON_STOP &&
!Chance16(1, 20)) { !Chance16(1, 20)) {
return; return;
} }
@ -1999,7 +1999,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
ClearSlot(v); ClearSlot(v);
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
v->current_order.dest = depot->index; v->current_order.dest = depot->index;
v->dest_tile = depot->xy; v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);

View File

@ -164,7 +164,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
} }
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
v->current_order.dest = depot->index; v->current_order.dest = depot->index;
v->dest_tile = depot->xy; v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@ -250,8 +250,8 @@ static void ProcessShipOrder(Vehicle *v)
switch (v->current_order.type) { switch (v->current_order.type) {
case OT_GOTO_DEPOT: case OT_GOTO_DEPOT:
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return; if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
if (v->current_order.flags & OF_SERVICE_IF_NEEDED && if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
!VehicleNeedsService(v)) { !VehicleNeedsService(v)) {
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
v->cur_order_index++; v->cur_order_index++;
@ -1000,13 +1000,13 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
/* If the current orders are already goto-depot */ /* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) { if (v->current_order.type == OT_GOTO_DEPOT) {
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) { if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting. /* 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. * 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) */ * Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} }
return CommandCost(); return CommandCost();
@ -1016,7 +1016,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing), /* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */ * then skip to the next order; effectively cancelling this forced service */
if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
v->cur_order_index++; v->cur_order_index++;
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
@ -1034,8 +1034,8 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
v->dest_tile = dep->xy; v->dest_tile = dep->xy;
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = dep->index; v->current_order.dest = dep->index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);

View File

@ -2354,9 +2354,9 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) { !IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
StationID station_id = GetStationIndex(tile); StationID station_id = GetStationIndex(tile);
if ((!(v->current_order.flags & OF_NON_STOP) && !_patches.new_nonstop) || if ((!(v->current_order.flags & OFB_NON_STOP) && !_patches.new_nonstop) ||
(v->current_order.type == OT_GOTO_STATION && v->current_order.dest == station_id)) { (v->current_order.type == OT_GOTO_STATION && v->current_order.dest == station_id)) {
if (!(_patches.new_nonstop && v->current_order.flags & OF_NON_STOP) && if (!(_patches.new_nonstop && v->current_order.flags & OFB_NON_STOP) &&
v->current_order.type != OT_LEAVESTATION && v->current_order.type != OT_LEAVESTATION &&
v->last_station_visited != station_id) { v->last_station_visited != station_id) {
DiagDirection dir = DirToDiagDir(v->direction); DiagDirection dir = DirToDiagDir(v->direction);

View File

@ -24,7 +24,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
order->wait_time = time; order->wait_time = time;
} }
if (v->cur_order_index == order_number && HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) { if (v->cur_order_index == order_number && HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
if (is_journey) { if (is_journey) {
v->current_order.travel_time = time; v->current_order.travel_time = time;
} else { } else {
@ -65,7 +65,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
bool is_journey = HasBit(p1, 24); bool is_journey = HasBit(p1, 24);
if (!is_journey) { if (!is_journey) {
if (order->type != OT_GOTO_STATION) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS); if (order->type != OT_GOTO_STATION) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
if (_patches.new_nonstop && (order->flags & OF_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE); if (_patches.new_nonstop && (order->flags & OFB_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {

View File

@ -64,7 +64,7 @@ static void DrawTimetableWindow(Window *w)
w->EnableWidget(7); w->EnableWidget(7);
} else { } else {
const Order *order = GetVehicleOrder(v, (selected + 1) / 2); const Order *order = GetVehicleOrder(v, (selected + 1) / 2);
bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OF_NON_STOP)); bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OFB_NON_STOP));
w->SetWidgetDisabledState(6, disable); w->SetWidgetDisabledState(6, disable);
w->SetWidgetDisabledState(7, disable); w->SetWidgetDisabledState(7, disable);
@ -104,7 +104,7 @@ static void DrawTimetableWindow(Window *w)
break; break;
case OT_GOTO_STATION: case OT_GOTO_STATION:
SetDParam(0, (order->flags & OF_NON_STOP) ? STR_880C_GO_NON_STOP_TO : STR_8806_GO_TO); SetDParam(0, (order->flags & OFB_NON_STOP) ? STR_880C_GO_NON_STOP_TO : STR_8806_GO_TO);
SetDParam(1, order->dest); SetDParam(1, order->dest);
if (order->wait_time > 0) { if (order->wait_time > 0) {
@ -124,20 +124,20 @@ static void DrawTimetableWindow(Window *w)
SetDParam(1, GetDepot(order->dest)->town_index); SetDParam(1, GetDepot(order->dest)->town_index);
switch (v->type) { switch (v->type) {
case VEH_TRAIN: string = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break; case VEH_TRAIN: string = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
case VEH_ROAD: string = STR_9038_GO_TO_ROADVEH_DEPOT; break; case VEH_ROAD: string = STR_9038_GO_TO_ROADVEH_DEPOT; break;
case VEH_SHIP: string = STR_GO_TO_SHIP_DEPOT; break; case VEH_SHIP: string = STR_GO_TO_SHIP_DEPOT; break;
default: break; default: break;
} }
} }
if (order->flags & OF_FULL_LOAD) string++; // Service at orders if (order->flags & OFB_FULL_LOAD) string++; // Service at orders
SetDParam(0, string); SetDParam(0, string);
} break; } break;
case OT_GOTO_WAYPOINT: case OT_GOTO_WAYPOINT:
SetDParam(0, (order->flags & OF_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT); SetDParam(0, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
SetDParam(1, order->dest); SetDParam(1, order->dest);
break; break;
@ -182,7 +182,7 @@ static void DrawTimetableWindow(Window *w)
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) { for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
total_time += order->travel_time + order->wait_time; total_time += order->travel_time + order->wait_time;
if (order->travel_time == 0) complete = false; if (order->travel_time == 0) complete = false;
if (order->wait_time == 0 && order->type == OT_GOTO_STATION && !(_patches.new_nonstop && (order->flags & OF_NON_STOP))) complete = false; if (order->wait_time == 0 && order->type == OT_GOTO_STATION && !(_patches.new_nonstop && (order->flags & OFB_NON_STOP))) complete = false;
} }
if (total_time != 0) { if (total_time != 0) {

View File

@ -303,13 +303,13 @@ static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
/* When does a train drive through a station /* When does a train drive through a station
* first we deal with the "new nonstop handling" */ * first we deal with the "new nonstop handling" */
if (_patches.new_nonstop && o->flags & OF_NON_STOP && sid == o->dest) { if (_patches.new_nonstop && o->flags & OFB_NON_STOP && sid == o->dest) {
return false; return false;
} }
if (v->last_station_visited == sid) return false; if (v->last_station_visited == sid) return false;
if (sid != o->dest && (o->flags & OF_NON_STOP || _patches.new_nonstop)) { if (sid != o->dest && (o->flags & OFB_NON_STOP || _patches.new_nonstop)) {
return false; return false;
} }
@ -1993,13 +1993,13 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (v->vehstatus & VS_CRASHED) return CMD_ERROR; if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT) { if (v->current_order.type == OT_GOTO_DEPOT) {
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) { if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting. /* 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. * 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) */ * Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} }
return CommandCost(); return CommandCost();
@ -2007,7 +2007,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) { if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
v->cur_order_index++; v->cur_order_index++;
} }
@ -2030,8 +2030,8 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
v->dest_tile = tfdd.tile; v->dest_tile = tfdd.tile;
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.dest = GetDepotByTile(tfdd.tile)->index; v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@ -2481,8 +2481,8 @@ static bool ProcessTrainOrder(Vehicle *v)
{ {
switch (v->current_order.type) { switch (v->current_order.type) {
case OT_GOTO_DEPOT: case OT_GOTO_DEPOT:
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false; if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false;
if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) && if ((v->current_order.flags & OFB_SERVICE_IF_NEEDED) &&
!VehicleNeedsService(v)) { !VehicleNeedsService(v)) {
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
v->cur_order_index++; v->cur_order_index++;
@ -2513,7 +2513,7 @@ static bool ProcessTrainOrder(Vehicle *v)
/* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */ /* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
if (_patches.new_nonstop && if (_patches.new_nonstop &&
v->current_order.flags & OF_NON_STOP && v->current_order.flags & OFB_NON_STOP &&
IsTileType(v->tile, MP_STATION) && IsTileType(v->tile, MP_STATION) &&
v->current_order.dest == GetStationIndex(v->tile)) { v->current_order.dest == GetStationIndex(v->tile)) {
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
@ -3475,7 +3475,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
} }
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP; v->current_order.flags = OFB_NON_STOP;
v->current_order.dest = depot->index; v->current_order.dest = depot->index;
v->dest_tile = tfdd.tile; v->dest_tile = tfdd.tile;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);

View File

@ -104,10 +104,10 @@ void VehicleServiceInDepot(Vehicle *v)
bool VehicleNeedsService(const Vehicle *v) bool VehicleNeedsService(const Vehicle *v)
{ {
if (v->vehstatus & (VS_STOPPED | VS_CRASHED)) return false; if (v->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
if (v->current_order.type != OT_GOTO_DEPOT || !(v->current_order.flags & OF_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list if (v->current_order.type != OT_GOTO_DEPOT || !(v->current_order.flags & OFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return false; if (_patches.gotodepot && VehicleHasDepotOrders(v)) return false;
if (v->current_order.type == OT_LOADING) return false; if (v->current_order.type == OT_LOADING) return false;
if (v->current_order.type == OT_GOTO_DEPOT && v->current_order.flags & OF_HALT_IN_DEPOT) return false; if (v->current_order.type == OT_GOTO_DEPOT && v->current_order.flags & OFB_HALT_IN_DEPOT) return false;
} }
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) { if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
@ -615,7 +615,7 @@ static Vehicle* _first_veh_in_depot_list;
void VehicleEnteredDepotThisTick(Vehicle *v) void VehicleEnteredDepotThisTick(Vehicle *v)
{ {
/* we need to set v->leave_depot_instantly as we have no control of it's contents at this time */ /* we need to set v->leave_depot_instantly as we have no control of it's contents at this time */
if (HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OFB_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) { if (HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) {
/* we keep the vehicle in the depot since the user ordered it to stay */ /* we keep the vehicle in the depot since the user ordered it to stay */
v->leave_depot_instantly = false; v->leave_depot_instantly = false;
} else { } else {
@ -2156,7 +2156,7 @@ uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color)
max += v->cargo_cap; max += v->cargo_cap;
if (v->cargo_cap != 0) { if (v->cargo_cap != 0) {
unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0; unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
loading |= (u->current_order.flags & OF_UNLOAD) == 0 && st->goods[v->cargo_type].days_since_pickup != 255; loading |= (u->current_order.flags & OFB_UNLOAD) == 0 && st->goods[v->cargo_type].days_since_pickup != 255;
cars++; cars++;
} }
} }
@ -2242,11 +2242,11 @@ void VehicleEnterDepot(Vehicle *v)
} }
} }
if (HasBit(t.flags, OFB_PART_OF_ORDERS)) { if (HasBit(t.flags, OF_PART_OF_ORDERS)) {
/* Part of orders */ /* Part of orders */
UpdateVehicleTimetable(v, true); UpdateVehicleTimetable(v, true);
v->cur_order_index++; v->cur_order_index++;
} else if (HasBit(t.flags, OFB_HALT_IN_DEPOT)) { } else if (HasBit(t.flags, OF_HALT_IN_DEPOT)) {
/* Force depot visit */ /* Force depot visit */
v->vehstatus |= VS_STOPPED; v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) { if (v->owner == _local_player) {
@ -3095,14 +3095,14 @@ void Vehicle::BeginLoading()
this->current_order.dest == this->last_station_visited) { this->current_order.dest == this->last_station_visited) {
/* Arriving at the ordered station. /* Arriving at the ordered station.
* Keep the load/unload flags, as we (obviously) still need them. */ * Keep the load/unload flags, as we (obviously) still need them. */
this->current_order.flags &= OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER; this->current_order.flags &= OFB_FULL_LOAD | OFB_UNLOAD | OFB_TRANSFER;
/* Furthermore add the Non Stop flag to mark that this station /* Furthermore add the Non Stop flag to mark that this station
* is the actual destination of the vehicle, which is (for example) * is the actual destination of the vehicle, which is (for example)
* necessary to be known for HandleTrainLoading to determine * necessary to be known for HandleTrainLoading to determine
* whether the train is lost or not; not marking a train lost * whether the train is lost or not; not marking a train lost
* that arrives at random stations is bad. */ * that arrives at random stations is bad. */
this->current_order.flags |= OF_NON_STOP; this->current_order.flags |= OFB_NON_STOP;
UpdateVehicleTimetable(this, true); UpdateVehicleTimetable(this, true);
} else { } else {
/* This is just an unordered intermediate stop */ /* This is just an unordered intermediate stop */
@ -3128,7 +3128,7 @@ void Vehicle::LeaveStation()
assert(current_order.type == OT_LOADING); assert(current_order.type == OT_LOADING);
/* Only update the timetable if the vehicle was supposed to stop here. */ /* Only update the timetable if the vehicle was supposed to stop here. */
if (current_order.flags & OF_NON_STOP) UpdateVehicleTimetable(this, false); if (current_order.flags & OFB_NON_STOP) UpdateVehicleTimetable(this, false);
current_order.type = OT_LEAVESTATION; current_order.type = OT_LEAVESTATION;
current_order.flags = 0; current_order.flags = 0;
@ -3155,7 +3155,7 @@ void Vehicle::HandleLoading(bool mode)
this->LeaveStation(); this->LeaveStation();
/* If this was not the final order, don't remove it from the list. */ /* If this was not the final order, don't remove it from the list. */
if (!(b.flags & OF_NON_STOP)) return; if (!(b.flags & OFB_NON_STOP)) return;
break; break;
} }

View File

@ -1990,7 +1990,7 @@ static void DrawVehicleViewWindow(Window *w)
SetDParam(0, depot->town_index); SetDParam(0, depot->town_index);
SetDParam(1, v->GetDisplaySpeed()); SetDParam(1, v->GetDisplaySpeed());
} }
if (HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) { if (HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed; str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed;
} else { } else {
str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed; str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed;