Ver Fonte

Made debug ShowStatus calls easier to disable (#7618)

Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Jittapan Pluemsumran há 2 anos atrás
pai
commit
1985662045
6 ficheiros alterados com 13 adições e 5 exclusões
  1. 1 1
      src/common/database.cpp
  2. 8 0
      src/config/core.hpp
  3. 1 1
      src/map/itemdb.cpp
  4. 1 1
      src/map/map.cpp
  5. 1 1
      src/map/mob.cpp
  6. 1 1
      src/map/npc.cpp

+ 1 - 1
src/common/database.cpp

@@ -164,7 +164,7 @@ void YamlDatabase::parse( const ryml::Tree& tree ){
 
 		for( const ryml::NodeRef &node : bodyNode ){
 			count += this->parseBodyNode( node );
-#ifdef DEBUG
+#ifdef DETAILED_LOADING_OUTPUT
 			ShowStatus( "Loading [%" PRIdPTR "/%" PRIdPTR "] entries from '" CL_WHITE "%s" CL_RESET "'" CL_CLL "\r", ++childNodesProgressed, childNodesCount, fileName );
 #endif
 		}

+ 8 - 0
src/config/core.hpp

@@ -100,6 +100,14 @@
 /// Uncomment for use with Nemo patch ExtendOldCashShopPreview
 //#define ENABLE_OLD_CASHSHOP_PREVIEW_PATCH
 
+#if defined(_DEBUG) || defined(DEBUG)
+	#define DETAILED_LOADING_OUTPUT
+#endif
+
+/// Uncomment to forcibly disable the detailed loading output.
+/// This will noticeably decrease the boot time of the map server by not having to print so many status messages.
+//#undef DETAILED_LOADING_OUTPUT
+
 /**
  * No settings past this point
  **/

+ 1 - 1
src/map/itemdb.cpp

@@ -4168,7 +4168,7 @@ static int itemdb_read_sqldb(void) {
 
 		// process rows one by one
 		while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ) {
-#ifdef DEBUG
+#ifdef DETAILED_LOADING_OUTPUT
 			ShowStatus( "Loading [%" PRIu64 "/%" PRIu64 "] entries in '" CL_WHITE "%s" CL_RESET "'" CL_CLL "\r", ++rows, total_rows, item_db_name[fi] );
 #endif
 			std::vector<std::string> data = {};

+ 1 - 1
src/map/map.cpp

@@ -3786,7 +3786,7 @@ int map_readallmaps (void)
 		struct map_data *mapdata = &map[i];
 		char map_cache_decode_buffer[MAX_MAP_SIZE];
 
-#ifdef DEBUG
+#ifdef DETAILED_LOADING_OUTPUT
 		// show progress
 		ShowStatus("Loading maps [%i/%i]: %s" CL_CLL "\r", i, map_num, mapdata->name);
 #endif

+ 1 - 1
src/map/mob.cpp

@@ -5285,7 +5285,7 @@ static int mob_read_sqldb(void)
 
 		// process rows one by one
 		while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ) {
-#ifdef DEBUG
+#ifdef DETAILED_LOADING_OUTPUT
 			ShowStatus("Loading [%" PRIu64 "/%" PRIu64 "] entries in '" CL_WHITE "%s" CL_RESET "'" CL_CLL "\r", ++rows, total_rows, mob_db_name[fi]);
 #endif
 			std::vector<std::string> data = {};

+ 1 - 1
src/map/npc.cpp

@@ -3611,7 +3611,7 @@ void npc_delsrcfile(const char* name)
 void npc_loadsrcfiles() {
 	ShowStatus("Loading NPCs...\n");
 	for (const auto& file : npc_src_files) {
-#ifdef DEBUG
+#ifdef DETAILED_LOADING_OUTPUT
 		ShowStatus("Loading NPC file: %s" CL_CLL "\r", file.c_str());
 #endif
 		npc_parsesrcfile(file.c_str());