Changeset - r18243:cf295a72fdc8
[Not reviewed]
master
0 4 0
michi_cc - 13 years ago 2011-11-04 00:38:59
michi_cc@openttd.org
(svn r23089) -Add: Allow specifying refits for go-to station orders.
4 files changed with 161 insertions and 49 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3190,6 +3190,10 @@ STR_ORDER_TOOLTIP_UNLOAD                
 

	
 
STR_ORDER_REFIT                                                 :{BLACK}Refit
 
STR_ORDER_REFIT_TOOLTIP                                         :{BLACK}Select what cargo type to refit to in this order. Ctrl+Click to remove refit instruction
 
STR_ORDER_REFIT_AUTO                                            :{BLACK}Auto-refit
 
STR_ORDER_REFIT_AUTO_TOOLTIP                                    :{BLACK}Select what cargo type to auto-refit to in this order. Ctrl+Click to remove refit instruction. Auto-refitting will only be done if the vehicle allows it
 
STR_ORDER_DROP_REFIT_AUTO                                       :Fixed cargo
 
STR_ORDER_DROP_REFIT_AUTO_ANY                                   :Available cargo
 

	
 
STR_ORDER_SERVICE                                               :{BLACK}Service
 
STR_ORDER_DROP_GO_ALWAYS_DEPOT                                  :Always go
 
@@ -3279,6 +3283,21 @@ STR_ORDER_NO_UNLOAD_FULL_LOAD           
 
STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY                               :(No unloading and wait for any full load)
 
STR_ORDER_NO_UNLOAD_NO_LOAD                                     :(No unloading and no loading)
 

	
 
STR_ORDER_AUTO_REFIT                                            :(Auto-refit to {STRING})
 
STR_ORDER_FULL_LOAD_REFIT                                       :(Full load with auto-refit to {STRING})
 
STR_ORDER_FULL_LOAD_ANY_REFIT                                   :(Full load any cargo with auto-refit to {STRING})
 
STR_ORDER_UNLOAD_REFIT                                          :(Unload and take cargo with auto-refit to {STRING})
 
STR_ORDER_UNLOAD_FULL_LOAD_REFIT                                :(Unload and wait for full load with auto-refit to {STRING})
 
STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT                            :(Unload and wait for any full load with auto-refit to {STRING})
 
STR_ORDER_TRANSFER_REFIT                                        :(Transfer and take cargo with auto-refit to {STRING})
 
STR_ORDER_TRANSFER_FULL_LOAD_REFIT                              :(Transfer and wait for full load with auto-refit to {STRING})
 
STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT                          :(Transfer and wait for any full load with auto-refit to {STRING})
 
STR_ORDER_NO_UNLOAD_REFIT                                       :(No unloading and take cargo with auto-refit to {STRING})
 
STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT                             :(No unloading and wait for full load with auto-refit to {STRING})
 
STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT                         :(No unloading and wait for any full load with auto-refit to {STRING})
 

	
 
STR_ORDER_AUTO_REFIT_ANY                                        :available cargo
 

	
 
STR_ORDER_STOP_LOCATION_NEAR_END                                :[near end]
 
STR_ORDER_STOP_LOCATION_MIDDLE                                  :[middle]
 
STR_ORDER_STOP_LOCATION_FAR_END                                 :[far end]
src/order_gui.cpp
Show inline comments
 
