From c2785be685716fc47b089e46d37afcfab08e1ff4 Mon Sep 17 00:00:00 2001 From: Andreas Schmitt Date: Sun, 20 Jun 2021 10:22:43 +0200 Subject: [PATCH] Make old group creation methods consistent with new one by calling the same command --- src/order_gui.cpp | 4 ++-- src/vehicle_gui.cpp | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/order_gui.cpp b/src/order_gui.cpp index c8c446df81..6aec110b13 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -2552,8 +2552,8 @@ public: break; case WID_O_ADD_VEH_GROUP: { - this->query_text_widget = WID_O_ADD_VEH_GROUP; - ShowQueryString(STR_EMPTY, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + this->SetDirty(); + DoCommandP(0, this->vehicle->index | 0,0 , CMD_CREATE_GROUP_AUTO_NAME, nullptr, nullptr); break; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 9b7fabffee..195cbd3157 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2346,7 +2346,11 @@ public: break; case ADI_CREATE_GROUP: - ShowQueryString(STR_EMPTY, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + if (!this->vehicles.empty()) { + const VehicleID vindex = (*this->vehicles.begin())->index; + this->SetDirty(); + DoCommandP(0, vindex | (1 << 31),0 , CMD_CREATE_GROUP_AUTO_NAME, nullptr, nullptr); + } break; case ADI_TRACERESTRICT_SLOT_MGMT: {