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.
This commit is contained in:
Peter Nelson 2024-12-07 13:35:43 +00:00 committed by Peter Nelson
parent d0d5a18120
commit 5575c0ba5a
2 changed files with 3 additions and 17 deletions

View File

@ -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}

View File

@ -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);
}
}
}