@@ -48,6 +48,7 @@ enum OrderWindowWidgets {
 
	ORDER_WIDGET_REFIT,
 
	ORDER_WIDGET_SERVICE,
 
	ORDER_WIDGET_EMPTY,
 
	ORDER_WIDGET_REFIT_DROPDOWN,
 
	ORDER_WIDGET_COND_VARIABLE,
 
	ORDER_WIDGET_COND_COMPARATOR,
 
	ORDER_WIDGET_COND_VALUE,
 
@@ -61,37 +62,73 @@ enum OrderWindowWidgets {
 
};
 

	
 
/** Order load types that could be given to station orders. */
 
static const StringID _station_load_types[][5] = {
 
static const StringID _station_load_types[][5][5] = {
 
	{
 
		STR_EMPTY,
 
		INVALID_STRING_ID,
 
		STR_ORDER_FULL_LOAD,
 
		STR_ORDER_FULL_LOAD_ANY,
 
		STR_ORDER_NO_LOAD,
 
	}, {
 
		STR_ORDER_UNLOAD,
 
		INVALID_STRING_ID,
 
		STR_ORDER_UNLOAD_FULL_LOAD,
 
		STR_ORDER_UNLOAD_FULL_LOAD_ANY,
 
		STR_ORDER_UNLOAD_NO_LOAD,
 
		/* No refitting. */
 
		{
 
			STR_EMPTY,
 
			INVALID_STRING_ID,
 
			STR_ORDER_FULL_LOAD,
 
			STR_ORDER_FULL_LOAD_ANY,
 
			STR_ORDER_NO_LOAD,
 
		}, {
 
			STR_ORDER_UNLOAD,
 
			INVALID_STRING_ID,
 
			STR_ORDER_UNLOAD_FULL_LOAD,
 
			STR_ORDER_UNLOAD_FULL_LOAD_ANY,
 
			STR_ORDER_UNLOAD_NO_LOAD,
 
		}, {
 
			STR_ORDER_TRANSFER,
 
			INVALID_STRING_ID,
 
			STR_ORDER_TRANSFER_FULL_LOAD,
 
			STR_ORDER_TRANSFER_FULL_LOAD_ANY,
 
			STR_ORDER_TRANSFER_NO_LOAD,
 
		}, {
 
			/* Unload and transfer do not work together. */
 
			INVALID_STRING_ID,
 
			INVALID_STRING_ID,
 
			INVALID_STRING_ID,
 
			INVALID_STRING_ID,
 
		}, {
 
			STR_ORDER_NO_UNLOAD,
 
			INVALID_STRING_ID,
 
			STR_ORDER_NO_UNLOAD_FULL_LOAD,
 
			STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
 
			STR_ORDER_NO_UNLOAD_NO_LOAD,
 
		}
 
	}, {
 
		STR_ORDER_TRANSFER,
 
		INVALID_STRING_ID,
 
		STR_ORDER_TRANSFER_FULL_LOAD,
 
		STR_ORDER_TRANSFER_FULL_LOAD_ANY,
 
		STR_ORDER_TRANSFER_NO_LOAD,
 
	}, {
 
		/* Unload and transfer do not work together. */
 
		INVALID_STRING_ID,
 
		INVALID_STRING_ID,
 
		INVALID_STRING_ID,
 
		INVALID_STRING_ID,
 
	}, {
 
		STR_ORDER_NO_UNLOAD,
 
		INVALID_STRING_ID,
 
		STR_ORDER_NO_UNLOAD_FULL_LOAD,
 
		STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
 
		STR_ORDER_NO_UNLOAD_NO_LOAD,
 
		/* With auto-refitting. No loading and auto-refitting do not work together. */
 
		{
 
			STR_ORDER_AUTO_REFIT,
 
			INVALID_STRING_ID,
 
			STR_ORDER_FULL_LOAD_REFIT,
 
			STR_ORDER_FULL_LOAD_ANY_REFIT,
 
			INVALID_STRING_ID,
 
		}, {
 
			STR_ORDER_UNLOAD_REFIT,
 
			INVALID_STRING_ID,
 
			STR_ORDER_UNLOAD_FULL_LOAD_REFIT,
 
			STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT,
 
			INVALID_STRING_ID,
 
		}, {
 
			STR_ORDER_TRANSFER_REFIT,
 
			INVALID_STRING_ID,
 
			STR_ORDER_TRANSFER_FULL_LOAD_REFIT,
 
			STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT,
 
			INVALID_STRING_ID,
 
		}, {
 
			/* Unload and transfer do not work together. */
 
			INVALID_STRING_ID,
 
			INVALID_STRING_ID,
 
			INVALID_STRING_ID,
 
			INVALID_STRING_ID,
 
		}, {
 
			STR_ORDER_NO_UNLOAD_REFIT,
 
			INVALID_STRING_ID,
 
			STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT,
 
			STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT,
 
			INVALID_STRING_ID,
 
		}
 
	}
 
};
 

	
 
@@ -181,6 +218,12 @@ static int DepotActionStringIndex(const 
 
	}
 
}
 

	
 
static const StringID _order_refit_action_dropdown[] = {
 
	STR_ORDER_DROP_REFIT_AUTO,
 
	STR_ORDER_DROP_REFIT_AUTO_ANY,
 
	INVALID_STRING_ID
 
};
 

	
 
/**
 
 * Draws an order in order or timetable GUI
 
 * @param v Vehicle the order belongs to
 
@@ -247,7 +290,10 @@ void DrawOrderString(const Vehicle *v, c
 
					SetTimetableParams(6, 7, order->wait_time);
 
				}
 
			} else {
 
				SetDParam(3, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]);
 
				SetDParam(3, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[order->IsRefit()][unload][load]);
 
				if (order->IsRefit()) {
 
					SetDParam(4, order->IsAutoRefit() ? STR_ORDER_AUTO_REFIT_ANY : CargoSpec::Get(order->GetRefitCargo())->name);
 
				}
 
				if (v->type == VEH_TRAIN && (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) == 0) {
 
					SetDParam(5, order->GetStopLocation() + STR_ORDER_STOP_LOCATION_NEAR_END);
 
				}
 
@@ -423,7 +469,7 @@ static Order GetOrderCmdFromTile(const V
 
 * The top-row buttons of one of your trains or road vehicles is one of the following three cases:
 
 * \verbatim
 
 * +-----------------+-----------------+-----------------+-----------------+
 
 * |    NON-STOP     |    FULL_LOAD    |     UNLOAD      |     (empty)     | (normal)
 
 * |    NON-STOP     |    FULL_LOAD    |     UNLOAD      |      REFIT      | (normal)
 
 * +-----------------+-----+-----------+-----------+-----+-----------------+
 
 * |       COND_VAR        |    COND_COMPARATOR    |      COND_VALUE       | (for conditional orders)
 
 * +-----------------+-----+-----------+-----------+-----+-----------------+
 
@@ -433,9 +479,9 @@ static Order GetOrderCmdFromTile(const V
 
 *
 
 * Airplanes and ships have one of the following three top-row button rows:
 
 * \verbatim
 
 * +--------------------------+--------------------------+
 
 * |          FULL_LOAD       |          UNLOAD          | (normal)
 
 * +-----------------+--------+--------+-----------------+
 
 * +-----------------+-----------------+-----------------+
 
 * |    FULL_LOAD    |     UNLOAD      |      REFIT      | (normal)
 
 * +-----------------+-----------------+-----------------+
 
 * |    COND_VAR     | COND_COMPARATOR |   COND_VALUE    | (for conditional orders)
 
 * +-----------------+--------+--------+-----------------+
 
 * |            REFIT         |          SERVICE         | (for depot order)
 
@@ -477,9 +523,10 @@ private:
 

	
 
		/* ORDER_WIDGET_SEL_TOP_RIGHT */
 
		DP_RIGHT_EMPTY     = 0, ///< Display an empty panel in the right button of the top row of the train/rv order window.
 
		DP_RIGHT_REFIT     = 1, ///< Display 'refit' in the right button of the top  row of the train/rv order window.
 

	
 
		/* ORDER_WIDGET_SEL_TOP_ROW */
 
		DP_ROW_LOAD        = 0, ///< Display 'load' / 'unload' buttons in the top row of the ship/airplane order window.
 
		DP_ROW_LOAD        = 0, ///< Display 'load' / 'unload' / 'refit' buttons in the top row of the ship/airplane order window.
 
		DP_ROW_DEPOT       = 1, ///< Display 'refit' / 'service' buttons in the top row of the ship/airplane order window.
 
		DP_ROW_CONDITIONAL = 2, ///< Display the conditional order buttons in the top row of the ship/airplane order window.
 

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

	
 
	/**
 
	 * Return the memorised selected order.
 
@@ -740,15 +788,29 @@ private:
 
	/**
 
	 * Handle the click on the refit button.
 
	 * If ctrl is pressed, cancel refitting, else show the refit window.
 
	 * @param i Dummy parameter.
 
	 * @param i Selected refit command.
 
	 * @param auto_refit Select refit for auto-refitting.
 
	 */
 
	void OrderClick_Refit(int i)
 
	void OrderClick_Refit(int i, bool auto_refit)
 
	{
 
		if (_ctrl_pressed) {
 
			/* Cancel refitting */
 
			DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT);
 
		} else {
 
			ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this);
 
			if (i == 1) { // Auto-refit to available cargo type.
 
				DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | CT_AUTO_REFIT, CMD_ORDER_REFIT);
 
			} else {
 
				ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this, auto_refit);
 
			}
 
		}
 
	}
 

	
 
	/** Cache auto-refittability of the vehicle chain. */
 
	void UpdateAutoRefitState()
 
	{
 
		this->can_do_autorefit = false;
 
		for (const Vehicle *w = this->vehicle; w != NULL; w = w->Next()) {
 
			if (HasBit(Engine::Get(w->engine_type)->info.misc_flags, EF_AUTO_REFIT)) this->can_do_autorefit = true;
 
		}
 
	}
 

	
 
