mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r12595) -Codechange: hide Order's flags in the last few cases.
This commit is contained in:
parent
c0a5fa9eea
commit
d90a041230
@ -28,6 +28,7 @@ private:
|
||||
friend const struct SaveLoad *GetOrderDescription(); ///< Saving and loading of orders.
|
||||
|
||||
OrderTypeByte type; ///< The type of order
|
||||
uint8 flags; ///< 'Sub'type of order
|
||||
DestinationID dest; ///< The destination of the order.
|
||||
|
||||
CargoID refit_cargo; ///< Refit CargoID
|
||||
@ -36,8 +37,6 @@ private:
|
||||
public:
|
||||
Order *next; ///< Pointer to next order. If NULL, end of list
|
||||
|
||||
uint8 flags; ///< 'Sub'type of order
|
||||
|
||||
uint16 wait_time; ///< How long in ticks to wait at the destination.
|
||||
uint16 travel_time; ///< How long in ticks the journey to this destination should take.
|
||||
|
||||
|
@ -302,10 +302,12 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
default: return CMD_ERROR;
|
||||
}
|
||||
|
||||
if (new_order.GetNonStopType() != OFB_NO_NON_STOP && v->type != VEH_TRAIN) return CMD_ERROR;
|
||||
|
||||
/* Order flags can be any of the following for stations:
|
||||
* [full-load | unload] [+ transfer] [+ non-stop]
|
||||
* non-stop orders (if any) are only valid for trains */
|
||||
switch (new_order.flags) {
|
||||
switch (new_order.GetLoadType() | new_order.GetUnloadType()) {
|
||||
case 0:
|
||||
case OFB_FULL_LOAD:
|
||||
case OFB_FULL_LOAD | OFB_TRANSFER:
|
||||
@ -314,15 +316,6 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
case OFB_TRANSFER:
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
default: return CMD_ERROR;
|
||||
}
|
||||
break;
|
||||
@ -364,19 +357,16 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
}
|
||||
}
|
||||
|
||||
if (new_order.GetNonStopType() != OFB_NO_NON_STOP && v->type != VEH_TRAIN) return CMD_ERROR;
|
||||
|
||||
/* Order flags can be any of the following for depots:
|
||||
* order [+ halt] [+ non-stop]
|
||||
* non-stop orders (if any) are only valid for trains */
|
||||
switch (new_order.flags) {
|
||||
switch (new_order.GetDepotOrderType() | new_order.GetDepotActionType()) {
|
||||
case OFB_PART_OF_ORDERS:
|
||||
case OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
default: return CMD_ERROR;
|
||||
}
|
||||
break;
|
||||
@ -768,21 +758,25 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
switch (p2) {
|
||||
case OF_FULL_LOAD:
|
||||
ToggleBit(order->flags, OF_FULL_LOAD);
|
||||
if (!order->IsType(OT_GOTO_DEPOT)) ClrBit(order->flags, OF_UNLOAD);
|
||||
break;
|
||||
case OF_UNLOAD:
|
||||
ToggleBit(order->flags, OF_UNLOAD);
|
||||
ClrBit(order->flags, OF_FULL_LOAD);
|
||||
break;
|
||||
case OF_NON_STOP:
|
||||
ToggleBit(order->flags, OF_NON_STOP);
|
||||
break;
|
||||
case OF_TRANSFER:
|
||||
ToggleBit(order->flags, OF_TRANSFER);
|
||||
break;
|
||||
default: NOT_REACHED();
|
||||
case OF_FULL_LOAD:
|
||||
if (order->IsType(OT_GOTO_DEPOT)) {
|
||||
order->SetDepotOrderType(order->GetDepotOrderType() ^ OFB_SERVICE_IF_NEEDED);
|
||||
} else {
|
||||
order->SetLoadType(order->GetUnloadType() ^ OFB_FULL_LOAD);
|
||||
order->SetUnloadType(order->GetUnloadType() & ~OFB_UNLOAD);
|
||||
}
|
||||
break;
|
||||
case OF_UNLOAD:
|
||||
order->SetUnloadType(order->GetUnloadType() ^ OFB_UNLOAD);
|
||||
order->SetLoadType(0);
|
||||
break;
|
||||
case OF_NON_STOP:
|
||||
order->SetNonStopType(order->GetNonStopType() ^ OFB_NON_STOP);
|
||||
break;
|
||||
case OF_TRANSFER:
|
||||
order->SetUnloadType(order->GetUnloadType() ^ OFB_TRANSFER);
|
||||
break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
/* Update the windows and full load flags, also for vehicles that share the same order list */
|
||||
|
@ -91,22 +91,22 @@ static int GetOrderFromOrderWndPt(Window *w, int y, const Vehicle *v)
|
||||
return (sel <= v->num_orders && sel >= 0) ? sel : INVALID_ORDER;
|
||||
}
|
||||
|
||||
static StringID StationOrderStrings[] = {
|
||||
STR_8806_GO_TO,
|
||||
STR_GO_TO_TRANSFER,
|
||||
STR_8807_GO_TO_UNLOAD,
|
||||
STR_GO_TO_TRANSFER_UNLOAD,
|
||||
STR_8808_GO_TO_LOAD,
|
||||
STR_GO_TO_TRANSFER_LOAD,
|
||||
STR_NULL,
|
||||
STR_NULL,
|
||||
STR_880A_GO_NON_STOP_TO,
|
||||
STR_GO_TO_NON_STOP_TRANSFER,
|
||||
STR_880B_GO_NON_STOP_TO_UNLOAD,
|
||||
STR_GO_TO_NON_STOP_TRANSFER_UNLOAD,
|
||||
STR_880C_GO_NON_STOP_TO_LOAD,
|
||||
STR_GO_TO_NON_STOP_TRANSFER_LOAD,
|
||||
STR_NULL
|
||||
static StringID _station_order_strings[][7] = {
|
||||
{
|
||||
STR_8806_GO_TO,
|
||||
STR_GO_TO_TRANSFER,
|
||||
STR_8807_GO_TO_UNLOAD,
|
||||
STR_GO_TO_TRANSFER_UNLOAD,
|
||||
STR_8808_GO_TO_LOAD,
|
||||
STR_GO_TO_TRANSFER_LOAD
|
||||
}, {
|
||||
STR_880A_GO_NON_STOP_TO,
|
||||
STR_GO_TO_NON_STOP_TRANSFER,
|
||||
STR_880B_GO_NON_STOP_TO_UNLOAD,
|
||||
STR_GO_TO_NON_STOP_TRANSFER_UNLOAD,
|
||||
STR_880C_GO_NON_STOP_TO_LOAD,
|
||||
STR_GO_TO_NON_STOP_TRANSFER_LOAD
|
||||
}
|
||||
};
|
||||
|
||||
static void DrawOrdersWindow(Window *w)
|
||||
@ -201,7 +201,7 @@ static void DrawOrdersWindow(Window *w)
|
||||
break;
|
||||
|
||||
case OT_GOTO_STATION:
|
||||
SetDParam(1, StationOrderStrings[order->flags]);
|
||||
SetDParam(1, _station_order_strings[!!order->GetNonStopType()][order->GetLoadType() | order->GetUnloadType()]);
|
||||
SetDParam(2, order->GetDestination());
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user