@ -112,11 +112,11 @@ static const int MAX_TILE_EXTENT_TOP = ZOOM_LVL_BASE * MAX_BUILDING_PIXELS;
static const int MAX_TILE_EXTENT_BOTTOM = ZOOM_LVL_BASE * ( TILE_PIXELS + 2 * TILE_HEIGHT ) ; ///< Maximum bottom extent of tile relative to north corner (worst case: #SLOPE_STEEP_N).
struct StringSpriteToDraw {
StringID string ;
std : : string string ;
StringID string_id ;
Colours colour ;
int32 x ;
int32 y ;
uint64 params [ 2 ] ;
uint16 width ;
} ;
@ -849,15 +849,14 @@ void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool tran
_vd . last_child = & cs . next ;
}
static void AddStringToDraw ( int x , int y , StringID string , uint64 params_1 , uint64 params_2 , Colours colour , uint16 width )
static void AddStringToDraw ( int x , int y , StringID string , Colours colour , uint16 width )
{
assert ( width ! = 0 ) ;
StringSpriteToDraw & ss = _vd . string_sprites_to_draw . emplace_back ( ) ;
ss . string = string ;
ss . string = GetString ( string ) ;
ss . string_id = string ;
ss . x = x ;
ss . y = y ;
ss . params [ 0 ] = params_1 ;
ss . params [ 1 ] = params_2 ;
ss . width = width ;
ss . colour = colour ;
}
@ -1297,7 +1296,7 @@ static void ViewportAddLandscape()
* @ param string_small_shadow Shadow string for 4 x and 8 x zoom level ; or # STR_NULL if no shadow
* @ param colour colour of the sign background ; or INVALID_COLOUR if transparent
*/
void ViewportAddString ( const DrawPixelInfo * dpi , ZoomLevel small_from , const ViewportSign * sign , StringID string_normal , StringID string_small , StringID string_small_shadow , uint64 params_1 , uint64 params_2 , Colours colour )
void ViewportAddString ( const DrawPixelInfo * dpi , ZoomLevel small_from , const ViewportSign * sign , StringID string_normal , StringID string_small , StringID string_small_shadow , Colours colour )
{
bool small = dpi - > zoom > = small_from ;
@ -1317,15 +1316,14 @@ void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const Vie
}
if ( ! small ) {
AddStringToDraw ( sign - > center - sign_half_width , sign - > top , string_normal , params_1, params_2 , colour, sign - > width_normal ) ;
AddStringToDraw ( sign - > center - sign_half_width , sign - > top , string_normal , colour, sign - > width_normal ) ;
} else {
int shadow_offset = 0 ;
if ( string_small_shadow ! = STR_NULL ) {
shadow_offset = 4 ;
AddStringToDraw ( sign - > center - sign_half_width + shadow_offset , sign - > top , string_small_shadow , params_1, params_2 , INVALID_COLOUR, sign - > width_small | 0x8000 ) ;
AddStringToDraw ( sign - > center - sign_half_width + shadow_offset , sign - > top , string_small_shadow , INVALID_COLOUR, sign - > width_small | 0x8000 ) ;
}
AddStringToDraw ( sign - > center - sign_half_width , sign - > top - shadow_offset , string_small , params_1 , params_2 ,
colour , sign - > width_small | 0x8000 ) ;
AddStringToDraw ( sign - > center - sign_half_width , sign - > top - shadow_offset , string_small , colour , sign - > width_small | 0x8000 ) ;
}
}
@ -1411,33 +1409,37 @@ static void ViewportAddKdtreeSigns(DrawPixelInfo *dpi)
/* Layering order (bottom to top): Town names, signs, stations */
for ( const auto * t : towns ) {
SetDParam ( 0 , t - > index ) ;
SetDParam ( 1 , t - > cache . population ) ;
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 ) ;
STR_VIEWPORT_TOWN_TINY_WHITE , STR_VIEWPORT_TOWN_TINY_BLACK ) ;
}
/* Do not draw signs nor station names if they are set invisible */
if ( IsInvisibilitySet ( TO_SIGNS ) ) return ;
for ( const auto * si : signs ) {
SetDParam ( 0 , si - > index ) ;
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 ] ) ) ;
( si - > owner = = OWNER_NONE ) ? COLOUR_GREY : ( si - > owner = = OWNER_DEITY ? INVALID_COLOUR : _company_colours [ si - > owner ] ) ) ;
}
for ( const auto * st : stations ) {
SetDParam ( 0 , st - > index ) ;
SetDParam ( 1 , st - > facilities ) ;
if ( Station : : IsExpected ( st ) ) {
/* Station */
ViewportAddString ( dpi , ZOOM_LVL_OUT_16X , & st - > sign ,
STR_VIEWPORT_STATION , STR_VIEWPORT_STATION_TINY , STR_NULL ,
st - > index , st - > facilities , ( st - > owner = = OWNER_NONE | | ! st - > IsInUse ( ) ) ? COLOUR_GREY : _company_colours [ st - > owner ] ) ;
( st - > owner = = OWNER_NONE | | ! st - > IsInUse ( ) ) ? COLOUR_GREY : _company_colours [ st - > owner ] ) ;
} else {
/* Waypoint */
ViewportAddString ( dpi , ZOOM_LVL_OUT_16X , & st - > sign ,
STR_VIEWPORT_WAYPOINT , STR_VIEWPORT_WAYPOINT_TINY , STR_NULL ,
st - > index , st - > facilities , ( st - > owner = = OWNER_NONE | | ! st - > IsInUse ( ) ) ? COLOUR_GREY : _company_colours [ st - > owner ] ) ;
( st - > owner = = OWNER_NONE | | ! st - > IsInUse ( ) ) ? COLOUR_GREY : _company_colours [ st - > owner ] ) ;
}
}
}
@ -1700,11 +1702,8 @@ static void ViewportDrawStrings(ZoomLevel zoom, const StringSpriteToDrawVector *
int y = UnScaleByZoom ( ss . y , zoom ) ;
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 ) {
if ( IsTransparencySet ( TO_SIGNS ) & & ss . string ! = STR_WHITE_SIGN ) {
if ( IsTransparencySet ( TO_SIGNS ) & & ss . string_id ! = STR_WHITE_SIGN ) {
/* Don't draw the rectangle.
* Real colours need the TC_IS_PALETTE_COLOUR flag .
* Otherwise colours from _string_colourmap are assumed . */