Ver Fonte

Console clean up, dropped quite a few pointless messages and modified others to only be displayed when relevant (e.g. you dont need to know you have only 1 subnetwork)
Improved the debugging of scripts when an amount greater than supported of arguments is used.
Follow up r16935 -- commit missed the script.c part of it.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16936 54d463be-8e91-2dee-dedb-b68131a5f0ec

shennetsind há 12 anos atrás
pai
commit
1e93aef6ac
6 ficheiros alterados com 29 adições e 65 exclusões
  1. 7 27
      src/char/char.c
  2. 1 10
      src/char/inter.c
  3. 0 1
      src/common/random.c
  4. 8 16
      src/login/login.c
  5. 2 1
      src/map/map.c
  6. 11 10
      src/map/script.c

+ 7 - 27
src/char/char.c

@@ -1336,11 +1336,10 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
 //==========================================================================================================
 int mmo_char_sql_init(void)
 {
-	ShowInfo("Begin Initializing.......\n");
 	char_db_= idb_alloc(DB_OPT_RELEASE_DATA);
 
 	if(char_per_account == 0){
-	  ShowStatus("Chars per Account: 'Unlimited'.......\n");
+		ShowStatus("Chars per Account: 'Unlimited'.......\n");
 	}else{
 		ShowStatus("Chars per Account: '%d'.......\n", char_per_account);
 	}
@@ -1354,8 +1353,6 @@ int mmo_char_sql_init(void)
 	// (useful when servers crashs and don't clean the database)
 	set_all_offline_sql();
 
-	ShowInfo("Finished initilizing.......\n");
-
 	return 0;
 }
 
@@ -4357,10 +4354,7 @@ int char_lan_config_read(const char *lancfgName)
 		return 1;
 	}
 
-	ShowInfo("Reading the configuration file %s...\n", lancfgName);
-
-	while(fgets(line, sizeof(line), fp))
-	{
+	while(fgets(line, sizeof(line), fp)) {
 		line_num++;
 		if ((line[0] == '/' && line[1] == '/') || line[0] == '\n' || line[1] == '\n')
 			continue;
@@ -4392,7 +4386,8 @@ int char_lan_config_read(const char *lancfgName)
 		}
 	}
 
-	ShowStatus("Read information about %d subnetworks.\n", subnet_count);
+	if( subnet_count > 1 ) /* only useful if there is more than 1 */
+		ShowStatus("Read information about %d subnetworks.\n", subnet_count);
 
 	fclose(fp);
 	return 0;
@@ -4403,8 +4398,6 @@ void sql_config_read(const char* cfgName)
 	char line[1024], w1[1024], w2[1024];
 	FILE* fp;
 
-	ShowInfo("Reading file %s...\n", cfgName);
-
 	if ((fp = fopen(cfgName, "r")) == NULL) {
 		ShowError("File not found: %s\n", cfgName);
 		return;
@@ -4494,9 +4487,7 @@ int char_config_read(const char* cfgName)
 		return 1;
 	}
 
