diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-25 23:37:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-31 23:07:45 +0300 |
commit | 0cb157c95e3c3af13af1f1f4294bf38c414fc7ab (patch) | |
tree | c68b70c8d0e81bc826e1c2c4684d0852335e1f3c /src | |
parent | f0d5be2db32afc7b4382276ffa3c60a1354bea8e (diff) | |
download | hercules-0cb157c95e3c3af13af1f1f4294bf38c414fc7ab.tar.gz hercules-0cb157c95e3c3af13af1f1f4294bf38c414fc7ab.tar.bz2 hercules-0cb157c95e3c3af13af1f1f4294bf38c414fc7ab.tar.xz hercules-0cb157c95e3c3af13af1f1f4294bf38c414fc7ab.zip |
Remove useless checks.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/utils.c | 2 | ||||
-rw-r--r-- | src/map/atcommand.c | 4 | ||||
-rw-r--r-- | src/map/battle.c | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 2 | ||||
-rw-r--r-- | src/map/log.c | 4 | ||||
-rw-r--r-- | src/map/npc.c | 6 | ||||
-rw-r--r-- | src/map/pc.c | 4 |
7 files changed, 12 insertions, 12 deletions
diff --git a/src/common/utils.c b/src/common/utils.c index d73aab066..f4e261222 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -134,7 +134,7 @@ void findfile(const char *p, const char *pat, void (func)(const char*)) sprintf(tmppath,"%s%c%s",path,PATHSEP,FindFileData.cFileName); - if (FindFileData.cFileName && strstr(FindFileData.cFileName, pattern)) { + if (strstr(FindFileData.cFileName, pattern)) { func( tmppath ); } diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 74a9531e5..d43637b81 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -6675,7 +6675,7 @@ ACMD(showmobs) return false; } - if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname) + if(mob_id == atoi(mob_name)) strcpy(mob_name,mob->db(mob_id)->jname); // --ja-- //strcpy(mob_name,mob_db(mob_id)->name); // --en-- @@ -6799,7 +6799,7 @@ ACMD(hommutate) { m_class = homun->class2type(sd->hd->homunculus.class_); m_id = homun->class2type(homun_id); - if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 ) { + if (m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99) { homun->mutate(sd->hd, homun_id); } else { clif->emotion(&sd->hd->bl, E_SWT); diff --git a/src/map/battle.c b/src/map/battle.c index 263670ea3..86134db52 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -348,7 +348,7 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d struct skill_unit_group *sg; struct block_list *sgsrc; - if( !su || !su->alive + if(!su->alive || (sg = su->group) == NULL || sg->val3 == -1 || (sgsrc = map->id2bl(sg->src_id)) == NULL || status->isdead(sgsrc) ) diff --git a/src/map/itemdb.c b/src/map/itemdb.c index cc9865496..8b6dfba63 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1427,7 +1427,7 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { entry->type = IT_ETC; } - if (entry->flag.trade_restriction < 0 || entry->flag.trade_restriction > ITR_ALL) { + if (entry->flag.trade_restriction > ITR_ALL) { ShowWarning("itemdb_validate_entry: Invalid trade restriction flag 0x%x for item %d (%s) in '%s', defaulting to none.\n", entry->flag.trade_restriction, entry->nameid, entry->jname, source); entry->flag.trade_restriction = ITR_NONE; diff --git a/src/map/log.c b/src/map/log.c index 92956fa67..9dcf1f359 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -134,7 +134,7 @@ void log_pick_sub_sql(int id, int16 m, e_log_pick_type type, int amount, struct LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) " "VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%"PRIu64"')", logs->config.log_pick, id, logs->picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], - map->list[m].name?map->list[m].name:"", itm->unique_id) + map->list[m].name, itm->unique_id) ) { Sql_ShowDebug(logs->mysql_handle); return; @@ -151,7 +151,7 @@ void log_pick_sub_txt(int id, int16 m, e_log_pick_type type, int amount, struct strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime)); fprintf(logfp,"%s - %d\t%c\t%d,%d,%d,%d,%d,%d,%d,%s,'%"PRIu64"'\n", timestring, id, logs->picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], - map->list[m].name?map->list[m].name:"", itm->unique_id); + map->list[m].name, itm->unique_id); fclose(logfp); } /// logs item transactions (generic) diff --git a/src/map/npc.c b/src/map/npc.c index 2da99c0bd..43cb4f993 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3143,7 +3143,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch nd->u.scr.timerid = INVALID_TIMER; - if( type == SCRIPT && options&NPO_ONINIT ) { + if (options&NPO_ONINIT) { // From npc_parse_script char evname[EVENT_NAME_LENGTH]; struct event_data *ev; @@ -3509,13 +3509,13 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st return strchr(start,'\n');// skip and continue } - if( (mobspawn.state.size < 0 || mobspawn.state.size > 2) && size != -1 ) { + if (mobspawn.state.size > 2 && size != -1) { ShowError("npc_parse_mob: Invalid size number %d for mob ID %d in file '%s', line '%d'.\n", mobspawn.state.size, class_, filepath, strline(buffer, start - buffer)); if (retval) *retval = EXIT_FAILURE; return strchr(start, '\n'); } - if( (mobspawn.state.ai < 0 || mobspawn.state.ai > 4) && ai != -1 ) { + if (mobspawn.state.ai > 4 && ai != -1) { ShowError("npc_parse_mob: Invalid ai %d for mob ID %d in file '%s', line '%d'.\n", mobspawn.state.ai, class_, filepath, strline(buffer, start - buffer)); if (retval) *retval = EXIT_FAILURE; return strchr(start, '\n'); diff --git a/src/map/pc.c b/src/map/pc.c index 9468a34f6..b8902d753 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3566,7 +3566,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag) { uint16 index = 0; nullpo_ret(sd); - if( !(index = skill->get_index(id)) || skill->db[index].name == NULL) { + if (!(index = skill->get_index(id))) { ShowError("pc_skill: Skill with id %d does not exist in the skill database\n", id); return 0; } @@ -4859,7 +4859,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil //A Rare Steal Global Announce by Lupus if(md->db->dropitem[i].p<=battle_config.rare_drop_announce) { char message[128]; - sprintf (message, msg_txt(542), (sd->status.name != NULL)?sd->status.name :"GM", md->db->jname, data->jname, (float)md->db->dropitem[i].p/100); + sprintf (message, msg_txt(542), sd->status.name, md->db->jname, data->jname, (float)md->db->dropitem[i].p / 100); //MSG: "'%s' stole %s's %s (chance: %0.02f%%)" intif->broadcast(message, strlen(message)+1, BC_DEFAULT); } |