]> granicus.if.org Git - nethack/commitdiff
win32-gui: parse value of gold correctly for status hilite
authorAlex Kompel <barbos+nethack@gmail.com>
Mon, 1 Jun 2015 04:31:27 +0000 (21:31 -0700)
committerAlex Kompel <barbos+nethack@gmail.com>
Mon, 1 Jun 2015 04:31:27 +0000 (21:31 -0700)
win/win32/mswproc.c

index 12a514cbbfa2d68b100cb9892fa4e691a6059971..77c33b2cfef9be4d09f3d79ca89dccbc507549d4 100644 (file)
@@ -2864,9 +2864,14 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent)
                      0, 0);
             buf[0] = ochar;
             p = strchr(text, ':');
-            if (p)
+            if (p) {
                 strncpy(buf + 1, p, sizeof(buf) - 2);
-            value = atol(buf);
+                value = atol(p + 1);
+            } else {
+                buf[1] = ':';
+                strncpy(buf + 2, text, sizeof(buf) - 2);
+                value = atol(text);
+            }
             Sprintf(_status_vals[idx],
                     _status_fieldfmt[idx] ? _status_fieldfmt[idx] : "%s",
                     buf);