-	ShowInfo("Reading configuration file %s...\n", cfgName);
-	while(fgets(line, sizeof(line), fp))
-	{
+	while(fgets(line, sizeof(line), fp)) {
 		if (line[0] == '/' && line[1] == '/')
 			continue;
 
@@ -4508,8 +4499,9 @@ int char_config_read(const char* cfgName)
 		if(strcmpi(w1,"timestamp_format") == 0) {
 			safestrncpy(timestamp_format, w2, sizeof(timestamp_format));
 		} else if(strcmpi(w1,"console_silent")==0){
-			ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 			msg_silent = atoi(w2);
+			if( msg_silent ) /* only bother if its actually enabled */
+				ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 		} else if(strcmpi(w1,"stdout_with_ansisequence")==0){
 			stdout_with_ansisequence = config_switch(w2);
 		} else if (strcmpi(w1, "userid") == 0) {
@@ -4518,7 +4510,6 @@ int char_config_read(const char* cfgName)
 			safestrncpy(passwd, w2, sizeof(passwd));
 		} else if (strcmpi(w1, "server_name") == 0) {
 			safestrncpy(server_name, w2, sizeof(server_name));
-			ShowStatus("%s server has been initialized\n", w2);
 		} else if (strcmpi(w1, "wisp_server_name") == 0) {
 			if (strlen(w2) >= 4) {
 				safestrncpy(wisp_server_name, w2, sizeof(wisp_server_name));
@@ -4720,17 +4711,12 @@ int do_init(int argc, char **argv)
 		ShowNotice("And then change the user/password to use in conf/char_athena.conf (or conf/import/char_conf.txt)\n");
 	}
 
-	ShowInfo("Finished reading the char-server configuration.\n");
-
 	inter_init_sql((argc > 2) ? argv[2] : inter_cfgName); // inter server configuration
-	ShowInfo("Finished reading the inter-server configuration.\n");
 	
-	ShowInfo("Initializing char server.\n");
 	auth_db = idb_alloc(DB_OPT_RELEASE_DATA);
 	online_char_db = idb_alloc(DB_OPT_RELEASE_DATA);
 	mmo_char_sql_init();
 	char_read_fame_list(); //Read fame lists.
-	ShowInfo("char server initialized.\n");
 
 	if ((naddr_ != 0) && (!login_ip || !char_ip))
 	{
@@ -4772,24 +4758,18 @@ int do_init(int argc, char **argv)
 	
 	//Cleaning the tables for NULL entrys @ startup [Sirius]
 	//Chardb clean
-	ShowInfo("Cleaning the '%s' table...\n", char_db);
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id` = '0'", char_db) )
 		Sql_ShowDebug(sql_handle);
 
 	//guilddb clean
-    ShowInfo("Cleaning the '%s' table...\n", guild_db);
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `guild_lv` = '0' AND `max_member` = '0' AND `exp` = '0' AND `next_exp` = '0' AND `average_lv` = '0'", guild_db) )
 		Sql_ShowDebug(sql_handle);
 
 	//guildmemberdb clean
-	ShowInfo("Cleaning the '%s' table...\n", guild_member_db);
 	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id` = '0' AND `account_id` = '0' AND `char_id` = '0'", guild_member_db) )
 		Sql_ShowDebug(sql_handle);
 
-	ShowInfo("End of char server initilization function.\n");
-
 	set_defaultparse(parse_char);
-	ShowInfo("open port %d.....\n",char_port);
 	char_fd = make_listen_bind(bind_ip, char_port);
 	ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port);
 	

+ 1 - 10
src/char/inter.c

@@ -698,8 +698,6 @@ static int inter_config_read(const char* cfgName)
 		return 1;
 	}
 
-	ShowInfo("reading file %s...\n", cfgName);
-
 	while(fgets(line, sizeof(line), fp))
 	{
 		i = sscanf(line, "%[^:]: %[^\r\n]", w1, w2);
@@ -708,27 +706,21 @@ static int inter_config_read(const char* cfgName)
 
 		if(!strcmpi(w1,"char_server_ip")) {
 			strcpy(char_server_ip,w2);
-			ShowStatus ("set char_server_ip : %s\n", w2);
 		} else
 		if(!strcmpi(w1,"char_server_port")) {
 			char_server_port = atoi(w2);
-			ShowStatus ("set char_server_port : %s\n", w2);
 		} else
 		if(!strcmpi(w1,"char_server_id")) {
 			strcpy(char_server_id,w2);
-			ShowStatus ("set char_server_id : %s\n", w2);
 		} else
 		if(!strcmpi(w1,"char_server_pw")) {
 			strcpy(char_server_pw,w2);
-			ShowStatus ("set char_server_pw : %s\n", w2);
 		} else
 		if(!strcmpi(w1,"char_server_db")) {
 			strcpy(char_server_db,w2);
-			ShowStatus ("set char_server_db : %s\n", w2);
 		} else
 		if(!strcmpi(w1,"default_codepage")) {
 			strcpy(default_codepage,w2);
-			ShowStatus ("set default_codepage : %s\n", w2);
 		}
 		else if(!strcmpi(w1,"party_share_level"))
 			party_share_level = atoi(w2);
@@ -741,7 +733,7 @@ static int inter_config_read(const char* cfgName)
 	}
 	fclose(fp);
 
-	ShowInfo ("done reading %s.\n", cfgName);
+	ShowInfo ("Done reading %s.\n", cfgName);
 
 	return 0;
 }
@@ -769,7 +761,6 @@ int inter_init_sql(const char *file)
 {
 	//int i;
 
-	ShowInfo ("interserver initialize...\n");
 	inter_config_read(file);
 
 	//DB connection initialized

+ 0 - 1
src/common/random.c

@@ -30,7 +30,6 @@ void rnd_init(void)
 	seed += (uint32)gettid();
 #endif // HAVE_GETTID
 #endif
-	ShowInfo("Initializing random number generator.\n");
 	init_genrand(seed);
 }
 

+ 8 - 16
src/login/login.c

@@ -324,8 +324,6 @@ int login_lan_config_read(const char *lancfgName)
 		return 1;
 	}
 
-	ShowInfo("Reading the configuration file %s...\n", lancfgName);
-
 	while(fgets(line, sizeof(line), fp))
 	{
 		line_num++;
@@ -354,7 +352,8 @@ int login_lan_config_read(const char *lancfgName)
 		}
 	}
 