@@ -766,6 +828,8 @@ public:
 
		this->order_over = INVALID_VEH_ORDER_ID;
 
		this->owner = v->owner;
 

	
 
		this->UpdateAutoRefitState();
 

	
 
		if (_settings_client.gui.quick_goto && v->owner == _local_company) {
 
			/* If there are less than 2 station, make Go To active. */
 
			int station_orders = 0;
 
@@ -825,6 +889,7 @@ public:
 
			case -666:
 
				/* Autoreplace replaced the vehicle */
 
				this->vehicle = Vehicle::Get(this->window_number);
 
				this->UpdateAutoRefitState();
 
				break;
 

	
 
			case -1:
 
@@ -945,6 +1010,7 @@ public:
 
			}
 
			this->DisableWidget(ORDER_WIDGET_FULL_LOAD);
 
			this->DisableWidget(ORDER_WIDGET_UNLOAD);
 
			this->DisableWidget(ORDER_WIDGET_REFIT_DROPDOWN);
 
		} else {
 
			this->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load
 
			this->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD,    (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload
 
@@ -957,12 +1023,16 @@ public:
 
						train_row_sel->SetDisplayedPlane(DP_GROUNDVEHICLE_ROW_NORMAL);
 
						left_sel->SetDisplayedPlane(DP_LEFT_LOAD);
 
						middle_sel->SetDisplayedPlane(DP_MIDDLE_UNLOAD);
 
						right_sel->SetDisplayedPlane(DP_RIGHT_EMPTY);
 
						right_sel->SetDisplayedPlane(DP_RIGHT_REFIT);
 
						this->EnableWidget(ORDER_WIDGET_NON_STOP);
 
						this->SetWidgetLoweredState(ORDER_WIDGET_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
					}
 
					this->SetWidgetLoweredState(ORDER_WIDGET_FULL_LOAD, order->GetLoadType() == OLF_FULL_LOAD_ANY);
 
					this->SetWidgetLoweredState(ORDER_WIDGET_UNLOAD, order->GetUnloadType() == OUFB_UNLOAD);
 

	
 
					/* Can only do refitting when stopping at the destination and loading cargo. */
 
					this->SetWidgetDisabledState(ORDER_WIDGET_REFIT_DROPDOWN, !this->can_do_autorefit || order->GetLoadType() == OLFB_NO_LOAD || order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION);
 

	
 
					break;
 

	
 
				case OT_GOTO_WAYPOINT:
 
@@ -978,6 +1048,7 @@ public:
 
					}
 
					this->DisableWidget(ORDER_WIDGET_FULL_LOAD);
 
					this->DisableWidget(ORDER_WIDGET_UNLOAD);
 
					this->DisableWidget(ORDER_WIDGET_REFIT_DROPDOWN);
 
					break;
 

	
 
				case OT_GOTO_DEPOT:
 
@@ -1024,6 +1095,7 @@ public:
 
					}
 
					this->DisableWidget(ORDER_WIDGET_FULL_LOAD);
 
					this->DisableWidget(ORDER_WIDGET_UNLOAD);
 
					this->DisableWidget(ORDER_WIDGET_REFIT_DROPDOWN);
 
					break;
 
			}
 
		}
 
