summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-20 13:24:15 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-20 13:24:15 +0000
commita10e65fdc82e4073909354e760c95080a407d25e (patch)
tree9584accc18962093148329ef6ccb26cf72491171
parentf8b4fc65481df7c8c3d831677763387d7effb863 (diff)
downloadhercules-a10e65fdc82e4073909354e760c95080a407d25e.tar.gz
hercules-a10e65fdc82e4073909354e760c95080a407d25e.tar.bz2
hercules-a10e65fdc82e4073909354e760c95080a407d25e.tar.xz
hercules-a10e65fdc82e4073909354e760c95080a407d25e.zip
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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16936 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/char/char.c34
-rw-r--r--src/char/inter.c11
-rw-r--r--src/common/random.c1
-rw-r--r--src/login/login.c24
-rw-r--r--src/map/map.c3
-rw-r--r--src/map/script.c21
6 files changed, 29 insertions, 65 deletions
diff --git a/src/char/char.c b/src/char/char.c
index ee41e061d..6d23dea16 100644
--- a/src/char/char.c
+++ b/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);
diff --git a/src/char/inter.c b/src/char/inter.c
index 4cbb1e32b..6f09fa9d7 100644
--- a/src/char/inter.c
+++ b/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
diff --git a/src/common/random.c b/src/common/random.c
index 367d26cfe..5c048c7eb 100644
--- a/src/common/random.c
+++ b/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);
}
diff --git a/src/login/login.c b/src/login/login.c
index 457a25f64..e079dbaf2 100644
--- a/src/login/login.c
+++ b/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);
}
diff --git a/src/map/map.c b/src/map/map.c
index 456ae66ed..9238af9f9 100644
--- a/src/map/map.c
+++ b/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)
diff --git a/src/map/script.c b/src/map/script.c
index 3e7db8720..7a2b9bea2 100644
--- a/src/map/script.c
+++ b/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;
}