-	ShowStatus("Read information about %d subnetworks.\n", subnet_count);
+	if( subnet_count > 1 ) /* only useful if there is more than 1 available */
+		ShowStatus("Read information about %d subnetworks.\n", subnet_count);
 
 	fclose(fp);
 	return 0;
@@ -1589,9 +1588,7 @@ int login_config_read(const char* cfgName)
 		ShowError("Configuration file (%s) not found.\n", cfgName);
 		return 1;
 	}
-	ShowInfo("Reading configuration file %s...\n", cfgName);
-	while(fgets(line, sizeof(line), fp))
-	{
+	while(fgets(line, sizeof(line), fp)) {
 		if (line[0] == '/' && line[1] == '/')
 			continue;
 
@@ -1603,8 +1600,9 @@ int login_config_read(const char* cfgName)
 		else if(!strcmpi(w1,"stdout_with_ansisequence"))
 			stdout_with_ansisequence = config_switch(w2);
 		else if(!strcmpi(w1,"console_silent")) {
-			ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 			msg_silent = atoi(w2);
+			if( msg_silent ) /* only bother if we actually have this enabled */
+				ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 		}
 		else if( !strcmpi(w1, "bind_ip") ) {
 			char ip_str[16];
@@ -1614,7 +1612,6 @@ int login_config_read(const char* cfgName)
 		}
 		else if( !strcmpi(w1, "login_port") ) {
 			login_config.login_port = (uint16)atoi(w2);
-			ShowStatus("set login_port : %s\n",w2);
 		}
 		else if(!strcmpi(w1, "log_login"))
 			login_config.log_login = (bool)config_switch(w2);
@@ -1854,17 +1851,12 @@ int do_init(int argc, char** argv)
 
 	// Account database init
 	accounts = get_account_engine();
-	if( accounts == NULL )
-	{
+	if( accounts == NULL ) {
 		ShowFatalError("do_init: account engine '%s' not found.\n", login_config.account_engine);
 		exit(EXIT_FAILURE);
-	}
-	else
-	{
-		ShowInfo("Using account engine '%s'.\n", login_config.account_engine);
+	} else {
 
-		if(!accounts->init(accounts))
-		{
+		if(!accounts->init(accounts)) {
 			ShowFatalError("do_init: Failed to initialize account engine '%s'.\n", login_config.account_engine);
 			exit(EXIT_FAILURE);
 		}

+ 2 - 1
src/map/map.c

@@ -3218,8 +3218,9 @@ int map_config_read(char *cfgName)
 		else if(strcmpi(w1,"stdout_with_ansisequence")==0)
 			stdout_with_ansisequence = config_switch(w2);
 		else if(strcmpi(w1,"console_silent")==0) {
-			ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 			msg_silent = atoi(w2);
+			if( msg_silent ) // only bother if its actually enabled
+				ShowInfo("Console Silent Setting: %d\n", atoi(w2));
 		} else if (strcmpi(w1, "userid")==0)
 			chrif_setuserid(w2);
 		else if (strcmpi(w1, "passwd") == 0)

+ 11 - 10
src/map/script.c

@@ -3352,7 +3352,7 @@ static void script_check_buildin_argtype(struct script_state* st, int func)
 		}
 		else if( type == 0 )
 		{// more arguments than necessary ( should not happen, as it is checked before )
-			ShowWarning("Found more arguments than necessary.\n");
+			ShowWarning("Found more arguments than necessary. unexpected arg type %s\n",script_op2name(data->type));
 			invalid++;
 			break;
 		}
@@ -11029,23 +11029,24 @@ BUILDIN_FUNC(agitcheck2)
 BUILDIN_FUNC(flagemblem)
 {
 	TBL_NPC* nd;
-	int g_id=script_getnum(st,2);
+	int g_id = script_getnum(st,2);
 
 	if(g_id < 0) return 0;
 
 	nd = (TBL_NPC*)map_id2nd(st->oid);
-	if( nd == NULL )
-	{
+	if( nd == NULL ) {
 		ShowError("script:flagemblem: npc %d not found\n", st->oid);
-	}
-	else if( nd->subtype != SCRIPT )
-	{
+	} else if( nd->subtype != SCRIPT ) {
 		ShowError("script:flagemblem: unexpected subtype %d for npc %d '%s'\n", nd->subtype, st->oid, nd->exname);
-	}
-	else
-	{
+	} else {
+		bool changed = ( nd->u.scr.guild_id != g_id )?true:false;
 		nd->u.scr.guild_id = g_id;
 		clif_guild_emblem_area(&nd->bl);
+		/* guild flag caching */
+		if( g_id ) /* adding a id */
+			guild_flag_add(nd);
+		else if( changed ) /* removing a flag */
+			guild_flag_remove(nd);
 	}
 	return 0;
 }