mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r12640) -Codechange: let GetLoadType make a difference between full load and full load any based on the patch setting instead of using the patch setting directly.
This commit is contained in:
parent
d178345947
commit
82155367f6
|
@ -1730,7 +1730,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
|
||||||
} else {
|
} else {
|
||||||
bool finished_loading = true;
|
bool finished_loading = true;
|
||||||
if (v->current_order.GetLoadType() & OLFB_FULL_LOAD) {
|
if (v->current_order.GetLoadType() & OLFB_FULL_LOAD) {
|
||||||
if (_patches.full_load_any) {
|
if (v->current_order.GetLoadType() == OLF_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 */
|
||||||
if ((v->type == VEH_AIRCRAFT && IsCargoInClass(v->cargo_type, CC_PASSENGERS) && v->cargo_cap != v->cargo.Count()) ||
|
if ((v->type == VEH_AIRCRAFT && IsCargoInClass(v->cargo_type, CC_PASSENGERS) && v->cargo_cap != v->cargo.Count()) ||
|
||||||
|
|
|
@ -161,7 +161,7 @@ public:
|
||||||
void SetRefit(CargoID cargo, byte subtype = 0);
|
void SetRefit(CargoID cargo, byte subtype = 0);
|
||||||
|
|
||||||
/** How must the consist be loaded? */
|
/** How must the consist be loaded? */
|
||||||
inline OrderLoadFlags GetLoadType() const { return (OrderLoadFlags)(this->flags & OLFB_FULL_LOAD); }
|
OrderLoadFlags GetLoadType() const;
|
||||||
/** How must the consist be unloaded? */
|
/** How must the consist be unloaded? */
|
||||||
inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 2); }
|
inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 2); }
|
||||||
/** Where must we stop? */
|
/** Where must we stop? */
|
||||||
|
|
|
@ -41,6 +41,12 @@ BackuppedOrders _backup_orders_data;
|
||||||
|
|
||||||
DEFINE_OLD_POOL_GENERIC(Order, Order);
|
DEFINE_OLD_POOL_GENERIC(Order, Order);
|
||||||
|
|
||||||
|
OrderLoadFlags Order::GetLoadType() const
|
||||||
|
{
|
||||||
|
if ((this->flags & OLFB_FULL_LOAD) == 0) return OLF_LOAD_IF_POSSIBLE;
|
||||||
|
return _patches.full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD;
|
||||||
|
}
|
||||||
|
|
||||||
OrderNonStopFlags Order::GetNonStopType() const
|
OrderNonStopFlags Order::GetNonStopType() const
|
||||||
{
|
{
|
||||||
if (_patches.new_nonstop) {
|
if (_patches.new_nonstop) {
|
||||||
|
@ -322,7 +328,10 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if ((new_order.GetLoadType() & OLFB_FULL_LOAD) && (new_order.GetUnloadType() & OUFB_UNLOAD)) return CMD_ERROR;
|
if ((new_order.GetLoadType() & OLFB_FULL_LOAD) && (new_order.GetUnloadType() & OUFB_UNLOAD)) return CMD_ERROR;
|
||||||
|
|
||||||
/* Filter invalid load/unload types. */
|
/* Filter invalid load/unload types. */
|
||||||
if (new_order.GetLoadType() & ~OLFB_FULL_LOAD) return CMD_ERROR;
|
switch (new_order.GetLoadType()) {
|
||||||
|
case OLF_LOAD_IF_POSSIBLE: case OLFB_FULL_LOAD: case OLF_FULL_LOAD_ANY: break;
|
||||||
|
default: return CMD_ERROR;
|
||||||
|
}
|
||||||
if (new_order.GetUnloadType() & ~(OUFB_UNLOAD | OUFB_TRANSFER)) return CMD_ERROR;
|
if (new_order.GetUnloadType() & ~(OUFB_UNLOAD | OUFB_TRANSFER)) return CMD_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ static void DrawOrdersWindow(Window *w)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OT_GOTO_STATION:
|
case OT_GOTO_STATION:
|
||||||
SetDParam(1, _station_order_strings[!(order->GetNonStopType() == (_patches.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE))][order->GetLoadType() | order->GetUnloadType()]);
|
SetDParam(1, _station_order_strings[!(order->GetNonStopType() == (_patches.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE))][(order->GetLoadType() & OLFB_FULL_LOAD) | order->GetUnloadType()]);
|
||||||
SetDParam(2, order->GetDestination());
|
SetDParam(2, order->GetDestination());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,8 @@ enum OrderUnloadFlags {
|
||||||
*/
|
*/
|
||||||
enum OrderLoadFlags {
|
enum OrderLoadFlags {
|
||||||
OLF_LOAD_IF_POSSIBLE = 0, ///< Load as long as there is cargo that fits in the train.
|
OLF_LOAD_IF_POSSIBLE = 0, ///< Load as long as there is cargo that fits in the train.
|
||||||
OLFB_FULL_LOAD = 1 << 2, ///< Full load the complete (or a single cargo) of the consist.
|
OLFB_FULL_LOAD = 1 << 2, ///< Full load the complete the consist.
|
||||||
|
OLF_FULL_LOAD_ANY = 5, ///< Full load the a single cargo of the consist.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue