From 5575c0ba5ab6c08fbbb229e935a6826dd20e5d1e Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 7 Dec 2024 13:35:43 +0000 Subject: [PATCH] Codechange: Deduplicate text effect strings. Small viewport signs are drawn with FS_SMALL, so there is no need to duplicate text effect strings for both normal and small versions. This also avoids an extra string format when text effect positions are updated. --- src/lang/english.txt | 14 -------------- src/texteff.cpp | 6 +++--- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 08b4828db7..a41a3f2ec3 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -4451,12 +4451,7 @@ STR_VEHICLE_STATUS_CANNOT_REACH_DEPOT_VEL :{ORANGE}{1:VELO STR_VEHICLE_STATUS_CANNOT_REACH_DEPOT_SERVICE_VEL :{LTBLUE}{1:VELOCITY} - Cannot reach {0:DEPOT} # Vehicle stopped/started animations -###length 2 -STR_VEHICLE_COMMAND_STOPPED_SMALL :{TINY_FONT}{RED}Stopped STR_VEHICLE_COMMAND_STOPPED :{RED}Stopped - -###length 2 -STR_VEHICLE_COMMAND_STARTED_SMALL :{TINY_FONT}{GREEN}Started STR_VEHICLE_COMMAND_STARTED :{GREEN}Started # Vehicle details @@ -4918,25 +4913,16 @@ STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD # Vehicle loading indicators -STR_PERCENT_UP_SMALL :{TINY_FONT}{WHITE}{NUM}%{UP_ARROW} STR_PERCENT_UP :{WHITE}{NUM}%{UP_ARROW} -STR_PERCENT_DOWN_SMALL :{TINY_FONT}{WHITE}{NUM}%{DOWN_ARROW} STR_PERCENT_DOWN :{WHITE}{NUM}%{DOWN_ARROW} -STR_PERCENT_UP_DOWN_SMALL :{TINY_FONT}{WHITE}{NUM}%{UP_ARROW}{DOWN_ARROW} STR_PERCENT_UP_DOWN :{WHITE}{NUM}%{UP_ARROW}{DOWN_ARROW} -STR_PERCENT_NONE_SMALL :{TINY_FONT}{WHITE}{NUM}% STR_PERCENT_NONE :{WHITE}{NUM}% # Income 'floats' -STR_INCOME_FLOAT_COST_SMALL :{TINY_FONT}{RED}Cost: {CURRENCY_LONG} STR_INCOME_FLOAT_COST :{RED}Cost: {CURRENCY_LONG} -STR_INCOME_FLOAT_INCOME_SMALL :{TINY_FONT}{GREEN}Income: {CURRENCY_LONG} STR_INCOME_FLOAT_INCOME :{GREEN}Income: {CURRENCY_LONG} -STR_FEEDER_TINY :{TINY_FONT}{YELLOW}Transfer: {CURRENCY_LONG} STR_FEEDER :{YELLOW}Transfer: {CURRENCY_LONG} -STR_FEEDER_INCOME_TINY :{TINY_FONT}{YELLOW}Transfer: {CURRENCY_LONG}{WHITE} / {GREEN}Income: {CURRENCY_LONG} STR_FEEDER_INCOME :{YELLOW}Transfer: {CURRENCY_LONG}{WHITE} / {GREEN}Income: {CURRENCY_LONG} -STR_FEEDER_COST_TINY :{TINY_FONT}{YELLOW}Transfer: {CURRENCY_LONG}{WHITE} / {RED}Cost: {CURRENCY_LONG} STR_FEEDER_COST :{YELLOW}Transfer: {CURRENCY_LONG}{WHITE} / {RED}Cost: {CURRENCY_LONG} STR_MESSAGE_ESTIMATED_COST :{WHITE}Estimated Cost: {CURRENCY_LONG} STR_MESSAGE_ESTIMATED_INCOME :{WHITE}Estimated Income: {CURRENCY_LONG} diff --git a/src/texteff.cpp b/src/texteff.cpp index a5092e624d..43201c4b91 100644 --- a/src/texteff.cpp +++ b/src/texteff.cpp @@ -72,7 +72,7 @@ void UpdateTextEffect(TextEffectID te_id, StringID msg) te.string_id = msg; CopyOutDParam(te.params, 2); - te.UpdatePosition(te.center, te.top, te.string_id, te.string_id - 1); + te.UpdatePosition(te.center, te.top, te.string_id); } void UpdateAllTextEffectVirtCoords() @@ -80,7 +80,7 @@ void UpdateAllTextEffectVirtCoords() for (auto &te : _text_effects) { if (te.string_id == INVALID_STRING_ID) continue; CopyInDParam(te.params); - te.UpdatePosition(te.center, te.top, te.string_id, te.string_id - 1); + te.UpdatePosition(te.center, te.top, te.string_id); } } @@ -124,7 +124,7 @@ void DrawTextEffects(DrawPixelInfo *dpi) if (te.string_id == INVALID_STRING_ID) continue; if (te.mode == TE_RISING || _settings_client.gui.loading_indicators) { CopyInDParam(te.params); - ViewportAddString(dpi, ZOOM_LVL_TEXT_EFFECT, &te, te.string_id, te.string_id - 1, STR_NULL); + ViewportAddString(dpi, ZOOM_LVL_TEXT_EFFECT, &te, te.string_id, te.string_id, STR_NULL); } } }