Changeset - r27633:0683ff891bec
[Not reviewed]
master
0 1 0
Rubidium - 16 months ago 2023-06-22 18:08:06
rubidium@openttd.org
Codechange: move sign invisibility check out of loop
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/viewport.cpp
Show inline comments
 
@@ -1414,12 +1414,15 @@ static void ViewportAddKdtreeSigns(DrawP
 
		ViewportAddString(dpi, ZOOM_LVL_OUT_16X, &t->cache.sign,
 
			_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN,
 
			STR_VIEWPORT_TOWN_TINY_WHITE, STR_VIEWPORT_TOWN_TINY_BLACK,
 
			t->index, t->cache.population);
 
	}
 

	
 
	/* Do not draw signs nor station names if they are set invisible */
 
	if (IsInvisibilitySet(TO_SIGNS)) return;
 

	
 
	for (const auto *si : signs) {
 
		ViewportAddString(dpi, ZOOM_LVL_OUT_16X, &si->sign,
 
			STR_WHITE_SIGN,
 
			(IsTransparencySet(TO_SIGNS) || si->owner == OWNER_DEITY) ? STR_VIEWPORT_SIGN_SMALL_WHITE : STR_VIEWPORT_SIGN_SMALL_BLACK, STR_NULL,
 
			si->index, 0, (si->owner == OWNER_NONE) ? COLOUR_GREY : (si->owner == OWNER_DEITY ? INVALID_COLOUR : _company_colours[si->owner]));
 
	}
 
@@ -1698,15 +1701,12 @@ static void ViewportDrawStrings(ZoomLeve
 
		int h = WidgetDimensions::scaled.fullbevel.top + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom;
 

	
 
		SetDParam(0, ss.params[0]);
 
		SetDParam(1, ss.params[1]);
 

	
 
		if (ss.colour != INVALID_COLOUR) {
 
			/* Do not draw signs nor station names if they are set invisible */
 
			if (IsInvisibilitySet(TO_SIGNS) && ss.string != STR_WHITE_SIGN) continue;
 

	
 
			if (IsTransparencySet(TO_SIGNS) && ss.string != STR_WHITE_SIGN) {
 
				/* Don't draw the rectangle.
 
				 * Real colours need the TC_IS_PALETTE_COLOUR flag.
 
				 * Otherwise colours from _string_colourmap are assumed. */
 
				colour = (TextColour)_colour_gradient[ss.colour][6] | TC_IS_PALETTE_COLOUR;
 
			} else {
0 comments (0 inline, 0 general)