Feature: Ctrl-Clicking GB_SHARED_ORDERS vehicle list opens order window

This commit is contained in:
Bernard Teo 2021-05-31 15:59:17 +08:00 committed by Patric Stout
parent ff6c934916
commit 6a6dbbaad2
2 changed files with 19 additions and 12 deletions

View File

@ -24,6 +24,7 @@
#include "core/geometry_func.hpp" #include "core/geometry_func.hpp"
#include "company_base.h" #include "company_base.h"
#include "company_gui.h" #include "company_gui.h"
#include "gui.h"
#include "widgets/group_widget.h" #include "widgets/group_widget.h"
@ -745,18 +746,20 @@ public:
NOT_REACHED(); NOT_REACHED();
} }
if (v) { if (v) {
this->vehicle_sel = v->index;
if (_ctrl_pressed) { if (_ctrl_pressed) {
if (this->grouping == GB_NONE) {
this->SelectGroup(v->group_id); this->SelectGroup(v->group_id);
} else {
ShowOrdersWindow(v);
} }
} else {
this->vehicle_sel = v->index;
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this); SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
SetMouseCursorVehicle(v, EIT_IN_LIST); SetMouseCursorVehicle(v, EIT_IN_LIST);
_cursor.vehchain = true; _cursor.vehchain = true;
this->SetDirty(); this->SetDirty();
} }
}
break; break;
} }

View File

@ -1843,11 +1843,15 @@ public:
const Vehicle *v = vehgroup.vehicles_begin[0]; const Vehicle *v = vehgroup.vehicles_begin[0];
/* We do not support VehicleClicked() here since the contextual action may only make sense for individual vehicles */ /* We do not support VehicleClicked() here since the contextual action may only make sense for individual vehicles */
if (_ctrl_pressed) {
ShowOrdersWindow(v);
} else {
if (vehgroup.NumVehicles() == 1) { if (vehgroup.NumVehicles() == 1) {
ShowVehicleViewWindow(v); ShowVehicleViewWindow(v);
} else { } else {
ShowVehicleListWindow(v); ShowVehicleListWindow(v);
} }
}
break; break;
} }