summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-12-09 16:54:02 +0000
committerfrosch <frosch@openttd.org>2012-12-09 16:54:02 +0000
commit8872ed12ff6631a36a306f63227b30b9bb50cac3 (patch)
tree6f594a1c92c9b845eaae611f8931967170418cc5
parent870eab53d27b4938115c02a040091e0d7353db7d (diff)
downloadopenttd-8872ed12ff6631a36a306f63227b30b9bb50cac3.tar.xz
(svn r24808) -Feature(ette) [FS#4458]: When share-cloning vehicles don't open the vehicle window of the new vehicle. The only reasonable thing to do with the new vehicle is to start it, which can also be done via the depot GUI.
-rw-r--r--src/depot_gui.cpp3
-rw-r--r--src/vehicle_gui.cpp6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 25d36b690..106d9c95f 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -821,7 +821,8 @@ struct DepotWindow : Window {
*/
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)) {
+ /* Suppress the vehicle GUI when share-cloning. There is no point to it, starting vehicles can also be done via the depot GUI. */
+ if (DoCommandP(this->window_number, v->index, _ctrl_pressed ? 1 : 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), _ctrl_pressed ? NULL : CcCloneVehicle)) {
ResetObjectToPlace();
}
return true;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index f64a3cc47..19cc7d217 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -2525,9 +2525,13 @@ public:
ShowVehicleDetailsWindow(v);
break;
case WID_VV_CLONE: // clone vehicle
+ /* Suppress the vehicle GUI when share-cloning.
+ * There is no point to it except for starting the vehicle.
+ * For starting the vehicle the player has to open the depot GUI, which is
+ * most likely already open, but is also visible in the vehicle viewport. */
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0,
_vehicle_command_translation_table[VCT_CMD_CLONE_VEH][v->type],
- CcCloneVehicle);
+ _ctrl_pressed ? NULL : CcCloneVehicle);
break;
case WID_VV_TURN_AROUND: // turn around
assert(v->IsGroundVehicle());