Changeset - r20444:ab7194ebfed2
[Not reviewed]
master
0 1 0
frosch - 11 years ago 2013-06-24 21:02:26
frosch@openttd.org
(svn r25459) -Fix: Disable the depot-refit button in the order GUI, if the consist is not refittable.
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/order_gui.cpp
Show inline comments
 
@@ -28,6 +28,7 @@
 
#include "core/geometry_func.hpp"
 
#include "hotkeys.h"
 
#include "aircraft.h"
 
#include "engine_func.h"
 

	
 
#include "widgets/order_widget.h"
 

	
 
@@ -533,6 +534,7 @@ private:
 
	OrderPlaceObjectState goto_type;
 
	const Vehicle *vehicle; ///< Vehicle owning the orders being displayed and manipulated.
 
	Scrollbar *vscroll;
 
	bool can_do_refit;     ///< Vehicle chain can be refitted in depot.
 
	bool can_do_autorefit; ///< Vehicle chain can be auto-refitted.
 

	
 
	/**
 
@@ -794,8 +796,10 @@ private:
 
	/** Cache auto-refittability of the vehicle chain. */
 
	void UpdateAutoRefitState()
 
	{
 
		this->can_do_refit = false;
 
		this->can_do_autorefit = false;
 
		for (const Vehicle *w = this->vehicle; w != NULL; w = w->IsGroundVehicle() ? w->Next() : NULL) {
 
			if (IsEngineRefittable(w->engine_type)) this->can_do_refit = true;
 
			if (HasBit(Engine::Get(w->engine_type)->info.misc_flags, EF_AUTO_REFIT)) this->can_do_autorefit = true;
 
		}
 
	}
 
@@ -1026,7 +1030,7 @@ public:
 
					 * Also enable the button if a refit is already set to allow clearing it. */
 
					this->SetWidgetDisabledState(WID_O_REFIT_DROPDOWN,
 
							order->GetLoadType() == OLFB_NO_LOAD || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ||
 
							(!this->can_do_autorefit && !order->IsRefit()));
 
							((!this->can_do_refit || !this->can_do_autorefit) && !order->IsRefit()));
 

	
 
					break;
 

	
 
@@ -1059,7 +1063,9 @@ public:
 
					}
 
					/* Disable refit button if the order is no 'always go' order.
 
					 * However, keep the service button enabled for refit-orders to allow clearing refits (without knowing about ctrl). */
 
					this->SetWidgetDisabledState(WID_O_REFIT, (order->GetDepotOrderType() & ODTFB_SERVICE) || (order->GetDepotActionType() & ODATFB_HALT));
 
					this->SetWidgetDisabledState(WID_O_REFIT,
 
							(order->GetDepotOrderType() & ODTFB_SERVICE) || (order->GetDepotActionType() & ODATFB_HALT) ||
 
							(!this->can_do_refit && !order->IsRefit()));
 
					this->SetWidgetLoweredState(WID_O_SERVICE, order->GetDepotOrderType() & ODTFB_SERVICE);
 
					break;
 

	
0 comments (0 inline, 0 general)