From: Kahrl Date: Fri, 31 May 2013 23:49:59 +0000 (+0200) Subject: Generate debug HUD text with ostringstream instead of snprintf. X-Git-Tag: 0.4.7~14^2~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7721948a2fbd101bc8530e4d3ae7c1552bdf9490;p=oweals%2Fminetest.git Generate debug HUD text with ostringstream instead of snprintf. This should fix #730. --- diff --git a/src/game.cpp b/src/game.cpp index ffc69d739..22bd8c429 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -66,6 +66,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "sound_openal.h" #endif #include "event_manager.h" +#include #include #include "util/directiontables.h" @@ -2961,21 +2962,20 @@ void the_game( static float endscenetime_avg = 0; endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05;*/ - char temptext[300]; - snprintf(temptext, 300, "%s (" - "R: range_all=%i" - ")" - " drawtime=%.0f, dtime_jitter = % .1f %%" - ", v_range = %.1f, RTT = %.3f", - program_name_and_version, - draw_control.range_all, - drawtime_avg, - dtime_jitter1_max_fraction * 100.0, - draw_control.wanted_range, - client.getRTT() - ); - - guitext->setText(narrow_to_wide(temptext).c_str()); + std::ostringstream os(std::ios_base::binary); + os<setText(narrow_to_wide(temptext).c_str()); + std::ostringstream os(std::ios_base::binary); + os<setText(narrow_to_wide(os.str()).c_str()); guitext2->setVisible(true); } else