@@ -1220,7 +1292,7 @@ public:
 
				break;
 

	
 
			case ORDER_WIDGET_REFIT:
 
				this->OrderClick_Refit(0);
 
				this->OrderClick_Refit(0, false);
 
				break;
 

	
 
			case ORDER_WIDGET_SERVICE:
 
@@ -1231,6 +1303,14 @@ public:
 
				}
 
				break;
 

	
 
			case ORDER_WIDGET_REFIT_DROPDOWN:
 
				if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
					this->OrderClick_Refit(0, true);
 
				} else {
 
					ShowDropDownMenu(this, _order_refit_action_dropdown, 0, ORDER_WIDGET_REFIT_DROPDOWN, 0, 0);
 
				}
 
				break;
 

	
 
			case ORDER_WIDGET_TIMETABLE_VIEW:
 
				ShowTimetableWindow(this->vehicle);
 
				break;
 
@@ -1317,6 +1397,10 @@ public:
 
				this->OrderClick_Service(index);
 
				break;
 

	
 
			case ORDER_WIDGET_REFIT_DROPDOWN:
 
				this->OrderClick_Refit(index, true);
 
				break;
 

	
 
			case ORDER_WIDGET_COND_VARIABLE:
 
				DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 20), MOF_COND_VARIABLE | index << 4,  CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER));
 
				break;
 
