From 61f6c81f74e7664d0ee2b90fe91a032f1f4c00b5 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 10 Oct 2015 03:44:14 +0000 Subject: [PATCH] Use std::replace for rewriting count to wide 1s --- similar/main/gauges.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/similar/main/gauges.cpp b/similar/main/gauges.cpp index cc52bee47..4b92619db 100644 --- a/similar/main/gauges.cpp +++ b/similar/main/gauges.cpp @@ -1010,8 +1010,6 @@ static inline const char *SECONDARY_WEAPON_NAMES_VERY_SHORT(const unsigned u) static void show_bomb_count(int x,int y,int bg_color,int always_show,int right_align) { int bomb,count; - char txt[5],*t; - #if defined(DXX_BUILD_DESCENT_I) if (!PlayerCfg.BombGauge) return; @@ -1033,10 +1031,10 @@ static void show_bomb_count(int x,int y,int bg_color,int always_show,int right_a : bg_color, //erase by drawing in background color bg_color); + char txt[5]; snprintf(txt, sizeof(txt), "B:%02d", count); - - while ((t=strchr(txt,'1')) != NULL) - *t = '\x84'; //convert to wide '1' + //convert to wide '1' + std::replace(&txt[2], &txt[4], '1', '\x84'); int w, h; gr_get_string_size(txt, &w, &h, nullptr);