@@ -66,6 +66,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
66
66
#include " sound_openal.h"
67
67
#endif
68
68
#include " event_manager.h"
69
+ #include < iomanip>
69
70
#include < list>
70
71
#include " util/directiontables.h"
71
72
@@ -2961,21 +2962,20 @@ void the_game(
2961
2962
static float endscenetime_avg = 0;
2962
2963
endscenetime_avg = endscenetime_avg * 0.95 + (float)endscenetime*0.05;*/
2963
2964
2964
- char temptext[300 ];
2965
- snprintf (temptext, 300 , " %s ("
2966
- " R: range_all=%i"
2967
- " )"
2968
- " drawtime=%.0f, dtime_jitter = % .1f %%"
2969
- " , v_range = %.1f, RTT = %.3f" ,
2970
- program_name_and_version,
2971
- draw_control.range_all ,
2972
- drawtime_avg,
2973
- dtime_jitter1_max_fraction * 100.0 ,
2974
- draw_control.wanted_range ,
2975
- client.getRTT ()
2976
- );
2977
-
2978
- guitext->setText (narrow_to_wide (temptext).c_str ());
2965
+ std::ostringstream os (std::ios_base::binary);
2966
+ os<<std::fixed
2967
+ <<program_name_and_version
2968
+ <<" (R: range_all=" <<draw_control.range_all <<" )"
2969
+ <<std::setprecision (0 )
2970
+ <<" drawtime = " <<drawtime_avg
2971
+ <<std::setprecision (1 )
2972
+ <<" , dtime_jitter = "
2973
+ <<(dtime_jitter1_max_fraction * 100.0 )<<" %"
2974
+ <<std::setprecision (1 )
2975
+ <<" , v_range = " <<draw_control.wanted_range
2976
+ <<std::setprecision (3 )
2977
+ <<" , RTT = " <<client.getRTT ();
2978
+ guitext->setText (narrow_to_wide (os.str ()).c_str ());
2979
2979
guitext->setVisible (true );
2980
2980
}
2981
2981
else if (show_hud || show_chat)
@@ -2990,17 +2990,15 @@ void the_game(
2990
2990
2991
2991
if (show_debug)
2992
2992
{
2993
- char temptext[300 ];
2994
- snprintf (temptext, 300 ,
2995
- " (% .1f, % .1f, % .1f)"
2996
- " (yaw = %.1f) (seed = %llu)" ,
2997
- player_position.X /BS,
2998
- player_position.Y /BS,
2999
- player_position.Z /BS,
3000
- wrapDegrees_0_360 (camera_yaw),
3001
- (unsigned long long )client.getMapSeed ());
3002
-
3003
- guitext2->setText (narrow_to_wide (temptext).c_str ());
2993
+ std::ostringstream os (std::ios_base::binary);
2994
+ os<<std::setprecision (1 )<<std::fixed
2995
+ <<" (" <<(player_position.X /BS)
2996
+ <<" , " <<(player_position.Y /BS)
2997
+ <<" , " <<(player_position.Z /BS)
2998
+ <<" ) (yaw=" <<(wrapDegrees_0_360 (camera_yaw))
2999
+ <<" ) (seed = " <<((unsigned long long )client.getMapSeed ())
3000
+ <<" )" ;
3001
+ guitext2->setText (narrow_to_wide (os.str ()).c_str ());
3004
3002
guitext2->setVisible (true );
3005
3003
}
3006
3004
else
0 commit comments