Changeset - r18627:ed625b8206b5
[Not reviewed]
master
0 4 0
rubidium - 12 years ago 2011-12-10 19:20:30
rubidium@openttd.org
(svn r23484) -Fix [FS#4770]: in case you already have orders, ignore the vehicles when adding an extra order
4 files changed with 9 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/depot_gui.cpp
Show inline comments
 
@@ -838,12 +838,14 @@ struct DepotWindow : Window {
 
	/**
 
	 * Clones a vehicle
 
	 * @param v the original vehicle to clone
 
	 * @return Always true.
 
	 */
 
	virtual void OnVehicleSelect(const Vehicle *v)
 
	virtual bool OnVehicleSelect(const Vehicle *v)
 
	{
 
		if (DoCommandP(this->window_number, v->index, _ctrl_pressed ? 1 : 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), CcCloneVehicle)) {
 
			ResetObjectToPlace();
 
		}
 
		return true;
 
	}
 

	
 
	virtual void OnPlaceObjectAbort()
src/order_gui.cpp
Show inline comments
 
@@ -1466,7 +1466,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnVehicleSelect(const Vehicle *v)
 
	virtual bool OnVehicleSelect(const Vehicle *v)
 
	{
 
		/* 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
 
@@ -1474,13 +1474,14 @@ public:
 
		 * Obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
 
		 * TODO: give a warning message */
 
		bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
 
		if (this->vehicle->GetNumOrders() != 0 && !share_order) return;
 
		if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
 

	
 
		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();
 
		}
 
		return true;
 
	}
 

	
 
	virtual void OnPlaceObjectAbort()
src/vehicle_gui.cpp
Show inline comments
 
@@ -2671,8 +2671,7 @@ bool VehicleClicked(const Vehicle *v)
 
	v = v->First();
 
	if (!v->IsPrimaryVehicle()) return false;
 

	
 
	_thd.GetCallbackWnd()->OnVehicleSelect(v);
 
	return true;
 
	return _thd.GetCallbackWnd()->OnVehicleSelect(v);
 
}
 

	
 
void StopGlobalFollowVehicle(const Vehicle *v)
src/window_gui.h
Show inline comments
 
@@ -667,8 +667,9 @@ public:
 
	/**
 
	 * The user clicked on a vehicle while HT_VEHICLE has been set.
 
	 * @param v clicked vehicle. It is guaranteed to be v->IsPrimaryVehicle() == true
 
	 * @return True if the click is handled, false if it is ignored.
 
	 */
 
	virtual void OnVehicleSelect(const struct Vehicle *v) {}
 
	virtual bool OnVehicleSelect(const struct Vehicle *v) { return false; }
 

	
 
	/**
 
	 * The user cancelled a tile highlight mode that has been set.
0 comments (0 inline, 0 general)