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 --- conf/char_athena.conf | 1 + conf/login_athena.conf | 1 + conf/map_athena.conf | 1 + src/char/char.c | 20 ++++---- src/char/int_guild.c | 1 - src/char/int_homun.c | 2 - src/char/int_party.c | 3 -- src/char/int_pet.c | 3 -- src/char/int_storage.c | 2 - src/char/inter.c | 4 -- src/char_sql/char.c | 21 ++++---- src/char_sql/inter.c | 1 - src/common/core.c | 2 +- src/common/malloc.c | 2 +- src/common/showmsg.c | 18 ++----- src/common/showmsg.h | 1 - src/common/socket.c | 12 ++--- src/login/login.c | 19 ++++--- src/login_sql/login.c | 18 +++---- 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 ++++++++++++++++++------------------- src/txt-converter/char-converter.c | 22 ++++---- 26 files changed, 147 insertions(+), 187 deletions(-) diff --git a/conf/char_athena.conf b/conf/char_athena.conf index a9848422e..24ad0d3fc 100644 --- a/conf/char_athena.conf +++ b/conf/char_athena.conf @@ -55,6 +55,7 @@ stdout_with_ansisequence: no //4: Hide Notice Messages //8: Hide Warning Messages //16: Hide Error and SQL Error messages. +//32: Hide Debug Messages //Example: "console_silent: 7" Hides information, status and notice messages (1+2+4) console_silent: 0 diff --git a/conf/login_athena.conf b/conf/login_athena.conf index 1c9fd0836..f7ecb22bd 100644 --- a/conf/login_athena.conf +++ b/conf/login_athena.conf @@ -31,6 +31,7 @@ stdout_with_ansisequence: no //4: Hide Notice Messages //8: Hide Warning Messages //16: Hide Error and SQL Error messages. +//32: Hide Debug Messages //Example: "console_silent: 7" Hides information, status and notice messages (1+2+4) console_silent: 0 diff --git a/conf/map_athena.conf b/conf/map_athena.conf index 06fe87eb2..b0a467f1e 100644 --- a/conf/map_athena.conf +++ b/conf/map_athena.conf @@ -65,6 +65,7 @@ stdout_with_ansisequence: no //4: Hide Notice Messages //8: Hide Warning Messages //16: Hide Error and SQL Error messages. +//32: Hide Debug Messages //Example: "console_silent: 7" Hides information, status and notice messages (1+2+4) console_silent: 0 diff --git a/src/char/char.c b/src/char/char.c index 717b1117e..e43ea9e7c 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -2058,7 +2058,6 @@ int parse_fromlogin(int fd) WBUFL(buf,2) = RFIFOL(fd,2); // account WBUFL(buf,6) = RFIFOL(fd,6); // GM level mapif_sendall(buf,10); -// printf("parse_fromlogin: To become GM answer: char -> map.\n"); RFIFOSKIP(fd,10); } @@ -2892,7 +2891,6 @@ int parse_frommap(int fd) case 0x2b0a: // request to become GM if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2)) return 0; -// printf("parse_frommap: change gm -> login, account: %d, pass: '%s'.\n", RFIFOL(fd,4), RFIFOP(fd,8)); if (login_fd > 0) { // don't send request if no login-server WFIFOHEAD(login_fd, RFIFOW(fd,2)); WFIFOW(login_fd,0) = 0x2720; @@ -3704,19 +3702,19 @@ int parse_console(char* buf) //login_log("Console command :%s\n", command); if( strcmpi("shutdown", command) == 0 || - strcmpi("exit", command) == 0 || - strcmpi("quit", command) == 0 || - strcmpi("end", command) == 0 ) + strcmpi("exit", command) == 0 || + strcmpi("quit", command) == 0 || + strcmpi("end", command) == 0 ) runflag = 0; else if( strcmpi("alive", command) == 0 || - strcmpi("status", command) == 0 ) + strcmpi("status", command) == 0 ) ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n"); else if( strcmpi("help", command) == 0 ){ - printf(CL_BOLD"Help of commands:"CL_RESET"\n"); - printf(" To shutdown the server:\n"); - printf(" 'shutdown|exit|qui|end'\n"); - printf(" To know if server is alive:\n"); - printf(" 'alive|status'\n"); + ShowInfo(CL_BOLD"Help of commands:"CL_RESET"\n"); + ShowInfo(" To shutdown the server:\n"); + ShowInfo(" 'shutdown|exit|qui|end'\n"); + ShowInfo(" To know if server is alive:\n"); + ShowInfo(" 'alive|status'\n"); } return 0; diff --git a/src/char/int_guild.c b/src/char/int_guild.c index f1d9c7429..2e2933c14 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -431,7 +431,6 @@ int inter_guild_init() c++; } fclose(fp); -// printf("int_guild: %s read done (%d guilds)\n", guild_txt, c); c = 0;//カウンタ初期化 diff --git a/src/char/int_homun.c b/src/char/int_homun.c index be0dcd087..49434cd90 100644 --- a/src/char/int_homun.c +++ b/src/char/int_homun.c @@ -140,7 +140,6 @@ int inter_homun_init() c++; } fclose(fp); -// printf("int_homun: %s read done (%d homuns)\n",homun_txt,c); return 0; } @@ -170,7 +169,6 @@ int inter_homun_save() } homun_db->foreach(homun_db,inter_homun_save_sub,fp); lock_fclose(fp,homun_txt,&lock); -// printf("int_homun: %s saved.\n",homun_txt); return 0; } diff --git a/src/char/int_party.c b/src/char/int_party.c index 7e71adb64..50d6b0d6a 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -127,7 +127,6 @@ int inter_party_fromstr(char *str, struct party *p) { memset(p, 0, sizeof(struct party)); -// printf("sscanf party main info\n"); if (sscanf(str, "%d\t%255[^\t]\t%d,%d\t", &tmp_int[0], tmp_str, &tmp_int[1], &tmp_int[2]) != 4) return 1; @@ -135,7 +134,6 @@ int inter_party_fromstr(char *str, struct party *p) { memcpy(p->name, tmp_str, NAME_LENGTH); p->exp = tmp_int[1]?1:0; p->item = tmp_int[2]; -// printf("%d [%s] %d %d\n", tmp_int[0], tmp_str[0], tmp_int[1], tmp_int[2]); for(j = 0; j < 3 && str != NULL; j++) str = strchr(str + 1, '\t'); @@ -144,7 +142,6 @@ int inter_party_fromstr(char *str, struct party *p) { struct party_member *m = &p->member[i]; if (str == NULL) return 1; -// printf("sscanf party member info %d\n", i); if (sscanf(str + 1, "%d,%d,%d\t", &tmp_int[0], &tmp_int[1], &tmp_int[2]) != 3) return 1; diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 2f06e2df5..59c705620 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -49,7 +49,6 @@ int inter_pet_fromstr(char *str,struct s_pet *p) memset(p,0,sizeof(struct s_pet)); -// printf("sscanf pet main info\n"); s=sscanf(str,"%d,%d,%[^\t]\t%d,%d,%d,%d,%d,%d,%d,%d,%d",&tmp_int[0],&tmp_int[1],tmp_str,&tmp_int[2], &tmp_int[3],&tmp_int[4],&tmp_int[5],&tmp_int[6],&tmp_int[7],&tmp_int[8],&tmp_int[9],&tmp_int[10]); @@ -111,7 +110,6 @@ int inter_pet_init() c++; } fclose(fp); -// printf("int_pet: %s read done (%d pets)\n",pet_txt,c); return 0; } @@ -141,7 +139,6 @@ int inter_pet_save() } pet_db->foreach(pet_db,inter_pet_save_sub,fp); lock_fclose(fp,pet_txt,&lock); -// printf("int_pet: %s saved.\n",pet_txt); return 0; } diff --git a/src/char/int_storage.c b/src/char/int_storage.c index cba4a28a9..4aefd231b 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -286,7 +286,6 @@ int inter_storage_save() } storage_db->foreach(storage_db,inter_storage_save_sub,fp); lock_fclose(fp,storage_txt,&lock); -// printf("int_storage: %s saved.\n",storage_txt); return 0; } @@ -314,7 +313,6 @@ int inter_guild_storage_save() } guild_storage_db->foreach(guild_storage_db,inter_guild_storage_save_sub,fp); lock_fclose(fp,guild_storage_txt,&lock); -// printf("int_storage: %s saved.\n",guild_storage_txt); return 0; } diff --git a/src/char/inter.c b/src/char/inter.c index 85b4793f7..4e617c1e6 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -129,7 +129,6 @@ int inter_accreg_init(void) { c++; } fclose(fp); -// printf("inter: %s read done (%d)\n", accreg_txt, c); return 0; } @@ -160,7 +159,6 @@ int inter_accreg_save(void) { } accreg_db->foreach(accreg_db, inter_accreg_save_sub,fp); lock_fclose(fp, accreg_txt, &lock); -// printf("inter: %s saved.\n", accreg_txt); return 0; } @@ -316,7 +314,6 @@ int mapif_GMmessage(unsigned char *mes, int len, unsigned long color, int sfd) { WBUFL(buf,4) = color; memcpy(WBUFP(buf,8), mes, len - 8); mapif_sendallwos(sfd, buf, len); -// printf("inter server: GM:%d %s\n", len, mes); return 0; } @@ -369,7 +366,6 @@ int mapif_wis_end(struct WisData *wd, int flag) { memcpy(WBUFP(buf, 2), wd->src, 24); WBUFB(buf,26) = flag; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target mapif_send(wd->fd, buf, 27); -// printf("inter server wis_end: flag: %d\n", flag); return 0; } diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 1c048b555..233b87050 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -1719,7 +1719,6 @@ int parse_fromlogin(int fd) return 0; /* Note that this is the code from char-txt! Even uncommenting it will not work. - printf("0x2721:GM reply\n"); { int oldacc, newacc; unsigned char buf[64]; @@ -1738,7 +1737,6 @@ int parse_fromlogin(int fd) WBUFL(buf,2)=oldacc; WBUFL(buf,6)=newacc; mapif_sendall(buf,10); -// printf("char -> map\n"); } */ RFIFOSKIP(fd, 10); @@ -2463,7 +2461,6 @@ int parse_frommap(int fd) memcpy(WFIFOP(login_fd,2),RFIFOP(fd,2),RFIFOW(fd,2)-2); WFIFOW(login_fd,0)=0x2720; WFIFOSET(login_fd,RFIFOW(fd,2)); -// printf("char : change gm -> login %d %s %d\n", RFIFOL(fd, 4), RFIFOP(fd, 8), RFIFOW(fd, 2)); */ ShowWarning("packet 0x2ba (become GM) is not supported by the Char-Server.\n"); RFIFOSKIP(fd, RFIFOW(fd, 2)); @@ -3254,19 +3251,19 @@ int parse_console(char* buf) //login_log("Console command :%s\n", command); if( strcmpi("shutdown", command) == 0 || - strcmpi("exit", command) == 0 || - strcmpi("quit", command) == 0 || - strcmpi("end", command) == 0 ) + strcmpi("exit", command) == 0 || + strcmpi("quit", command) == 0 || + strcmpi("end", command) == 0 ) runflag = 0; else if( strcmpi("alive", command) == 0 || - strcmpi("status", command) == 0 ) + strcmpi("status", command) == 0 ) ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n"); else if( strcmpi("help", command) == 0 ){ - printf(CL_BOLD"Help of commands:"CL_RESET"\n"); - printf(" To shutdown the server:\n"); - printf(" 'shutdown|exit|qui|end'\n"); - printf(" To know if server is alive:\n"); - printf(" 'alive|status'\n"); + ShowInfo(CL_BOLD"Help of commands:"CL_RESET"\n"); + ShowInfo(" To shutdown the server:\n"); + ShowInfo(" 'shutdown|exit|qui|end'\n"); + ShowInfo(" To know if server is alive:\n"); + ShowInfo(" 'alive|status'\n"); } return 0; diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index a472018b8..e6f955fbe 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -503,7 +503,6 @@ int mapif_wis_end(struct WisData *wd,int flag) memcpy(WBUFP(buf, 2),wd->src,24); WBUFB(buf,26)=flag; mapif_send(wd->fd,buf,27); -// printf("inter server wis_end %d\n",flag); return 0; } diff --git a/src/common/core.c b/src/common/core.c index 301760759..b89cc3841 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -94,7 +94,7 @@ static void sig_proc(int sn) //run_flag = 0; // should we quit? break; case SIGPIPE: - ShowMessage ("Broken pipe found... closing socket\n"); // set to eof in socket.c + //ShowInfo ("Broken pipe found... closing socket\n"); // set to eof in socket.c break; // does nothing here #endif } diff --git a/src/common/malloc.c b/src/common/malloc.c index f2866e564..8b985bbd7 100644 --- a/src/common/malloc.c +++ b/src/common/malloc.c @@ -201,7 +201,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func ) size_t size_hash; if (((long) size) < 0) { - printf("_mmalloc: %d\n", size); + ShowError("_mmalloc: %d\n", size); return 0; } diff --git a/src/common/showmsg.c b/src/common/showmsg.c index fa744f0e4..c50716bed 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -525,9 +525,6 @@ int FPRINTF(HANDLE handle, const char *fmt, ...) #else // not _WIN32 -//#define VPRINTF vprintf -//#define PRINTF printf - #define is_console(file) (0!=isatty(fileno(file))) //vprintf_without_ansiformats @@ -674,12 +671,8 @@ int FPRINTF(FILE *file, const char *fmt, ...) char timestamp_format[20] = ""; //For displaying Timestamps -// by MC Cameri int _vShowMessage(enum msg_type flag, const char *string, va_list ap) { - // _ShowMessage MUST be used instead of printf as of 10/24/2004. - // Return: 0 = Successful, 1 = Failed. -// int ret = 0; char prefix[100]; #if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) FILE *fp; @@ -689,19 +682,18 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap) ShowError("Empty string passed to _vShowMessage().\n"); return 1; } - if ( -#if !defined(SHOW_DEBUG_MSG) - (flag == MSG_DEBUG) || -#endif + if( (flag == MSG_INFORMATION && msg_silent&1) || (flag == MSG_STATUS && msg_silent&2) || (flag == MSG_NOTICE && msg_silent&4) || (flag == MSG_WARNING && msg_silent&8) || (flag == MSG_ERROR && msg_silent&16) || - (flag == MSG_SQL && msg_silent&16)) + (flag == MSG_SQL && msg_silent&16) || + (flag == MSG_DEBUG && msg_silent&32) + ) return 0; //Do not print it. - if (timestamp_format[0]) + if (timestamp_format[0] && flag != MSG_NONE) { //Display time format. [Skotlex] time_t t = time(NULL); strftime(prefix, 80, timestamp_format, localtime(&t)); diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 31933f17a..998296b66 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -4,7 +4,6 @@ #ifndef _SHOWMSG_H_ #define _SHOWMSG_H_ -#define SHOW_DEBUG_MSG 1 // for help with the console colors look here: // http://www.edoceo.com/liberum/?doc=printf-with-color // some code explanation (used here): diff --git a/src/common/socket.c b/src/common/socket.c index 0173ee846..9bc49a3e0 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -817,7 +817,7 @@ static int connect_check(uint32 ip) { int result = connect_check_(ip); if( access_debug ) { - ShowMessage("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!"); + ShowInfo("connect_check: Connection from %d.%d.%d.%d %s\n", CONVIP(ip),result ? "allowed." : "denied!"); } return result; } @@ -837,7 +837,7 @@ static int connect_check_(uint32 ip) for( i=0; i < access_allownum; ++i ){ if( (ip & access_allow[i].mask) == (access_allow[i].ip & access_allow[i].mask) ){ if( access_debug ){ - ShowMessage("connect_check: Found match from allow list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", + ShowInfo("connect_check: Found match from allow list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(access_allow[i].ip), CONVIP(access_allow[i].mask)); @@ -850,7 +850,7 @@ static int connect_check_(uint32 ip) for( i=0; i < access_denynum; ++i ){ if( (ip & access_deny[i].mask) == (access_deny[i].ip & access_deny[i].mask) ){ if( access_debug ){ - ShowMessage("connect_check: Found match from deny list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", + ShowInfo("connect_check: Found match from deny list:%d.%d.%d.%d IP:%d.%d.%d.%d Mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(access_deny[i].ip), CONVIP(access_deny[i].mask)); @@ -956,7 +956,7 @@ static int connect_check_clear(int tid, unsigned int tick, int id, int data) connect_history[i] = root.next; } if( access_debug ){ - ShowMessage("connect_check_clear: Cleared %d of %d from IP list.\n", clear, list); + ShowInfo("connect_check_clear: Cleared %d of %d from IP list.\n", clear, list); } return list; } @@ -1001,7 +1001,7 @@ int access_ipmask(const char* str, AccessControl* acc) } } if( access_debug ){ - ShowMessage("access_ipmask: Loaded IP:%d.%d.%d.%d mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(mask)); + ShowInfo("access_ipmask: Loaded IP:%d.%d.%d.%d mask:%d.%d.%d.%d\n", CONVIP(ip), CONVIP(mask)); } acc->ip = ip; acc->mask = mask; @@ -1215,7 +1215,7 @@ void socket_init(void) } if( LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0 ) { - printf("socket_init: WinSock version mismatch (2.0 or compatible required)!\n"); + ShowError("socket_init: WinSock version mismatch (2.0 or compatible required)!\n"); return; } } diff --git a/src/login/login.c b/src/login/login.c index 9a6f61c0b..0fb728ff2 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1627,7 +1627,6 @@ int parse_fromchar(int fd) charif_sendallwos(fd, buf, WBUFW(buf,2)); // Save mmo_auth_sync(); -// printf("parse_fromchar: receiving (from the char-server) of account_reg2 (account id: %d).\n", acc); if (buf) aFree(buf); break; } @@ -2219,21 +2218,21 @@ int parse_console(char* buf) ShowInfo("Console command :%s", command); if( strcmpi("shutdown", command) == 0 || - strcmpi("exit", command) == 0 || - strcmpi("quit", command) == 0 || - strcmpi("end", command) == 0 ) + strcmpi("exit", command) == 0 || + strcmpi("quit", command) == 0 || + strcmpi("end", command) == 0 ) runflag = 0; else if( strcmpi("alive", command) == 0 || - strcmpi("status", command) == 0 ) + strcmpi("status", command) == 0 ) ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n"); else if( strcmpi("help", command) == 0 ) { - printf(CL_BOLD"Help of commands:"CL_RESET"\n"); - printf(" To shutdown the server:\n"); - printf(" 'shutdown|exit|quit|end'\n"); - printf(" To know if server is alive:\n"); - printf(" 'alive|status'\n"); + ShowInfo(CL_BOLD"Help of commands:"CL_RESET"\n"); + ShowInfo(" To shutdown the server:\n"); + ShowInfo(" 'shutdown|exit|quit|end'\n"); + ShowInfo(" To know if server is alive:\n"); + ShowInfo(" 'alive|status'\n"); } return 0; diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 5d76c2d93..45fc548c5 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -1589,21 +1589,21 @@ int parse_console(char* buf) ShowInfo("Console command :%s", command); if( strcmpi("shutdown", command) == 0 || - strcmpi("exit", command) == 0 || - strcmpi("quit", command) == 0 || - strcmpi("end", command) == 0 ) + strcmpi("exit", command) == 0 || + strcmpi("quit", command) == 0 || + strcmpi("end", command) == 0 ) runflag = 0; else if( strcmpi("alive", command) == 0 || - strcmpi("status", command) == 0 ) + strcmpi("status", command) == 0 ) ShowInfo(CL_CYAN"Console: "CL_BOLD"I'm Alive."CL_RESET"\n"); else if( strcmpi("help", command) == 0 ) { - printf(CL_BOLD"Help of commands:"CL_RESET"\n"); - printf(" To shutdown the server:\n"); - printf(" 'shutdown|exit|quit|end'\n"); - printf(" To know if server is alive:\n"); - printf(" 'alive|status'\n"); + ShowInfo(CL_BOLD"Help of commands:"CL_RESET"\n"); + ShowInfo(" To shutdown the server:\n"); + ShowInfo(" 'shutdown|exit|quit|end'\n"); + ShowInfo(" To know if server is alive:\n"); + ShowInfo(" 'alive|status'\n"); } return 0; 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; } diff --git a/src/txt-converter/char-converter.c b/src/txt-converter/char-converter.c index dcc5b9653..44e48d224 100644 --- a/src/txt-converter/char-converter.c +++ b/src/txt-converter/char-converter.c @@ -41,7 +41,7 @@ int convert_init(void) FILE *fp; ShowWarning("Make sure you backup your databases before continuing!\n"); - printf("\n"); + ShowMessage("\n"); ShowNotice("Do you wish to convert your Character Database to SQL? (y/n) : "); input = getchar(); @@ -102,13 +102,13 @@ int convert_init(void) } while(getchar() != '\n'); - printf("\n"); + ShowMessage("\n"); ShowNotice("Do you wish to convert your Storage Database to SQL? (y/n) : "); input = getchar(); if(input == 'y' || input == 'Y') { struct storage storage_; - printf("\n"); + ShowMessage("\n"); ShowStatus("Converting Storage Database...\n"); if( (fp = fopen(storage_txt,"r")) == NULL ) { @@ -138,13 +138,13 @@ int convert_init(void) //FIXME: CONVERT STATUS DATA HERE!!! while(getchar() != '\n'); - printf("\n"); + ShowMessage("\n"); ShowNotice("Do you wish to convert your Pet Database to SQL? (y/n) : "); input=getchar(); if(input == 'y' || input == 'Y') { struct s_pet p; - printf("\n"); + ShowMessage("\n"); ShowStatus("Converting Pet Database...\n"); if( (fp = fopen(pet_txt, "r")) == NULL ) { @@ -170,13 +170,13 @@ int convert_init(void) //FIXME: CONVERT HOMUNCULUS DATA AND SKILLS HERE!!! while(getchar() != '\n'); - printf("\n"); + ShowMessage("\n"); ShowNotice("Do you wish to convert your Party Database to SQL? (y/n) : "); input=getchar(); if(input == 'y' || input == 'Y') { struct party p; - printf("\n"); + ShowMessage("\n"); ShowStatus("Converting Party Database...\n"); if( (fp = fopen(party_txt, "r")) == NULL ) { @@ -201,14 +201,14 @@ int convert_init(void) } while(getchar() != '\n'); - printf("\n"); + ShowMessage("\n"); ShowNotice("Do you wish to convert your Guilds and Castles Database to SQL? (y/n) : "); input=getchar(); if(input == 'y' || input == 'Y') { struct guild g; struct guild_castle gc; - printf("\n"); + ShowMessage("\n"); ShowStatus("Converting Guild Database...\n"); if( (fp = fopen(guild_txt, "r")) == NULL ) { @@ -252,13 +252,13 @@ int convert_init(void) } while(getchar() != '\n'); - printf("\n"); + ShowMessage("\n"); ShowNotice("Do you wish to convert your Guild Storage Database to SQL? (y/n) : "); input=getchar(); if(input == 'y' || input == 'Y') { struct guild_storage storage_; - printf("\n"); + ShowMessage("\n"); ShowStatus("Converting Guild Storage Database...\n"); if( (fp = fopen(guild_storage_txt, "r")) == NULL ) { -- cgit v1.2.3-60-g2f50