@@ -1505,6 +1589,8 @@ static const NWidgetPart _nested_orders_
 
				NWidget(NWID_SELECTION, INVALID_COLOUR, ORDER_WIDGET_SEL_TOP_RIGHT),
 
					NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_EMPTY), SetMinimalSize(93, 12), SetFill(1, 0),
 
															SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0),
 
					NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_REFIT_DROPDOWN), SetMinimalSize(93, 12), SetFill(1, 0),
 
															SetDataTip(STR_ORDER_REFIT_AUTO, STR_ORDER_REFIT_AUTO_TOOLTIP), SetResize(1, 0),
 
				EndContainer(),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
@@ -1561,12 +1647,14 @@ static const NWidgetPart _nested_orders_
 
	/* First button row. */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_SELECTION, INVALID_COLOUR, ORDER_WIDGET_SEL_TOP_ROW),
 
			/* load + unload buttons. */
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_FULL_LOAD), SetMinimalSize(186, 12), SetFill(1, 0),
 
			/* Load + unload + refit buttons. */
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
 
				NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_FULL_LOAD), SetMinimalSize(124, 12), SetFill(1, 0),
 
													SetDataTip(STR_ORDER_TOGGLE_FULL_LOAD, STR_ORDER_TOOLTIP_FULL_LOAD), SetResize(1, 0),
 
				NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_UNLOAD), SetMinimalSize(186, 12), SetFill(1, 0),
 
				NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_UNLOAD), SetMinimalSize(124, 12), SetFill(1, 0),
 
													SetDataTip(STR_ORDER_TOGGLE_UNLOAD, STR_ORDER_TOOLTIP_UNLOAD), SetResize(1, 0),
 
				NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_REFIT_DROPDOWN), SetMinimalSize(124, 12), SetFill(1, 0),
 
													SetDataTip(STR_ORDER_REFIT_AUTO, STR_ORDER_REFIT_AUTO_TOOLTIP), SetResize(1, 0),
 
			EndContainer(),
 
			/* Refit + service buttons. */
 
			NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
