diff --git a/source/src/command.cpp b/source/src/command.cpp index 29a310e6..a3e2332f 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -519,11 +519,11 @@ void intret(int v) const char *floatstr(float v, bool neat) { - static string s; + static char s[2 * MAXSTRLEN]; static int i = 0; - if(i > MAXSTRLEN - 100) i = 0; + if(i > MAXSTRLEN - 10) i = 0; char *t = s + i; - snprintf(t, 99, !neat && (v) == int(v) ? "%.1f" : "%.7g", v); // was ftoa() + formatstring(t)(!neat && (v) == int(v) ? "%.1f" : "%.7g", v); // was ftoa() i += strlen(t) + 1; return t; } diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index bf9b4b65..cac1952c 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -831,14 +831,14 @@ VARP(oldfashionedgunstats, 0, 0, 1); void weapon::renderstats() { - char gunstats[64]; - if(oldfashionedgunstats) snprintf(gunstats, 64, "%d/%d", mag, ammo); else snprintf(gunstats, 64, "%d", mag); + string gunstats; + if(oldfashionedgunstats) formatstring(gunstats)("%d/%d", mag, ammo); else formatstring(gunstats)("%d", mag); draw_text(gunstats, HUDPOS_WEAPON + HUDPOS_NUMBERSPACING, 823); if(!oldfashionedgunstats) { int offset = text_width(gunstats); glScalef(0.5f, 0.5f, 1.0f); - snprintf(gunstats, 64, "%d", ammo); + formatstring(gunstats)("%d", ammo); draw_text(gunstats, (HUDPOS_WEAPON + HUDPOS_NUMBERSPACING + offset)*2, 826*2); glLoadIdentity(); }