Codechange: do not hide variables with other variables

This commit is contained in:
rubidium42
2023-01-28 20:06:51 +01:00
committed by rubidium42
parent 1951af07c0
commit 6ba55e663e
30 changed files with 137 additions and 146 deletions

View File

@@ -1356,9 +1356,6 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
bool show_signs = HasBit(_display_opt, DO_SHOW_SIGNS) && !IsInvisibilitySet(TO_SIGNS);
bool show_competitors = HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS);
const BaseStation *st;
const Sign *si;
/* Collect all the items first and draw afterwards, to ensure layering */
std::vector<const BaseStation *> stations;
std::vector<const Town *> towns;
@@ -1366,34 +1363,36 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
_viewport_sign_kdtree.FindContained(search_rect.left, search_rect.top, search_rect.right, search_rect.bottom, [&](const ViewportSignKdtreeItem & item) {
switch (item.type) {
case ViewportSignKdtreeItem::VKI_STATION:
case ViewportSignKdtreeItem::VKI_STATION: {
if (!show_stations) break;
st = BaseStation::Get(item.id.station);
const BaseStation *st = BaseStation::Get(item.id.station);
/* Don't draw if station is owned by another company and competitor station names are hidden. Stations owned by none are never ignored. */
if (!show_competitors && _local_company != st->owner && st->owner != OWNER_NONE) break;
stations.push_back(st);
break;
}
case ViewportSignKdtreeItem::VKI_WAYPOINT:
case ViewportSignKdtreeItem::VKI_WAYPOINT: {
if (!show_waypoints) break;
st = BaseStation::Get(item.id.station);
const BaseStation *st = BaseStation::Get(item.id.station);
/* Don't draw if station is owned by another company and competitor station names are hidden. Stations owned by none are never ignored. */
if (!show_competitors && _local_company != st->owner && st->owner != OWNER_NONE) break;
stations.push_back(st);
break;
}
case ViewportSignKdtreeItem::VKI_TOWN:
if (!show_towns) break;
towns.push_back(Town::Get(item.id.town));
break;
case ViewportSignKdtreeItem::VKI_SIGN:
case ViewportSignKdtreeItem::VKI_SIGN: {
if (!show_signs) break;
si = Sign::Get(item.id.sign);
const Sign *si = Sign::Get(item.id.sign);
/* Don't draw if sign is owned by another company and competitor signs should be hidden.
* Note: It is intentional that also signs owned by OWNER_NONE are hidden. Bankrupt
@@ -1402,6 +1401,7 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
signs.push_back(si);
break;
}
default:
NOT_REACHED();