src/vehicle_gui.cpp
Show inline comments
 
@@ -371,6 +371,7 @@ struct RefitWindow : public Window {
 
	int click_x;                 ///< Position of the first click while dragging.
 
	VehicleID selected_vehicle;  ///< First vehicle in the current selection.
 
	uint8 num_vehicles;          ///< Number of selected vehicles.
 
	bool auto_refit;             ///< Select cargo for auto-refitting.
 

	
 
	/**
 
	 * Collects all (cargo, subcargo) refit options of a vehicle chain.
 
@@ -392,6 +393,8 @@ struct RefitWindow : public Window {
 

	
 
			/* Skip this engine if it does not carry anything */
 
			if (!e->CanCarryCargo()) continue;
 
			/* Skip this engine if we build the list for auto-refitting and engine doesn't allow it. */
 
			if (this->auto_refit && !HasBit(e->info.misc_flags, EF_AUTO_REFIT)) continue;
 

	
 
			/* Loop through all cargos in the refit mask */
 
			int current_index = 0;
 
@@ -479,9 +482,10 @@ struct RefitWindow : public Window {
 
		return NULL;
 
	}
 

	
 
	RefitWindow(const WindowDesc *desc, const Vehicle *v, VehicleOrderID order) : Window()
 
	RefitWindow(const WindowDesc *desc, const Vehicle *v, VehicleOrderID order, bool auto_refit) : Window()
 
	{
 
		this->sel = -1;
 
		this->auto_refit = auto_refit;
 
		this->CreateNestedTree(desc);
 

	
 
		this->vscroll = this->GetScrollbar(VRW_SCROLLBAR);
 
@@ -587,7 +591,7 @@ struct RefitWindow : public Window {
 
	{
 
		assert(_current_company == _local_company);
 
		Vehicle *v = Vehicle::Get(this->window_number);
 
		CommandCost cost = DoCommand(v->tile, this->selected_vehicle, option->cargo | option->subtype << 8 |
 
		CommandCost cost = DoCommand(v->tile, this->selected_vehicle, option->cargo | (int)this->auto_refit << 6 | option->subtype << 8 |
 
				this->num_vehicles << 16, DC_QUERY_COST, GetCmdRefitVeh(v->type));
 

	
 
		if (cost.Failed()) return INVALID_STRING_ID;
 
@@ -910,11 +914,12 @@ static const WindowDesc _vehicle_refit_d
 
 * @param *v The vehicle to show the refit window for
 
 * @param order of the vehicle ( ? )
 
 * @param parent the parent window of the refit window
 
 * @param auto_refit Choose cargo for auto-refitting
 
 */
 
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent)
 
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit)
 
{
 
	DeleteWindowById(WC_VEHICLE_REFIT, v->index);
 
	RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order);
 
	RefitWindow *w = new RefitWindow(&_vehicle_refit_desc, v, order, auto_refit);
 
	w->parent = parent;
 
}
 

	
src/vehicle_gui.h
Show inline comments
 
@@ -19,7 +19,7 @@
 
#include "engine_type.h"
 
#include "company_type.h"
 

	
 
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent);
 
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit = false);
 

	
 
/** Constants of vehicle view widget indices */
 
enum VehicleViewWindowWidgets {
0 comments (0 inline, 0 general)