Changeset - r16721:e05d2c73492b
[Not reviewed]
master
0 2 0
planetmaker - 13 years ago 2010-12-11 13:38:35
planetmaker@openttd.org
(svn r21464) -Add: Explicitly make 'shared orders' an option in the orders menu
2 files changed with 27 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3223,7 +3223,8 @@ STR_ORDERS_GO_TO_BUTTON                 
 
STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Go to nearest depot
 
STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Go to nearest hangar
 
STR_ORDER_CONDITIONAL                                           :Conditional order jump
 
STR_ORDERS_GO_TO_TOOLTIP                                        :{BLACK}Insert a new order before the highlighted order, or add to end of list. Ctrl makes station orders 'full load any cargo', waypoint orders 'non-stop' and depot orders 'service'
 
STR_ORDER_SHARE                                                 :Share orders
 
STR_ORDERS_GO_TO_TOOLTIP                                        :{BLACK}Insert a new order before the highlighted order, or add to end of list. Ctrl makes station orders 'full load any cargo', waypoint orders 'non-stop' and depot orders 'service'. 'Share orders' lets this vehicle share orders with the selected vehicle.
 
STR_ORDERS_GO_TO_DROPDOWN_TOOLTIP                               :{BLACK}Insert an advanced order
 

	
 
STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP                  :{BLACK}Show all vehicles that share this schedule
src/order_gui.cpp
Show inline comments
 
@@ -123,6 +123,7 @@ static const StringID _order_goto_dropdo
 
	STR_ORDER_GO_TO,
 
	STR_ORDER_GO_TO_NEAREST_DEPOT,
 
	STR_ORDER_CONDITIONAL,
 
	STR_ORDER_SHARE,
 
	INVALID_STRING_ID
 
};
 

	
 
@@ -130,6 +131,7 @@ static const StringID _order_goto_dropdo
 
	STR_ORDER_GO_TO,
 
	STR_ORDER_GO_TO_NEAREST_HANGAR,
 
	STR_ORDER_CONDITIONAL,
 
	STR_ORDER_SHARE,
 
	INVALID_STRING_ID
 
};
 

	
 
@@ -438,6 +440,7 @@ private:
 
	enum OrderPlaceObjectState {
 
		OPOS_GOTO,
 
		OPOS_CONDITIONAL,
 
		OPOS_SHARE,
 
	};
 

	
 
	/** Displayed planes of the #NWID_SELECTION widgets. */
 
@@ -581,13 +584,25 @@ private:
 
	 */
 
	void OrderClick_Conditional(int i)
 
	{
 
		this->LowerWidget(ORDER_WIDGET_GOTO);
 
		this->SetWidgetDirty(ORDER_WIDGET_GOTO);
 
		this->LowerWidget(ORDER_WIDGET_GOTO);
 
		SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this);
 
		this->goto_type = OPOS_CONDITIONAL;
 
	}
 

	
 
	/**
 
	 * Handle the click on the share button.
 
	 * @param i Dummy parameter.
 
	 */
 
	void OrderClick_Share(int i)
 
	{
 
		this->LowerWidget(ORDER_WIDGET_GOTO);
 
		this->SetWidgetDirty(ORDER_WIDGET_GOTO);
 
		SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT | HT_VEHICLE, this);
 
		this->goto_type = OPOS_SHARE;
 
	}
 

	
 
	/**
 
	 * Handle the click on the unload button.
 
	 */
 
	void OrderClick_Unload(int unload_type)
 
@@ -1232,6 +1247,7 @@ public:
 
					case 0: this->OrderClick_Goto(0); break;
 
					case 1: this->OrderClick_NearestDepot(0); break;
 
					case 2: this->OrderClick_Conditional(0); break;
 
					case 3: this->OrderClick_Share(0); break;
 
					default: NOT_REACHED();
 
				}
 
				break;
 
@@ -1306,13 +1322,16 @@ public:
 

	
 
	virtual void OnVehicleSelect(const Vehicle *v)
 
	{
 
		/* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet
 
		 * obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
 
		/* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet.
 
		 * We disallow copying orders of other vehicles if we already have at least one order entry
 
		 * ourself as it easily copies orders of vehicles within a station when we mean the station.
 
		 * Obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
 
		 * TODO: give a warning message */
 
		if (this->vehicle->GetNumOrders() != 0 && _ctrl_pressed == 0) return;
 
		bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
 
		if (this->vehicle->GetNumOrders() != 0 && !share_order) return;
 

	
 
		if (DoCommandP(this->vehicle->tile, this->vehicle->index | (_ctrl_pressed ? CO_SHARE : CO_COPY) << 30, v->index,
 
				_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) {
 
		if (DoCommandP(this->vehicle->tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->index,
 
				share_order ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) {
 
			this->selected_order = -1;
 
			ResetObjectToPlace();
 
		}
0 comments (0 inline, 0 general)