mirror of https://github.com/OpenTTD/OpenTTD.git
(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:
parent
ab7cb0804d
commit
576f8ad93e
|
@ -2516,9 +2516,9 @@ handle_nocash:
|
|||
order.flags = 0;
|
||||
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))
|
||||
order.flags |= OF_FULL_LOAD;
|
||||
order.flags |= OFB_FULL_LOAD;
|
||||
|
||||
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.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))
|
||||
order.flags |= OF_FULL_LOAD;
|
||||
order.flags |= OFB_FULL_LOAD;
|
||||
|
||||
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.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))
|
||||
order.flags |= OF_FULL_LOAD;
|
||||
order.flags |= OFB_FULL_LOAD;
|
||||
|
||||
DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||
}
|
||||
|
|
|
@ -1187,7 +1187,7 @@ static void AiNew_State_GiveOrders(Player *p)
|
|||
if (_patches.gotodepot) {
|
||||
idx = 0;
|
||||
order.type = OT_GOTO_DEPOT;
|
||||
order.flags = OF_UNLOAD;
|
||||
order.flags = OFB_UNLOAD;
|
||||
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);
|
||||
}
|
||||
|
@ -1197,7 +1197,7 @@ static void AiNew_State_GiveOrders(Player *p)
|
|||
order.flags = 0;
|
||||
order.dest = GetStationIndex(_players_ainew[p->index].to_tile);
|
||||
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);
|
||||
|
||||
idx = 0;
|
||||
|
@ -1205,7 +1205,7 @@ static void AiNew_State_GiveOrders(Player *p)
|
|||
order.flags = 0;
|
||||
order.dest = GetStationIndex(_players_ainew[p->index].from_tile);
|
||||
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);
|
||||
|
||||
// Start the engines!
|
||||
|
|
|
@ -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->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.
|
||||
* 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) {
|
||||
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
}
|
||||
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 (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.flags = 0;
|
||||
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();
|
||||
|
||||
v->current_order.type = OT_GOTO_DEPOT;
|
||||
v->current_order.flags = OF_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
v->current_order.flags = OFB_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
v->current_order.refit_cargo = CT_INVALID;
|
||||
v->current_order.dest = next_airport_index;
|
||||
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);
|
||||
// v->u.air.targetairport = st->index;
|
||||
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);
|
||||
} else if (v->current_order.type == OT_GOTO_DEPOT) {
|
||||
v->current_order.type = OT_DUMMY;
|
||||
|
@ -1347,8 +1347,8 @@ static void ProcessAircraftOrder(Vehicle *v)
|
|||
{
|
||||
switch (v->current_order.type) {
|
||||
case OT_GOTO_DEPOT:
|
||||
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
|
||||
if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
|
||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
|
||||
if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
|
||||
!VehicleNeedsService(v)) {
|
||||
UpdateVehicleTimetable(v, true);
|
||||
v->cur_order_index++;
|
||||
|
|
|
@ -1475,7 +1475,7 @@ void VehiclePayment(Vehicle *front_v)
|
|||
if (!cp->paid_for &&
|
||||
cp->source != last_visited &&
|
||||
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 */
|
||||
st->time_since_unload = 0;
|
||||
|
||||
|
@ -1488,8 +1488,8 @@ void VehiclePayment(Vehicle *front_v)
|
|||
result |= 1;
|
||||
|
||||
SetBit(v->vehicle_flags, VF_CARGO_UNLOADING);
|
||||
} else if (front_v->current_order.flags & (OF_UNLOAD | OF_TRANSFER)) {
|
||||
if (!cp->paid_for && (front_v->current_order.flags & OF_TRANSFER) != 0) {
|
||||
} else if (front_v->current_order.flags & (OFB_UNLOAD | OFB_TRANSFER)) {
|
||||
if (!cp->paid_for && (front_v->current_order.flags & OFB_TRANSFER) != 0) {
|
||||
Money profit = GetTransportedGoodsIncome(
|
||||
cp->count,
|
||||
/* 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 */
|
||||
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. */
|
||||
for (; v != NULL; v = v->Next()) {
|
||||
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;
|
||||
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 */
|
||||
remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
|
||||
|
||||
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);
|
||||
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 */
|
||||
if (u->current_order.flags & OF_UNLOAD) continue;
|
||||
if (u->current_order.flags & OFB_UNLOAD) continue;
|
||||
|
||||
/* update stats */
|
||||
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'
|
||||
* loading algorithm for the wagons (only fill wagon when there is
|
||||
* 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 */
|
||||
for (v = u; v != NULL; v = v->Next()) {
|
||||
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 {
|
||||
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 the aircraft carries passengers and is NOT full, then
|
||||
* continue loading, no matter how much mail is in */
|
||||
|
|
|
@ -1951,13 +1951,13 @@ int WhoCanServiceIndustry(Industry* ind)
|
|||
*/
|
||||
const Order *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 */
|
||||
Station *st = GetStation(o->dest);
|
||||
if (!st->IsValid()) continue;
|
||||
|
||||
/* 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 (v->owner == _local_player) return 2; // Player services industry
|
||||
|
|
36
src/order.h
36
src/order.h
|
@ -37,32 +37,32 @@ template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BE
|
|||
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 */
|
||||
enum OrderFlagMasks {
|
||||
//Flags for stations:
|
||||
/** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */
|
||||
OF_TRANSFER = 0x1,
|
||||
/** If OF_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station.
|
||||
OFB_TRANSFER = 0x1,
|
||||
/** 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 */
|
||||
OF_UNLOAD = 0x2,
|
||||
OFB_UNLOAD = 0x2,
|
||||
/** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting
|
||||
* @todo make this two different flags */
|
||||
OF_FULL_LOAD = 0x4,
|
||||
OFB_FULL_LOAD = 0x4,
|
||||
|
||||
//Flags for depots:
|
||||
/** The current depot-order was initiated because it was in the vehicle's order list */
|
||||
OF_PART_OF_ORDERS = 0x2,
|
||||
/** if OF_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
|
||||
OF_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 */
|
||||
OF_SERVICE_IF_NEEDED = 0x4, //used when OF_PART_OF_ORDERS is set.
|
||||
OFB_PART_OF_ORDERS = 0x2,
|
||||
/** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
|
||||
OFB_HALT_IN_DEPOT = 0x4,
|
||||
/** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
|
||||
OFB_SERVICE_IF_NEEDED = 0x4, //used when OFB_PART_OF_ORDERS is set.
|
||||
|
||||
//Common flags
|
||||
/** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings)
|
||||
* @todo make this two different flags */
|
||||
OF_NON_STOP = 0x8
|
||||
OFB_NON_STOP = 0x8
|
||||
};
|
||||
|
||||
/** Order flags bits - these are for the *BIT macros
|
||||
|
@ -70,13 +70,13 @@ enum OrderFlagMasks {
|
|||
* @see OrderFlagMasks
|
||||
*/
|
||||
enum {
|
||||
OFB_TRANSFER = 0,
|
||||
OFB_UNLOAD = 1,
|
||||
OFB_FULL_LOAD = 2,
|
||||
OFB_PART_OF_ORDERS = 1,
|
||||
OFB_HALT_IN_DEPOT = 2,
|
||||
OFB_SERVICE_IF_NEEDED = 2,
|
||||
OFB_NON_STOP = 3
|
||||
OF_TRANSFER = 0,
|
||||
OF_UNLOAD = 1,
|
||||
OF_FULL_LOAD = 2,
|
||||
OF_PART_OF_ORDERS = 1,
|
||||
OF_HALT_IN_DEPOT = 2,
|
||||
OF_SERVICE_IF_NEEDED = 2,
|
||||
OF_NON_STOP = 3
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -219,19 +219,19 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
* non-stop orders (if any) are only valid for trains */
|
||||
switch (new_order.flags) {
|
||||
case 0:
|
||||
case OF_FULL_LOAD:
|
||||
case OF_FULL_LOAD | OF_TRANSFER:
|
||||
case OF_UNLOAD:
|
||||
case OF_UNLOAD | OF_TRANSFER:
|
||||
case OF_TRANSFER:
|
||||
case OFB_FULL_LOAD:
|
||||
case OFB_FULL_LOAD | OFB_TRANSFER:
|
||||
case OFB_UNLOAD:
|
||||
case OFB_UNLOAD | OFB_TRANSFER:
|
||||
case OFB_TRANSFER:
|
||||
break;
|
||||
|
||||
case OF_NON_STOP:
|
||||
case OF_NON_STOP | OF_FULL_LOAD:
|
||||
case OF_NON_STOP | OF_FULL_LOAD | OF_TRANSFER:
|
||||
case OF_NON_STOP | OF_UNLOAD:
|
||||
case OF_NON_STOP | OF_UNLOAD | OF_TRANSFER:
|
||||
case OF_NON_STOP | OF_TRANSFER:
|
||||
case OFB_NON_STOP:
|
||||
case OFB_NON_STOP | OFB_FULL_LOAD:
|
||||
case OFB_NON_STOP | OFB_FULL_LOAD | OFB_TRANSFER:
|
||||
case OFB_NON_STOP | OFB_UNLOAD:
|
||||
case OFB_NON_STOP | OFB_UNLOAD | OFB_TRANSFER:
|
||||
case OFB_NON_STOP | OFB_TRANSFER:
|
||||
if (v->type != VEH_TRAIN) return CMD_ERROR;
|
||||
break;
|
||||
|
||||
|
@ -282,12 +282,12 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
* order [+ halt] [+ non-stop]
|
||||
* non-stop orders (if any) are only valid for trains */
|
||||
switch (new_order.flags) {
|
||||
case OF_PART_OF_ORDERS:
|
||||
case OF_PART_OF_ORDERS | OF_HALT_IN_DEPOT:
|
||||
case OFB_PART_OF_ORDERS:
|
||||
case OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
|
||||
break;
|
||||
|
||||
case OF_NON_STOP | OF_PART_OF_ORDERS:
|
||||
case OF_NON_STOP | OF_PART_OF_ORDERS | OF_HALT_IN_DEPOT:
|
||||
case OFB_NON_STOP | OFB_PART_OF_ORDERS:
|
||||
case OFB_NON_STOP | OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
|
||||
if (v->type != VEH_TRAIN) return CMD_ERROR;
|
||||
break;
|
||||
|
||||
|
@ -312,7 +312,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
switch (new_order.flags) {
|
||||
case 0: break;
|
||||
|
||||
case OF_NON_STOP:
|
||||
case OFB_NON_STOP:
|
||||
if (v->type != VEH_TRAIN) return CMD_ERROR;
|
||||
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
|
||||
* on his order list or not */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
v->LeaveStation();
|
||||
/* NON-stop flag is misused to see if a train is in a station that is
|
||||
* 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);
|
||||
|
@ -673,7 +673,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
VehicleID veh = GB(p1, 0, 16);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -684,26 +684,26 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
order = GetVehicleOrder(v, sel_ord);
|
||||
if ((order->type != OT_GOTO_STATION || GetStation(order->dest)->IsBuoy()) &&
|
||||
(order->type != OT_GOTO_DEPOT || p2 == OFB_UNLOAD) &&
|
||||
(order->type != OT_GOTO_WAYPOINT || p2 != OFB_NON_STOP)) {
|
||||
(order->type != OT_GOTO_DEPOT || p2 == OF_UNLOAD) &&
|
||||
(order->type != OT_GOTO_WAYPOINT || p2 != OF_NON_STOP)) {
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
switch (p2) {
|
||||
case OFB_FULL_LOAD:
|
||||
ToggleBit(order->flags, OFB_FULL_LOAD);
|
||||
if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OFB_UNLOAD);
|
||||
case OF_FULL_LOAD:
|
||||
ToggleBit(order->flags, OF_FULL_LOAD);
|
||||
if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OF_UNLOAD);
|
||||
break;
|
||||
case OFB_UNLOAD:
|
||||
ToggleBit(order->flags, OFB_UNLOAD);
|
||||
ClrBit(order->flags, OFB_FULL_LOAD);
|
||||
case OF_UNLOAD:
|
||||
ToggleBit(order->flags, OF_UNLOAD);
|
||||
ClrBit(order->flags, OF_FULL_LOAD);
|
||||
break;
|
||||
case OFB_NON_STOP:
|
||||
ToggleBit(order->flags, OFB_NON_STOP);
|
||||
case OF_NON_STOP:
|
||||
ToggleBit(order->flags, OF_NON_STOP);
|
||||
break;
|
||||
case OFB_TRANSFER:
|
||||
ToggleBit(order->flags, OFB_TRANSFER);
|
||||
case OF_TRANSFER:
|
||||
ToggleBit(order->flags, OF_TRANSFER);
|
||||
break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
@ -726,8 +726,8 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
*/
|
||||
if (sel_ord == u->cur_order_index &&
|
||||
u->current_order.type != OT_GOTO_DEPOT &&
|
||||
HasBit(u->current_order.flags, OFB_FULL_LOAD) != HasBit(order->flags, OFB_FULL_LOAD)) {
|
||||
ToggleBit(u->current_order.flags, OFB_FULL_LOAD);
|
||||
HasBit(u->current_order.flags, OF_FULL_LOAD) != HasBit(order->flags, OF_FULL_LOAD)) {
|
||||
ToggleBit(u->current_order.flags, OF_FULL_LOAD);
|
||||
}
|
||||
InvalidateVehicleOrder(u);
|
||||
}
|
||||
|
@ -909,7 +909,7 @@ CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
InvalidateVehicleOrder(u);
|
||||
|
||||
/* 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_subtype = subtype;
|
||||
}
|
||||
|
|
|
@ -215,14 +215,14 @@ static void DrawOrdersWindow(Window *w)
|
|||
SetDParam(2, GetDepot(order->dest)->town_index);
|
||||
|
||||
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_SHIP: s = STR_GO_TO_SHIP_DEPOT; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
if (order->flags & OF_FULL_LOAD) s++; /* service at */
|
||||
if (order->flags & OFB_FULL_LOAD) s++; /* service at */
|
||||
|
||||
SetDParam(1, s);
|
||||
if (order->refit_cargo < NUM_CARGO) {
|
||||
|
@ -235,7 +235,7 @@ static void DrawOrdersWindow(Window *w)
|
|||
}
|
||||
|
||||
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);
|
||||
break;
|
||||
|
||||
|
@ -273,7 +273,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
|||
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
|
||||
if (IsRailDepot(tile)) {
|
||||
order.type = OT_GOTO_DEPOT;
|
||||
order.flags = OF_PART_OF_ORDERS;
|
||||
order.flags = OFB_PART_OF_ORDERS;
|
||||
order.dest = GetDepotByTile(tile)->index;
|
||||
return order;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
|||
case MP_ROAD:
|
||||
if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
||||
order.type = OT_GOTO_DEPOT;
|
||||
order.flags = OF_PART_OF_ORDERS;
|
||||
order.flags = OFB_PART_OF_ORDERS;
|
||||
order.dest = GetDepotByTile(tile)->index;
|
||||
return order;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
|||
if (v->type != VEH_AIRCRAFT) break;
|
||||
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
|
||||
order.type = OT_GOTO_DEPOT;
|
||||
order.flags = OF_PART_OF_ORDERS;
|
||||
order.flags = OFB_PART_OF_ORDERS;
|
||||
order.dest = GetStationIndex(tile);
|
||||
return order;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
|||
TileIndex tile2 = GetOtherShipDepotTile(tile);
|
||||
|
||||
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;
|
||||
return order;
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ static void OrderClick_Goto(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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -479,13 +479,13 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
|
|||
|
||||
/* If the current orders are already 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.
|
||||
* 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) {
|
||||
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
}
|
||||
return CommandCost();
|
||||
|
@ -495,7 +495,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
|
|||
if (flags & DC_EXEC) {
|
||||
/* If the orders to 'goto depot' are in the orders list (forced servicing),
|
||||
* 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->current_order.type = OT_DUMMY;
|
||||
|
@ -513,8 +513,8 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
|
|||
|
||||
ClearSlot(v);
|
||||
v->current_order.type = OT_GOTO_DEPOT;
|
||||
v->current_order.flags = OF_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
v->current_order.flags = OFB_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
v->current_order.refit_cargo = CT_INVALID;
|
||||
v->current_order.dest = dep->index;
|
||||
v->dest_tile = dep->xy;
|
||||
|
@ -764,8 +764,8 @@ static void ProcessRoadVehOrder(Vehicle *v)
|
|||
switch (v->current_order.type) {
|
||||
case OT_GOTO_DEPOT:
|
||||
/* Let a depot order in the orderlist interrupt. */
|
||||
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
|
||||
if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
|
||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
|
||||
if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
|
||||
!VehicleNeedsService(v)) {
|
||||
UpdateVehicleTimetable(v, true);
|
||||
v->cur_order_index++;
|
||||
|
@ -1990,7 +1990,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
|
|||
}
|
||||
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
@ -1999,7 +1999,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
|
|||
ClearSlot(v);
|
||||
|
||||
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->dest_tile = depot->xy;
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
|
|
|
@ -164,7 +164,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
|
|||
}
|
||||
|
||||
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->dest_tile = depot->xy;
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
|
@ -250,8 +250,8 @@ static void ProcessShipOrder(Vehicle *v)
|
|||
|
||||
switch (v->current_order.type) {
|
||||
case OT_GOTO_DEPOT:
|
||||
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
|
||||
if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
|
||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
|
||||
if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
|
||||
!VehicleNeedsService(v)) {
|
||||
UpdateVehicleTimetable(v, true);
|
||||
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 (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.
|
||||
* 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) {
|
||||
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
}
|
||||
return CommandCost();
|
||||
|
@ -1016,7 +1016,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
|||
if (flags & DC_EXEC) {
|
||||
/* If the orders to 'goto depot' are in the orders list (forced servicing),
|
||||
* 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->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->current_order.type = OT_GOTO_DEPOT;
|
||||
v->current_order.flags = OF_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
v->current_order.flags = OFB_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
v->current_order.refit_cargo = CT_INVALID;
|
||||
v->current_order.dest = dep->index;
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
|
|
|
@ -2354,9 +2354,9 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
|
|||
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), 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)) {
|
||||
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->last_station_visited != station_id) {
|
||||
DiagDirection dir = DirToDiagDir(v->direction);
|
||||
|
|
|
@ -24,7 +24,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 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) {
|
||||
v->current_order.travel_time = time;
|
||||
} else {
|
||||
|
@ -65,7 +65,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
|||
bool is_journey = HasBit(p1, 24);
|
||||
if (!is_journey) {
|
||||
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) {
|
||||
|
|
|
@ -64,7 +64,7 @@ static void DrawTimetableWindow(Window *w)
|
|||
w->EnableWidget(7);
|
||||
} else {
|
||||
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(7, disable);
|
||||
|
@ -104,7 +104,7 @@ static void DrawTimetableWindow(Window *w)
|
|||
break;
|
||||
|
||||
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);
|
||||
|
||||
if (order->wait_time > 0) {
|
||||
|
@ -124,20 +124,20 @@ static void DrawTimetableWindow(Window *w)
|
|||
SetDParam(1, GetDepot(order->dest)->town_index);
|
||||
|
||||
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_SHIP: string = STR_GO_TO_SHIP_DEPOT; 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);
|
||||
} break;
|
||||
|
||||
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);
|
||||
break;
|
||||
|
||||
|
@ -182,7 +182,7 @@ static void DrawTimetableWindow(Window *w)
|
|||
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
|
||||
total_time += order->travel_time + order->wait_time;
|
||||
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) {
|
||||
|
|
|
@ -303,13 +303,13 @@ static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
|
|||
assert(v->type == VEH_TRAIN);
|
||||
/* When does a train drive through a station
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1993,13 +1993,13 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
|
|||
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
|
||||
|
||||
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.
|
||||
* 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) {
|
||||
ClrBit(v->current_order.flags, OFB_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
|
||||
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
}
|
||||
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 (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++;
|
||||
}
|
||||
|
||||
|
@ -2030,8 +2030,8 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
|
|||
|
||||
v->dest_tile = tfdd.tile;
|
||||
v->current_order.type = OT_GOTO_DEPOT;
|
||||
v->current_order.flags = OF_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OFB_HALT_IN_DEPOT);
|
||||
v->current_order.flags = OFB_NON_STOP;
|
||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||
v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
|
||||
v->current_order.refit_cargo = CT_INVALID;
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
|
@ -2481,8 +2481,8 @@ static bool ProcessTrainOrder(Vehicle *v)
|
|||
{
|
||||
switch (v->current_order.type) {
|
||||
case OT_GOTO_DEPOT:
|
||||
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false;
|
||||
if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) &&
|
||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false;
|
||||
if ((v->current_order.flags & OFB_SERVICE_IF_NEEDED) &&
|
||||
!VehicleNeedsService(v)) {
|
||||
UpdateVehicleTimetable(v, true);
|
||||
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.. */
|
||||
if (_patches.new_nonstop &&
|
||||
v->current_order.flags & OF_NON_STOP &&
|
||||
v->current_order.flags & OFB_NON_STOP &&
|
||||
IsTileType(v->tile, MP_STATION) &&
|
||||
v->current_order.dest == GetStationIndex(v->tile)) {
|
||||
UpdateVehicleTimetable(v, true);
|
||||
|
@ -3475,7 +3475,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
|
|||
}
|
||||
|
||||
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->dest_tile = tfdd.tile;
|
||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
|
||||
|
|
|
@ -104,10 +104,10 @@ void VehicleServiceInDepot(Vehicle *v)
|
|||
bool VehicleNeedsService(const Vehicle *v)
|
||||
{
|
||||
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 (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) {
|
||||
|
@ -615,7 +615,7 @@ static Vehicle* _first_veh_in_depot_list;
|
|||
void VehicleEnteredDepotThisTick(Vehicle *v)
|
||||
{
|
||||
/* 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 */
|
||||
v->leave_depot_instantly = false;
|
||||
} else {
|
||||
|
@ -2156,7 +2156,7 @@ uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color)
|
|||
max += v->cargo_cap;
|
||||
if (v->cargo_cap != 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++;
|
||||
}
|
||||
}
|
||||
|
@ -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 */
|
||||
UpdateVehicleTimetable(v, true);
|
||||
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 */
|
||||
v->vehstatus |= VS_STOPPED;
|
||||
if (v->owner == _local_player) {
|
||||
|
@ -3095,14 +3095,14 @@ void Vehicle::BeginLoading()
|
|||
this->current_order.dest == this->last_station_visited) {
|
||||
/* Arriving at the ordered station.
|
||||
* 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
|
||||
* is the actual destination of the vehicle, which is (for example)
|
||||
* necessary to be known for HandleTrainLoading to determine
|
||||
* whether the train is lost or not; not marking a train lost
|
||||
* that arrives at random stations is bad. */
|
||||
this->current_order.flags |= OF_NON_STOP;
|
||||
this->current_order.flags |= OFB_NON_STOP;
|
||||
UpdateVehicleTimetable(this, true);
|
||||
} else {
|
||||
/* This is just an unordered intermediate stop */
|
||||
|
@ -3128,7 +3128,7 @@ void Vehicle::LeaveStation()
|
|||
assert(current_order.type == OT_LOADING);
|
||||
|
||||
/* 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.flags = 0;
|
||||
|
@ -3155,7 +3155,7 @@ void Vehicle::HandleLoading(bool mode)
|
|||
this->LeaveStation();
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1990,7 +1990,7 @@ static void DrawVehicleViewWindow(Window *w)
|
|||
SetDParam(0, depot->town_index);
|
||||
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;
|
||||
} else {
|
||||
str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed;
|
||||
|
|
Loading…
Reference in New Issue