summaryrefslogtreecommitdiff
path: root/src/company_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-02-26 06:45:14 +0000
committerNiels Martin Hansen <nielsm@indvikleren.dk>2019-02-26 11:20:23 +0100
commit7ac17f5ae4576a11d1f16281b656ffcd463ab5ac (patch)
tree68b9ac881053ccfa18eba9655b249be359dded4c /src/company_gui.cpp
parentc2e4a8c9bf6c2e7ceaddb13001adab5b1db916ab (diff)
downloadopenttd-7ac17f5ae4576a11d1f16281b656ffcd463ab5ac.tar.xz
Fix #7281: Unable to select last group in open livery window on group creation.
Diffstat (limited to 'src/company_gui.cpp')
-rw-r--r--src/company_gui.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 5a751a363..143fa0ab8 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -1025,9 +1025,15 @@ public:
if (data != -1) {
/* data contains a VehicleType, rebuild list if it displayed */
if (this->livery_class == data + LC_GROUP_RAIL) {
- if (!Group::IsValidID(this->sel)) this->sel = INVALID_GROUP;
this->groups.ForceRebuild();
this->BuildGroupList((CompanyID)this->window_number);
+ this->SetRows();
+
+ if (!Group::IsValidID(this->sel)) {
+ this->sel = INVALID_GROUP;
+ if (this->groups.Length() > 0) this->sel = this->groups[0]->index;
+ }
+
this->SetDirty();
}
return;