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