summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-09 18:26:19 +0000
committerrubidium <rubidium@openttd.org>2008-04-09 18:26:19 +0000
commit2e4044ac81acf7101667b2d90fb273a11ef3f39b (patch)
treeddb520943c26dd780e20324992cfd08a769fb197
parentc93e1293cb2df96c52066d39b522c563dc5b2f60 (diff)
downloadopenttd-2e4044ac81acf7101667b2d90fb273a11ef3f39b.tar.xz
(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.
-rw-r--r--src/economy.cpp2
-rw-r--r--src/order_base.h2
-rw-r--r--src/order_cmd.cpp11
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/order_type.h3
5 files changed, 15 insertions, 5 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 7c70bba06..53115d448 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1730,7 +1730,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
} else {
bool finished_loading = true;
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
* 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()) ||
diff --git a/src/order_base.h b/src/order_base.h
index cb770eaa7..e3daa9098 100644
--- a/src/order_base.h
+++ b/src/order_base.h
@@ -161,7 +161,7 @@ public:
void SetRefit(CargoID cargo, byte subtype = 0);
/** 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? */
inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 2); }
/** Where must we stop? */
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index bbd1c01bd..9fc94e854 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -41,6 +41,12 @@ BackuppedOrders _backup_orders_data;
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
{
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;
/* 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;
break;
}
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 9cf98c48e..76fa29b33 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -194,7 +194,7 @@ static void DrawOrdersWindow(Window *w)
break;
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());
break;
diff --git a/src/order_type.h b/src/order_type.h
index 1ebbbdc35..7e2548a08 100644
--- a/src/order_type.h
+++ b/src/order_type.h
@@ -50,7 +50,8 @@ enum OrderUnloadFlags {
*/
enum OrderLoadFlags {
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.
};
/**