Departure Boards: Allow Ctrl-Click on vehicle type buttons to show type exclusively

(cherry picked from commit a834d3cd452fe28e2c32fb953d41c0bd0ce20494)

See: #36
This commit is contained in:
keldorkatarn
2018-04-10 14:49:31 +02:00
committed by Jonathan G Rennison
parent 07ca7cfb8c
commit d2ca8914ac
2 changed files with 23 additions and 9 deletions

View File

@@ -204,18 +204,32 @@ public:
case WID_DB_SHOW_TRAINS: // Show trains to this station
case WID_DB_SHOW_ROADVEHS: // Show road vehicles to this station
case WID_DB_SHOW_SHIPS: // Show ships to this station
case WID_DB_SHOW_PLANES: // Show aircraft to this station
this->show_types[widget - WID_DB_SHOW_TRAINS] = !this->show_types[widget - WID_DB_SHOW_TRAINS];
if (this->show_types[widget - WID_DB_SHOW_TRAINS]) {
this->LowerWidget(widget);
case WID_DB_SHOW_PLANES: { // Show aircraft to this station
if (_ctrl_pressed) {
for (int w = WID_DB_SHOW_TRAINS; w <= WID_DB_SHOW_PLANES; w++) {
if (w == widget) {
this->show_types[w - WID_DB_SHOW_TRAINS] = true;
this->LowerWidget(w);
} else {
this->show_types[w - WID_DB_SHOW_TRAINS] = false;
this->RaiseWidget(w);
}
}
} else {
this->RaiseWidget(widget);
this->show_types[widget - WID_DB_SHOW_TRAINS] = !this->show_types[widget - WID_DB_SHOW_TRAINS];
if (this->show_types[widget - WID_DB_SHOW_TRAINS]) {
this->LowerWidget(widget);
}
else {
this->RaiseWidget(widget);
}
}
/* We need to recompute the departures list. */
this->calc_tick_countdown = 0;
/* We need to redraw the button that was pressed. */
this->SetWidgetDirty(widget);
break;
}
case WID_DB_SHOW_DEPS:
case WID_DB_SHOW_ARRS: