Changeset - r8873:ef1fcefc792a
[Not reviewed]
master
0 5 0
rubidium - 16 years ago 2008-04-09 18:26:19
rubidium@openttd.org
(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.
5 files changed with 15 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -1730,7 +1730,7 @@ static void LoadUnloadVehicle(Vehicle *v
 
	} 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()) ||
src/order_base.h
Show inline comments
 
@@ -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? */
src/order_cmd.cpp
Show inline comments
 
@@ -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 til
 
			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;
 
		}
src/order_gui.cpp
Show inline comments
 
@@ -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;
 

	
src/order_type.h
Show inline comments
 
@@ -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.
 
};
 

	
 
/**
0 comments (0 inline, 0 general)