mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
(svn r23484) -Fix [FS#4770]: in case you already have orders, ignore the vehicles when adding an extra order
This commit is contained in:
parent
d800fcae1d
commit
b5a2183214
@ -838,12 +838,14 @@ struct DepotWindow : Window {
|
|||||||
/**
|
/**
|
||||||
* Clones a vehicle
|
* Clones a vehicle
|
||||||
* @param v the original vehicle to clone
|
* @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)) {
|
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();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlaceObjectAbort()
|
virtual void OnPlaceObjectAbort()
|
||||||
|
@ -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.
|
/* 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
|
* 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
|
* Obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
|
||||||
* TODO: give a warning message */
|
* TODO: give a warning message */
|
||||||
bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
|
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,
|
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))) {
|
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;
|
this->selected_order = -1;
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlaceObjectAbort()
|
virtual void OnPlaceObjectAbort()
|
||||||
|
@ -2671,8 +2671,7 @@ bool VehicleClicked(const Vehicle *v)
|
|||||||
v = v->First();
|
v = v->First();
|
||||||
if (!v->IsPrimaryVehicle()) return false;
|
if (!v->IsPrimaryVehicle()) return false;
|
||||||
|
|
||||||
_thd.GetCallbackWnd()->OnVehicleSelect(v);
|
return _thd.GetCallbackWnd()->OnVehicleSelect(v);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopGlobalFollowVehicle(const Vehicle *v)
|
void StopGlobalFollowVehicle(const Vehicle *v)
|
||||||
|
@ -667,8 +667,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* The user clicked on a vehicle while HT_VEHICLE has been set.
|
* The user clicked on a vehicle while HT_VEHICLE has been set.
|
||||||
* @param v clicked vehicle. It is guaranteed to be v->IsPrimaryVehicle() == true
|
* @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.
|
* The user cancelled a tile highlight mode that has been set.
|
||||||
|
Loading…
Reference in New Issue
Block a user