From a857ed824071b1b0123bbe2cbd56218f79d01bf4 Mon Sep 17 00:00:00 2001 From: translators Date: Tue, 20 Dec 2022 18:41:59 +0000 Subject: [PATCH 01/15] Update: Translations from eints finnish: 13 changes by hpiirai spanish: 1 change by MontyMontana --- src/lang/finnish.txt | 26 +++++++++++++------------- src/lang/spanish.txt | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index bf330bd18f..ac7410a938 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -509,8 +509,8 @@ STR_ABOUT_MENU_SCREENSHOT :Kuvakaappaus STR_ABOUT_MENU_SHOW_FRAMERATE :Näytä kuvataajuus STR_ABOUT_MENU_ABOUT_OPENTTD :Tietoja OpenTTD:stä STR_ABOUT_MENU_SPRITE_ALIGNER :Sprite-kohdistaja -STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :Reunat päälle/pois -STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :Likaisten ruutujen värjäys päälle/pois +STR_ABOUT_MENU_TOGGLE_BOUNDING_BOXES :Rajakehikot päälle/pois +STR_ABOUT_MENU_TOGGLE_DIRTY_BLOCKS :Likaisten lohkojen värjäys päälle/pois # Place in highscore window ###length 15 @@ -1898,9 +1898,9 @@ STR_CONFIG_SETTING_ZOOM_LVL_OUT_8X :8x STR_CONFIG_SETTING_SPRITE_ZOOM_MIN :Korkein käytettävä sprite-resoluutio: {STRING} STR_CONFIG_SETTING_SPRITE_ZOOM_MIN_HELPTEXT :Rajoita suurinta spriteille käytettävää resoluutiota. Resoluution rajoittaminen estää korkean tarkkuuden grafiikoiden käyttämisen vaikka niitä olisi saatavilla. Tämä voi auttaa pitämään pelin ulkoasun yhtenäisenä käytettäessä sekaisin GRF-tiedostoja, joista osalla on ja osalla ei ole korkean tarkkuuden grafiikoita. ###length 3 -STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_MIN :4x -STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_IN_2X :2x -STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_NORMAL :1x +STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_MIN :4× +STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_IN_2X :2× +STR_CONFIG_SETTING_SPRITE_ZOOM_LVL_NORMAL :1× STR_CONFIG_SETTING_TOWN_GROWTH :Kuntien kasvunopeus: {STRING} STR_CONFIG_SETTING_TOWN_GROWTH_HELPTEXT :Kunnan kasvunopeus @@ -2048,7 +2048,7 @@ STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... ohit STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ohitetaan äänipaketti ”{STRING}”: ei löydetty STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ohitetaan musiikkipaketti ”{STRING}”: ei löydetty STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Muisti lopussa -STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}{BYTES} sprite-välimuistin varaaminen epäonnistui. Sprite-välimuistin kooksi valittiin {BYTES}. Tämä heikentää OpenTTD:n suorituskykyä. Vähentääksesi muistivaatimuksia voit kokeilla poistaa käytöstä 32bpp-grafiikat ja/tai lähennystasoja +STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}{BYTES} sprite-välimuistin varaaminen epäonnistui. Sprite-välimuistin kooksi valittiin {BYTES}. Tämä heikentää OpenTTD:n suorituskykyä. Vähentääksesi muistivaatimuksia voit kokeilla poistaa käytöstä 32 bpp -grafiikat ja/tai lähennystasoja # Video initalization errors STR_VIDEO_DRIVER_ERROR :{WHITE}Virhe näyttöasetuksissa… @@ -3318,12 +3318,12 @@ STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF m # Sprite aligner window STR_SPRITE_ALIGNER_CAPTION :{WHITE}Kohdistetaan spriteä {COMMA} ({STRING}) STR_SPRITE_ALIGNER_NEXT_BUTTON :{BLACK}Seuraava sprite -STR_SPRITE_ALIGNER_NEXT_TOOLTIP :{BLACK}Mene seuraavaan tavalliseen spriteen ja hyppää yli pseudo-/uudelleenväritetyt/fontti- spritet ja mene alkuun kun päästään viimeiseen +STR_SPRITE_ALIGNER_NEXT_TOOLTIP :{BLACK}Siirry seuraavaan tavalliseen spriteen; mahdolliset pseudo-, uudelleenväritys- ja fonttispritet ohitetaan; viimeisen spriten jälkeen siirrytään ensimmäiseen STR_SPRITE_ALIGNER_GOTO_BUTTON :{BLACK}Mene spriteen -STR_SPRITE_ALIGNER_GOTO_TOOLTIP :{BLACK}Mene valittuun spriteen. Jos sprite ei ole tavallinen, jatka seuraavaan tavalliseen spriteen -STR_SPRITE_ALIGNER_PREVIOUS_BUTTON :{BLACK}Edelinen sprite +STR_SPRITE_ALIGNER_GOTO_TOOLTIP :{BLACK}Siirry valittuun spriteen. Jos sprite ei ole tavallinen, jatka seuraavaan tavalliseen spriteen +STR_SPRITE_ALIGNER_PREVIOUS_BUTTON :{BLACK}Edellinen sprite STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP :{BLACK}Jatka edelliseen tavalliseen spriteen ja hyppää yli kaikki pseudo-/uudelleenväritetyt/fontti- spritet ja mene loppuun kun päästään ensimmäiseen -STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Valitun spriten näyttö. Sijaintia ei huomioida spriteä piirrettäessä +STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Valitun spriten esitys. Siirrosta ei huomioida tätä spriteä piirrettäessä STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Liikuta spriteä ympäriinsä, muuttaen X- ja Y-sijainteja. Ctrl+napsautus siirtää spriteä kahdeksan yksikköä kerralla. ###length 2 @@ -3333,9 +3333,9 @@ STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Sprite k STR_SPRITE_ALIGNER_CROSSHAIR :{BLACK}Hiusristikko STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Nollaa suhteelliset -STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Nollaa suhteelliset erotukset -STR_SPRITE_ALIGNER_OFFSETS_ABS :{BLACK}X-erotus: {NUM}, Y-erotus: {NUM} (absoluuttinen) -STR_SPRITE_ALIGNER_OFFSETS_REL :{BLACK}X-erotus: {NUM}, Y-erotus: {NUM} (suhteellinen) +STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Nollaa tämänhetkiset suhteelliset siirrokset +STR_SPRITE_ALIGNER_OFFSETS_ABS :{BLACK}X-siirros: {NUM}, Y-siirros: {NUM} (absoluuttinen) +STR_SPRITE_ALIGNER_OFFSETS_REL :{BLACK}X-siirros: {NUM}, Y-siirros: {NUM} (suhteellinen) STR_SPRITE_ALIGNER_PICKER_BUTTON :{BLACK}Valitse sprite STR_SPRITE_ALIGNER_PICKER_TOOLTIP :{BLACK}Valitse sprite ruudulta diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 71b02427b8..2824968d79 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -1069,7 +1069,7 @@ STR_CURRENCY_SET_CUSTOM_CURRENCY_TO_EURO_TOOLTIP :{BLACK}Configur STR_CURRENCY_DECREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP :{BLACK}Cambia al Euro antes STR_CURRENCY_INCREASE_CUSTOM_CURRENCY_TO_EURO_TOOLTIP :{BLACK}Cambia al Euro después -STR_CURRENCY_PREVIEW :{LTBLUE}Previa: {ORANGE}{CURRENCY_LONG} +STR_CURRENCY_PREVIEW :{LTBLUE}Vista preliminar: {ORANGE} {CURRENCY_LONG} STR_CURRENCY_CUSTOM_CURRENCY_PREVIEW_TOOLTIP :{BLACK}10000 Libras(£) en tu moneda STR_CURRENCY_CHANGE_PARAMETER :{BLACK}Cambiar parámetro de moneda personalizada From c179c10048349d067f0a4614ee7e0a4ee4a684f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guilloux?= Date: Wed, 21 Dec 2022 02:37:59 +0100 Subject: [PATCH 02/15] Fix #10263, ccefa76: [scripts] restore tile validation for commands (#10269) --- regression/regression/main.nut | 1 + regression/regression/result.txt | 1 + src/script/api/script_object.hpp | 3 +++ 3 files changed, 5 insertions(+) diff --git a/regression/regression/main.nut b/regression/regression/main.nut index 5aafaa4e71..7621c49c6f 100644 --- a/regression/regression/main.nut +++ b/regression/regression/main.nut @@ -1703,6 +1703,7 @@ function Regression::Vehicle() print(" BuildVehicle(): " + AIVehicle.BuildVehicle(33417, 153)); print(" IsValidVehicle(12): " + AIVehicle.IsValidVehicle(12)); print(" CloneVehicle(): " + AIVehicle.CloneVehicle(33417, 12, true)); + print(" BuildVehicle(): " + AIVehicle.BuildVehicle(-1, 153)); local bank_after = AICompany.GetBankBalance(AICompany.COMPANY_SELF); diff --git a/regression/regression/result.txt b/regression/regression/result.txt index d9b946f71a..dc3e294844 100644 --- a/regression/regression/result.txt +++ b/regression/regression/result.txt @@ -9295,6 +9295,7 @@ ERROR: IsEnd() is invalid as Begin() is never called BuildVehicle(): 12 IsValidVehicle(12): true CloneVehicle(): 13 + BuildVehicle(): 1048575 --Accounting-- GetCosts(): 11894 Should be: 11894 diff --git a/src/script/api/script_object.hpp b/src/script/api/script_object.hpp index 5fffe783b2..96c78acb7f 100644 --- a/src/script/api/script_object.hpp +++ b/src/script/api/script_object.hpp @@ -333,6 +333,9 @@ bool ScriptObject::ScriptDoCommandHelper tile = std::get<0>(args); } + /* Do not even think about executing out-of-bounds tile-commands. */ + if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (GetCommandFlags() & CMD_ALL_TILES) == 0))) return false; + /* Only set ClientID parameters when the command does not come from the network. */ if constexpr ((::GetCommandFlags() & CMD_CLIENT_ID) != 0) ScriptObjectInternal::SetClientIds(args, std::index_sequence_for{}); From f6e7e44169d750ea2e594d5c088304a1c7701379 Mon Sep 17 00:00:00 2001 From: PeterN Date: Wed, 21 Dec 2022 22:21:50 +0000 Subject: [PATCH 03/15] Fix #10151: Use smaller padding for viewport signs. (#10272) Before variable-scaling, the padding was always 1x1 pixel. This was changed to be scaled, except using the wrong dimension of 2x1 pixels instead of 1x1 pixel. --- src/viewport.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/viewport.cpp b/src/viewport.cpp index 341bace7fa..5a71aa1119 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1301,7 +1301,7 @@ void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const Vie int right = left + dpi->width; int bottom = top + dpi->height; - int sign_height = ScaleByZoom(WidgetDimensions::scaled.framerect.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.framerect.bottom, dpi->zoom); + int sign_height = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.fullbevel.bottom, dpi->zoom); int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, dpi->zoom); if (bottom < sign->top || @@ -1329,8 +1329,8 @@ static Rect ExpandRectWithViewportSignMargins(Rect r, ZoomLevel zoom) /* Pessimistically always use normal font, but also assume small font is never larger in either dimension */ const int fh = FONT_HEIGHT_NORMAL; const int max_tw = _viewport_sign_maxwidth / 2 + 1; - const int expand_y = ScaleByZoom(WidgetDimensions::scaled.framerect.top + fh + WidgetDimensions::scaled.framerect.bottom, zoom); - const int expand_x = ScaleByZoom(WidgetDimensions::scaled.framerect.left + max_tw + WidgetDimensions::scaled.framerect.right, zoom); + const int expand_y = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + fh + WidgetDimensions::scaled.fullbevel.bottom, zoom); + const int expand_x = ScaleByZoom(WidgetDimensions::scaled.fullbevel.left + max_tw + WidgetDimensions::scaled.fullbevel.right, zoom); r.left -= expand_x; r.right += expand_x; @@ -1451,14 +1451,14 @@ void ViewportSign::UpdatePosition(int center, int top, StringID str, StringID st char buffer[DRAW_STRING_BUFFER]; GetString(buffer, str, lastof(buffer)); - this->width_normal = WidgetDimensions::scaled.framerect.left + Align(GetStringBoundingBox(buffer).width, 2) + WidgetDimensions::scaled.framerect.right; + this->width_normal = WidgetDimensions::scaled.fullbevel.left + Align(GetStringBoundingBox(buffer).width, 2) + WidgetDimensions::scaled.fullbevel.right; this->center = center; /* zoomed out version */ if (str_small != STR_NULL) { GetString(buffer, str_small, lastof(buffer)); } - this->width_small = WidgetDimensions::scaled.framerect.left + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + WidgetDimensions::scaled.framerect.right; + this->width_small = WidgetDimensions::scaled.fullbevel.left + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + WidgetDimensions::scaled.fullbevel.right; this->MarkDirty(); } @@ -1478,7 +1478,7 @@ void ViewportSign::MarkDirty(ZoomLevel maxzoom) const zoomlevels[zoom].left = this->center - ScaleByZoom(this->width_normal / 2 + 1, zoom); zoomlevels[zoom].top = this->top - ScaleByZoom(1, zoom); zoomlevels[zoom].right = this->center + ScaleByZoom(this->width_normal / 2 + 1, zoom); - zoomlevels[zoom].bottom = this->top + ScaleByZoom(WidgetDimensions::scaled.framerect.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.framerect.bottom + 1, zoom); + zoomlevels[zoom].bottom = this->top + ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.fullbevel.bottom + 1, zoom); } for (const Window *w : Window::Iterate()) { @@ -1688,7 +1688,7 @@ static void ViewportDrawStrings(ZoomLevel zoom, const StringSpriteToDrawVector * int w = GB(ss.width, 0, 15); int x = UnScaleByZoom(ss.x, zoom); int y = UnScaleByZoom(ss.y, zoom); - int h = WidgetDimensions::scaled.framerect.top + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.framerect.bottom; + 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]); @@ -1712,7 +1712,7 @@ static void ViewportDrawStrings(ZoomLevel zoom, const StringSpriteToDrawVector * } } - DrawString(x + WidgetDimensions::scaled.framerect.left, x + w - 1 - WidgetDimensions::scaled.framerect.right, y + WidgetDimensions::scaled.framerect.top, ss.string, colour, SA_HOR_CENTER); + DrawString(x + WidgetDimensions::scaled.fullbevel.left, x + w - 1 - WidgetDimensions::scaled.fullbevel.right, y + WidgetDimensions::scaled.fullbevel.top, ss.string, colour, SA_HOR_CENTER); } } @@ -2131,7 +2131,7 @@ static bool CheckClickOnViewportSign(const Viewport *vp, int x, int y, const Vie { bool small = (vp->zoom >= ZOOM_LVL_OUT_16X); int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, vp->zoom); - int sign_height = ScaleByZoom(WidgetDimensions::scaled.framerect.top + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.framerect.bottom, vp->zoom); + int sign_height = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + (small ? FONT_HEIGHT_SMALL : FONT_HEIGHT_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom, vp->zoom); return y >= sign->top && y < sign->top + sign_height && x >= sign->center - sign_half_width && x < sign->center + sign_half_width; From d4c530904c2bf4018bbbf4a2580f1c1525435414 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 22 Dec 2022 19:23:17 +0000 Subject: [PATCH 04/15] Fix #10274: Use after free when rescanning scripts with GS selected --- src/game/game_core.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/game_core.cpp b/src/game/game_core.cpp index 32ca99e6a4..9ebfbe04d7 100644 --- a/src/game/game_core.cpp +++ b/src/game/game_core.cpp @@ -199,6 +199,7 @@ InvalidateWindowData(WC_AI_LIST, 0, 1); SetWindowClassesDirty(WC_AI_DEBUG); InvalidateWindowClassesData(WC_AI_SETTINGS); + InvalidateWindowClassesData(WC_GAME_OPTIONS); } From 14c1266bbc189521c8c7a5da19e57e4e94268ed3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 22 Dec 2022 19:25:47 +0000 Subject: [PATCH 05/15] Fix: Wrong type cast for selected AI/GS script info in AIListWindow This resulted in technically undefined behaviour when listing GSs --- src/ai/ai_gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 041b9b6f10..d885de813b 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -142,11 +142,11 @@ struct AIListWindow : public Window { break; } case WID_AIL_INFO_BG: { - AIInfo *selected_info = nullptr; + ScriptInfo *selected_info = nullptr; int i = 0; for (const auto &item : *this->info_list) { i++; - if (this->selected == i - 1) selected_info = static_cast(item.second); + if (this->selected == i - 1) selected_info = static_cast(item.second); } /* Some info about the currently selected AI. */ if (selected_info != nullptr) { From 002fe67bef6221530c676e7a0fd671c697d26217 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 18 Dec 2022 12:34:14 +0000 Subject: [PATCH 06/15] Add: Optionally disable child sprites drawing relative to parent sprites offsets. --- src/viewport.cpp | 12 ++++++++++-- src/viewport_func.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/viewport.cpp b/src/viewport.cpp index 5a71aa1119..e5546fbbe8 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -134,6 +134,7 @@ struct ChildScreenSpriteToDraw { const SubSprite *sub; ///< only draw a rectangular part of the sprite int32 x; int32 y; + bool relative; int next; ///< next child to draw (-1 at the end) }; @@ -816,8 +817,10 @@ bool IsInsideRotatedRectangle(int x, int y) * @param y sprite y-offset (screen coordinates) relative to parent sprite. * @param transparent if true, switch the palette between the provided palette and the transparent palette, * @param sub Only draw a part of the sprite. + * @param scale if true, scale offsets to base zoom level. + * @param relative if true, draw sprite relative to parent sprite offsets. */ -void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent, const SubSprite *sub, bool scale) +void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent, const SubSprite *sub, bool scale, bool relative) { assert((image & SPRITE_MASK) < MAX_SPRITES); @@ -838,6 +841,7 @@ void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool tran cs.sub = sub; cs.x = scale ? x * ZOOM_LVL_BASE : x; cs.y = scale ? y * ZOOM_LVL_BASE : y; + cs.relative = relative; cs.next = -1; /* Append the sprite to the active ChildSprite list. @@ -1634,7 +1638,11 @@ static void ViewportDrawParentSprites(const ParentSpriteToSortVector *psd, const while (child_idx >= 0) { const ChildScreenSpriteToDraw *cs = csstdv->data() + child_idx; child_idx = cs->next; - DrawSpriteViewport(cs->image, cs->pal, ps->left + cs->x, ps->top + cs->y, cs->sub); + if (cs->relative) { + DrawSpriteViewport(cs->image, cs->pal, ps->left + cs->x, ps->top + cs->y, cs->sub); + } else { + DrawSpriteViewport(cs->image, cs->pal, ps->x + cs->x, ps->y + cs->y, cs->sub); + } } } } diff --git a/src/viewport_func.h b/src/viewport_func.h index e60df4d31e..16a8fdc5ec 100644 --- a/src/viewport_func.h +++ b/src/viewport_func.h @@ -51,7 +51,7 @@ void OffsetGroundSprite(int x, int y); void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub = nullptr, int extra_offs_x = 0, int extra_offs_y = 0); void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub = nullptr, int extra_offs_x = 0, int extra_offs_y = 0); void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent = false, int bb_offset_x = 0, int bb_offset_y = 0, int bb_offset_z = 0, const SubSprite *sub = nullptr); -void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent = false, const SubSprite *sub = nullptr, bool scale = true); +void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent = false, const SubSprite *sub = nullptr, bool scale = true, bool relative = true); 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 = 0, Colours colour = INVALID_COLOUR); From 138198e97197fc24620d9b1493b2d07113e3b2cf Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 18 Dec 2022 12:35:08 +0000 Subject: [PATCH 07/15] Change: Separate ground sprite from foundation sprite offsets. --- src/landscape.cpp | 18 ++++++++++-------- src/station_cmd.cpp | 2 +- src/viewport.cpp | 10 ++++++---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/landscape.cpp b/src/landscape.cpp index 6fbd0c00af..305fb2c75c 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -516,26 +516,27 @@ void DrawFoundation(TileInfo *ti, Foundation f) f == FOUNDATION_INCLINED_Y ? 16 : 1, TILE_HEIGHT, ti->z ); - OffsetGroundSprite(31, 9); + OffsetGroundSprite(0, 0); } else if (IsLeveledFoundation(f)) { AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z - TILE_HEIGHT); - OffsetGroundSprite(31, 1); + OffsetGroundSprite(0, -8); } else if (f == FOUNDATION_STEEP_LOWER) { /* one corner raised */ - OffsetGroundSprite(31, 1); + OffsetGroundSprite(0, -8); } else { /* halftile foundation */ int x_bb = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? 8 : 0); int y_bb = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? 8 : 0); AddSortableSpriteToDraw(halftile_base + highest_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, 8, 8, 7, ti->z + TILE_HEIGHT); - OffsetGroundSprite(31, 9); + Point pt = {(y_bb - x_bb) * 2, y_bb + x_bb}; + OffsetGroundSprite(-pt.x, -pt.y); } } else { if (IsLeveledFoundation(f)) { /* leveled foundation */ AddSortableSpriteToDraw(leveled_base + ti->tileh, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z); - OffsetGroundSprite(31, 1); + OffsetGroundSprite(0, -8); } else if (IsNonContinuousFoundation(f)) { /* halftile foundation */ Corner halftile_corner = GetHalftileFoundationCorner(f); @@ -543,7 +544,8 @@ void DrawFoundation(TileInfo *ti, Foundation f) int y_bb = (((halftile_corner == CORNER_S) || (halftile_corner == CORNER_E)) ? 8 : 0); AddSortableSpriteToDraw(halftile_base + halftile_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, 8, 8, 7, ti->z); - OffsetGroundSprite(31, 9); + Point pt = {(y_bb - x_bb) * 2, y_bb + x_bb}; + OffsetGroundSprite(-pt.x, -pt.y); } else if (IsSpecialRailFoundation(f)) { /* anti-zig-zag foundation */ SpriteID spr; @@ -555,7 +557,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) spr = inclined_base + 2 * GetRailFoundationCorner(f) + ((ti->tileh == SLOPE_SW || ti->tileh == SLOPE_NE) ? 1 : 0); } AddSortableSpriteToDraw(spr, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z); - OffsetGroundSprite(31, 9); + OffsetGroundSprite(0, 0); } else { /* inclined foundation */ byte inclined = GetHighestSlopeCorner(ti->tileh) * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); @@ -565,7 +567,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) f == FOUNDATION_INCLINED_Y ? 16 : 1, TILE_HEIGHT, ti->z ); - OffsetGroundSprite(31, 9); + OffsetGroundSprite(0, 0); } ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index bb107461bb..01bcc68ed8 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2921,7 +2921,7 @@ static void DrawTile_Station(TileInfo *ti) EndSpriteCombine(); } - OffsetGroundSprite(31, 1); + OffsetGroundSprite(0, -8); ti->z += ApplyPixelFoundationToSlope(FOUNDATION_LEVELED, &ti->tileh); } else { draw_default_foundation: diff --git a/src/viewport.cpp b/src/viewport.cpp index e5546fbbe8..8ce8d438b7 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -538,7 +538,7 @@ static void AddChildSpriteToFoundation(SpriteID image, PaletteID pal, const SubS int *old_child = _vd.last_child; _vd.last_child = _vd.last_foundation_child[foundation_part]; - AddChildSpriteScreen(image, pal, offs.x + extra_offs_x, offs.y + extra_offs_y, false, sub, false); + AddChildSpriteScreen(image, pal, offs.x + extra_offs_x, offs.y + extra_offs_y, false, sub, false, false); /* Switch back to last ChildSprite list */ _vd.last_child = old_child; @@ -876,16 +876,18 @@ static void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint * @param ti TileInfo Tile that is being drawn * @param z_offset Z offset relative to the groundsprite. Only used for the sprite position, not for sprite sorting. * @param foundation_part Foundation part the sprite belongs to. + * @param extra_offs_x Pixel X offset for the sprite position. + * @param extra_offs_y Pixel Y offset for the sprite position. */ -static void DrawSelectionSprite(SpriteID image, PaletteID pal, const TileInfo *ti, int z_offset, FoundationPart foundation_part) +static void DrawSelectionSprite(SpriteID image, PaletteID pal, const TileInfo *ti, int z_offset, FoundationPart foundation_part, int extra_offs_x = 0, int extra_offs_y = 0) { /* FIXME: This is not totally valid for some autorail highlights that extend over the edges of the tile. */ if (_vd.foundation[foundation_part] == -1) { /* draw on real ground */ - AddTileSpriteToDraw(image, pal, ti->x, ti->y, ti->z + z_offset); + AddTileSpriteToDraw(image, pal, ti->x, ti->y, ti->z + z_offset, nullptr, extra_offs_x, extra_offs_y); } else { /* draw on top of foundation */ - AddChildSpriteToFoundation(image, pal, nullptr, foundation_part, 0, -z_offset * ZOOM_LVL_BASE); + AddChildSpriteToFoundation(image, pal, nullptr, foundation_part, extra_offs_x, extra_offs_y - z_offset * ZOOM_LVL_BASE); } } From a971eee2e073ef674eb5d5f0124282c9f638f560 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 23 Dec 2022 14:47:11 +0000 Subject: [PATCH 08/15] Cleanup: Replace foundation drawing magic numbers. Use TILE_SIZE or TILE_HEIGHT as appropriate instead. --- src/landscape.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/landscape.cpp b/src/landscape.cpp index 305fb2c75c..a0707108a4 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -500,7 +500,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) if (!IsNonContinuousFoundation(f)) { /* Lower part of foundation */ AddSortableSpriteToDraw( - leveled_base + (ti->tileh & ~SLOPE_STEEP), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z + leveled_base + (ti->tileh & ~SLOPE_STEEP), PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z ); } @@ -512,38 +512,42 @@ void DrawFoundation(TileInfo *ti, Foundation f) byte inclined = highest_corner * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, - f == FOUNDATION_INCLINED_X ? 16 : 1, - f == FOUNDATION_INCLINED_Y ? 16 : 1, + f == FOUNDATION_INCLINED_X ? TILE_SIZE : 1, + f == FOUNDATION_INCLINED_Y ? TILE_SIZE : 1, TILE_HEIGHT, ti->z ); OffsetGroundSprite(0, 0); } else if (IsLeveledFoundation(f)) { - AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z - TILE_HEIGHT); - OffsetGroundSprite(0, -8); + AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z - TILE_HEIGHT); + OffsetGroundSprite(0, -(int)TILE_HEIGHT); } else if (f == FOUNDATION_STEEP_LOWER) { /* one corner raised */ - OffsetGroundSprite(0, -8); + OffsetGroundSprite(0, -(int)TILE_HEIGHT); } else { /* halftile foundation */ - int x_bb = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? 8 : 0); - int y_bb = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? 8 : 0); + int x_bb = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? TILE_SIZE / 2 : 0); + int y_bb = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? TILE_SIZE / 2 : 0); - AddSortableSpriteToDraw(halftile_base + highest_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, 8, 8, 7, ti->z + TILE_HEIGHT); + AddSortableSpriteToDraw(halftile_base + highest_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, TILE_SIZE / 2, TILE_SIZE / 2, TILE_HEIGHT - 1, ti->z + TILE_HEIGHT); + /* Reposition ground sprite back to original position after bounding box change above. This is similar to + * RemapCoords() but without zoom scaling. */ Point pt = {(y_bb - x_bb) * 2, y_bb + x_bb}; OffsetGroundSprite(-pt.x, -pt.y); } } else { if (IsLeveledFoundation(f)) { /* leveled foundation */ - AddSortableSpriteToDraw(leveled_base + ti->tileh, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z); - OffsetGroundSprite(0, -8); + AddSortableSpriteToDraw(leveled_base + ti->tileh, PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z); + OffsetGroundSprite(0, -(int)TILE_HEIGHT); } else if (IsNonContinuousFoundation(f)) { /* halftile foundation */ Corner halftile_corner = GetHalftileFoundationCorner(f); - int x_bb = (((halftile_corner == CORNER_W) || (halftile_corner == CORNER_S)) ? 8 : 0); - int y_bb = (((halftile_corner == CORNER_S) || (halftile_corner == CORNER_E)) ? 8 : 0); + int x_bb = (((halftile_corner == CORNER_W) || (halftile_corner == CORNER_S)) ? TILE_SIZE / 2 : 0); + int y_bb = (((halftile_corner == CORNER_S) || (halftile_corner == CORNER_E)) ? TILE_SIZE / 2 : 0); - AddSortableSpriteToDraw(halftile_base + halftile_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, 8, 8, 7, ti->z); + AddSortableSpriteToDraw(halftile_base + halftile_corner, PAL_NONE, ti->x + x_bb, ti->y + y_bb, TILE_SIZE / 2, TILE_SIZE / 2, TILE_HEIGHT - 1, ti->z); + /* Reposition ground sprite back to original position after bounding box change above. This is similar to + * RemapCoords() but without zoom scaling. */ Point pt = {(y_bb - x_bb) * 2, y_bb + x_bb}; OffsetGroundSprite(-pt.x, -pt.y); } else if (IsSpecialRailFoundation(f)) { @@ -556,15 +560,15 @@ void DrawFoundation(TileInfo *ti, Foundation f) /* tile-slope = sloped along X/Y, foundation-slope = three corners raised */ spr = inclined_base + 2 * GetRailFoundationCorner(f) + ((ti->tileh == SLOPE_SW || ti->tileh == SLOPE_NE) ? 1 : 0); } - AddSortableSpriteToDraw(spr, PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z); + AddSortableSpriteToDraw(spr, PAL_NONE, ti->x, ti->y, TILE_SIZE, TILE_SIZE, TILE_HEIGHT - 1, ti->z); OffsetGroundSprite(0, 0); } else { /* inclined foundation */ byte inclined = GetHighestSlopeCorner(ti->tileh) * 2 + (f == FOUNDATION_INCLINED_Y ? 1 : 0); AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, - f == FOUNDATION_INCLINED_X ? 16 : 1, - f == FOUNDATION_INCLINED_Y ? 16 : 1, + f == FOUNDATION_INCLINED_X ? TILE_SIZE : 1, + f == FOUNDATION_INCLINED_Y ? TILE_SIZE : 1, TILE_HEIGHT, ti->z ); OffsetGroundSprite(0, 0); From 7b5edba76c2a4e354901cd6f7680d2dde861b845 Mon Sep 17 00:00:00 2001 From: PeterN Date: Fri, 23 Dec 2022 21:02:14 +0000 Subject: [PATCH 09/15] Change: Support flipping shorter engines without NewGRF support. (#10262) * Change: Support flipping shorter engines without NewGRF support. * Cleanup: Remove write-only prop27_set temporary flag. --- src/engine_type.h | 2 +- src/newgrf.cpp | 9 -------- src/table/engines.h | 6 +++--- src/train.h | 1 + src/train_cmd.cpp | 52 +++++++++++++++++++++++++++++++++------------ src/vehicle_gui.cpp | 5 ++++- 6 files changed, 48 insertions(+), 27 deletions(-) diff --git a/src/engine_type.h b/src/engine_type.h index f0b6ea5450..3eccc663e1 100644 --- a/src/engine_type.h +++ b/src/engine_type.h @@ -155,7 +155,7 @@ enum EngineMiscFlags { EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle EF_USES_2CC = 1, ///< Vehicle uses two company colours EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU) - EF_RAIL_FLIPS = 3, ///< Rail vehicle can be flipped in the depot + EF_RAIL_FLIPS = 3, ///< Rail vehicle has old depot-flip handling EF_AUTO_REFIT = 4, ///< Automatic refitting is allowed EF_NO_DEFAULT_CARGO_MULTIPLIER = 5, ///< Use the new capacity algorithm. The default cargotype of the vehicle does not affect capacity multipliers. CB 15 is also called in purchase list. EF_NO_BREAKDOWN_SMOKE = 6, ///< Do not show black smoke during a breakdown. diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 09e8c6fd4e..6045a8438a 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -328,7 +328,6 @@ struct GRFTempEngineData { uint8 roadtramtype; const GRFFile *defaultcargo_grf; ///< GRF defining the cargo translation table to use if the default cargo is the 'first refittable'. Refittability refittability; ///< Did the newgrf set any refittability property? If not, default refittability will be applied. - bool prop27_set; ///< Did the NewGRF set property 27 (misc flags)? uint8 rv_max_speed; ///< Temporary storage of RV prop 15, maximum speed in mph/0.8 CargoTypes ctt_include_mask; ///< Cargo types always included in the refit mask. CargoTypes ctt_exclude_mask; ///< Cargo types always excluded from the refit mask. @@ -1295,7 +1294,6 @@ static ChangeInfoResult RailVehicleChangeInfo(uint engine, int numinfo, int prop case 0x27: // Miscellaneous flags ei->misc_flags = buf->ReadByte(); _loaded_newgrf_features.has_2CC |= HasBit(ei->misc_flags, EF_USES_2CC); - _gted[e->index].prop27_set = true; break; case 0x28: // Cargo classes allowed @@ -8985,13 +8983,6 @@ static void FinaliseEngineArray() if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue; - /* When the train does not set property 27 (misc flags), but it - * is overridden by a NewGRF graphically we want to disable the - * flipping possibility. */ - if (e->type == VEH_TRAIN && !_gted[e->index].prop27_set && e->GetGRF() != nullptr && is_custom_sprite(e->u.rail.image_index)) { - ClrBit(e->info.misc_flags, EF_RAIL_FLIPS); - } - /* Skip wagons, there livery is defined via the engine */ if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) { LiveryScheme ls = GetEngineLiveryScheme(e->index, INVALID_ENGINE, nullptr); diff --git a/src/table/engines.h b/src/table/engines.h index ab6ba77467..2a207dd760 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -24,7 +24,7 @@ * @param f Bitmask of the climates * @note the 5 between b and f is the load amount */ -#define MT(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 1 << EF_RAIL_FLIPS, 0, 0, STR_EMPTY, CARGO_AGING_TICKS } +#define MT(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS } /** * Writes the properties of a multiple-unit train into the EngineInfo struct. @@ -37,7 +37,7 @@ * @param f Bitmask of the climates * @note the 5 between b and f is the load amount */ -#define MM(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 1 << EF_RAIL_FLIPS | 1 << EF_RAIL_IS_MU, 0, 0, STR_EMPTY, CARGO_AGING_TICKS } +#define MM(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 1 << EF_RAIL_IS_MU, 0, 0, STR_EMPTY, CARGO_AGING_TICKS } /** * Writes the properties of a train carriage into the EngineInfo struct. @@ -50,7 +50,7 @@ * @see MT * @note the 5 between b and f is the load amount */ -#define MW(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 1 << EF_RAIL_FLIPS, 0, 0, STR_EMPTY, CARGO_AGING_TICKS } +#define MW(a, b, c, d, e, f) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, f, e, 0, 8, 0, 0, 0, STR_EMPTY, CARGO_AGING_TICKS } /** * Writes the properties of a road vehicle into the EngineInfo struct. diff --git a/src/train.h b/src/train.h index 1e5583ea65..4592d32bd8 100644 --- a/src/train.h +++ b/src/train.h @@ -116,6 +116,7 @@ struct Train FINAL : public GroundVehicle { int GetDisplaySpeed() const override { return this->gcache.last_speed; } int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed; } Money GetRunningCost() const override; + int GetCursorImageOffset() const; int GetDisplayImageWidth(Point *offset = nullptr) const; bool IsInDepot() const override { return this->track == TRACK_BIT_DEPOT; } bool Tick() override; diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index d9f4358691..f30e4d5f6e 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -434,6 +434,21 @@ void Train::UpdateAcceleration() this->acceleration = Clamp(power / weight * 4, 1, 255); } +int Train::GetCursorImageOffset() const +{ + if (this->gcache.cached_veh_length != 8 && HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS)) { + int reference_width = TRAININFO_DEFAULT_VEHICLE_WIDTH; + + const Engine *e = this->GetEngine(); + if (e->GetGRF() != nullptr && is_custom_sprite(e->u.rail.image_index)) { + reference_width = e->GetGRF()->traininfo_vehicle_width; + } + + return ScaleSpriteTrad((this->gcache.cached_veh_length - (int)VEHICLE_LENGTH) * reference_width / (int)VEHICLE_LENGTH); + } + return 0; +} + /** * Get the width of a train vehicle image in the GUI. * @param offset Additional offset for positioning the sprite; set to nullptr if not needed @@ -451,7 +466,11 @@ int Train::GetDisplayImageWidth(Point *offset) const } if (offset != nullptr) { - offset->x = ScaleSpriteTrad(reference_width) / 2; + if (HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS)) { + offset->x = ScaleSpriteTrad((this->gcache.cached_veh_length - VEHICLE_LENGTH / 2) * reference_width / VEHICLE_LENGTH); + } else { + offset->x = ScaleSpriteTrad(reference_width) / 2; + } offset->y = ScaleSpriteTrad(vehicle_pitch); } return ScaleSpriteTrad(this->gcache.cached_veh_length * reference_width / VEHICLE_LENGTH); @@ -1438,7 +1457,15 @@ void Train::UpdateDeltaXY() this->x_bb_offs = 0; this->y_bb_offs = 0; - if (!IsDiagonalDirection(this->direction)) { + /* Set if flipped and engine is NOT flagged with custom flip handling. */ + int flipped = HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS); + /* If flipped and vehicle length is odd, we need to adjust the bounding box offset slightly. */ + int flip_offs = flipped && (this->gcache.cached_veh_length & 1); + + Direction dir = this->direction; + if (flipped) dir = ReverseDir(dir); + + if (!IsDiagonalDirection(dir)) { static const int _sign_table[] = { /* x, y */ @@ -1448,25 +1475,25 @@ void Train::UpdateDeltaXY() 1, -1, // DIR_W }; - int half_shorten = (VEHICLE_LENGTH - this->gcache.cached_veh_length) / 2; + int half_shorten = (VEHICLE_LENGTH - this->gcache.cached_veh_length + flipped) / 2; /* For all straight directions, move the bound box to the centre of the vehicle, but keep the size. */ - this->x_offs -= half_shorten * _sign_table[this->direction]; - this->y_offs -= half_shorten * _sign_table[this->direction + 1]; - this->x_extent += this->x_bb_offs = half_shorten * _sign_table[direction]; - this->y_extent += this->y_bb_offs = half_shorten * _sign_table[direction + 1]; + this->x_offs -= half_shorten * _sign_table[dir]; + this->y_offs -= half_shorten * _sign_table[dir + 1]; + this->x_extent += this->x_bb_offs = half_shorten * _sign_table[dir]; + this->y_extent += this->y_bb_offs = half_shorten * _sign_table[dir + 1]; } else { - switch (this->direction) { + switch (dir) { /* Shorten southern corner of the bounding box according the vehicle length * and center the bounding box on the vehicle. */ case DIR_NE: - this->x_offs = 1 - (this->gcache.cached_veh_length + 1) / 2; + this->x_offs = 1 - (this->gcache.cached_veh_length + 1) / 2 + flip_offs; this->x_extent = this->gcache.cached_veh_length - 1; this->x_bb_offs = -1; break; case DIR_NW: - this->y_offs = 1 - (this->gcache.cached_veh_length + 1) / 2; + this->y_offs = 1 - (this->gcache.cached_veh_length + 1) / 2 + flip_offs; this->y_extent = this->gcache.cached_veh_length - 1; this->y_bb_offs = -1; break; @@ -1474,13 +1501,13 @@ void Train::UpdateDeltaXY() /* Move northern corner of the bounding box down according to vehicle length * and center the bounding box on the vehicle. */ case DIR_SW: - this->x_offs = 1 + (this->gcache.cached_veh_length + 1) / 2 - VEHICLE_LENGTH; + this->x_offs = 1 + (this->gcache.cached_veh_length + 1) / 2 - VEHICLE_LENGTH - flip_offs; this->x_extent = VEHICLE_LENGTH - 1; this->x_bb_offs = VEHICLE_LENGTH - this->gcache.cached_veh_length - 1; break; case DIR_SE: - this->y_offs = 1 + (this->gcache.cached_veh_length + 1) / 2 - VEHICLE_LENGTH; + this->y_offs = 1 + (this->gcache.cached_veh_length + 1) / 2 - VEHICLE_LENGTH - flip_offs; this->y_extent = VEHICLE_LENGTH - 1; this->y_bb_offs = VEHICLE_LENGTH - this->gcache.cached_veh_length - 1; break; @@ -1975,7 +2002,6 @@ CommandCost CmdReverseTrainDirection(DoCommandFlag flags, VehicleID veh_id, bool if (v->IsMultiheaded() || HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) { return_cmd_error(STR_ERROR_CAN_T_REVERSE_DIRECTION_RAIL_VEHICLE_MULTIPLE_UNITS); } - if (!HasBit(EngInfo(v->engine_type)->misc_flags, EF_RAIL_FLIPS)) return CMD_ERROR; Train *front = v->First(); /* make sure the vehicle is stopped in the depot */ diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index cb09ea86d8..a0388a6c54 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -3418,11 +3418,14 @@ void SetMouseCursorVehicle(const Vehicle *v, EngineImageType image_type) if (_cursor.sprite_count + seq.count > lengthof(_cursor.sprite_seq)) break; + int x_offs = 0; + if (v->type == VEH_TRAIN) x_offs = Train::From(v)->GetCursorImageOffset(); + for (uint i = 0; i < seq.count; ++i) { PaletteID pal2 = (v->vehstatus & VS_CRASHED) || !seq.seq[i].pal ? pal : seq.seq[i].pal; _cursor.sprite_seq[_cursor.sprite_count].sprite = seq.seq[i].sprite; _cursor.sprite_seq[_cursor.sprite_count].pal = pal2; - _cursor.sprite_pos[_cursor.sprite_count].x = rtl ? -total_width : total_width; + _cursor.sprite_pos[_cursor.sprite_count].x = rtl ? (-total_width + x_offs) : (total_width + x_offs); _cursor.sprite_pos[_cursor.sprite_count].y = y_offset; _cursor.sprite_count++; } From af3df959c2124fa988b597124c442af342e9aaeb Mon Sep 17 00:00:00 2001 From: glx22 Date: Thu, 22 Dec 2022 19:41:58 +0100 Subject: [PATCH 10/15] Codechange: reduce code duplication --- src/fontcache.cpp | 9 +-------- src/fontcache.h | 16 ++++++++++++++++ src/fontcache/freetypefontcache.cpp | 12 ++---------- src/gfx_type.h | 7 +++++++ src/os/macosx/font_osx.cpp | 15 +++------------ src/os/windows/font_win32.cpp | 15 +++------------ 6 files changed, 32 insertions(+), 42 deletions(-) diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 91dae57564..5eec40a215 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -70,16 +70,9 @@ bool GetFontAAState(FontSize size, bool check_blitter) /* AA is only supported for 32 bpp */ if (check_blitter && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 32) return false; - switch (size) { - default: NOT_REACHED(); - case FS_NORMAL: return _fcsettings.medium.aa; - case FS_SMALL: return _fcsettings.small.aa; - case FS_LARGE: return _fcsettings.large.aa; - case FS_MONO: return _fcsettings.mono.aa; - } + return GetFontCacheSubSetting(size)->aa; } - /** * (Re)initialize the font cache related things, i.e. load the non-sprite fonts. * @param monospace Whether to initialise the monospace or regular fonts. diff --git a/src/fontcache.h b/src/fontcache.h index 6cde1ab65e..7a86c137f8 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -218,6 +218,22 @@ struct FontCacheSettings { extern FontCacheSettings _fcsettings; +/** + * Get the settings of a given font size. + * @param fs The font size to look up. + * @return The settings. + */ +static inline FontCacheSubSetting *GetFontCacheSubSetting(FontSize fs) +{ + switch (fs) { + default: NOT_REACHED(); + case FS_SMALL: return &_fcsettings.small; + case FS_NORMAL: return &_fcsettings.medium; + case FS_LARGE: return &_fcsettings.large; + case FS_MONO: return &_fcsettings.mono; + } +} + void InitFontCache(bool monospace); void UninitFontCache(); bool HasAntialiasedFonts(); diff --git a/src/fontcache/freetypefontcache.cpp b/src/fontcache/freetypefontcache.cpp index 26087eee99..621b33fa9d 100644 --- a/src/fontcache/freetypefontcache.cpp +++ b/src/fontcache/freetypefontcache.cpp @@ -122,14 +122,7 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels) */ void LoadFreeTypeFont(FontSize fs) { - FontCacheSubSetting *settings = nullptr; - switch (fs) { - default: NOT_REACHED(); - case FS_SMALL: settings = &_fcsettings.small; break; - case FS_NORMAL: settings = &_fcsettings.medium; break; - case FS_LARGE: settings = &_fcsettings.large; break; - case FS_MONO: settings = &_fcsettings.mono; break; - } + FontCacheSubSetting *settings = GetFontCacheSubSetting(fs); if (settings->font.empty()) return; @@ -197,8 +190,7 @@ void LoadFreeTypeFont(FontSize fs) FT_Done_Face(face); - static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" }; - ShowInfoF("Unable to use '%s' for %s font, FreeType reported error 0x%X, using sprite font instead", font_name, SIZE_TO_NAME[fs], error); + ShowInfoF("Unable to use '%s' for %s font, FreeType reported error 0x%X, using sprite font instead", font_name, FontSizeToName(fs), error); return; found_face: diff --git a/src/gfx_type.h b/src/gfx_type.h index 932a6cb87d..8a3fc64dfd 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -214,6 +214,13 @@ enum FontSize { }; DECLARE_POSTFIX_INCREMENT(FontSize) +static inline const char *FontSizeToName(FontSize fs) +{ + static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" }; + assert(fs < FS_END); + return SIZE_TO_NAME[fs]; +} + /** * Used to only draw a part of the sprite. * Draw the subsprite in the rect (sprite_x_offset + left, sprite_y_offset + top) to (sprite_x_offset + right, sprite_y_offset + bottom). diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index 1ad4352004..4152c7da0f 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -350,16 +350,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa) */ void LoadCoreTextFont(FontSize fs) { - static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" }; - - FontCacheSubSetting *settings = nullptr; - switch (fs) { - default: NOT_REACHED(); - case FS_SMALL: settings = &_fcsettings.small; break; - case FS_NORMAL: settings = &_fcsettings.medium; break; - case FS_LARGE: settings = &_fcsettings.large; break; - case FS_MONO: settings = &_fcsettings.mono; break; - } + FontCacheSubSetting *settings = GetFontCacheSubSetting(fs); if (settings->font.empty()) return; @@ -395,7 +386,7 @@ void LoadCoreTextFont(FontSize fs) font_ref.reset((CTFontDescriptorRef)CFArrayGetValueAtIndex(descs.get(), 0)); CFRetain(font_ref.get()); } else { - ShowInfoF("Unable to load file '%s' for %s font, using default OS font selection instead", settings->font.c_str(), SIZE_TO_NAME[fs]); + ShowInfoF("Unable to load file '%s' for %s font, using default OS font selection instead", settings->font.c_str(), FontSizeToName(fs)); } } } @@ -419,7 +410,7 @@ void LoadCoreTextFont(FontSize fs) } if (!font_ref) { - ShowInfoF("Unable to use '%s' for %s font, using sprite font instead", settings->font.c_str(), SIZE_TO_NAME[fs]); + ShowInfoF("Unable to use '%s' for %s font, using sprite font instead", settings->font.c_str(), FontSizeToName(fs)); return; } diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index 52d63b6938..e6b95222d7 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -580,16 +580,7 @@ void Win32FontCache::ClearFontCache() */ void LoadWin32Font(FontSize fs) { - static const char *SIZE_TO_NAME[] = { "medium", "small", "large", "mono" }; - - FontCacheSubSetting *settings = nullptr; - switch (fs) { - case FS_SMALL: settings = &_fcsettings.small; break; - case FS_NORMAL: settings = &_fcsettings.medium; break; - case FS_LARGE: settings = &_fcsettings.large; break; - case FS_MONO: settings = &_fcsettings.mono; break; - default: NOT_REACHED(); - } + FontCacheSubSetting *settings = GetFontCacheSubSetting(fs); if (settings->font.empty()) return; @@ -647,7 +638,7 @@ void LoadWin32Font(FontSize fs) logfont.lfWeight = strcasestr(font_name, " bold") != nullptr || strcasestr(font_name, "-bold") != nullptr ? FW_BOLD : FW_NORMAL; // Poor man's way to allow selecting bold fonts. } } else { - ShowInfoF("Unable to load file '%s' for %s font, using default windows font selection instead", font_name, SIZE_TO_NAME[fs]); + ShowInfoF("Unable to load file '%s' for %s font, using default windows font selection instead", font_name, FontSizeToName(fs)); } } } @@ -659,7 +650,7 @@ void LoadWin32Font(FontSize fs) HFONT font = CreateFontIndirect(&logfont); if (font == nullptr) { - ShowInfoF("Unable to use '%s' for %s font, Win32 reported error 0x%lX, using sprite font instead", font_name, SIZE_TO_NAME[fs], GetLastError()); + ShowInfoF("Unable to use '%s' for %s font, Win32 reported error 0x%lX, using sprite font instead", font_name, FontSizeToName(fs), GetLastError()); return; } DeleteObject(font); From e6c857cdbad0d7962c69c559d93d33cd18558fd5 Mon Sep 17 00:00:00 2001 From: glx22 Date: Thu, 22 Dec 2022 19:50:05 +0100 Subject: [PATCH 11/15] Codechange: [windows] cache the actually loaded font name --- src/os/windows/font_win32.cpp | 5 +++-- src/os/windows/font_win32.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index e6b95222d7..093d466954 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -378,7 +378,6 @@ Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels) { this->dc = CreateCompatibleDC(nullptr); this->SetFontSize(fs, pixels); - this->fontname = FS2OTTD(this->logfont.lfFaceName); } Win32FontCache::~Win32FontCache() @@ -441,7 +440,9 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels) this->glyph_size.cx = otm->otmTextMetrics.tmMaxCharWidth; this->glyph_size.cy = otm->otmTextMetrics.tmHeight; - Debug(fontcache, 2, "Loaded font '{}' with size {}", FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)), pixels); + this->fontname = FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFaceName)); + + Debug(fontcache, 2, "Loaded font '{}' with size {}", this->fontname, pixels); } /** diff --git a/src/os/windows/font_win32.h b/src/os/windows/font_win32.h index 070c6eb35e..b83b2c5f35 100644 --- a/src/os/windows/font_win32.h +++ b/src/os/windows/font_win32.h @@ -21,7 +21,7 @@ private: HDC dc = nullptr; ///< Cached GDI device context. HGDIOBJ old_font; ///< Old font selected into the GDI context. SIZE glyph_size; ///< Maximum size of regular glyphs. - std::string fontname; ///< Cached copy of this->logfont.lfFaceName + std::string fontname; ///< Cached copy of loaded font facename void SetFontSize(FontSize fs, int pixels); From 04ee86d3ace52b0758d76b9ddadff75d7a12251a Mon Sep 17 00:00:00 2001 From: glx22 Date: Thu, 22 Dec 2022 22:54:24 +0100 Subject: [PATCH 12/15] Add: 'font' console command to configure fonts --- src/console_cmds.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++ src/fontcache.cpp | 48 +++++++++++++++++++++++++++ src/fontcache.h | 1 + 3 files changed, 127 insertions(+) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 1718ecce26..33b47d9600 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -23,6 +23,7 @@ #include "settings_func.h" #include "fios.h" #include "fileio_func.h" +#include "fontcache.h" #include "screenshot.h" #include "genworld.h" #include "strings_func.h" @@ -1982,6 +1983,82 @@ DEF_CONSOLE_CMD(ConContent) } #endif /* defined(WITH_ZLIB) */ +DEF_CONSOLE_CMD(ConFont) +{ + if (argc == 0) { + IConsolePrint(CC_HELP, "Manage the fonts configuration."); + IConsolePrint(CC_HELP, "Usage 'font'."); + IConsolePrint(CC_HELP, " Print out the fonts configuration."); + IConsolePrint(CC_HELP, "Usage 'font [medium|small|large|mono] [] [] [aa|noaa]'."); + IConsolePrint(CC_HELP, " Change the configuration for a font."); + IConsolePrint(CC_HELP, " Omitting an argument will keep the current value."); + IConsolePrint(CC_HELP, " Set to \"\" for the sprite font (size and aa have no effect on sprite font)."); + return true; + } + + FontSize argfs; + for (argfs = FS_BEGIN; argfs < FS_END; argfs++) { + if (argc > 1 && strcasecmp(argv[1], FontSizeToName(argfs)) == 0) break; + } + + /* First argument must be a FontSize. */ + if (argc > 1 && argfs == FS_END) return false; + + if (argc > 2) { + FontCacheSubSetting *setting = GetFontCacheSubSetting(argfs); + std::string font = setting->font; + uint size = setting->size; + bool aa = setting->aa; + + byte arg_index = 2; + + if (argc > arg_index) { + /* We may encounter "aa" or "noaa" but it must be the last argument. */ + if (strcasecmp(argv[arg_index], "aa") == 0 || strcasecmp(argv[arg_index], "noaa") == 0) { + aa = strncasecmp(argv[arg_index++], "no", 2) != 0; + if (argc > arg_index) return false; + } else { + /* For we want a string. */ + uint v; + if (!GetArgumentInteger(&v, argv[arg_index])) { + font = argv[arg_index++]; + } + } + } + + if (argc > arg_index) { + /* For we want a number. */ + uint v; + if (GetArgumentInteger(&v, argv[arg_index])) { + size = v; + arg_index++; + } + } + + if (argc > arg_index) { + /* Last argument must be "aa" or "noaa". */ + if (strcasecmp(argv[arg_index], "aa") != 0 && strcasecmp(argv[arg_index], "noaa") != 0) return false; + aa = strncasecmp(argv[arg_index++], "no", 2) != 0; + if (argc > arg_index) return false; + } + + SetFont(argfs, font, size, aa); + } + + for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) { + FontCache *fc = FontCache::Get(fs); + FontCacheSubSetting *setting = GetFontCacheSubSetting(fs); + /* Make sure all non sprite fonts are loaded. */ + if (!setting->font.empty() && !fc->HasParent()) { + InitFontCache(fs == FS_MONO); + fc = FontCache::Get(fs); + } + IConsolePrint(CC_DEFAULT, "{}: \"{}\" {} {} [\"{}\" {} {}]", FontSizeToName(fs), fc->GetFontName(), fc->GetFontSize(), GetFontAAState(fs), setting->font, setting->size, setting->aa); + } + + return true; +} + DEF_CONSOLE_CMD(ConSetting) { if (argc == 0) { @@ -2480,6 +2557,7 @@ void IConsoleStdLibRegister() IConsole::CmdRegister("cd", ConChangeDirectory); IConsole::CmdRegister("pwd", ConPrintWorkingDirectory); IConsole::CmdRegister("clear", ConClearBuffer); + IConsole::CmdRegister("font", ConFont); IConsole::CmdRegister("setting", ConSetting); IConsole::CmdRegister("setting_newgame", ConSettingNewgame); IConsole::CmdRegister("list_settings", ConListSettings); diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 5eec40a215..546199bc1f 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -13,6 +13,11 @@ #include "blitter/factory.hpp" #include "gfx_layout.h" #include "fontcache/spritefontcache.h" +#include "openttd.h" +#include "settings_func.h" +#include "strings_func.h" +#include "viewport_func.h" +#include "window_func.h" #include "safeguards.h" @@ -73,6 +78,49 @@ bool GetFontAAState(FontSize size, bool check_blitter) return GetFontCacheSubSetting(size)->aa; } +void SetFont(FontSize fontsize, const std::string& font, uint size, bool aa) +{ + FontCacheSubSetting *setting = GetFontCacheSubSetting(fontsize); + bool changed = false; + + if (setting->font != font) { + setting->font = font; + changed = true; + } + + if (setting->size != size) { + setting->size = size; + changed = true; + } + + if (setting->aa != aa) { + setting->aa = aa; + changed = true; + } + + if (!changed) return; + + if (fontsize != FS_MONO) { + /* Try to reload only the modified font. */ + FontCacheSettings backup = _fcsettings; + for (FontSize fs = FS_BEGIN; fs < FS_END; fs++) { + if (fs == fontsize) continue; + FontCache *fc = FontCache::Get(fs); + GetFontCacheSubSetting(fs)->font = fc->HasParent() ? fc->GetFontName() : ""; + } + CheckForMissingGlyphs(); + _fcsettings = backup; + } else { + InitFontCache(true); + } + + LoadStringWidthTable(); + UpdateAllVirtCoords(); + ReInitAllWindows(true); + + if (_save_config) SaveToConfig(); +} + /** * (Re)initialize the font cache related things, i.e. load the non-sprite fonts. * @param monospace Whether to initialise the monospace or regular fonts. diff --git a/src/fontcache.h b/src/fontcache.h index 7a86c137f8..efc1496304 100644 --- a/src/fontcache.h +++ b/src/fontcache.h @@ -239,5 +239,6 @@ void UninitFontCache(); bool HasAntialiasedFonts(); bool GetFontAAState(FontSize size, bool check_blitter = true); +void SetFont(FontSize fontsize, const std::string &font, uint size, bool aa); #endif /* FONTCACHE_H */ From 3451c0a82c23670a26058d79449e4382d430b6da Mon Sep 17 00:00:00 2001 From: translators Date: Sat, 24 Dec 2022 18:43:00 +0000 Subject: [PATCH 13/15] Update: Translations from eints russian: 3 changes by Ln-Wolf latvian: 21 changes by lexuslatvia dutch: 3 changes by Afoklala portuguese: 3 changes by azulcosta portuguese (brazilian): 13 changes by ericandradex --- src/lang/brazilian_portuguese.txt | 23 +++++++++++++---------- src/lang/dutch.txt | 3 +++ src/lang/latvian.txt | 21 +++++++++++++++++++++ src/lang/portuguese.txt | 3 +++ src/lang/russian.txt | 3 +++ 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index 3829561858..0e25b0f0e7 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -746,7 +746,7 @@ STR_SMALLMAP_TOOLTIP_SHOW_INDUSTRIES_ON_MAP :{BLACK}Exibir i STR_SMALLMAP_TOOLTIP_SHOW_LINK_STATS_ON_MAP :{BLACK}Exibir fluxo de carga no mapa STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON :{BLACK}Exibir rotas de transporte no mapa STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP :{BLACK}Exibir vegetação no mapa -STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP :{BLACK}Exibir proprietários de terreno no mapa +STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP :{BLACK}Exibir proprietários de terrenos no mapa STR_SMALLMAP_TOOLTIP_INDUSTRY_SELECTION :{BLACK}Clique em um tipo de indústria para alternar sua exibição. Ctrl+Clique desabilita todos os tipos exceto a selecionada. Ctrl+Clique nela novamente para habilitar todos os tipos de indústrias STR_SMALLMAP_TOOLTIP_COMPANY_SELECTION :{BLACK}Clique em uma compania para alternar a exibição de suas propriedades. Ctrl+Clique desabilita todas as companias exceto a selecionada. Ctrl+Clique nela novamente para habilitar todas as companias STR_SMALLMAP_TOOLTIP_CARGO_SELECTION :{BLACK}Clique numa carga para alternar a exibição de sua propriedade. Ctrl+Clique desativa todas as cargas exceto a selecionada. Ctrl+Clique novamente para exibir todas @@ -1007,7 +1007,7 @@ STR_GAME_OPTIONS_VIDEO_ACCELERATION_RESTART :{WHITE}A config STR_GAME_OPTIONS_VIDEO_VSYNC :{BLACK}VSync STR_GAME_OPTIONS_VIDEO_VSYNC_TOOLTIP :{BLACK}Marque esta caixa para habilitar o v-sync na tela. Qualquer mudança nesta configuração só será aplicada após reiniciar o jogo. Só funciona com a aceleração de hardware habilitada -STR_GAME_OPTIONS_VIDEO_DRIVER_INFO :{BLACK}Motorista atual: {STRING} +STR_GAME_OPTIONS_VIDEO_DRIVER_INFO :{BLACK}Driver de vídeo atual: {STRING} STR_GAME_OPTIONS_GUI_SCALE_FRAME :{BLACK}Tamanho da interface STR_GAME_OPTIONS_GUI_SCALE_TOOLTIP :{BLACK}Arraste o controle deslizante para definir o tamanho do interface. Mantenha pressionada a tecla Ctrl para um ajuste contínuo @@ -2500,7 +2500,7 @@ STR_NETWORK_ERROR_COORDINATOR_ISOLATED :{WHITE}Seu serv STR_NETWORK_ERROR_COORDINATOR_ISOLATED_DETAIL :{WHITE}Outros jogadores não poderão se conectar ao seu servidor # Content downloading window -STR_CONTENT_TITLE :{WHITE}Baixando conteúdo +STR_CONTENT_TITLE :{WHITE}Download de conteúdo STR_CONTENT_TYPE_CAPTION :{BLACK}Tipo STR_CONTENT_TYPE_CAPTION_TOOLTIP :{BLACK}Tipo do conteúdo STR_CONTENT_NAME_CAPTION :{BLACK}Nome @@ -2522,7 +2522,7 @@ STR_CONTENT_OPEN_URL_TOOLTIP :{BLACK}Visitar STR_CONTENT_DOWNLOAD_CAPTION :{BLACK}Baixar STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP :{BLACK}Baixa o conteúdo selecionado STR_CONTENT_TOTAL_DOWNLOAD_SIZE :{SILVER}Tamanho total do download: {WHITE}{BYTES} -STR_CONTENT_DETAIL_TITLE :{SILVER}INFO DO CONT. +STR_CONTENT_DETAIL_TITLE :{SILVER}INFORMAÇÕES DO CONTEÚDO ###length 5 STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED :{SILVER}Você não selecionou para ser baixado @@ -2822,13 +2822,13 @@ STR_PLANT_TREE_TOOLTIP :{BLACK}Selecion STR_TREES_RANDOM_TYPE :{BLACK}Árvores de tipo aleatório STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Plantar árvores de tipo aleatório, Shift alterna entre construção/preço estimado STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Plantar Aleatoriamente -STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Planta árvores aleatoriamente pelo terreno +STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Plantar árvores aleatoriamente pelo terreno STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Normal STR_TREES_MODE_NORMAL_TOOLTIP :{BLACK}Planta árvores isoladas ao arrastar pelo terreno. STR_TREES_MODE_FOREST_SM_BUTTON :{BLACK}Bosque -STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Planta pequenas florestas ao arrastar pelo terreno. +STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Plantar pequenas florestas ao arrastar sobre o terreno. STR_TREES_MODE_FOREST_LG_BUTTON :{BLACK}Floresta -STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Planta florestas grandes ao arrastar pelo terreno. +STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Plantar florestas grandes ao arrastar pelo terreno. # Land generation window (SE) STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Gerar Terreno @@ -3328,7 +3328,10 @@ STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Represen STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Move o "sprite", alterando os offsets X e Y. Ctrl+Clique para mover o sprite 8 unidades por vez ###length 2 +STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}Deslocamento centralizado +STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Sprite centralizado +STR_SPRITE_ALIGNER_CROSSHAIR :{BLACK}Mira STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Resetar relativo STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Reseta os offsets relativos atuais @@ -4626,11 +4629,11 @@ STR_AI_SETTINGS_START_DELAY :Número de dias # Textfile window STR_TEXTFILE_WRAP_TEXT :{WHITE}Quebra de linha STR_TEXTFILE_WRAP_TEXT_TOOLTIP :[BLACK}Quebra linhas automaticamente para que o texto caiba na janela -STR_TEXTFILE_VIEW_README :{BLACK}Ler o Leiame +STR_TEXTFILE_VIEW_README :{BLACK}Ver o leia-me STR_TEXTFILE_VIEW_CHANGELOG :{BLACK}Log de mudanças STR_TEXTFILE_VIEW_LICENCE :{BLACK}Licença ###length 3 -STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} Leiame de {STRING} +STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} Leia-me de {STRING} STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} log de mudanças de {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} licença de {STRING} @@ -4939,7 +4942,7 @@ STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST :{WHITE}Remova a STR_ERROR_CAN_T_START_AND_END_ON :{WHITE}Impossível iniciar e terminar no mesmo ponto STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT :{WHITE}Extremidades da ponte não estão no mesmo nível STR_ERROR_BRIDGE_TOO_LOW_FOR_TERRAIN :{WHITE}Ponte é muito baixa para o terreno -STR_ERROR_BRIDGE_TOO_HIGH_FOR_TERRAIN :{WHITE}A ponte está muito alta para esse terreno. +STR_ERROR_BRIDGE_TOO_HIGH_FOR_TERRAIN :{WHITE}A ponte está muito alta para este terreno. STR_ERROR_START_AND_END_MUST_BE_IN :{WHITE}Inicio e fim devem estar alinhados STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH :{WHITE}... os extremos da ponte devem estar sobre a terra STR_ERROR_BRIDGE_TOO_LONG :{WHITE}... ponte muito longa diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index ec37cf1587..38d75a2a28 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -3327,7 +3327,10 @@ STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Voorbeel STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Sprite verplaatsen, dit verandert X en Y offsets. Ctr+klik om de sprite 8 eenheden per keer te verplaatsen. ###length 2 +STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}Op offset gecentreerd +STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Op sprite gecentreerd +STR_SPRITE_ALIGNER_CROSSHAIR :{BLACK}Richtkruis STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Relatief herstellen STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Herstel de huidige relatieve offsets diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt index 3bf41f51ea..31191ebf5b 100644 --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -202,6 +202,10 @@ STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}ZS STR_UNITS_POWER_METRIC :{COMMA}{NBSP}ZS STR_UNITS_POWER_SI :{COMMA}{NBSP}kW +STR_UNITS_POWER_IMPERIAL_TO_WEIGHT_SI :{DECIMAL}{NBSP}zs/Mg +STR_UNITS_POWER_METRIC_TO_WEIGHT_IMPERIAL :{DECIMAL}{NBSP}zs/l +STR_UNITS_POWER_SI_TO_WEIGHT_IMPERIAL :{DECIMAL}{NBSP}kW/l +STR_UNITS_POWER_SI_TO_WEIGHT_SI :{DECIMAL}{NBSP}W/kg STR_UNITS_WEIGHT_SHORT_IMPERIAL :{COMMA}{NBSP}t STR_UNITS_WEIGHT_SHORT_METRIC :{COMMA}{NBSP}t @@ -999,8 +1003,13 @@ STR_GAME_OPTIONS_VIDEO_VSYNC_TOOLTIP :{BLACK}Atzīmē STR_GAME_OPTIONS_VIDEO_DRIVER_INFO :{BLACK}Esošais vadītājs: {STRING} +STR_GAME_OPTIONS_GUI_SCALE_TOOLTIP :{BLACK}Velciet slīdni, lai iestatītu interfeisa izmēru. Turiet nospiestu taustiņu Ctrl, lai veiktu nepārtrauktu regulēšanu +STR_GAME_OPTIONS_GUI_SCALE_AUTO :{BLACK}Automātiski noteikt izmēru +STR_GAME_OPTIONS_GUI_SCALE_2X :2x +STR_GAME_OPTIONS_GUI_SCALE_3X :3x +STR_GAME_OPTIONS_GUI_SCALE_5X :5x STR_GAME_OPTIONS_GRAPHICS :{BLACK}Grafika @@ -2049,6 +2058,8 @@ STR_INTRO_HIGHSCORE :{BLACK}Sasniegu STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Iestatījumi STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF iestatījumi STR_INTRO_ONLINE_CONTENT :{BLACK}Pārbaudīt tiešsaistes saturu +STR_INTRO_AI_SETTINGS :{BLACK}AI Iestatījumi +STR_INTRO_GAMESCRIPT_SETTINGS :{BLACK}Spēles Skripta Iestatījumi STR_INTRO_QUIT :{BLACK}Iziet STR_INTRO_TOOLTIP_NEW_GAME :{BLACK}Sākt jaunu spēli. Ctrl+klikšķis izlaiž kartes konfigurēšanu @@ -2579,6 +2590,8 @@ STR_LINKGRAPH_LEGEND_SATURATED :{TINY_FONT}{BLA STR_LINKGRAPH_LEGEND_OVERLOADED :{TINY_FONT}{BLACK}pārslogots # Linkgraph tooltip +STR_LINKGRAPH_STATS_TOOLTIP_RETURN_EXTENSION :{}{CARGO_LONG} jātransportē atpakaļ ({COMMA}% no pārvadājuma) +STR_LINKGRAPH_STATS_TOOLTIP_TIME_EXTENSION :{}Vidējais ceļojuma laiks: {NUM}{NBSP}dienas # Base for station construction window(s) STR_STATION_BUILD_COVERAGE_AREA_TITLE :{BLACK}Pārklājuma iezīmēšana @@ -3294,6 +3307,7 @@ STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Atlasīt STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Pārvietot gariņu, lai mainītu X un Y vērtības. Ctrl+klikšķis, lai vienā piegājienā pārvietotu gariņu par astoņām vienībām ###length 2 +STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Spraits centrēts STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Atiestatīt relatīvi @@ -3639,13 +3653,16 @@ STR_FINANCES_SECTION_LOAN_INTEREST :{GOLD}Aizdevuma STR_FINANCES_SECTION_OTHER :{GOLD}Citi STR_FINANCES_NEGATIVE_INCOME :-{CURRENCY_LONG} +STR_FINANCES_ZERO_INCOME :{CURRENCY_LONG} STR_FINANCES_POSITIVE_INCOME :+{CURRENCY_LONG} +STR_FINANCES_PROFIT :{WHITE}Peļņa STR_FINANCES_BANK_BALANCE_TITLE :{WHITE}Bankas bilance STR_FINANCES_OWN_FUNDS_TITLE :{WHITE}Pašu līdzekļi STR_FINANCES_LOAN_TITLE :{WHITE}Aizdevums STR_FINANCES_INTEREST_RATE :{WHITE}Aizdevuma procenti: {BLACK}{NUM}% STR_FINANCES_MAX_LOAN :{WHITE}Maksimālais aizdevums: {BLACK}{CURRENCY_LONG} STR_FINANCES_TOTAL_CURRENCY :{BLACK}{CURRENCY_LONG} +STR_FINANCES_BANK_BALANCE :{WHITE}{CURRENCY_LONG} STR_FINANCES_BORROW_BUTTON :{BLACK}Aizņemties {CURRENCY_LONG} STR_FINANCES_BORROW_TOOLTIP :{BLACK}Palielināt aizdevuma apmēru. Ctrl+klikšķis lai aizņemtos cik daudz vien iespējams STR_FINANCES_REPAY_BUTTON :{BLACK}Atmaksāt {CURRENCY_LONG} @@ -3777,6 +3794,8 @@ STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP :{BLACK}Sūtīt STR_VEHICLE_LIST_REPLACE_VEHICLES :Nomainīt transportlīdzekļus STR_VEHICLE_LIST_SEND_FOR_SERVICING :Sūtīt uz apkopi STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR :{TINY_FONT}{BLACK}Peļņa šogad: {CURRENCY_LONG} (pērn: {CURRENCY_LONG}) +STR_VEHICLE_LIST_CARGO :{TINY_FONT}{BLACK}[{CARGO_LIST}] +STR_VEHICLE_LIST_NAME_AND_CARGO :{TINY_FONT}{BLACK}{STRING} {STRING} STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT :Sūtīt uz depo STR_VEHICLE_LIST_SEND_ROAD_VEHICLE_TO_DEPOT :Sūtīt uz depo @@ -4543,6 +4562,7 @@ STR_AI_CONFIG_MOVE_DOWN :{BLACK}Nolaist STR_AI_CONFIG_MOVE_DOWN_TOOLTIP :{BLACK}Nolaist izvēlētos MI sarakstā uz leju STR_AI_CONFIG_GAMESCRIPT :{SILVER}Spēles skripti +STR_AI_CONFIG_GAMESCRIPT_PARAM :{SILVER}Parametri STR_AI_CONFIG_AI :{SILVER}MI STR_AI_CONFIG_CHANGE_AI :MI @@ -4920,6 +4940,7 @@ STR_ERROR_OBJECT_IN_THE_WAY :{WHITE}Traucēj STR_ERROR_COMPANY_HEADQUARTERS_IN :{WHITE}... traucē uzņēmuma birojs STR_ERROR_CAN_T_PURCHASE_THIS_LAND :{WHITE}Nevar nopirkt šo zemes platību... STR_ERROR_YOU_ALREADY_OWN_IT :{WHITE}... tā jums jau pieder! +STR_ERROR_BUILD_OBJECT_LIMIT_REACHED :{WHITE}... sasniegts objektu būvniecības limits # Group related errors STR_ERROR_GROUP_CAN_T_CREATE :{WHITE}Nevar izveidot grupu... diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index de21cdd199..a25cc0f0f7 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -3328,7 +3328,10 @@ STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Represen STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Desloca o gráfico, alterando os intervalos X e Y. Ctrl+Clique desloca o gráfico 8 unidades de uma só vez ###length 2 +STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}Deslocamento centrado +STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Sprite centrado +STR_SPRITE_ALIGNER_CROSSHAIR :{BLACK}Mira STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Repor relativo STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Repor intervalos relativos atuais diff --git a/src/lang/russian.txt b/src/lang/russian.txt index be1f27bea9..4d775ed2cf 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -3502,7 +3502,10 @@ STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Пред STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Двигайте спрайт, изменяя смещение по осям X и Y. С помощью Ctrl+щелчка можно сдвигать спрайты на 8 единиц. ###length 2 +STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}Смещение в центре +STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Спрайт в центре +STR_SPRITE_ALIGNER_CROSSHAIR :{BLACK}Перекрестие STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Сброс смещения STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Сбросить значения относительного смещения From 23eec0b7b32ad1b39d927e8a2c662ade1f376e5a Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 25 Dec 2022 00:40:55 +0000 Subject: [PATCH 14/15] Fix #8971: Resize QueryStrings with interface scale change. (#10281) * Fix: Use width of caret symbol '_' for text entry. This replaces an arbitrary pixel width with the space actually required. * Fix #8971: Update QueryString sizes with interface scale change. --- src/misc_gui.cpp | 13 +++++++++---- src/window.cpp | 16 +++++++++++++++- src/window_gui.h | 1 + 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 44ccd9eac4..2641f7227e 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -789,6 +789,11 @@ void QueryString::HandleEditBox(Window *w, int wid) } } +static int GetCaretWidth() +{ + return GetCharacterWidth(FS_NORMAL, '_'); +} + void QueryString::DrawEditBox(const Window *w, int wid) const { const NWidgetLeaf *wi = w->GetWidget(wid); @@ -821,7 +826,7 @@ void QueryString::DrawEditBox(const Window *w, int wid) const /* We will take the current widget length as maximum width, with a small * space reserved at the end for the caret to show */ const Textbuf *tb = &this->text; - int delta = std::min(0, (fr.right - fr.left) - tb->pixels - 10); + int delta = std::min(0, (fr.right - fr.left) - tb->pixels - GetCaretWidth()); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; @@ -858,7 +863,7 @@ Point QueryString::GetCaretPosition(const Window *w, int wid) const /* Clamp caret position to be inside out current width. */ const Textbuf *tb = &this->text; - int delta = std::min(0, (r.right - r.left) - tb->pixels - 10); + int delta = std::min(0, (r.right - r.left) - tb->pixels - GetCaretWidth()); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; Point pt = {r.left + tb->caretxoffs + delta, r.top}; @@ -887,7 +892,7 @@ Rect QueryString::GetBoundingRect(const Window *w, int wid, const char *from, co /* Clamp caret position to be inside our current width. */ const Textbuf *tb = &this->text; - int delta = std::min(0, r.Width() - tb->pixels - 10); + int delta = std::min(0, r.Width() - tb->pixels - GetCaretWidth()); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; /* Get location of first and last character. */ @@ -920,7 +925,7 @@ const char *QueryString::GetCharAtPosition(const Window *w, int wid, const Point /* Clamp caret position to be inside our current width. */ const Textbuf *tb = &this->text; - int delta = std::min(0, r.Width() - tb->pixels - 10); + int delta = std::min(0, r.Width() - tb->pixels - GetCaretWidth()); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; return ::GetCharAtPosition(tb->buf, pt.x - delta - r.left); diff --git a/src/window.cpp b/src/window.cpp index 2ae61648ee..81952d27db 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -354,6 +354,17 @@ QueryString *Window::GetQueryString(uint widnum) return query != this->querystrings.End() ? query->second : nullptr; } +/** + * Update size of all QueryStrings of this window. + */ +void Window::UpdateQueryStringSize() +{ + for (auto &qs : this->querystrings) + { + qs.second->text.UpdateSize(); + } +} + /** * Get the current input text if an edit box has the focus. * @return The currently focused input text or nullptr if no input focused. @@ -3353,7 +3364,10 @@ void HideVitalWindows() void ReInitWindow(Window *w, bool zoom_changed) { if (w == nullptr) return; - if (zoom_changed) w->nested_root->AdjustPaddingForZoom(); + if (zoom_changed) { + w->nested_root->AdjustPaddingForZoom(); + w->UpdateQueryStringSize(); + } w->ReInit(); } diff --git a/src/window_gui.h b/src/window_gui.h index 8bd5dc39ee..00dfd9960a 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -276,6 +276,7 @@ public: const QueryString *GetQueryString(uint widnum) const; QueryString *GetQueryString(uint widnum); + void UpdateQueryStringSize(); virtual const char *GetFocusedText() const; virtual const char *GetCaret() const; From c8cc61d8899ad8b7c8509116fc85194436642848 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 25 Dec 2022 13:29:38 +0000 Subject: [PATCH 15/15] Fix #10150: Force FS_SMALL for small viewport signs. (#10283) * Fix #10150: Force FS_SMALL for small viewport signs. This is a workaround for string widths being different with mixed font-sizes. * Fix: Flag small sign shadow as small text. (This method of drawing shadows is hilarious and needs replacing, but this is a quick fix.) --- src/town_cmd.cpp | 2 +- src/viewport.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 680bffda2f..280fa4efea 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -408,7 +408,7 @@ void Town::UpdateVirtCoord() SetDParam(1, this->cache.population); this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_LVL_BASE, _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN, - STR_VIEWPORT_TOWN); + STR_VIEWPORT_TOWN_TINY_WHITE); _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeTown(this->index)); diff --git a/src/viewport.cpp b/src/viewport.cpp index 8ce8d438b7..b32bca80d2 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1323,7 +1323,7 @@ void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const Vie 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); + 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, sign->top - shadow_offset, string_small, params_1, params_2, colour, sign->width_small | 0x8000); @@ -1722,7 +1722,7 @@ static void ViewportDrawStrings(ZoomLevel zoom, const StringSpriteToDrawVector * } } - DrawString(x + WidgetDimensions::scaled.fullbevel.left, x + w - 1 - WidgetDimensions::scaled.fullbevel.right, y + WidgetDimensions::scaled.fullbevel.top, ss.string, colour, SA_HOR_CENTER); + DrawString(x + WidgetDimensions::scaled.fullbevel.left, x + w - 1 - WidgetDimensions::scaled.fullbevel.right, y + WidgetDimensions::scaled.fullbevel.top, ss.string, colour, SA_HOR_CENTER, false, small ? FS_SMALL : FS_NORMAL); } }