diff options
author | Alexander Weiss <ik@alexanderweiss.nl> | 2018-10-31 12:51:10 +0100 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2018-10-31 12:51:10 +0100 |
commit | b3dc90af58474e08971c9c70e0cd62bd1ed4dd88 (patch) | |
tree | 0acb89fb80c2175f1a76455dc05a6fe24f645268 /src | |
parent | 264e60529fb632ffbdd5d19a91d9b2dd03e97428 (diff) | |
download | openttd-b3dc90af58474e08971c9c70e0cd62bd1ed4dd88.tar.xz |
Change: Clone tool in depot window now behaves like clone button in vehicle window. Keep the tool active when share-cloning. Open the vehicle GUI when copy-cloning. (#6754)
Diffstat (limited to 'src')
-rw-r--r-- | src/depot_gui.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 14461d881..39accd65f 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -908,9 +908,16 @@ 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)) { - ResetObjectToPlace(); + if (_ctrl_pressed) { + /* Share-clone, do not open new viewport, and keep tool active */ + DoCommandP(this->window_number, v->index, 1, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), NULL); + } else { + /* Copy-clone, open viewport for new vehicle, and deselect the tool (assume player wants to changs things on new vehicle) */ + if (DoCommandP(this->window_number, v->index, 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), CcCloneVehicle)) { + ResetObjectToPlace(); + } } + return true; } |