mirror of https://github.com/OpenTTD/OpenTTD
(svn r19770) -Feature: Hide all other industries when ctrl+clicking an industry type in smallmap legend.
parent
5b77a63ecf
commit
9ff8032c94
|
@ -1212,8 +1212,26 @@ public:
|
||||||
/* Check if click is on industry label*/
|
/* Check if click is on industry label*/
|
||||||
int industry_pos = (column * number_of_rows) + line;
|
int industry_pos = (column * number_of_rows) + line;
|
||||||
if (industry_pos < _smallmap_industry_count) {
|
if (industry_pos < _smallmap_industry_count) {
|
||||||
|
if (_ctrl_pressed) {
|
||||||
|
/* Disable all, except the clicked one */
|
||||||
|
bool changes = false;
|
||||||
|
for (int i = 0; i != _smallmap_industry_count; i++) {
|
||||||
|
bool new_state = i == industry_pos;
|
||||||
|
if (_legend_from_industries[i].show_on_map != new_state) {
|
||||||
|
changes = true;
|
||||||
|
_legend_from_industries[i].show_on_map = new_state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!changes) {
|
||||||
|
/* Nothing changed? Then show all (again). */
|
||||||
|
for (int i = 0; i != _smallmap_industry_count; i++) {
|
||||||
|
_legend_from_industries[i].show_on_map = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_legend_from_industries[industry_pos].show_on_map = !_legend_from_industries[industry_pos].show_on_map;
|
_legend_from_industries[industry_pos].show_on_map = !_legend_from_industries[industry_pos].show_on_map;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue