summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-06 14:19:26 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-01-06 14:19:26 +0000
commit3adaf8788b65a84ec4266c6621d30679a95f546d (patch)
treeda233eb45db1f482a4f2a86be9529c90edd76c8b /src/map
parentad95c2ba955e42d74afffbb6b9b333f69a3f1b1e (diff)
downloadhercules-3adaf8788b65a84ec4266c6621d30679a95f546d.tar.gz
hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.tar.bz2
hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.tar.xz
hercules-3adaf8788b65a84ec4266c6621d30679a95f546d.zip
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
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c30
-rw-r--r--src/map/guild.c2
-rw-r--r--src/map/intif.c5
-rw-r--r--src/map/irc.c8
-rw-r--r--src/map/map.c33
-rw-r--r--src/map/script.c102
6 files changed, 84 insertions, 96 deletions
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;i<len;i++){
if((i&15)==0)
- printf("\n%04X ",i);
- printf("%02X ",RFIFOB(fd,i));
+ ShowMessage("\n%04X ",i);
+ ShowMessage("%02X ",RFIFOB(fd,i));
}
- printf("\n");
+ ShowMessage("\n");
}
/*==========================================
@@ -11648,21 +11648,21 @@ int clif_parse(int fd)
if (dump) {
int i;
ShowDebug("\nclif_parse: session #%d, packet 0x%04x, length %d, version %d\n", fd, cmd, packet_len, packet_ver);
- 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; i < packet_len; i++) {
if ((i & 15) == 0)
- printf("\n%04X ",i);
- printf("%02X ", RFIFOB(fd,i));
+ ShowMessage("\n%04X ",i);
+ ShowMessage("%02X ", RFIFOB(fd,i));
}
- printf("\n");
+ ShowMessage("\n");
if (sd && sd->state.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)<packet_len){
return 2;
}
diff --git a/src/map/irc.c b/src/map/irc.c
index 0238225fe..9b1a48c5f 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -55,10 +55,10 @@ int irc_connect_timer(int tid, unsigned int tick, int id, int data)
ShowInfo("(IRC) Connecting to %s... ", irc_ip_str);
irc_fd = make_connection(irc_ip,irc_port);
if(irc_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:<gm command>:<map of \"gm\"> <x> <y>\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 <map of \"gm\"> <x> <y> 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:<gm command>:<map of \"gm\"> <x> <y>\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 <map of \"gm\"> <x> <y> 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;i<script_pos;i++){
if((i&15)==0) printf("%04x : ",i);
- printf("%02x ",script_buf[i]);
+ ShowMessage("%02x ",script_buf[i]);
if((i&15)==15) printf("\n");
}
- printf("\n");
+ ShowMessage("\n");
#endif
#ifdef DEBUG_DISASM
{
int i = 0,j;
while(i < script_pos) {
- printf("%06x ",i);
+ ShowMessage("%06x ",i);
j = i;
switch(get_com(script_buf,&i)) {
case C_EOL: printf("C_EOL"); break;
case C_INT: printf("C_INT %d",get_num(script_buf,&i)); break;
case C_POS:
- printf("C_POS 0x%06x",*(int*)(script_buf+i)&0xffffff);
+ ShowMessage("C_POS 0x%06x",*(int*)(script_buf+i)&0xffffff);
i += 3;
break;
case C_NAME:
j = (*(int*)(script_buf+i)&0xffffff);
- printf("C_NAME %s",j == 0xffffff ? "?? unknown ??" : str_buf + str_data[j].str);
+ ShowMessage("C_NAME %s",j == 0xffffff ? "?? unknown ??" : str_buf + str_data[j].str);
i += 3;
break;
- case C_ARG: printf("C_ARG"); break;
- case C_FUNC: printf("C_FUNC"); break;
- case C_ADD: printf("C_ADD"); break;
- case C_SUB: printf("C_SUB"); break;
- case C_MUL: printf("C_MUL"); break;
- case C_DIV: printf("C_DIV"); break;
- case C_MOD: printf("C_MOD"); break;
- case C_EQ: printf("C_EQ"); break;
- case C_NE: printf("C_NE"); break;
- case C_GT: printf("C_GT"); break;
- case C_GE: printf("C_GE"); break;
- case C_LT: printf("C_LT"); break;
- case C_LE: printf("C_LE"); break;
- case C_AND: printf("C_AND"); break;
- case C_OR: printf("C_OR"); break;
- case C_XOR: printf("C_XOR"); break;
- case C_LAND: printf("C_LAND"); break;
- case C_LOR: printf("C_LOR"); break;
- case C_R_SHIFT: printf("C_R_SHIFT"); break;
- case C_L_SHIFT: printf("C_L_SHIFT"); break;
- case C_NEG: printf("C_NEG"); break;
- case C_NOT: printf("C_NOT"); break;
- case C_LNOT: printf("C_LNOT"); break;
- case C_NOP: printf("C_NOP"); break;
- case C_OP3: printf("C_OP3"); break;
+ case C_ARG: ShowMessage("C_ARG"); break;
+ case C_FUNC: ShowMessage("C_FUNC"); break;
+ case C_ADD: ShowMessage("C_ADD"); break;
+ case C_SUB: ShowMessage("C_SUB"); break;
+ case C_MUL: ShowMessage("C_MUL"); break;
+ case C_DIV: ShowMessage("C_DIV"); break;
+ case C_MOD: ShowMessage("C_MOD"); break;
+ case C_EQ: ShowMessage("C_EQ"); break;
+ case C_NE: ShowMessage("C_NE"); break;
+ case C_GT: ShowMessage("C_GT"); break;
+ case C_GE: ShowMessage("C_GE"); break;
+ case C_LT: ShowMessage("C_LT"); break;
+ case C_LE: ShowMessage("C_LE"); break;
+ case C_AND: ShowMessage("C_AND"); break;
+ case C_OR: ShowMessage("C_OR"); break;
+ case C_XOR: ShowMessage("C_XOR"); break;
+ case C_LAND: ShowMessage("C_LAND"); break;
+ case C_LOR: ShowMessage("C_LOR"); break;
+ case C_R_SHIFT: ShowMessage("C_R_SHIFT"); break;
+ case C_L_SHIFT: ShowMessage("C_L_SHIFT"); break;
+ case C_NEG: ShowMessage("C_NEG"); break;
+ case C_NOT: ShowMessage("C_NOT"); break;
+ case C_LNOT: ShowMessage("C_LNOT"); break;
+ case C_NOP: ShowMessage("C_NOP"); break;
+ case C_OP3: ShowMessage("C_OP3"); break;
case C_STR:
j = strlen(script_buf + i);
- printf("C_STR %s",script_buf + i);
+ ShowMessage("C_STR %s",script_buf + i);
i+= j+1;
break;
default:
- printf("unknown");
+ ShowMessage("unknown");
}
- printf("\n");
+ ShowMessage("\n");
}
}
#endif
@@ -2871,33 +2871,33 @@ int run_func(struct script_state *st)
for(i=0;i<end_sp;i++){
switch(st->stack->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;
}