From 3bc87ad6525650e95b9bb5db9ba7785434c7dece Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 29 May 2026 20:41:05 +0200 Subject: [PATCH] =?UTF-8?q?tweak(hud):=20l'=C3=BAltim=20d=C3=ADgit=20de=20?= =?UTF-8?q?la=20puntuaci=C3=B3=20sempre=20enc=C3=A8s=20(puntuaci=C3=B3=200?= =?UTF-8?q?=20no=20apaga=20el=20marcador)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/game/systems/init_hud_animator.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/game/systems/init_hud_animator.cpp b/source/game/systems/init_hud_animator.cpp index d46b865..385a075 100644 --- a/source/game/systems/init_hud_animator.cpp +++ b/source/game/systems/init_hud_animator.cpp @@ -129,7 +129,8 @@ namespace Systems::InitHud { // Pinta la puntuació amb els zeros de farciment previs al primer dígit // significatiu en to atenuat i la resta en brillant (efecte display de 7 - // segments). Puntuació 0 (tot zeros) → tot atenuat. + // segments). El dígit menys significatiu SEMPRE va encès: puntuació 0 → + // cinc zeros atenuats + l'últim "0" encès (el marcador no queda mai apagat). void drawScore(const Graphics::VectorText& text, const std::string& score, SDL_Color bright, @@ -138,9 +139,14 @@ namespace Systems::InitHud { float top_y, float scale, float spacing) { - const size_t SIG = score.find_first_not_of('0'); - const std::string PREFIX = (SIG == std::string::npos) ? score : score.substr(0, SIG); - const std::string REST = (SIG == std::string::npos) ? std::string{} : score.substr(SIG); + if (score.empty()) { + return; + } + // Primer dígit significatiu; si són tots zeros, força l'últim a encès. + const size_t FIRST_SIG = score.find_first_not_of('0'); + const size_t SIG = (FIRST_SIG == std::string::npos) ? (score.size() - 1) : FIRST_SIG; + const std::string PREFIX = score.substr(0, SIG); + const std::string REST = score.substr(SIG); if (!PREFIX.empty()) { text.render(PREFIX, {.x = x, .y = top_y}, scale, spacing, 1.0F, dim); // Avança l'amplada del prefix més el buit inter-caràcter que hi