@@ -60,6 +60,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
60
60
61
61
extern gui::IGUIEnvironment* guienv;
62
62
63
+ /*
64
+ Utility classes
65
+ */
66
+
67
+ void PacketCounter::print (std::ostream &o) const
68
+ {
69
+ for (const auto &it : m_packets) {
70
+ auto name = it.first >= TOCLIENT_NUM_MSG_TYPES ? " ?"
71
+ : toClientCommandTable[it.first ].name ;
72
+ o << " cmd " << it.first << " (" << name << " ) count "
73
+ << it.second << std::endl;
74
+ }
75
+ }
76
+
63
77
/*
64
78
Client
65
79
*/
@@ -336,12 +350,12 @@ void Client::step(float dtime)
336
350
{
337
351
float &counter = m_packetcounter_timer;
338
352
counter -= dtime;
339
- if (counter <= 0.0 )
353
+ if (counter <= 0 .0f )
340
354
{
341
- counter = 20.0 ;
355
+ counter = 30 . 0f ;
342
356
343
357
infostream << " Client packetcounter (" << m_packetcounter_timer
344
- << " ):" <<std::endl;
358
+ << " s ):" <<std::endl;
345
359
m_packetcounter.print (infostream);
346
360
m_packetcounter.clear ();
347
361
}
@@ -621,14 +635,17 @@ void Client::step(float dtime)
621
635
622
636
m_mod_storage_save_timer -= dtime;
623
637
if (m_mod_storage_save_timer <= 0 .0f ) {
624
- verbosestream << " Saving registered mod storages." << std::endl;
625
638
m_mod_storage_save_timer = g_settings->getFloat (" server_map_save_interval" );
639
+ int n = 0 ;
626
640
for (std::unordered_map<std::string, ModMetadata *>::const_iterator
627
641
it = m_mod_storages.begin (); it != m_mod_storages.end (); ++it) {
628
642
if (it->second ->isModified ()) {
629
643
it->second ->save (getModStoragePath ());
644
+ n++;
630
645
}
631
646
}
647
+ if (n > 0 )
648
+ infostream << " Saved " << n << " modified mod storages." << std::endl;
632
649
}
633
650
634
651
// Write server map
@@ -653,8 +670,8 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
653
670
};
654
671
name = removeStringEnd (filename, image_ext);
655
672
if (!name.empty ()) {
656
- verbosestream<< " Client: Attempting to load image "
657
- << " file \" " << filename<< " \" " << std::endl;
673
+ TRACESTREAM (<< " Client: Attempting to load image "
674
+ << " file \" " << filename << " \" " << std::endl) ;
658
675
659
676
io::IFileSystem *irrfs = RenderingEngine::get_filesystem ();
660
677
video::IVideoDriver *vdrv = RenderingEngine::get_video_driver ();
@@ -687,10 +704,9 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
687
704
};
688
705
name = removeStringEnd (filename, sound_ext);
689
706
if (!name.empty ()) {
690
- verbosestream<<" Client: Attempting to load sound "
691
- <<" file \" " <<filename<<" \" " <<std::endl;
692
- m_sound->loadSoundData (name, data);
693
- return true ;
707
+ TRACESTREAM (<< " Client: Attempting to load sound "
708
+ << " file \" " << filename << " \" " << std::endl);
709
+ return m_sound->loadSoundData (name, data);
694
710
}
695
711
696
712
const char *model_ext[] = {
@@ -714,8 +730,8 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
714
730
};
715
731
name = removeStringEnd (filename, translate_ext);
716
732
if (!name.empty ()) {
717
- verbosestream << " Client: Loading translation: "
718
- << " \" " << filename << " \" " << std::endl;
733
+ TRACESTREAM ( << " Client: Loading translation: "
734
+ << " \" " << filename << " \" " << std::endl) ;
719
735
g_translations->loadTranslation (data);
720
736
return true ;
721
737
}
0 commit comments