From 462883b7cb02a2f229d0c53afd179163725d50de Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 17 Nov 2007 20:51:25 +0000 Subject: Removed battle_config.error_log as console_silent already handles this git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11751 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + conf/battle/misc.conf | 5 +- src/map/battle.c | 13 ++---- src/map/battle.h | 1 - src/map/chrif.c | 6 +-- src/map/clif.c | 21 +++------ src/map/guild.c | 12 ++--- src/map/intif.c | 109 ++++++++++++++----------------------------- src/map/itemdb.c | 9 ++-- src/map/map.c | 71 +++++++++------------------- src/map/mercenary.c | 3 +- src/map/mob.c | 20 ++++---- src/map/npc.c | 35 +++++--------- src/map/party.c | 12 ++--- src/map/path.c | 6 +-- src/map/pc.c | 127 +++++++++++++++++--------------------------------- src/map/pet.c | 32 +++++-------- src/map/script.c | 38 ++++++--------- src/map/skill.c | 19 +++----- src/map/status.c | 28 +++++------ src/map/unit.c | 15 ++---- 21 files changed, 200 insertions(+), 383 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 2456fb4c6..6d32df165 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2007/11/17 + * Removed battle_config.error_log as console_silent already handles this * Made OnTouch zone dimensions be stored as radius instead of diameter - cleaned up some overly complicated area calculations [ultramage] 2007/11/16 diff --git a/conf/battle/misc.conf b/conf/battle/misc.conf index 3fa7b34e6..4b3552b38 100644 --- a/conf/battle/misc.conf +++ b/conf/battle/misc.conf @@ -55,7 +55,7 @@ pk_weapon_attack_damage_rate: 60 pk_magic_attack_damage_rate: 60 pk_misc_attack_damage_rate: 60 -// Display skill usage/errors in console? (for debug only) (default: off) (Note 3) +// Display skill usage in console? (for debug only) (default: off) (Note 3) skill_log: off // Display battle log? (for debug only) (default: off) (Note 1) @@ -64,9 +64,6 @@ battle_log: off // Display save log? (for debug only) (default: off) (Note 1) save_log: off -// Display errors? (for debug only) (default: off) (Note 1) -error_log: on - // Display other stuff? (for debug only) (default: off) (Note 1) etc_log: off diff --git a/src/map/battle.c b/src/map/battle.c index 72580f03b..f686410f4 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -216,8 +216,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag if (def_type < 0 || def_type > ELE_MAX || def_lv < 1 || def_lv > 4) { - if (battle_config.error_log) - ShowError("battle_attr_fix: unknown attr type: atk=%d def_type=%d def_lv=%d\n",atk_elem,def_type,def_lv); + ShowError("battle_attr_fix: unknown attr type: atk=%d def_type=%d def_lv=%d\n",atk_elem,def_type,def_lv); return damage; } @@ -1243,7 +1242,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (nk&NK_SPLASHSPLIT){ // Divide ATK among targets if(wflag>0) wd.damage/= wflag; - else if(battle_config.error_log) + else ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); } @@ -2220,7 +2219,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if(nk&NK_SPLASHSPLIT){ // Divide MATK in case of multiple targets skill if(mflag>0) ad.damage/= mflag; - else if(battle_config.error_log) + else ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); } @@ -2563,7 +2562,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if (nk&NK_SPLASHSPLIT){ // Divide ATK among targets if(mflag>0) md.damage/= mflag; - else if(battle_config.error_log) + else ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num)); } @@ -2661,8 +2660,7 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl case BF_MAGIC: d = battle_calc_magic_attack(bl,target,skill_num,skill_lv,count); break; case BF_MISC: d = battle_calc_misc_attack(bl,target,skill_num,skill_lv,count); break; default: - if (battle_config.error_log) - ShowError("battle_calc_attack: unknown attack type! %d\n",attack_type); + ShowError("battle_calc_attack: unknown attack type! %d\n",attack_type); memset(&d,0,sizeof(d)); break; } @@ -3462,7 +3460,6 @@ static const struct _battle_data { { "skill_log", &battle_config.skill_log, BL_NUL, BL_NUL, BL_ALL, }, { "battle_log", &battle_config.battle_log, 0, 0, 1, }, { "save_log", &battle_config.save_log, 0, 0, 1, }, - { "error_log", &battle_config.error_log, 1, 0, 1, }, { "etc_log", &battle_config.etc_log, 1, 0, 1, }, { "save_clothcolor", &battle_config.save_clothcolor, 1, 0, 1, }, { "undead_detect_type", &battle_config.undead_detect_type, 0, 0, 2, }, diff --git a/src/map/battle.h b/src/map/battle.h index c2e4af72c..a46592308 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -223,7 +223,6 @@ extern struct Battle_Config int skill_log; int battle_log; int save_log; - int error_log; int etc_log; int save_clothcolor; int undead_detect_type; diff --git a/src/map/chrif.c b/src/map/chrif.c index 52fcc5ca3..0f4df2544 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -324,8 +324,7 @@ int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int c return -1; if (login_id1 == 1) { //FIXME: charserver says '0'! [ultramage] - if (battle_config.error_log) - ShowError("map server change failed.\n"); + ShowError("map server change failed.\n"); clif_authfail_fd(sd->fd, 0); return 0; } @@ -1321,8 +1320,7 @@ int chrif_parse(int fd) case 0x2b22: chrif_updatefamelist_ack(fd); break; case 0x2b24: chrif_keepalive_ack(fd); break; default: - if (battle_config.error_log) - ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd); + ShowError("chrif_parse : unknown packet (session #%d): 0x%x. Disconnecting.\n", fd, cmd); set_eof(fd); return 0; } diff --git a/src/map/clif.c b/src/map/clif.c index a332d38c9..4a393a332 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -497,8 +497,7 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target break; default: - if (battle_config.error_log) - ShowError("clif_send: Unrecognized type %d\n",type); + ShowError("clif_send: Unrecognized type %d\n",type); return -1; } @@ -2593,8 +2592,7 @@ int clif_updatestatus(struct map_session_data *sd,int type) break; default: - if(battle_config.error_log) - ShowError("clif_updatestatus : unrecognized type %d\n",type); + ShowError("clif_updatestatus : unrecognized type %d\n",type); return 1; } WFIFOSET(fd,len); @@ -2621,8 +2619,7 @@ int clif_changestatus(struct block_list *bl,int type,int val) WBUFL(buf,8)=val; break; default: - if(battle_config.error_log) - ShowError("clif_changestatus : unrecognized type %d.\n",type); + ShowError("clif_changestatus : unrecognized type %d.\n",type); return 1; } clif_send(buf,packet_len(0x1ab),bl,AREA_WOS); @@ -7399,8 +7396,7 @@ int clif_charnameack (int fd, struct block_list *bl) // break; return 0; default: - if (battle_config.error_log) - ShowError("clif_parse_GetCharNameRequest : bad type %d(%d)\n", bl->type, bl->id); + ShowError("clif_parse_GetCharNameRequest : bad type %d(%d)\n", bl->type, bl->id); return 0; } @@ -7498,8 +7494,7 @@ int clif_disp_overhead(struct map_session_data *sd, const char* mes) int len_mes = strlen(mes)+1; //Account for \0 if (len_mes + 8 >= 256) { - if (battle_config.error_log) - ShowError("clif_disp_overhead: Message too long (length %d)\n", len_mes); + ShowError("clif_disp_overhead: Message too long (length %d)\n", len_mes); len_mes = 247; //Trunk it to avoid problems. } // send message to others @@ -7810,8 +7805,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) if (sd) { - if (battle_config.error_log) - ShowError("clif_parse_WantToConnection : invalid request (character already logged in)?\n"); + ShowError("clif_parse_WantToConnection : invalid request (character already logged in)?\n"); return; } @@ -10091,8 +10085,7 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) clif_guild_expulsionlist(sd); break; default: - if (battle_config.error_log) - ShowError("clif: guild request info: unknown type %d\n", RFIFOL(fd,2)); + ShowError("clif: guild request info: unknown type %d\n", RFIFOL(fd,2)); break; } } diff --git a/src/map/guild.c b/src/map/guild.c index 84cbe137d..6193ed69b 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -511,8 +511,7 @@ int guild_check_member(struct guild *g) sd->status.guild_id=0; sd->state.guild_sent=0; sd->guild_emblem_id=0; - if(battle_config.error_log) - ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name); + ShowWarning("guild: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name); } } } @@ -568,8 +567,7 @@ int guild_recv_info(struct guild *sg) if(g->max_member > MAX_GUILD) { - if (battle_config.error_log) - ShowError("guild_recv_info: Received guild with %d members, but MAX_GUILD is only %d. Extra guild-members have been lost!\n", g->max_member, MAX_GUILD); + ShowError("guild_recv_info: Received guild with %d members, but MAX_GUILD is only %d. Extra guild-members have been lost!\n", g->max_member, MAX_GUILD); g->max_member = MAX_GUILD; } @@ -748,8 +746,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag) if(sd==NULL || sd->guild_invite==0){ // キャラ側に登録できなかったため脱退要求を出す if (flag == 0) { - if(battle_config.error_log) - ShowError("guild: member added error %d is not online\n",account_id); + ShowError("guild: member added error %d is not online\n",account_id); intif_guild_leave(guild_id,account_id,char_id,0,"**登録失敗**"); } return 0; @@ -959,8 +956,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin sd->guild_emblem_id=0; sd->state.guild_sent=0; } - if(battle_config.error_log) - ShowWarning("guild: not found member %d,%d on %d[%s]\n", account_id,char_id,guild_id,g->name); + ShowWarning("guild: not found member %d,%d on %d[%s]\n", account_id,char_id,guild_id,g->name); return 0; } diff --git a/src/map/intif.c b/src/map/intif.c index 3cced222f..1cecf5ab0 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -282,8 +282,7 @@ int intif_saveregistry(struct map_session_data *sd, int type) sd->state.reg_dirty &= ~0x1; break; default: //Broken code? - if (battle_config.error_log) - ShowError("intif_saveregistry: Invalid type %d\n", type); + ShowError("intif_saveregistry: Invalid type %d\n", type); return -1; } WFIFOHEAD(inter_fd, 288 * MAX_REG_NUM+13); @@ -962,8 +961,7 @@ int intif_parse_Registers(int fd) max = ACCOUNT_REG2_NUM; break; default: - if (battle_config.error_log) - ShowError("intif_parse_Registers: Unrecognized type %d\n",RFIFOB(fd,12)); + ShowError("intif_parse_Registers: Unrecognized type %d\n",RFIFOB(fd,12)); return 0; } for(j=0,p=13;jstorage_status == 1) { // Already open.. lets ignore this update - if (battle_config.error_log) - ShowWarning("intif_parse_LoadStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + ShowWarning("intif_parse_LoadStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); return 1; } if (stor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex] - if (battle_config.error_log) - ShowWarning("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + ShowWarning("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); return 1; } if (RFIFOW(fd,2)-8 != sizeof(struct storage)) { - if (battle_config.error_log) - ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage)); + ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage)); return 1; } if(battle_config.save_log) @@ -1046,30 +1040,24 @@ int intif_parse_LoadGuildStorage(int fd) return 1; sd=map_id2sd( RFIFOL(fd,4) ); if(sd==NULL){ - if(battle_config.error_log) - ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); + ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4)); return 1; } gstor=guild2storage(guild_id); if(!gstor) { - if(battle_config.error_log) - ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id); - return 1; + ShowWarning("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",guild_id); } if (gstor->storage_status == 1) { // Already open.. lets ignore this update - if (battle_config.error_log) - ShowWarning("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + ShowWarning("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n", sd->status.account_id, sd->status.char_id); return 1; } if (gstor->dirty) { // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex] - if (battle_config.error_log) - ShowWarning("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); + ShowWarning("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id); return 1; } if( RFIFOW(fd,2)-12 != sizeof(struct guild_storage) ){ + ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-12 , sizeof(struct guild_storage)); gstor->storage_status = 0; - if(battle_config.error_log) - ShowError("intif_parse_LoadGuildStorage: data size error %d %d\n",RFIFOW(fd,2)-12 , sizeof(struct guild_storage)); return 1; } if(battle_config.save_log) @@ -1102,17 +1090,14 @@ int intif_parse_PartyCreated(int fd) int intif_parse_PartyInfo(int fd) { if( RFIFOW(fd,2)==8){ - if(battle_config.error_log) - ShowWarning("intif: party noinfo %d\n",RFIFOL(fd,4)); + ShowWarning("intif: party noinfo %d\n",RFIFOL(fd,4)); party_recv_noinfo(RFIFOL(fd,4)); return 0; } // printf("intif: party info %d\n",RFIFOL(fd,4)); - if( RFIFOW(fd,2)!=sizeof(struct party)+4 ){ - if(battle_config.error_log) - ShowError("intif: party info : data size error %d %d %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct party)+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)); return 0; } @@ -1167,18 +1152,13 @@ int intif_parse_GuildCreated(int fd) int intif_parse_GuildInfo(int fd) { if(RFIFOW(fd,2) == 8) { - if(battle_config.error_log) - ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4)); + ShowWarning("intif: guild noinfo %d\n",RFIFOL(fd,4)); guild_recv_noinfo(RFIFOL(fd,4)); return 0; } -// if(battle_config.etc_log) -// printf("intif: guild info %d\n",RFIFOL(fd,4)); - if( RFIFOW(fd,2)!=sizeof(struct guild)+4 ){ - if(battle_config.error_log) - ShowError("intif: guild info : data size error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4); - } + if( RFIFOW(fd,2)!=sizeof(struct guild)+4 ) + ShowError("intif: guild info : data size error Gid: %d recv size: %d Expected size: %d\n",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild)+4); guild_recv_info((struct guild *)RFIFOP(fd,4)); return 0; } @@ -1270,10 +1250,8 @@ int intif_parse_GuildMemberInfoChanged(int fd) // ギルド役職変更通知 int intif_parse_GuildPosition(int fd) { - if( RFIFOW(fd,2)!=sizeof(struct guild_position)+12 ){ - if(battle_config.error_log) - ShowError("intif: guild info : data size error\n %d %d %d",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12); - } + if( RFIFOW(fd,2)!=sizeof(struct guild_position)+12 ) + ShowError("intif: guild info : data size error\n %d %d %d",RFIFOL(fd,4),RFIFOW(fd,2),sizeof(struct guild_position)+12); guild_position_changed(RFIFOL(fd,4),RFIFOL(fd,8),(struct guild_position *)RFIFOP(fd,12)); return 0; } @@ -1354,20 +1332,16 @@ int intif_parse_RecvPetData(int fd) } int intif_parse_SavePetOk(int fd) { - if(RFIFOB(fd,6) == 1) { - if(battle_config.error_log) - ShowError("pet data save failure\n"); - } + if(RFIFOB(fd,6) == 1) + ShowError("pet data save failure\n"); return 0; } int intif_parse_DeletePetOk(int fd) { - if(RFIFOB(fd,2) == 1) { - if(battle_config.error_log) - ShowError("pet data delete failure\n"); - } + if(RFIFOB(fd,2) == 1) + ShowError("pet data delete failure\n"); return 0; } @@ -1425,19 +1399,16 @@ int intif_parse_RecvHomunculusData(int fd) int intif_parse_SaveHomunculusOk(int fd) { - if(RFIFOB(fd,6) != 1) { - if(battle_config.error_log) - ShowError("homunculus data save failure for account %d\n", RFIFOL(fd,2)); - } + if(RFIFOB(fd,6) != 1) + ShowError("homunculus data save failure for account %d\n", RFIFOL(fd,2)); + return 0; } int intif_parse_DeleteHomunculusOk(int fd) { - if(RFIFOB(fd,2) != 1) { - if(battle_config.error_log) - ShowError("Homunculus data delete failure\n"); - } + if(RFIFOB(fd,2) != 1) + ShowError("Homunculus data delete failure\n"); return 0; } @@ -1475,8 +1446,7 @@ int intif_parse_Mail_inboxreceived(int fd) if (sd == NULL) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_inboxreceived: char not found %d\n",RFIFOL(fd,4)); + ShowError("intif_parse_Mail_inboxreceived: char not found %d\n",RFIFOL(fd,4)); return 1; } @@ -1485,8 +1455,7 @@ int intif_parse_Mail_inboxreceived(int fd) if (RFIFOW(fd,2) - 9 != sizeof(struct mail_data)) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_inboxreceived: data size error %d %d\n", RFIFOW(fd,2) - 9, sizeof(struct mail_data)); + ShowError("intif_parse_Mail_inboxreceived: data size error %d %d\n", RFIFOW(fd,2) - 9, sizeof(struct mail_data)); return 1; } @@ -1545,8 +1514,7 @@ int intif_parse_Mail_getattach(int fd) if (sd == NULL) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_getattach: char not found %d\n",RFIFOL(fd,4)); + ShowError("intif_parse_Mail_getattach: char not found %d\n",RFIFOL(fd,4)); return 1; } @@ -1555,8 +1523,7 @@ int intif_parse_Mail_getattach(int fd) if (RFIFOW(fd,2) - 12 != sizeof(struct item)) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_getattach: data size error %d %d\n", RFIFOW(fd,2) - 16, sizeof(struct item)); + ShowError("intif_parse_Mail_getattach: data size error %d %d\n", RFIFOW(fd,2) - 16, sizeof(struct item)); return 1; } @@ -1591,8 +1558,7 @@ int intif_parse_Mail_delete(int fd) struct map_session_data *sd = map_charid2sd(char_id); if (sd == NULL) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_delete: char not found %d\n", char_id); + ShowError("intif_parse_Mail_delete: char not found %d\n", char_id); return 1; } @@ -1641,8 +1607,7 @@ int intif_parse_Mail_return(int fd) if( sd == NULL ) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_return: char not found %d\n",RFIFOL(fd,2)); + ShowError("intif_parse_Mail_return: char not found %d\n",RFIFOL(fd,2)); return 1; } @@ -1691,8 +1656,7 @@ static void intif_parse_Mail_send(int fd) if( RFIFOW(fd,2) - 4 != sizeof(struct mail_message) ) { - if (battle_config.error_log) - ShowError("intif_parse_Mail_send: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct mail_message)); + ShowError("intif_parse_Mail_send: data size error %d %d\n", RFIFOW(fd,2) - 4, sizeof(struct mail_message)); return; } @@ -1829,8 +1793,7 @@ int intif_parse(int fd) case 0x3892: intif_parse_SaveHomunculusOk(fd); break; case 0x3893: intif_parse_DeleteHomunculusOk(fd); break; default: - if(battle_config.error_log) - ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0)); + ShowError("intif_parse : unknown packet %d %x\n",fd,RFIFOW(fd,0)); return 0; } // パケット読み飛ばし diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 513b19a2e..b27074866 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -142,15 +142,13 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str) int itemdb_searchrandomid(int group) { if(group<1 || group>=MAX_ITEMGROUP) { - if (battle_config.error_log) - ShowError("itemdb_searchrandomid: Invalid group id %d\n", group); + ShowError("itemdb_searchrandomid: Invalid group id %d\n", group); return UNKNOWN_ITEM_ID; } if (itemgroup_db[group].qty) return itemgroup_db[group].nameid[rand()%itemgroup_db[group].qty]; - if (battle_config.error_log) - ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group); + ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group); return UNKNOWN_ITEM_ID; } @@ -302,8 +300,7 @@ struct item_data* itemdb_load(int nameid) static void* return_dummy_data(DBKey key, va_list args) { - if (battle_config.error_log) - ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i); + ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i); dummy_item.nameid = key.i; return &dummy_item; } diff --git a/src/map/map.c b/src/map/map.c index 2bf5b5551..e41cdad2c 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -233,9 +233,7 @@ int map_freeblock (struct block_list *bl) aFree(bl); bl = NULL; if (block_free_count >= block_free_max) - if (battle_config.error_log) - ShowWarning("map_freeblock: too many free block! %d %d\n", - block_free_count, block_free_lock); + ShowWarning("map_freeblock: too many free block! %d %d\n", block_free_count, block_free_lock); } else block_free[block_free_count++] = bl; @@ -265,8 +263,7 @@ int map_freeblock_unlock (void) } block_free_count = 0; } else if (block_free_lock < 0) { - if (battle_config.error_log) - ShowError("map_freeblock_unlock: lock count < 0 !\n"); + ShowError("map_freeblock_unlock: lock count < 0 !\n"); block_free_lock = 0; } @@ -332,8 +329,7 @@ int map_addblock_sub (struct block_list *bl, int flag) nullpo_retr(0, bl); if (bl->prev != NULL) { - if(battle_config.error_log) - ShowError("map_addblock: bl->prev != NULL\n"); + ShowError("map_addblock: bl->prev != NULL\n"); return 0; } @@ -399,8 +395,7 @@ int map_delblock_sub (struct block_list *bl, int flag) if (bl->prev == NULL) { if (bl->next != NULL) { // prevがNULLでnextがNULLでないのは有ってはならない - if(battle_config.error_log) - ShowError("map_delblock error : bl->next!=NULL\n"); + ShowError("map_delblock error : bl->next!=NULL\n"); } return 0; } @@ -646,10 +641,8 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_lis } } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachinrange: block count too many!\n"); - } + if(bl_list_count>=BL_LIST_MAX) + ShowWarning("map_foreachinrange: block count too many!\n"); map_freeblock_lock(); // メモリからの解放を禁止する @@ -720,10 +713,8 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block } } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) + if(bl_list_count>=BL_LIST_MAX) ShowWarning("map_foreachinrange: block count too many!\n"); - } map_freeblock_lock(); // メモリからの解放を禁止する @@ -794,10 +785,8 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, in } } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachinarea: block count too many!\n"); - } + if(bl_list_count>=BL_LIST_MAX) + ShowWarning("map_foreachinarea: block count too many!\n"); map_freeblock_lock(); // メモリからの解放を禁止する @@ -937,10 +926,8 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_ } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachinmovearea: block count too many!\n"); - } + if(bl_list_count>=BL_LIST_MAX) + ShowWarning("map_foreachinmovearea: block count too many!\n"); map_freeblock_lock(); // メモリからの解放を禁止する @@ -996,10 +983,8 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int m, int x, int } } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachincell: block count too many!\n"); - } + if(bl_list_count>=BL_LIST_MAX) + ShowWarning("map_foreachincell: block count too many!\n"); map_freeblock_lock(); // メモリからの解放を禁止する @@ -1192,10 +1177,8 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y } } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachinpath: block count too many!\n"); - } + if(bl_list_count>=BL_LIST_MAX) + ShowWarning("map_foreachinpath: block count too many!\n"); map_freeblock_lock(); @@ -1249,10 +1232,8 @@ int map_foreachinmap(int (*func)(struct block_list*,va_list), int m, int type,.. } } - if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachinmap: block count too many!\n"); - } + if(bl_list_count>=BL_LIST_MAX) + ShowWarning("map_foreachinmap: block count too many!\n"); map_freeblock_lock(); // メモリからの解放を禁止する @@ -1284,8 +1265,7 @@ int map_addobject(struct block_list *bl) first_free_object_id=2; for(i=first_free_object_id;i=MAX_FLOORITEM){ - if(battle_config.error_log) - ShowWarning("no free object id\n"); + ShowWarning("no free object id\n"); return 0; } first_free_object_id=i; @@ -1355,8 +1335,7 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) if(!(objects[i]->type==type)) // Fixed [Lance] continue; if(bl_list_count>=BL_LIST_MAX) { - if(battle_config.error_log) - ShowWarning("map_foreachobject: too many blocks !\n"); + ShowWarning("map_foreachobject: too many blocks !\n"); break; } bl_list[bl_list_count++]=objects[i]; @@ -1389,8 +1368,7 @@ int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data) fitem = (struct flooritem_data *)objects[id]; if(fitem==NULL || fitem->bl.type!=BL_ITEM || (!data && fitem->cleartimer != tid)){ - if(battle_config.error_log) - ShowError("map_clearflooritem_timer : error\n"); + ShowError("map_clearflooritem_timer : error\n"); return 1; } if(data) @@ -1951,8 +1929,7 @@ int map_addnpc(int m,struct npc_data *nd) if(map[m].npc[i]==NULL) break; if(i==MAX_NPC_PER_MAP){ - if(battle_config.error_log) - ShowWarning("too many NPCs in one map %s\n",map[m].name); + ShowWarning("too many NPCs in one map %s\n",map[m].name); return -1; } if(i==map[m].npc_num){ @@ -2059,14 +2036,12 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, int data) int k; if (id < 0 || id >= MAX_MAP_PER_SERVER) { //Incorrect map id! - if (battle_config.error_log) - ShowError("map_removemobs_timer error: timer %d points to invalid map %d\n",tid, id); + ShowError("map_removemobs_timer error: timer %d points to invalid map %d\n",tid, id); return 0; } if (map[id].mob_delete_timer != tid) { //Incorrect timer call! - if (battle_config.error_log) - ShowError("map_removemobs_timer mismatch: %d != %d (map %s)\n",map[id].mob_delete_timer, tid, map[id].name); + ShowError("map_removemobs_timer mismatch: %d != %d (map %s)\n",map[id].mob_delete_timer, tid, map[id].name); return 0; } map[id].mob_delete_timer = -1; diff --git a/src/map/mercenary.c b/src/map/mercenary.c index f0cca5182..3e03da1de 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -492,8 +492,7 @@ static int merc_hom_hungry(int tid,unsigned int tick,int id,int data) return 1; if(hd->hungry_timer != tid){ - if(battle_config.error_log) - ShowError("merc_hom_hungry_timer %d != %d\n",hd->hungry_timer,tid); + ShowError("merc_hom_hungry_timer %d != %d\n",hd->hungry_timer,tid); return 0; } diff --git a/src/map/mob.c b/src/map/mob.c index ed25d4198..236934c4a 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -253,8 +253,7 @@ int mob_get_random_id(int type, int flag, int lv) struct mob_db *mob; int i=0, class_; if(type < 0 || type >= MAX_RANDOMMONSTER) { - if (battle_config.error_log) - ShowError("mob_get_random_id: Invalid type (%d) of random monster.\n", type); + ShowError("mob_get_random_id: Invalid type (%d) of random monster.\n", type); return 0; } do { @@ -1067,8 +1066,7 @@ int mob_randomwalk(struct mob_data *md,unsigned int tick) if(i==retrycount){ md->move_fail_count++; if(md->move_fail_count>1000){ - if(battle_config.error_log) - ShowWarning("MOB can't move. random spawn %d, class = %d, at %s (%d,%d)\n",md->bl.id,md->class_,map[md->bl.m].name, md->bl.x, md->bl.y); + ShowWarning("MOB can't move. random spawn %d, class = %d, at %s (%d,%d)\n",md->bl.id,md->class_,map[md->bl.m].name, md->bl.x, md->bl.y); md->move_fail_count=0; mob_spawn(md); } @@ -3902,17 +3900,15 @@ static int mob_readskilldb(void) { //Ground skill. if (ms->target > MST_AROUND) { - if (battle_config.error_log) - ShowWarning("Wrong mob skill target for ground skill %d (%s) for %s.\n", - ms->skill_id, skill_get_name(ms->skill_id), - mob_id < 0?"all mobs":mob_db_data[mob_id]->sprite); + ShowWarning("Wrong mob skill target for ground skill %d (%s) for %s.\n", + ms->skill_id, skill_get_name(ms->skill_id), + mob_id < 0?"all mobs":mob_db_data[mob_id]->sprite); ms->target = MST_TARGET; } } else if (ms->target > MST_MASTER) { - if (battle_config.error_log) - ShowWarning("Wrong mob skill target 'around' for non-ground skill %d (%s) for %s\n.", - ms->skill_id, skill_get_name(ms->skill_id), - mob_id < 0?"all mobs":mob_db_data[mob_id]->sprite); + ShowWarning("Wrong mob skill target 'around' for non-ground skill %d (%s) for %s\n.", + ms->skill_id, skill_get_name(ms->skill_id), + mob_id < 0?"all mobs":mob_db_data[mob_id]->sprite); ms->target = MST_TARGET; } diff --git a/src/map/npc.c b/src/map/npc.c index f1482df4d..f90bce158 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -408,8 +408,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, int data) if (ted->rid) { sd = map_id2sd(ted->rid); if (!sd) { - if(battle_config.error_log) - ShowError("npc_timerevent: Attached player not found.\n"); + ShowError("npc_timerevent: Attached player not found.\n"); ers_free(timer_event_ers, ted); return 0; } @@ -474,8 +473,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid) //Try to attach timer to this player. sd = map_id2sd(nd->u.scr.rid); if (!sd) { - if(battle_config.error_log) - ShowError("npc_timerevent_start: Attached player not found!\n"); + ShowError("npc_timerevent_start: Attached player not found!\n"); return 1; } } @@ -517,8 +515,7 @@ int npc_timerevent_stop(struct npc_data* nd) if (nd->u.scr.rid) { sd = map_id2sd(nd->u.scr.rid); if (!sd) { - if(battle_config.error_log) - ShowError("npc_timerevent_stop: Attached player not found!\n"); + ShowError("npc_timerevent_stop: Attached player not found!\n"); return 1; } } @@ -617,8 +614,7 @@ int npc_settimerevent_tick(struct npc_data* nd, int newtimer) if (nd->u.scr.rid) { sd = map_id2sd(nd->u.scr.rid); if (!sd) { - if(battle_config.error_log) - ShowError("npc_settimerevent_tick: Attached player not found!\n"); + ShowError("npc_settimerevent_tick: Attached player not found!\n"); return 1; } flag= sd->npc_timer_id != -1 ; @@ -643,8 +639,7 @@ int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char if( i < MAX_EVENTQUEUE ) safestrncpy(sd->eventqueue[i],eventname,50); //Event enqueued. else - if( battle_config.error_log ) - ShowWarning("npc_event: event queue is full !\n"); + ShowWarning("npc_event: event queue is full !\n"); return 1; } @@ -687,8 +682,7 @@ int npc_event(struct map_session_data* sd, const char* eventname, int mob_kill) return 0; } } else { - if (battle_config.error_log) - ShowError("npc_event: event not found [%s]\n", eventname); + ShowError("npc_event: event not found [%s]\n", eventname); return 0; } } @@ -748,10 +742,8 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) break; } if (i==map[m].npc_num) { - if (f) { - if (battle_config.error_log) - ShowError("npc_touch_areanpc : some bug \n"); - } + if (f) + ShowError("npc_touch_areanpc : some bug \n"); return 1; } switch(map[m].npc[i]->bl.subtype) { @@ -946,8 +938,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd) nullpo_retr(1, sd); if (sd->npc_id != 0) { - if (battle_config.error_log) - ShowError("npc_click: npc_id != 0\n"); + ShowError("npc_click: npc_id != 0\n"); return 1; } @@ -1010,8 +1001,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type) return 1; if (nd->bl.subtype!=SHOP) { - if (battle_config.error_log) - ShowError("no such shop npc : %d\n",id); + ShowError("no such shop npc : %d\n",id); if (sd->npc_id == id) sd->npc_id=0; return 1; @@ -2674,8 +2664,7 @@ int npc_script_event(struct map_session_data* sd, int type) if (type < 0 || type >= NPCE_MAX) return 0; if (!sd) { - if (battle_config.error_log) - ShowError("npc_script_event: NULL sd. Event Type %d\n", type); + ShowError("npc_script_event: NULL sd. Event Type %d\n", type); return 0; } if (script_event[type].nd) { @@ -2789,7 +2778,7 @@ int npc_reload(void) if (map[m].moblist[i]) aFree(map[m].moblist[i]); memset (map[m].moblist, 0, sizeof(map[m].moblist)); } - if (map[m].npc_num > 0 && battle_config.error_log) + if (map[m].npc_num > 0) ShowWarning("npc_reload: %d npcs weren't removed at map %s!\n", map[m].npc_num, map[m].name); } mob_clear_spawninfo(); diff --git a/src/map/party.c b/src/map/party.c index 7b1e3f1ab..66100784e 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -162,8 +162,7 @@ int party_check_member(struct party *p) if(f){ sd->status.party_id=0; - if(battle_config.error_log) - ShowWarning("party: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name); + ShowWarning("party: check_member %d[%s] is not member\n",sd->status.account_id,sd->status.name); } } } @@ -343,8 +342,7 @@ int party_member_added(int party_id,int account_id,int char_id, int flag) int i; if(sd == NULL || sd->status.char_id != char_id){ if (flag == 0) { - if(battle_config.error_log) - ShowError("party: member added error %d is not online\n",account_id); + ShowError("party: member added error %d is not online\n",account_id); intif_party_leave(party_id,account_id,char_id); } return 0; @@ -353,8 +351,7 @@ int party_member_added(int party_id,int account_id,int char_id, int flag) sd->party_invite_account=0; if (!p) { - if(battle_config.error_log) - ShowError("party_member_added: party %d not found.\n",party_id); + ShowError("party_member_added: party %d not found.\n",party_id); intif_party_leave(party_id,account_id,char_id); return 0; } @@ -530,8 +527,7 @@ int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short m } } if(i==MAX_PARTY){ - if(battle_config.error_log) - ShowError("party: not found member %d/%d on %d[%s]",account_id,char_id,party_id,p->party.name); + ShowError("party: not found member %d/%d on %d[%s]",account_id,char_id,party_id,p->party.name); return 0; } diff --git a/src/map/path.c b/src/map/path.c index 48b62755a..50c2f2192 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -206,13 +206,11 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) md = &map[m]; if( count>25 ){ //Cap to prevent too much processing...? - if( battle_config.error_log ) - ShowWarning("path_blownpos: count too many %d !\n",count); + ShowWarning("path_blownpos: count too many %d !\n",count); count=25; } if( dx > 1 || dx < -1 || dy > 1 || dy < -1 ){ - if( battle_config.error_log ) - ShowError("path_blownpos: illeagal dx=%d or dy=%d !\n",dx,dy); + ShowError("path_blownpos: illegal dx=%d or dy=%d !\n",dx,dy); dx=(dx>0)?1:((dx<0)?-1:0); dy=(dy>0)?1:((dy<0)?-1:0); } diff --git a/src/map/pc.c b/src/map/pc.c index 9bf6c5d22..8ba137bfe 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -116,8 +116,7 @@ static int pc_invincible_timer(int tid,unsigned int tick,int id,int data) return 1; if(sd->invincible_timer != tid){ - if(battle_config.error_log) - ShowError("invincible_timer %d != %d\n",sd->invincible_timer,tid); + ShowError("invincible_timer %d != %d\n",sd->invincible_timer,tid); return 0; } sd->invincible_timer=-1; @@ -155,14 +154,12 @@ static int pc_spiritball_timer(int tid,unsigned int tick,int id,int data) return 1; if(sd->spirit_timer[0] != tid){ - if(battle_config.error_log) - ShowError("spirit_timer %d != %d\n",sd->spirit_timer[0],tid); + ShowError("spirit_timer %d != %d\n",sd->spirit_timer[0],tid); return 0; } if(sd->spiritball <= 0) { - if(battle_config.error_log) - ShowError("Spiritballs are already 0 when pc_spiritball_timer gets called"); + ShowError("Spiritballs are already 0 when pc_spiritball_timer gets called"); sd->spiritball = 0; return 0; } @@ -640,8 +637,7 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t //Set the map-server used job id. [Skotlex] i = pc_jobid2mapid(sd->status.class_); if (i == -1) { //Invalid class? - if (battle_config.error_log) - ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id); + ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id); sd->status.class_ = JOB_NOVICE; sd->class_ = MAPID_NOVICE; } else @@ -703,8 +699,7 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t // 位置の設定 if ((i=pc_setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, 0)) != 0) { - if(battle_config.error_log) - ShowError ("Last_point_map %s - id %d not found (error code %d)\n", mapindex_id2name(sd->status.last_point.map), sd->status.last_point.map, i); + ShowError ("Last_point_map %s - id %d not found (error code %d)\n", mapindex_id2name(sd->status.last_point.map), sd->status.last_point.map, i); // try warping to a default map instead (church graveyard) if (pc_setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, 0) != 0) { @@ -955,8 +950,7 @@ int pc_calc_skilltree(struct map_session_data *sd) i = pc_calc_skilltree_normalize_job(sd); c = pc_mapid2jobid(i, sd->status.sex); if (c == -1) { //Unable to normalize job?? - if (battle_config.error_log) - ShowError("pc_calc_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id); + ShowError("pc_calc_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id); return 1; } c = pc_class2idx(c); @@ -1075,8 +1069,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill) i = pc_calc_skilltree_normalize_job(sd); c = pc_mapid2jobid(i, sd->status.sex); if (c == -1) { //Unable to normalize job?? - if (battle_config.error_log) - ShowError("pc_check_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id); + ShowError("pc_check_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id); return; } c = pc_class2idx(c); @@ -1247,8 +1240,7 @@ int pc_autoscript_add(struct s_autoscript *scripts, int max, short rate, short f int i; ARR_FIND(0, max, i, scripts[i].script == NULL); if (i == max) { - if (battle_config.error_log) - ShowWarning("pc_autoscript_bonus: Reached max (%d) number of autoscripts per character!\n", max); + ShowWarning("pc_autoscript_bonus: Reached max (%d) number of autoscripts per character!\n", max); return 0; } scripts[i].script = script; @@ -1321,8 +1313,7 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor } } if (i == max) { - if (battle_config.error_log) - ShowWarning("pc_bonus: Reached max (%d) number of autospells per character!\n", max); + ShowWarning("pc_bonus: Reached max (%d) number of autospells per character!\n", max); return 0; } spell[i].id = id; @@ -1357,8 +1348,7 @@ static int pc_bonus_addeff(struct s_addeffect* effect, int max, short id, short } } if (i == max) { - if (battle_config.error_log) - ShowWarning("pc_bonus: Reached max (%d) number of add effects per character!\n", max); + ShowWarning("pc_bonus: Reached max (%d) number of add effects per character!\n", max); return 0; } effect[i].id = id; @@ -1406,8 +1396,7 @@ static int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id } } if(i == max) { - if (battle_config.error_log) - ShowWarning("pc_bonus: Reached max (%d) number of added drops per character!\n", max); + ShowWarning("pc_bonus: Reached max (%d) number of added drops per character!\n", max); return 0; } drop[i].id = id; @@ -1516,8 +1505,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_ATKELE: if(val >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus: SP_ATKELE: Invalid element %d\n", val); + ShowError("pc_bonus: SP_ATKELE: Invalid element %d\n", val); break; } switch (sd->state.lr_flag) @@ -1548,8 +1536,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_DEFELE: if(val >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus: SP_DEFELE: Invalid element %d\n", val); + ShowError("pc_bonus: SP_DEFELE: Invalid element %d\n", val); break; } if(sd->state.lr_flag != 2) @@ -1664,8 +1651,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_IGNORE_DEF_ELE: if(val >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus: SP_IGNORE_DEF_ELE: Invalid element %d\n", val); + ShowError("pc_bonus: SP_IGNORE_DEF_ELE: Invalid element %d\n", val); break; } if(!sd->state.lr_flag) @@ -1699,8 +1685,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_IGNORE_MDEF_ELE: if(val >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus: SP_IGNORE_MDEF_ELE: Invalid element %d\n", val); + ShowError("pc_bonus: SP_IGNORE_MDEF_ELE: Invalid element %d\n", val); break; } if(sd->state.lr_flag != 2) @@ -1724,8 +1709,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_DEF_RATIO_ATK_ELE: if(val >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus: SP_DEF_RATIO_ATK_ELE: Invalid element %d\n", val); + ShowError("pc_bonus: SP_DEF_RATIO_ATK_ELE: Invalid element %d\n", val); break; } if(!sd->state.lr_flag) @@ -1735,8 +1719,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) break; case SP_DEF_RATIO_ATK_RACE: if(val >= RC_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus: SP_DEF_RATIO_ATK_RACE: Invalid race %d\n", val); + ShowError("pc_bonus: SP_DEF_RATIO_ATK_RACE: Invalid race %d\n", val); break; } if(!sd->state.lr_flag) @@ -1965,8 +1948,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) sd->hp_gain_value += val; break; default: - if(battle_config.error_log) - ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); + ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); break; } return 0; @@ -1984,8 +1966,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) switch(type){ case SP_ADDELE: if(type2 >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus2: SP_ADDELE: Invalid element %d\n", type2); + ShowError("pc_bonus2: SP_ADDELE: Invalid element %d\n", type2); break; } if(!sd->state.lr_flag) @@ -2013,8 +1994,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; case SP_SUBELE: if(type2 >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus2: SP_SUBELE: Invalid element %d\n", type2); + ShowError("pc_bonus2: SP_SUBELE: Invalid element %d\n", type2); break; } if(sd->state.lr_flag != 2) @@ -2052,8 +2032,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; case SP_MAGIC_ADDELE: if(type2 >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus2: SP_MAGIC_ADDELE: Invalid element %d\n", type2); + ShowError("pc_bonus2: SP_MAGIC_ADDELE: Invalid element %d\n", type2); break; } if(sd->state.lr_flag != 2) @@ -2215,8 +2194,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; case SP_WEAPON_COMA_ELE: if(type2 >= ELE_MAX) { - if(battle_config.error_log) - ShowError("pc_bonus2: SP_WEAPON_COMA_ELE: Invalid element %d\n", type2); + ShowError("pc_bonus2: SP_WEAPON_COMA_ELE: Invalid element %d\n", type2); break; } if(sd->state.lr_flag == 2) @@ -2416,8 +2394,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; default: - if(battle_config.error_log) - ShowWarning("pc_bonus2: unknown type %d %d %d!\n",type,type2,val); + ShowWarning("pc_bonus2: unknown type %d %d %d!\n",type,type2,val); break; } return 0; @@ -2513,8 +2490,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) break; default: - if(battle_config.error_log) - ShowWarning("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val); + ShowWarning("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val); break; } @@ -2536,8 +2512,7 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4 pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, 0, current_equip_card_id); break; default: - if(battle_config.error_log) - ShowWarning("pc_bonus4: unknown type %d %d %d %d %d!\n",type,type2,type3,type4,val); + ShowWarning("pc_bonus4: unknown type %d %d %d %d %d!\n",type,type2,type3,type4,val); break; } @@ -2559,8 +2534,7 @@ int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4 pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), (val&1?type2:-type2), (val&2?-type3:type3), type4, type5, current_equip_card_id); break; default: - if(battle_config.error_log) - ShowWarning("pc_bonus5: unknown type %d %d %d %d %d %d!\n",type,type2,type3,type4,type5,val); + ShowWarning("pc_bonus5: unknown type %d %d %d %d %d %d!\n",type,type2,type3,type4,type5,val); break; } @@ -2579,13 +2553,11 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) nullpo_retr(0, sd); if( id <= 0 || id >= MAX_SKILL || skill_db[id].name == NULL) { - if( battle_config.error_log ) - ShowError("pc_skill: Skill with id %d does not exist in the skill database\n", id); + ShowError("pc_skill: Skill with id %d does not exist in the skill database\n", id); return 0; } if( level > MAX_SKILL_LEVEL ) { - if( battle_config.error_log ) - ShowError("pc_skill: Skill level %d too high. Max lv supported is %d\n", level, MAX_SKILL_LEVEL); + ShowError("pc_skill: Skill level %d too high. Max lv supported is %d\n", level, MAX_SKILL_LEVEL); return 0; } @@ -3526,8 +3498,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y !map_getcell(m, x, y, CELL_CHKICEWALL)) ){ //It is allowed on top of Moonlight/icewall tiles to prevent force-warping 'cheats' [Skotlex] if(x||y) { - if(battle_config.error_log) - ShowError("pc_setpos: attempt to place player %s (%d:%d) on non-walkable tile (%s-%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex),x,y); + ShowError("pc_setpos: attempt to place player %s (%d:%d) on non-walkable tile (%s-%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex),x,y); } do { x=rand()%(map[m].xs-2)+1; @@ -4062,8 +4033,7 @@ int pc_follow_timer(int tid,unsigned int tick,int id,int data) nullpo_retr(0, sd); if (sd->followtimer != tid){ - if(battle_config.error_log) - ShowError("pc_follow_timer %d != %d\n",sd->followtimer,tid); + ShowError("pc_follow_timer %d != %d\n",sd->followtimer,tid); sd->followtimer = -1; return 0; } @@ -4721,10 +4691,8 @@ int pc_resetstate(struct map_session_data* sd) int stat; if (sd->status.base_level > MAX_LEVEL) { //statp[] goes out of bounds, can't reset! - if (battle_config.error_log) - ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n", - sd->status.account_id, sd->status.char_id, sd->status.base_level, - MAX_LEVEL); + ShowError("pc_resetstate: Can't reset stats of %d:%d, the base level (%d) is greater than the max level supported (%d)\n", + sd->status.account_id, sd->status.char_id, sd->status.base_level, MAX_LEVEL); return 0; } stat = statp[sd->status.base_level]; @@ -6042,8 +6010,7 @@ int pc_readregistry(struct map_session_data *sd,const char *reg,int type) return 0; } if (max == -1) { - if (battle_config.error_log) - ShowError("pc_readregistry: Trying to read reg value %s (type %d) before it's been loaded!\n", reg, type); + ShowError("pc_readregistry: Trying to read reg value %s (type %d) before it's been loaded!\n", reg, type); //This really shouldn't happen, so it's possible the data was lost somewhere, we should request it again. intif_request_registry(sd,type==3?4:type); return 0; @@ -6078,8 +6045,7 @@ char* pc_readregistry_str(struct map_session_data *sd,char *reg,int type) return NULL; } if (max == -1) { - if (battle_config.error_log) - ShowError("pc_readregistry: Trying to read reg value %s (type %d) before it's been loaded!\n", reg, type); + ShowError("pc_readregistry: Trying to read reg value %s (type %d) before it's been loaded!\n", reg, type); //This really shouldn't happen, so it's possible the data was lost somewhere, we should request it again. intif_request_registry(sd,type==3?4:type); return NULL; @@ -6132,8 +6098,7 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type) return 0; } if (*max == -1) { - if(battle_config.error_log) - ShowError("pc_setregistry : refusing to set %s (type %d) until vars are received.\n", reg, type); + ShowError("pc_setregistry : refusing to set %s (type %d) until vars are received.\n", reg, type); return 1; } @@ -6170,8 +6135,7 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type) return 1; } - if(battle_config.error_log) - ShowError("pc_setregistry : couldn't set %s, limit of registries reached (%d)\n", reg, regmax); + ShowError("pc_setregistry : couldn't set %s, limit of registries reached (%d)\n", reg, regmax); return 0; } @@ -6183,8 +6147,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type) nullpo_retr(0, sd); if (reg[strlen(reg)-1] != '$') { - if(battle_config.error_log) - ShowError("pc_setregistry_str : reg %s must be string (end in '$') to use this!\n", reg); + ShowError("pc_setregistry_str : reg %s must be string (end in '$') to use this!\n", reg); return 0; } @@ -6208,8 +6171,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type) return 0; } if (*max == -1) { - if(battle_config.error_log) - ShowError("pc_setregistry_str : refusing to set %s (type %d) until vars are received.\n", reg, type); + ShowError("pc_setregistry_str : refusing to set %s (type %d) until vars are received.\n", reg, type); return 0; } @@ -6249,8 +6211,7 @@ int pc_setregistry_str(struct map_session_data *sd,char *reg,char *val,int type) return 1; } - if(battle_config.error_log) - ShowError("pc_setregistry : couldn't set %s, limit of registries reached (%d)\n", reg, regmax); + ShowError("pc_setregistry : couldn't set %s, limit of registries reached (%d)\n", reg, regmax); return 0; } @@ -6273,7 +6234,7 @@ static int pc_eventtimer(int tid,unsigned int tick,int id,int data) sd->eventcount--; npc_event(sd,p,0); } - else if( battle_config.error_log ) + else ShowError("pc_eventtimer: no such event timer\n"); if (p) aFree(p); @@ -6636,8 +6597,7 @@ int pc_checkitem(struct map_session_data *sd) if( (id=sd->status.inventory[i].nameid)==0) continue; if( battle_config.item_check && !itemdb_available(id) ){ - if(battle_config.error_log) - ShowWarning("illegal item id %d in %d[%s] inventory.\n",id,sd->bl.id,sd->status.name); + ShowWarning("illegal item id %d in %d[%s] inventory.\n",id,sd->bl.id,sd->status.name); pc_delitem(sd,i,sd->status.inventory[i].amount,3); continue; } @@ -6657,8 +6617,7 @@ int pc_checkitem(struct map_session_data *sd) if( (id=sd->status.cart[i].nameid)==0 ) continue; if( battle_config.item_check && !itemdb_available(id) ){ - if(battle_config.error_log) - ShowWarning("illegal item id %d in %d[%s] cart.\n",id,sd->bl.id,sd->status.name); + ShowWarning("illegal item id %d in %d[%s] cart.\n",id,sd->bl.id,sd->status.name); pc_cart_delitem(sd,i,sd->status.cart[i].amount,1); continue; } @@ -7599,7 +7558,7 @@ int pc_read_motd(void) } fclose(fp); } - else if(battle_config.error_log) + else ShowWarning("In function pc_read_motd() -> File '"CL_WHITE"%s"CL_RESET"' not found.\n", motd_txt); return 0; diff --git a/src/map/pet.c b/src/map/pet.c index 64424d7f1..592eee4c0 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -241,8 +241,7 @@ static int pet_hungry(int tid,unsigned int tick,int id,int data) pd = sd->pd; if(pd->pet_hungry_timer != tid){ - if(battle_config.error_log) - ShowError("pet_hungry_timer %d != %d\n",pd->pet_hungry_timer,tid); + ShowError("pet_hungry_timer %d != %d\n",pd->pet_hungry_timer,tid); return 0; } pd->pet_hungry_timer = -1; @@ -480,8 +479,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag) break; } if(i >= MAX_INVENTORY) { - if (battle_config.error_log) - ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name); + ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name); sd->status.pet_id = 0; return 1; } @@ -511,10 +509,9 @@ int pet_select_egg(struct map_session_data *sd,short egg_index) if(sd->status.inventory[egg_index].card[0] == CARD0_PET) intif_request_petdata(sd->status.account_id, sd->status.char_id, MakeDWord(sd->status.inventory[egg_index].card[1], sd->status.inventory[egg_index].card[2]) ); - else { - if(battle_config.error_log) - ShowError("wrong egg item inventory %d\n",egg_index); - } + else + ShowError("wrong egg item inventory %d\n",egg_index); + return 0; } @@ -831,8 +828,7 @@ static int pet_randomwalk(struct pet_data *pd,unsigned int tick) if(i+1>=retrycount){ pd->move_fail_count++; if(pd->move_fail_count>1000){ - if(battle_config.error_log) - ShowWarning("PET can't move. hold position %d, class = %d\n",pd->bl.id,pd->pet.class_); + ShowWarning("PET can't move. hold position %d, class = %d\n",pd->bl.id,pd->pet.class_); pd->move_fail_count=0; pd->ud.canmove_tick = tick + 60000; return 0; @@ -1088,11 +1084,8 @@ int pet_skill_bonus_timer(int tid,unsigned int tick,int id,int data) pd=sd->pd; if(pd->bonus->timer != tid) { - if(battle_config.error_log) - { - ShowError("pet_skill_bonus_timer %d != %d\n",pd->bonus->timer,tid); - pd->bonus->timer = -1; - } + ShowError("pet_skill_bonus_timer %d != %d\n",pd->bonus->timer,tid); + pd->bonus->timer = -1; return 0; } @@ -1131,8 +1124,7 @@ int pet_recovery_timer(int tid,unsigned int tick,int id,int data) pd=sd->pd; if(pd->recovery->timer != tid) { - if(battle_config.error_log) - ShowError("pet_recovery_timer %d != %d\n",pd->recovery->timer,tid); + ShowError("pet_recovery_timer %d != %d\n",pd->recovery->timer,tid); return 0; } @@ -1162,8 +1154,7 @@ int pet_heal_timer(int tid,unsigned int tick,int id,int data) pd=sd->pd; if(pd->s_skill->timer != tid) { - if(battle_config.error_log) - ShowError("pet_heal_timer %d != %d\n",pd->s_skill->timer,tid); + ShowError("pet_heal_timer %d != %d\n",pd->s_skill->timer,tid); return 0; } @@ -1200,8 +1191,7 @@ int pet_skill_support_timer(int tid,unsigned int tick,int id,int data) pd=sd->pd; if(pd->s_skill->timer != tid) { - if(battle_config.error_log) - ShowError("pet_skill_support_timer %d != %d\n",pd->s_skill->timer,tid); + ShowError("pet_skill_support_timer %d != %d\n",pd->s_skill->timer,tid); return 0; } diff --git a/src/map/script.c b/src/map/script.c index 374ed3d7b..50f1475f4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2546,10 +2546,9 @@ int get_com(unsigned char *script,int *pos) *------------------------------------------*/ void unget_com(int c) { - if(unget_com_data!=-1){ - if(battle_config.error_log) - ShowError("unget_com can back only 1 data\n"); - } + if(unget_com_data!=-1) + ShowError("unget_com can back only 1 data\n"); + unget_com_data=c; } @@ -2827,8 +2826,7 @@ int run_func(struct script_state *st) end_sp=st->stack->sp; for(i=end_sp-1;i>=0 && st->stack->stack_data[i].type!=C_ARG;i--); if(i<=0){ //Crash fix when missing "push_val" causes current pointer to become -1. from Rayce (jA) - if(battle_config.error_log) - ShowError("function not found\n"); + ShowError("function not found\n"); // st->stack->sp=0; st->state=END; script_reportsrc(st); @@ -2887,8 +2885,7 @@ int run_func(struct script_state *st) if (str_data[func].func(st)) //Report error script_reportsrc(st); } else { - if(battle_config.error_log) - ShowError("run_func : %s? (%d(%d))\n",str_buf+str_data[func].str,func,str_data[func].type); + ShowError("run_func : %s? (%d(%d))\n",str_buf+str_data[func].str,func,str_data[func].type); script_pushint(st,0); script_reportsrc(st); } @@ -3069,7 +3066,7 @@ void run_script_main(struct script_state *st) { //sp > defsp is valid in cases when you invoke functions and don't use the returned value. [Skotlex] //Since sp is supposed to be defsp in these cases, we could assume the extra stack elements are unneeded. pop_stack(stack, stack->defsp, stack->sp); //Clear out the unused stack-section. - } else if( battle_config.error_log ) + } else ShowError("script:run_script_main: unexpected stack position stack.sp(%d) != default(%d)\n", stack->sp, stack->defsp); stack->sp = stack->defsp; } @@ -3137,8 +3134,7 @@ void run_script_main(struct script_state *st) break; default: - if(battle_config.error_log) - ShowError("unknown command : %d @ %d\n",c,st->pos); + ShowError("unknown command : %d @ %d\n",c,st->pos); st->state=END; break; } @@ -5202,11 +5198,8 @@ BUILDIN_FUNC(countitem) nameid = conv_num(st,data); if (nameid < 500) { - if(battle_config.error_log) - { - ShowError("wrong item ID : countitem(%i)\n", nameid); - script_reportsrc(st); - } + ShowError("wrong item ID : countitem(%i)\n", nameid); + script_reportsrc(st); script_pushint(st,0); return 1; } @@ -5257,7 +5250,7 @@ BUILDIN_FUNC(countitem2) c4 = (short)script_getnum(st,9); if (nameid < 500) { - if(battle_config.error_log) ShowError("wrong item ID : countitem2(%i)\n", nameid); + ShowError("wrong item ID : countitem2(%i)\n", nameid); script_pushint(st,0); return 1; } @@ -7612,8 +7605,7 @@ BUILDIN_FUNC(getnpctimer) if (!nd || nd->bl.type != BL_NPC) { script_pushint(st,0); - if (battle_config.error_log) - ShowError("getnpctimer: Invalid NPC\n"); + ShowError("getnpctimer: Invalid NPC\n"); return 1; } @@ -7623,8 +7615,7 @@ BUILDIN_FUNC(getnpctimer) if (nd->u.scr.rid) { sd = map_id2sd(nd->u.scr.rid); if (!sd) { - if(battle_config.error_log) - ShowError("buildin_getnpctimer: Attached player not found!\n"); + ShowError("buildin_getnpctimer: Attached player not found!\n"); break; } val = (sd->npc_timer_id != -1); @@ -10802,7 +10793,7 @@ BUILDIN_FUNC(getsavepoint) /*========================================== * Get position for char/npc/pet/mob objects. Added by Lorky * - * int getMapXY(MapName$,MaxX,MapY,type,[CharName$]); + * int getMapXY(MapName$,MapX,MapY,type,[CharName$]); * where type: * MapName$ - String variable for output map name * MapX - Integer variable for output coord X @@ -11328,8 +11319,7 @@ BUILDIN_FUNC(equip) nameid=script_getnum(st,2); if((item_data = itemdb_exists(nameid)) == NULL) { - if(battle_config.error_log) - ShowError("wrong item ID : equipitem(%i)\n",nameid); + ShowError("wrong item ID : equipitem(%i)\n",nameid); return 1; } ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid ); diff --git a/src/map/skill.c b/src/map/skill.c index 02df3b52a..b294af028 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5307,7 +5307,7 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data) unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill_get_walkdelay(ud->skillid, ud->skilllv), 1); if(battle_config.skill_log && battle_config.skill_log&src->type) - ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d)\n", + ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n", src->type, src->id, ud->skillid, ud->skilllv, target->id); map_freeblock_lock(); @@ -6657,8 +6657,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns case UNT_FIREPILLAR_ACTIVE: return 0; default: - if (battle_config.error_log) - ShowError("skill_unit_onplace_timer: interval error (unit id %x)\n", sg->unit_id); + ShowError("skill_unit_onplace_timer: interval error (unit id %x)\n", sg->unit_id); return 0; } } @@ -9499,9 +9498,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis } if (j == -1) { - if(battle_config.error_log) { - ShowWarning ("skill_unitgrouptickset_search: tickset is full\n"); - } + ShowWarning ("skill_unitgrouptickset_search: tickset is full\n"); j = id % MAX_SKILLUNITGROUPTICKSET; } @@ -9747,7 +9744,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 ); if( i < ARRAYLENGTH(skill_unit_temp) ) skill_unit_temp[i] = skill_id; - else if( battle_config.error_log ) + else ShowError("skill_unit_move_sub: Reached limit of unit objects per cell!\n"); } @@ -9781,7 +9778,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 ); if( i < ARRAYLENGTH(skill_unit_temp) ) skill_unit_temp[i] = skill_id; - else if( battle_config.error_log ) + else ShowError("skill_unit_move_sub: Reached limit of unit objects per cell!\n"); } } @@ -10030,10 +10027,8 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in y = sd->status.inventory[j].amount; if(y>x)y=x; pc_delitem(sd,j,y,0); - }else { - if(battle_config.error_log) - ShowError("skill_produce_mix: material item error\n"); - } + } else + ShowError("skill_produce_mix: material item error\n"); x-=y; }while( j>=0 && x>0 ); diff --git a/src/map/status.c b/src/map/status.c index 926b77162..706037115 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -70,8 +70,7 @@ static void add_sc(int skill, int sc) else if (sk >= HM_SKILLBASE) sk = skill - HM_SKILLBASE + SC_HM_BASE; if (sk < 0 || sk >= MAX_SKILL) { - if (battle_config.error_log) - ShowError("add_sc: Unsupported skill id %d\n", skill); + ShowError("add_sc: Unsupported skill id %d\n", skill); return; } if (SkillStatusChangeTableArray[sk]==-1) // skill -> sk [Lance] @@ -512,8 +511,7 @@ int SkillStatusChangeTable(int skill) else if (sk >= HM_SKILLBASE) sk = skill - HM_SKILLBASE + SC_HM_BASE; if (sk < 0 || sk >= MAX_SKILL) { - if (battle_config.error_log) - ShowError("add_sc: Unsupported skill id %d\n", skill); + ShowError("add_sc: Unsupported skill id %d\n", skill); return -1; } return SkillStatusChangeTableArray[sk]; @@ -4336,7 +4334,7 @@ void status_set_viewdata(struct block_list *bl, int class_) sd->vd.sex = sd->status.sex; } else if (vd) memcpy(&sd->vd, vd, sizeof(struct view_data)); - else if (battle_config.error_log) + else ShowError("status_set_viewdata (PC): No view data for class %d\n", class_); } break; @@ -4345,7 +4343,7 @@ void status_set_viewdata(struct block_list *bl, int class_) TBL_MOB* md = (TBL_MOB*)bl; if (vd) md->vd = vd; - else if (battle_config.error_log) + else ShowError("status_set_viewdata (MOB): No view data for class %d\n", class_); } break; @@ -4362,7 +4360,7 @@ void status_set_viewdata(struct block_list *bl, int class_) pd->vd.head_bottom = pd->pet.equip; } } - } else if (battle_config.error_log) + } else ShowError("status_set_viewdata (PET): No view data for class %d\n", class_); } break; @@ -4371,7 +4369,7 @@ void status_set_viewdata(struct block_list *bl, int class_) TBL_NPC* nd = (TBL_NPC*)bl; if (vd) nd->vd = vd; - else if (battle_config.error_log) + else ShowError("status_set_viewdata (NPC): No view data for class %d\n", class_); } break; @@ -4380,7 +4378,7 @@ void status_set_viewdata(struct block_list *bl, int class_) struct homun_data *hd = (struct homun_data*)bl; if (vd) hd->vd = vd; - else if (battle_config.error_log) + else ShowError("status_set_viewdata (HOMUNCULUS): No view data for class %d\n", class_); } break; @@ -4606,8 +4604,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if( type < 0 || type >= SC_MAX ) { - if( battle_config.error_log ) - ShowError("status_change_start: invalid status change (%d)!\n", type); + ShowError("status_change_start: invalid status change (%d)!\n", type); return 0; } @@ -5874,8 +5871,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val default: if( calc_flag == SCB_NONE && StatusSkillChangeTable[type] == 0 && StatusIconChangeTable[type] == 0 ) { //Status change with no calc, no icon, and no skill associated...? - if(battle_config.error_log) - ShowError("UnknownStatusChange [%d]\n", type); + ShowError("UnknownStatusChange [%d]\n", type); return 0; } } @@ -6628,8 +6624,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, int data) if (!sc || !status || data != SC_KAAHI || sc->data[data].timer==-1) return 0; if(sc->data[data].val4 != tid) { - if (battle_config.error_log) - ShowError("kaahi_heal_timer: Timer mismatch: %d != %d\n", tid, sc->data[data].val4); + ShowError("kaahi_heal_timer: Timer mismatch: %d != %d\n", tid, sc->data[data].val4); sc->data[data].val4=-1; return 0; } @@ -6671,8 +6666,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data) if( sc->data[type].timer != tid ) { - if(battle_config.error_log) - ShowError("status_change_timer: Mismatch for type %d: %d != %d (bl id %d)\n",type,tid,sc->data[type].timer, bl->id); + ShowError("status_change_timer: Mismatch for type %d: %d != %d (bl id %d)\n",type,tid,sc->data[type].timer, bl->id); return 0; } diff --git a/src/map/unit.c b/src/map/unit.c index 7d75d6e70..9a214e2e6 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -123,8 +123,7 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) if(ud == NULL) return 0; if(ud->walktimer != tid){ - if(battle_config.error_log) - ShowError("unit_walk_timer mismatch %d != %d\n",ud->walktimer,tid); + ShowError("unit_walk_timer mismatch %d != %d\n",ud->walktimer,tid); return 0; } ud->walktimer=-1; @@ -582,20 +581,17 @@ int unit_warp(struct block_list *bl,short m,short x,short y,int type) if (x<0 || y<0) { //Random map position. if (!map_search_freecell(NULL, m, &x, &y, -1, -1, 1)) { - if(battle_config.error_log) - ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y); + ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y); return 2; } } else if (map_getcell(m,x,y,CELL_CHKNOREACH)) { //Invalid target cell - if(battle_config.error_log) - ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map[m].name, x,y); + ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map[m].name, x,y); if (!map_search_freecell(NULL, m, &x, &y, 4, 4, 1)) { //Can't find a nearby cell - if(battle_config.error_log) - ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y); + ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y); return 2; } } @@ -1353,8 +1349,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t if((ud=unit_bl2ud(src))==NULL) return 0; if(ud->attacktimer != tid){ - if(battle_config.error_log) - ShowError("unit_attack_timer %d != %d\n",ud->attacktimer,tid); + ShowError("unit_attack_timer %d != %d\n",ud->attacktimer,tid); return 0; } BL_CAST( BL_PC , src, sd); -- cgit v1.2.3-60-g2f50