From 3adaf8788b65a84ec4266c6621d30679a95f546d Mon Sep 17 00:00:00 2001 From: ultramage Date: Sun, 6 Jan 2008 14:19:26 +0000 Subject: Modified showmsg code to not attach a timestamp to MSG_NONE-type messages, generated by ShowMessage(). It now works exactly like printf(). Removed/replaced all printf calls in the code. Added a new flag to setting 'console_silent', for filtering debug messages. Silenced the "Broken pipe found" and "Server running in debug mode" messages. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12020 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 30 ++++++++-------- src/map/guild.c | 2 -- src/map/intif.c | 5 --- src/map/irc.c | 8 ++--- src/map/map.c | 33 ++++++++---------- src/map/script.c | 102 +++++++++++++++++++++++++++---------------------------- 6 files changed, 84 insertions(+), 96 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 46aa4494a..f9ba58156 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -249,9 +249,9 @@ int clif_send_sub(struct block_list *bl, va_list ap) if (session[fd] != NULL) { WFIFOHEAD(fd, len); if (WFIFOP(fd,0) == buf) { - printf("WARNING: Invalid use of clif_send function\n"); - printf(" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n", WBUFW(buf,0)); - printf(" Please correct your code.\n"); + ShowError("WARNING: Invalid use of clif_send function\n"); + ShowError(" Packet x%4x use a WFIFO of a player instead of to use a buffer.\n", WBUFW(buf,0)); + ShowError(" Please correct your code.\n"); // don't send to not move the pointer of the packet for next sessions in the loop WFIFOSET(fd,0);//## TODO is this ok? } else { @@ -11495,13 +11495,13 @@ void clif_parse_debug(int fd,struct map_session_data *sd) cmd = RFIFOW(fd,0); len = sd?packet_db[sd->packet_ver][cmd].len:RFIFOREST(fd); //With no session, just read the remaining in the buffer. ShowDebug("packet debug 0x%4X\n",cmd); - printf("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F"); + ShowMessage("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F"); for(i=0;istate.auth) { if (sd->status.name != NULL) - printf("\nAccount ID %d, character ID %d, player name %s.\n", - sd->status.account_id, sd->status.char_id, sd->status.name); + ShowMessage("\nAccount ID %d, character ID %d, player name %s.\n", + sd->status.account_id, sd->status.char_id, sd->status.name); else - printf("\nAccount ID %d.\n", sd->bl.id); + ShowMessage("\nAccount ID %d.\n", sd->bl.id); } else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified) - printf("\nAccount ID %d.\n", sd->bl.id); + ShowMessage("\nAccount ID %d.\n", sd->bl.id); }*/ RFIFOSKIP(fd, packet_len); diff --git a/src/map/guild.c b/src/map/guild.c index 1e90226dc..2d83e294e 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1404,8 +1404,6 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id clif_guild_allianceack(sd[i],((flag>>4)==i+1)?3:4); return 0; } -// if(battle_config.etc_log) -// printf("guild alliance_ack %d %d %d %d %d %s %s\n",guild_id1,guild_id2,account_id1,account_id2,flag,name1,name2); if(!(flag&0x08)){ // 関係追加 for(i=0;i<2-(flag&1);i++) diff --git a/src/map/intif.c b/src/map/intif.c index 49791ed94..3566e38c4 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -402,8 +402,6 @@ int intif_request_partyinfo(int party_id) WFIFOW(inter_fd,0) = 0x3021; WFIFOL(inter_fd,2) = party_id; WFIFOSET(inter_fd,6); -// if(battle_config.etc_log) -// printf("intif: request party info\n"); return 0; } // パーティ追加要求 @@ -1082,7 +1080,6 @@ int intif_parse_PartyInfo(int fd) return 0; } -// printf("intif: party info %d\n",RFIFOL(fd,4)); if( RFIFOW(fd,2)!=sizeof(struct party)+4 ) ShowError("intif: party info : data size error %d %d %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct party)+4); party_recv_info((struct party *)RFIFOP(fd,4)); @@ -1704,8 +1701,6 @@ int intif_parse(int fd) return 2; packet_len = RFIFOW(fd,2); } -// if(battle_config.etc_log) -// printf("intif_parse %d %x %d %d\n",fd,cmd,packet_len,RFIFOREST(fd)); if((int)RFIFOREST(fd) 0){ - printf("ok\n"); + ShowMessage("ok\n"); session[irc_fd]->func_parse = irc_parse; } else - printf("failed\n"); + ShowMessage("failed\n"); return 0; } @@ -298,10 +298,10 @@ void irc_parse_sub(int fd, char *incoming_string) { ShowInfo("IRC: Refreshing User List"); irc_rmnames(); - printf("..."); + ShowMessage("..."); sprintf(send_string,"NAMES %s",irc_channel); irc_send(send_string); - printf("Done\n"); + ShowMessage("Done\n"); } else // Autojoin on kick if((strcmpi(command,"kick")==0)&&(irc_autojoin==1)) diff --git a/src/map/map.c b/src/map/map.c index b26af3f36..a3757101d 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2614,22 +2614,22 @@ int parse_console(char* buf) if( n == 5 && strcmpi("admin",type) == 0 ){ if( !is_atcommand_sub(sd.fd,&sd,command,99) ) - printf("Console: not atcommand\n"); + ShowInfo("Console: not atcommand\n"); } else if( n == 2 && strcmpi("server",type) == 0 ){ if( strcmpi("shutdown",command) == 0 || - strcmpi("exit",command) == 0 || - strcmpi("quit",command) == 0 ){ + strcmpi("exit",command) == 0 || + strcmpi("quit",command) == 0 ){ runflag = 0; } } else if( strcmpi("help",type) == 0 ){ ShowNotice("To use GM commands:\n"); - printf("admin:: \n"); - printf("You can use any GM command that doesn't require the GM.\n"); - printf("No using @item or @warp however you can use @charwarp\n"); - printf("The is for commands that need coords of the GM\n"); - printf("IE: @spawn\n"); - printf("To shutdown the server:\n"); - printf("server:shutdown\n"); + ShowInfo("admin:: \n"); + ShowInfo("You can use any GM command that doesn't require the GM.\n"); + ShowInfo("No using @item or @warp however you can use @charwarp\n"); + ShowInfo("The is for commands that need coords of the GM\n"); + ShowInfo("IE: @spawn\n"); + ShowInfo("To shutdown the server:\n"); + ShowInfo("server:shutdown\n"); } return 0; @@ -3116,13 +3116,12 @@ void map_helpscreen(int flag) *------------------------------------------------------*/ void map_versionscreen(int flag) { - printf("CL_WHITE" "eAthena version %d.%02d.%02d, Athena Mod version %d" CL_RESET"\n", + ShowInfo("CL_WHITE" "eAthena version %d.%02d.%02d, Athena Mod version %d" CL_RESET"\n", ATHENA_MAJOR_VERSION, ATHENA_MINOR_VERSION, ATHENA_REVISION, ATHENA_MOD_VERSION); - puts(CL_GREEN "Website/Forum:" CL_RESET "\thttp://eathena.deltaanime.net/"); - puts(CL_GREEN "Download URL:" CL_RESET "\thttp://eathena.systeminplace.net/"); - puts(CL_GREEN "IRC Channel:" CL_RESET "\tirc://irc.deltaanime.net/#athena"); - puts("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information."); + ShowInfo(CL_GREEN "Website/Forum:" CL_RESET "\thttp://eathena.deltaanime.net/"); + ShowInfo(CL_GREEN "IRC Channel:" CL_RESET "\tirc://irc.deltaanime.net/#athena"); + ShowInfo("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information."); if (ATHENA_RELEASE_FLAG) ShowNotice("This version is not for release.\n"); if (flag) exit(EXIT_FAILURE); } @@ -3204,10 +3203,6 @@ int do_init(int argc, char *argv[]) chrif_setip(ip_str); } - if (SHOW_DEBUG_MSG) - ShowNotice("Server running in '"CL_WHITE"Debug Mode"CL_RESET"'.\n"); - - battle_config_read(BATTLE_CONF_FILENAME); msg_config_read(MSG_CONF_NAME); atcommand_config_read(ATCOMMAND_CONF_FILENAME); diff --git a/src/map/script.c b/src/map/script.c index e5bed56a6..67a0d235b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1828,16 +1828,16 @@ const char* script_print_line( const char *p, const char *mark, int line ) int i; if( p == NULL || !p[0] ) return NULL; if( line < 0 ) - printf("*% 5d : ", -line); + ShowMessage("*% 5d : ", -line); else - printf(" % 5d : ", line); + ShowMessage(" % 5d : ", line); for(i=0;p[i] && p[i] != '\n';i++){ if(p + i != mark) - printf("%c",p[i]); + ShowMessage("%c",p[i]); else - printf("\'%c\'",p[i]); + ShowMessage("\'%c\'",p[i]); } - printf("\n"); + ShowMessage("\n"); return p+i+(p[i] == '\n' ? 1 : 0); } @@ -1861,9 +1861,9 @@ void script_error(const char *src,const char *file,int start_line, const char *e p=lineend+1; } - printf("\a\n"); - printf("script error on %s line %d\n", file, line); - printf(" %s\n", error_msg); + ShowMessage("\a\n"); + ShowMessage("script error on %s line %d\n", file, line); + ShowMessage(" %s\n", error_msg); for(j = 0; j < 5; j++ ) { script_print_line( linestart[j], NULL, line + j - 5); } @@ -2017,63 +2017,63 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o #ifdef DEBUG_DISP for(i=0;istack->stack_data[i].type){ case C_INT: - printf(" int(%d)",st->stack->stack_data[i].u.num); + ShowMessage(" int(%d)",st->stack->stack_data[i].u.num); break; case C_NAME: - printf(" name(%s)",str_buf+str_data[st->stack->stack_data[i].u.num & 0xffffff].str); + ShowMessage(" name(%s)",str_buf+str_data[st->stack->stack_data[i].u.num & 0xffffff].str); break; case C_ARG: - printf(" arg"); + ShowMessage(" arg"); break; case C_POS: - printf(" pos(%d)",st->stack->stack_data[i].u.num); + ShowMessage(" pos(%d)",st->stack->stack_data[i].u.num); break; case C_STR: - printf(" str(%s)",st->stack->stack_data[i].u.str); + ShowMessage(" str(%s)",st->stack->stack_data[i].u.str); break; case C_CONSTSTR: - printf(" cstr(%s)",st->stack->stack_data[i].u.str); + ShowMessage(" cstr(%s)",st->stack->stack_data[i].u.str); break; default: - printf(" etc(%d,%d)",st->stack->stack_data[i].type,st->stack->stack_data[i].u.num); + ShowMessage(" etc(%d,%d)",st->stack->stack_data[i].type,st->stack->stack_data[i].u.num); } } - printf("\n"); + ShowMessage("\n"); } #endif if(str_data[func].type!=C_FUNC ){ - ShowMessage ("run_func: '"CL_WHITE"%s"CL_RESET"' (type %d) is not function and command!\n", str_buf+str_data[func].str, str_data[func].type); + ShowError("run_func: '"CL_WHITE"%s"CL_RESET"' (type %d) is not function and command!\n", str_buf+str_data[func].str, str_data[func].type); // st->stack->sp=0; st->state=END; script_reportsrc(st); @@ -9112,7 +9112,7 @@ BUILDIN_FUNC(flagemblem) if(g_id < 0) return 0; -// printf("Script.c: [FlagEmblem] GuildID=%d, Emblem=%d.\n", g->guild_id, g->emblem_id); +// ShowMessage("Script.c: [FlagEmblem] GuildID=%d, Emblem=%d.\n", g->guild_id, g->emblem_id); ((struct npc_data *)map_id2bl(st->oid))->u.scr.guild_id = g_id; return 0; } -- cgit v1.2.3-70-g09d2