summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Teo <btzy1996@hotmail.com>2021-05-31 15:59:17 +0800
committerPatric Stout <github@truebrain.nl>2021-09-18 11:17:49 +0200
commit6a6dbbaad2007f5a3b4b57c6b0ff44a899fb0ff8 (patch)
tree99ec4c11d636a96a1012e7664a76f015d7a97adb
parentff6c934916d4a7292f2f3abc165948a217d4c88e (diff)
downloadopenttd-6a6dbbaad2007f5a3b4b57c6b0ff44a899fb0ff8.tar.xz
Feature: Ctrl-Clicking GB_SHARED_ORDERS vehicle list opens order window
-rw-r--r--src/group_gui.cpp21
-rw-r--r--src/vehicle_gui.cpp10
2 files changed, 19 insertions, 12 deletions
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 89a89983d..bc6a9aaf2 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -24,6 +24,7 @@
#include "core/geometry_func.hpp"
#include "company_base.h"
#include "company_gui.h"
+#include "gui.h"
#include "widgets/group_widget.h"
@@ -745,17 +746,19 @@ public:
NOT_REACHED();
}
if (v) {
- this->vehicle_sel = v->index;
-
if (_ctrl_pressed) {
- this->SelectGroup(v->group_id);
+ if (this->grouping == GB_NONE) {
+ this->SelectGroup(v->group_id);
+ } else {
+ ShowOrdersWindow(v);
+ }
+ } else {
+ this->vehicle_sel = v->index;
+ SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
+ SetMouseCursorVehicle(v, EIT_IN_LIST);
+ _cursor.vehchain = true;
+ this->SetDirty();
}
-
- SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
- SetMouseCursorVehicle(v, EIT_IN_LIST);
- _cursor.vehchain = true;
-
- this->SetDirty();
}
break;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index da6e446bf..c3ae09490 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1843,10 +1843,14 @@ public:
const Vehicle *v = vehgroup.vehicles_begin[0];
/* We do not support VehicleClicked() here since the contextual action may only make sense for individual vehicles */
- if (vehgroup.NumVehicles() == 1) {
- ShowVehicleViewWindow(v);
+ if (_ctrl_pressed) {
+ ShowOrdersWindow(v);
} else {
- ShowVehicleListWindow(v);
+ if (vehgroup.NumVehicles() == 1) {
+ ShowVehicleViewWindow(v);
+ } else {
+ ShowVehicleListWindow(v);
+ }
}
break;
}