@@ -195,6 +195,8 @@ WorldGui::WorldGui(int width, int height, const char *caption)
195195 real_time_interval(sim_interval), real_time_now(RealTimeNow()),
196196 real_time_recorded(real_time_now), timing_interval(20 )
197197{
198+ Fl::lock (); // start FLTK's thread safe behaviour
199+
198200 Fl::scheme (" " );
199201 resizable (canvas);
200202 caption_prefix = caption ? std::string (caption) : std::string (PROJECT) + " v" + Stg::Version ();
@@ -416,8 +418,8 @@ std::string WorldGui::ClockString() const
416418
417419 const double localratio = (double )sim_interval / (double )(real_time_interval / timing_interval);
418420
419- char buf[32 ];
420- snprintf (buf, 32 , " [%.1f]" , localratio);
421+ char buf[64 ];
422+ snprintf (buf, 64 , " [%.1f]" , localratio);
421423 str += buf;
422424
423425 if (paused == true )
@@ -443,12 +445,13 @@ void WorldGui::RemoveChild(Model *mod)
443445std::string WorldGui::EnergyString () const
444446{
445447 char str[512 ];
446- snprintf (str, 255 , " Energy\n stored: %.0f / %.0f KJ\n input: %.0f "
447- " KJ\n output: %.0f KJ at %.2f KW\n " ,
448+ snprintf (str, 512 ,
449+ " Energy\n stored: %.0f / %.0f KJ\n input: %.0f "
450+ " KJ\n output: %.0f KJ at %.2f KW\n " ,
448451 PowerPack::global_stored / 1e3 , PowerPack::global_capacity / 1e3 ,
449452 PowerPack::global_input / 1e3 , PowerPack::global_dissipated / 1e3 ,
450453 (PowerPack::global_dissipated / (sim_time / 1e6 )) / 1e3 );
451-
454+
452455 return std::string (str);
453456}
454457
0 commit comments