diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/HPM.c | 4 | ||||
-rw-r--r-- | src/map/battle.c | 12 | ||||
-rw-r--r-- | src/map/battleground.c | 10 | ||||
-rw-r--r-- | src/map/channel.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 12 | ||||
-rw-r--r-- | src/map/guild.c | 2 | ||||
-rw-r--r-- | src/map/irc-bot.c | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 7 | ||||
-rw-r--r-- | src/map/npc.c | 12 | ||||
-rw-r--r-- | src/map/pc.c | 10 | ||||
-rw-r--r-- | src/map/script.c | 16 | ||||
-rw-r--r-- | src/map/skill.c | 36 | ||||
-rw-r--r-- | src/map/status.c | 48 | ||||
-rw-r--r-- | src/map/unit.c | 10 | ||||
-rw-r--r-- | src/plugins/HPMHooking.c | 2 | ||||
-rw-r--r-- | src/tool/mapcache.c | 2 |
17 files changed, 95 insertions, 94 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 6d68d6ed6..2277b9c71 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -560,8 +560,8 @@ void hplugins_config_read(void) { if ((plugin = HPM->load(filename))) { const char * (*func)(bool *fr); bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); - if ((func = plugin_import(plugin->dll, "Hooked",const char * (*)(bool *))) - && (addhook_sub = plugin_import(plugin->dll, "HPM_Plugin_AddHook",bool (*)(enum HPluginHookType, const char *, void *, unsigned int)))) { + if ((func = plugin_import(plugin->dll, "Hooked",const char * (*)(bool *))) != NULL + && (addhook_sub = plugin_import(plugin->dll, "HPM_Plugin_AddHook",bool (*)(enum HPluginHookType, const char *, void *, unsigned int))) != NULL) { const char *failed = func(&HPM->force_return); if (failed) { ShowError("HPM: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"'!\n", failed, plugin_name); diff --git a/src/map/battle.c b/src/map/battle.c index aa70525a9..8681d5efd 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -219,7 +219,7 @@ int battle_delay_damage_sub(int tid, int64 tick, int id, intptr_t data) { struct block_list* target = map->id2bl(dat->target_id); if( !target || status->isdead(target) ) {/* nothing we can do */ - if( dat->src_type == BL_PC && ( src = map->id2bl(dat->src_id) ) && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) { + if( dat->src_type == BL_PC && (src = map->id2bl(dat->src_id)) != NULL && --((TBL_PC*)src)->delayed_damage == 0 && ((TBL_PC*)src)->state.hold_recalc ) { ((TBL_PC*)src)->state.hold_recalc = 0; status_calc_pc(((TBL_PC*)src),SCO_FORCE); } @@ -860,7 +860,7 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target, i = 2; //Star anger else ARR_FIND(0, MAX_PC_FEELHATE, i, status->get_class(target) == sd->hate_mob[i]); - if ( i < MAX_PC_FEELHATE && (skill2_lv=pc->checkskill(sd,pc->sg_info[i].anger_id)) && weapon ) { + if (i < MAX_PC_FEELHATE && (skill2_lv=pc->checkskill(sd,pc->sg_info[i].anger_id)) > 0 && weapon) { int ratio = sd->status.base_level + status_get_dex(src) + status_get_luk(src); if ( i == 2 ) ratio += status_get_str(src); //Star Anger if (skill2_lv < 4 ) @@ -2917,7 +2917,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam return 0; } - if( flag&BF_MAGIC && (sce=sc->data[SC_PRESTIGE]) && rnd()%100 < sce->val2) { + if (flag&BF_MAGIC && (sce=sc->data[SC_PRESTIGE]) != NULL && rnd()%100 < sce->val2) { clif->specialeffect(bl, 462, AREA); // Still need confirm it. return 0; } @@ -3170,7 +3170,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if( sc->data[SC__DEADLYINFECT] && flag&BF_SHORT && damage > 0 && rnd()%100 < 30 + 10 * sc->data[SC__DEADLYINFECT]->val1 && !is_boss(src) ) status->change_spread(bl, src); // Deadly infect attacked side - if ( sd && damage > 0 && (sce = sc->data[SC_GENTLETOUCH_ENERGYGAIN]) ) { + if (sd && damage > 0 && (sce = sc->data[SC_GENTLETOUCH_ENERGYGAIN]) != NULL) { if ( rnd() % 100 < sce->val2 ) pc->addspiritball(sd, skill->get_time(MO_CALLSPIRITS, 1), pc->getmaxspiritball(sd, 0)); } @@ -3218,7 +3218,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam TBL_HOM *hd = BL_CAST(BL_HOM,bl); if (hd) homun->addspiritball(hd, 10); } - if ( src->type == BL_PC && damage > 0 && (sce = tsc->data[SC_GENTLETOUCH_ENERGYGAIN]) ) { + if (src->type == BL_PC && damage > 0 && (sce = tsc->data[SC_GENTLETOUCH_ENERGYGAIN]) != NULL) { struct map_session_data *tsd = (struct map_session_data *)src; if ( tsd && rnd() % 100 < sce->val2 ) pc->addspiritball(tsd, skill->get_time(MO_CALLSPIRITS, 1), pc->getmaxspiritball(tsd, 0)); @@ -4160,7 +4160,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * default: rskill = skill_id; } - if (sd && (i = pc->skillatk_bonus(sd, rskill))) + if (sd && (i = pc->skillatk_bonus(sd, rskill)) != 0) md.damage += md.damage*i/100; } if( (i = battle->adjust_skill_damage(src->m,skill_id)) ) diff --git a/src/map/battleground.c b/src/map/battleground.c index e825025a9..a92b3faef 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -501,7 +501,7 @@ void bg_queue_ready_ack (struct bg_arena *arena, struct map_session_data *sd, bo sd->bg_queue.ready = 1; for( i = 0; i < queue->size; i++ ) { - if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { + if (queue->item[i] > 0 && (sd = map->id2sd(queue->item[i])) != NULL) { if( sd->bg_queue.ready == 1 ) count++; } @@ -542,7 +542,7 @@ void bg_match_over(struct bg_arena *arena, bool canceled) { for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { + if (queue->item[i] > 0 && (sd = map->id2sd(queue->item[i])) != NULL) { if( sd->bg_queue.arena ) { bg->team_leave(sd, 0); bg->queue_pc_cleanup(sd); @@ -567,7 +567,7 @@ void bg_begin(struct bg_arena *arena) { for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { + if (queue->item[i] > 0 && (sd = map->id2sd(queue->item[i])) != NULL) { if( sd->bg_queue.ready == 1 ) count++; else @@ -594,7 +594,7 @@ void bg_begin(struct bg_arena *arena) { for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { + if (queue->item[i] > 0 && (sd = map->id2sd(queue->item[i])) != NULL) { if( sd->bg_queue.ready == 1 ) { mapreg->setreg(reference_uid(script->add_str("$@bg_member"), count), sd->status.account_id); mapreg->setreg(reference_uid(script->add_str("$@bg_member_group"), count), @@ -653,7 +653,7 @@ void bg_queue_pregame(struct bg_arena *arena) { for( i = 0; i < queue->size; i++ ) { struct map_session_data * sd = NULL; - if( queue->item[i] > 0 && ( sd = map->id2sd(queue->item[i]) ) ) { + if (queue->item[i] > 0 && (sd = map->id2sd(queue->item[i])) != NULL) { clif->bgqueue_battlebegins(sd,arena->id,SELF); } } diff --git a/src/map/channel.c b/src/map/channel.c index 529d3155e..196e5f770 100644 --- a/src/map/channel.c +++ b/src/map/channel.c @@ -363,7 +363,7 @@ enum channel_operation_status channel_join(struct channel_data *chan, struct map int i; for (i = 0; i < MAX_GUILDALLIANCE; i++) { struct guild *sg = NULL; - if (g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id))) { + if (g->alliance[i].opposition == 0 && g->alliance[i].guild_id && (sg = guild->search(g->alliance[i].guild_id)) != NULL) { if (!(sg->channel->banned && idb_exists(sg->channel->banned, sd->status.account_id))) { channel->join_sub(sg->channel, sd, stealth); } diff --git a/src/map/clif.c b/src/map/clif.c index 991c9a0e7..167a63d75 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -520,7 +520,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target break; case SELF: - if (sd && (fd=sd->fd) ) { + if (sd && (fd=sd->fd) != 0) { WFIFOHEAD(fd,len); memcpy(WFIFOP(fd,0), buf, len); WFIFOSET(fd,len); @@ -617,7 +617,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target for( i = 0; i < queue->size; i++ ) { struct map_session_data *qsd = NULL; - if( queue->item[i] > 0 && ( qsd = map->id2sd(queue->item[i]) ) ) { + if (queue->item[i] > 0 && (qsd = map->id2sd(queue->item[i])) != NULL) { WFIFOHEAD(qsd->fd,len); memcpy(WFIFOP(qsd->fd,0), buf, len); WFIFOSET(qsd->fd,len); @@ -2065,7 +2065,7 @@ void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) { nullpo_retv(mes); fd = sd->fd; slen = strlen(mes) + 9; - if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) && (bl->m!=sd->bl.m || + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != NULL && (bl->m!=sd->bl.m || bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif->sendfakenpc(sd, npcid); @@ -2096,7 +2096,7 @@ void clif_scriptinput(struct map_session_data *sd, int npcid) { nullpo_retv(sd); - if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) && (bl->m!=sd->bl.m || + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != NULL && (bl->m!=sd->bl.m || bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif->sendfakenpc(sd, npcid); @@ -2126,7 +2126,7 @@ void clif_scriptinputstr(struct map_session_data *sd, int npcid) { nullpo_retv(sd); - if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) && (bl->m!=sd->bl.m || + if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != NULL && (bl->m!=sd->bl.m || bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif->sendfakenpc(sd, npcid); @@ -18430,7 +18430,7 @@ void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { for(i = 0, c = 0; i < shop_size; i++) { struct item_data *id = NULL; - if( shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) ) { + if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != NULL) { npcmarket_open.list[c].nameid = shop[i].nameid; npcmarket_open.list[c].price = shop[i].value; npcmarket_open.list[c].qty = shop[i].qty; diff --git a/src/map/guild.c b/src/map/guild.c index ac9322b6b..0e5fa977e 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1361,7 +1361,7 @@ void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint1 return; if( !skill_lv ) return; - if( sd->sc.data[type] && (group = skill->id2group(sd->sc.data[type]->val4)) ) { + if (sd->sc.data[type] && (group = skill->id2group(sd->sc.data[type]->val4)) != NULL) { skill->del_unitgroup(group,ALC_MARK); status_change_end(&sd->bl,type,INVALID_TIMER); } diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index 86f854ff7..2b5069af7 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -197,7 +197,7 @@ void irc_parse_sub(int fd, char *str) { if( command[0] == '\0' ) return; - if( !(func = ircbot->func_search(command)) && !(func = ircbot->func_search(source)) ) { + if ((func = ircbot->func_search(command)) == NULL && (func = ircbot->func_search(source)) == NULL) { #ifdef IRCBOT_DEBUG ShowWarning("Unknown command received %s from %s\n",command,source); #endif // IRCBOT_DEBUG diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 7f5c2224c..dbade4c10 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -990,7 +990,7 @@ void itemdb_read_packages(void) { c = 0; while( (it = libconfig->setting_get_elem(itg,c++)) ) { int rval = 0; - if( ( t = libconfig->setting_get_member(it, "Random")) && ( rval = libconfig->setting_get_int(t) ) > 0 ) { + if ((t = libconfig->setting_get_member(it, "Random")) != NULL && (rval = libconfig->setting_get_int(t)) > 0) { rgroups[i - 1][rval - 1] += 1; } } diff --git a/src/map/mob.c b/src/map/mob.c index 35e0cd5ab..4e61cfeb6 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2184,7 +2184,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { else ARR_FIND(0, MAX_PC_FEELHATE, i, temp == sd->hate_mob[i] && (battle_config.allow_skill_without_day || pc->sg_info[i].day_func())); - if(i<MAX_PC_FEELHATE && (temp=pc->checkskill(sd,pc->sg_info[i].bless_id))) + if(i<MAX_PC_FEELHATE && (temp=pc->checkskill(sd,pc->sg_info[i].bless_id)) > 0) bonus += (i==2?20:10)*temp; } if(battle_config.mobs_level_up && md->level > md->db->lv) // [Valaris] @@ -2574,7 +2574,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if( sd ) { if( sd->mission_mobid == md->class_) { //TK_MISSION [Skotlex] - if( ++sd->mission_count >= 100 && (temp = mob->get_random_id(0, 0xE, sd->status.base_level)) ) { + if (++sd->mission_count >= 100 && (temp = mob->get_random_id(0, 0xE, sd->status.base_level)) != 0) { pc->addfame(sd, 1); sd->mission_mobid = temp; pc_setglobalreg(sd,script->add_str("TK_MISSION_ID"), temp); @@ -3175,7 +3175,8 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { case MSC_MASTERHPLTMAXRATE: flag = ((fbl = mob->getmasterhpltmaxrate(md, ms[i].cond2)) != NULL); break; case MSC_MASTERATTACKED: - flag = (md->master_id > 0 && (fbl=map->id2bl(md->master_id)) && unit->counttargeted(fbl) > 0); break; + flag = (md->master_id > 0 && (fbl=map->id2bl(md->master_id)) != NULL && unit->counttargeted(fbl) > 0); + break; case MSC_ALCHEMIST: flag = (md->state.alchemist); break; diff --git a/src/map/npc.c b/src/map/npc.c index bb0e772ae..7428070ab 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -556,7 +556,7 @@ int npc_timerevent(int tid, int64 tick, int id, intptr_t data) { return 0; } - if( ted->rid && !(sd = map->id2sd(ted->rid)) ) { + if (ted->rid && (sd = map->id2sd(ted->rid)) == NULL) { ShowError("npc_timerevent: Attached player not found.\n"); ers_free(npc->timer_event_ers, ted); return 0; @@ -621,7 +621,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid) { // Check if there is an OnTimer Event ARR_FIND( 0, nd->u.scr.timeramount, j, nd->u.scr.timer_event[j].timer > nd->u.scr.timer ); - if( nd->u.scr.rid > 0 && !(sd = map->id2sd(nd->u.scr.rid)) ) { + if (nd->u.scr.rid > 0 && (sd = map->id2sd(nd->u.scr.rid)) == NULL) { // Failed to attach timer to this player. ShowError("npc_timerevent_start: Attached player not found!\n"); return 1; @@ -670,7 +670,7 @@ int npc_timerevent_stop(struct npc_data* nd) nullpo_ret(nd); - if (nd->u.scr.rid && !(sd = map->id2sd(nd->u.scr.rid))) { + if (nd->u.scr.rid && (sd = map->id2sd(nd->u.scr.rid)) == NULL) { ShowError("npc_timerevent_stop: Attached player not found!\n"); return 1; } @@ -3783,7 +3783,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer)); if (retval) *retval = EXIT_FAILURE; } - if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)) && map->list[m].zone != zone ) { + if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)) != NULL && map->list[m].zone != zone ) { map->zone_change(m,zone,start,buffer,filepath); } else if ( !state ) { map->list[m].zone = &map->zone_all; @@ -3835,7 +3835,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer)); if (retval) *retval = EXIT_FAILURE; } - if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)) && map->list[m].zone != zone ) { + if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)) != NULL && map->list[m].zone != zone ) { map->zone_change(m,zone,start,buffer,filepath); } } @@ -3873,7 +3873,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char if (retval) *retval = EXIT_FAILURE; } - if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_BG_NAME)) && map->list[m].zone != zone ) { + if( state && (zone = strdb_get(map->zone_db, MAP_ZONE_BG_NAME)) != NULL && map->list[m].zone != zone ) { map->zone_change(m,zone,start,buffer,filepath); } } diff --git a/src/map/pc.c b/src/map/pc.c index 36bcbae88..14d234d82 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1306,7 +1306,7 @@ int pc_reg_received(struct map_session_data *sd) if ((i = pc->checkskill(sd,RG_PLAGIARISM)) > 0) { sd->cloneskill_id = pc_readglobalreg(sd,script->add_str("CLONE_SKILL")); - if (sd->cloneskill_id > 0 && (idx = skill->get_index(sd->cloneskill_id))) { + if (sd->cloneskill_id > 0 && (idx = skill->get_index(sd->cloneskill_id)) > 0) { sd->status.skill[idx].id = sd->cloneskill_id; sd->status.skill[idx].lv = pc_readglobalreg(sd,script->add_str("CLONE_SKILL_LV")); if (sd->status.skill[idx].lv > i) @@ -1316,7 +1316,7 @@ int pc_reg_received(struct map_session_data *sd) } if ((i = pc->checkskill(sd,SC_REPRODUCE)) > 0) { sd->reproduceskill_id = pc_readglobalreg(sd,script->add_str("REPRODUCE_SKILL")); - if( sd->reproduceskill_id > 0 && (idx = skill->get_index(sd->reproduceskill_id))) { + if( sd->reproduceskill_id > 0 && (idx = skill->get_index(sd->reproduceskill_id)) > 0) { sd->status.skill[idx].id = sd->reproduceskill_id; sd->status.skill[idx].lv = pc_readglobalreg(sd,script->add_str("REPRODUCE_SKILL_LV")); if( i < sd->status.skill[idx].lv) @@ -5293,7 +5293,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil // Try dropping one item, in the order from first to last possible slot. // Droprate is affected by the skill success rate. for( i = 0; i < MAX_STEAL_DROP; i++ ) - if( md->db->dropitem[i].nameid > 0 && (data = itemdb->exists(md->db->dropitem[i].nameid)) && rnd() % 10000 < md->db->dropitem[i].p * rate/100. ) + if (md->db->dropitem[i].nameid > 0 && (data = itemdb->exists(md->db->dropitem[i].nameid)) != NULL && rnd() % 10000 < md->db->dropitem[i].p * rate/100.) break; if( i == MAX_STEAL_DROP ) return 0; @@ -5403,7 +5403,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int stop = true; } } - if ( !stop && sd->status.party_id && (p = party->search(sd->status.party_id)) && p->instances ) { + if ( !stop && sd->status.party_id && (p = party->search(sd->status.party_id)) != NULL && p->instances ) { for( i = 0; i < p->instances; i++ ) { if( p->instance[i] >= 0 ) { ARR_FIND(0, instance->list[p->instance[i]].num_map, j, map->list[instance->list[p->instance[i]].map[j]].instance_src_map == m && !map->list[instance->list[p->instance[i]].map[j]].custom_name); @@ -10675,7 +10675,7 @@ void pc_read_skill_tree(void) { for (h = offset; h < rlen && h < MAX_PC_SKILL_REQUIRE; h++) { config_setting_t *rsk = libconfig->setting_get_elem(sk,h); int rskid; - if (rsk && ( rskid = skill->name2id(config_setting_name(rsk)))) { + if (rsk && (rskid = skill->name2id(config_setting_name(rsk))) != 0) { pc->skill_tree[idx][skidx].need[h].id = rskid; pc->skill_tree[idx][skidx].need[h].idx = skill->get_index(rskid); pc->skill_tree[idx][skidx].need[h].lv = (unsigned char)libconfig->setting_get_int(rsk); diff --git a/src/map/script.c b/src/map/script.c index 35142a4f5..45274e3dd 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1234,7 +1234,7 @@ const char* parse_simpleexpr(const char *p) script_string_buf_addb(sbuf, 0); - if( !(script->syntax.translation_db && (st = strdb_get(script->syntax.translation_db, sbuf->ptr))) ) { + if (!(script->syntax.translation_db && (st = strdb_get(script->syntax.translation_db, sbuf->ptr)) != NULL)) { script->addc(C_STR); if( script->pos+sbuf->pos >= script->size ) { @@ -6291,7 +6291,7 @@ BUILDIN(__setr) { if (!not_array_variable(*namevalue)) { // array variable being copied into another array variable - if (sd == NULL && not_server_variable(*namevalue) && !(sd = script->rid2sd(st))) { + if (sd == NULL && not_server_variable(*namevalue) && (sd = script->rid2sd(st)) == NULL) { // player must be attached in order to copy a player variable ShowError("script:set: no player attached for player variable '%s'\n", namevalue); return true; @@ -11136,7 +11136,7 @@ BUILDIN(roclass) sex = script_getnum(st,3); else { TBL_PC *sd; - if (st->rid && (sd=script->rid2sd(st))) + if (st->rid && (sd=script->rid2sd(st)) != NULL) sex = sd->status.sex; else sex = 1; //Just use male when not found. @@ -17779,7 +17779,7 @@ BUILDIN(has_instance) { if( i != sd->instances ) instance_id = sd->instance[i]; } - if( instance_id == -1 && sd->status.party_id && (p = party->search(sd->status.party_id)) && p->instances ) { + if (instance_id == -1 && sd->status.party_id && (p = party->search(sd->status.party_id)) != NULL && p->instances) { for( i = 0; i < p->instances; i++ ) { if( p->instance[i] >= 0 ) { ARR_FIND(0, instance->list[p->instance[i]].num_map, j, map->list[instance->list[p->instance[i]].map[j]].instance_src_map == m); @@ -18886,7 +18886,7 @@ bool script_hqueue_add(int idx, int var) script->hq[idx].item[i] = var; script->hq[idx].items++; - if (var >= START_ACCOUNT_NUM && (sd = map->id2sd(var))) { + if (var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) != NULL) { for (i = 0; i < sd->queues_count; i++) { if (sd->queues[i] == -1) { break; @@ -18932,7 +18932,7 @@ bool script_hqueue_remove(int idx, int var) { script->hq[idx].item[i] = -1; script->hq[idx].items--; - if( var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) ) { + if (var >= START_ACCOUNT_NUM && (sd = map->id2sd(var)) != NULL) { for(i = 0; i < sd->queues_count; i++) { if( sd->queues[i] == idx ) { break; @@ -19010,7 +19010,7 @@ bool script_hqueue_del(int idx) int i; for (i = 0; i < script->hq[idx].size; i++) { struct map_session_data *sd; - if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map->id2sd(script->hq[idx].item[i])) ) { + if (script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map->id2sd(script->hq[idx].item[i])) != NULL) { int j; for(j = 0; j < sd->queues_count; j++) { if( sd->queues[j] == script->hq[idx].item[i] ) { @@ -19049,7 +19049,7 @@ void script_hqueue_clear(int idx) { for(i = 0; i < script->hq[idx].size; i++) { if( script->hq[idx].item[i] > 0 ) { - if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map->id2sd(script->hq[idx].item[i])) ) { + if (script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = map->id2sd(script->hq[idx].item[i])) != NULL) { for(j = 0; j < sd->queues_count; j++) { if( sd->queues[j] == idx ) { break; diff --git a/src/map/skill.c b/src/map/skill.c index 6e50a3116..b61e5d8d9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -365,7 +365,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk #else // not RENEWAL hp = ( status->get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8); #endif // RENEWAL - if( sd && ((skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) ) + if (sd && (skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) hp += hp * skill2_lv * 2 / 100; else if( src->type == BL_HOM && (skill2_lv = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 ) hp += hp * skill2_lv * 2 / 100; @@ -375,10 +375,10 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND ) hp >>= 1; - if( sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) ) + if (sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) != 0) hp += hp*skill2_lv/100; - if( tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) ) + if (tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) != 0) hp += hp*skill2_lv/100; sc = status->get_sc(src); @@ -970,7 +970,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 case DC_UGLYDANCE: rate = 5+5*skill_lv; - if(sd && (temp=pc->checkskill(sd,DC_DANCINGLESSON))) + if (sd && (temp=pc->checkskill(sd,DC_DANCINGLESSON)) > 0) rate += 5+temp; status_zap(bl, 0, rate); break; @@ -2236,7 +2236,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr && (skill_id != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag & 0xFFF) == 1)) ) { /* Need more info cause NPC_EARTHQUAKE is ground type */ // Earthquake on multiple targets is not counted as a target skill. [Inkfish] int reflecttype; - if( (dmg.damage || dmg.damage2) && (reflecttype = skill->magic_reflect(src, bl, src==dsrc)) ) { + if ((dmg.damage || dmg.damage2) && (reflecttype = skill->magic_reflect(src, bl, src==dsrc)) != 0) { //Magic reflection, switch caster/target struct block_list *tbl = bl; rmdamage = true; @@ -2406,7 +2406,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr { //bonus from SG_FRIEND [Komurka] int level; - if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND))) + if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND)) > 0) party->skill_check(sd, sd->status.party_id, TK_COUNTER,level); } break; @@ -2610,7 +2610,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr can_copy(tsd,copy_skill,bl)) // Split all the check into their own function [Aru] { int lv, idx = 0; - if( sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) ) { + if (sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) > 0) { //Level dependent and limitation. lv = min(lv,skill->get_max(copy_skill)); @@ -2835,7 +2835,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr if (!(flag&2) && (skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT) - && (sc = status->get_sc(src)) + && (sc = status->get_sc(src)) != NULL && sc->data[SC_DOUBLECASTING] && rnd() % 100 < sc->data[SC_DOUBLECASTING]->val2 ) { @@ -3497,7 +3497,7 @@ int skill_activate_reverberation(struct block_list *bl, va_list ap) { struct skill_unit_group *sg; if( bl->type != BL_SKILL ) return 0; - if( su->alive && (sg = su->group) && sg->skill_id == WM_REVERBERATION && sg->unit_id == UNT_REVERBERATION ) { + if( su->alive && (sg = su->group) != NULL && sg->skill_id == WM_REVERBERATION && sg->unit_id == UNT_REVERBERATION ) { int64 tick = timer->gettick(); clif->changetraplook(bl,UNT_USED_TRAPS); map->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, tick); @@ -4532,7 +4532,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 struct skill_unit *su = BL_CAST(BL_SKILL,bl); struct skill_unit_group* sg; - if( su && (sg=su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP ) { + if( su && (sg=su->group) != NULL && skill->get_inf2(sg->skill_id)&INF2_TRAP ) { if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) { struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); @@ -4999,7 +4999,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { } if( inf&BCT_ENEMY - && (sc = status->get_sc(target)) && sc->data[SC_FOGWALL] + && (sc = status->get_sc(target)) != NULL && sc->data[SC_FOGWALL] && rnd() % 100 < 75 ) { // Fogwall makes all offensive-type targeted skills fail at 75% @@ -6911,7 +6911,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( dstsd ) hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100; } - if( dstsd && (i = pc->skillheal2_bonus(dstsd, skill_id)) ) { + if (dstsd && (i = pc->skillheal2_bonus(dstsd, skill_id)) != 0) { hp += hp * i / 100; sp += sp * i / 100; } @@ -7449,7 +7449,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin // Mercenaries can remove any trap // Players can only remove their own traps or traps on Vs maps. - if( su && (sg = su->group) && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill->get_inf2(sg->skill_id)&INF2_TRAP) ) + if( su && (sg = su->group) != NULL && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill->get_inf2(sg->skill_id)&INF2_TRAP) ) { clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); if( sd && !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) && sg->unit_id != UNT_THORNS_TRAP ) { @@ -7464,7 +7464,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = skill->dbs->db[su->group->skill_id].itemid[i]; item_tmp.identify = 1; - if( item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) ) { + if (item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) != 0) { clif->additem(sd,0,0,success); map->addflooritem(&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } @@ -7476,7 +7476,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP; item_tmp.identify = 1; - if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) ) { + if (item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) != 0) { clif->additem(sd,0,0,flag); map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } @@ -7492,7 +7492,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_nodamage(src,bl,skill_id,skill_lv,1); { struct skill_unit *su=NULL; - if((bl->type==BL_SKILL) && (su=(struct skill_unit *)bl) && (su->group) ){ + if (bl->type==BL_SKILL && (su=(struct skill_unit *)bl) != NULL && su->group != NULL) { switch(su->group->unit_id){ case UNT_ANKLESNARE: if (su->group->val2 != 0) @@ -7673,7 +7673,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case CG_LONGINGFREEDOM: { - if (tsc && !tsce && (tsce=tsc->data[SC_DANCING]) && tsce->val4 + if (tsc && !tsce && (tsce=tsc->data[SC_DANCING]) != NULL && tsce->val4 && (tsce->val1&0xFFFF) != CG_MOONLIT) //Can't use Longing for Freedom while under Moonlight Petals. [Skotlex] { clif->skill_nodamage(src,bl,skill_id,skill_lv, @@ -17805,7 +17805,7 @@ int skill_destroy_trap(struct block_list *bl, va_list ap) { nullpo_ret(su); tick = va_arg(ap, int64); - if (su->alive && (sg = su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP) { + if (su->alive && (sg = su->group) != NULL && skill->get_inf2(sg->skill_id)&INF2_TRAP) { switch( sg->unit_id ) { case UNT_CLAYMORETRAP: case UNT_FIRINGTRAP: diff --git a/src/map/status.c b/src/map/status.c index 720a02494..5ba0c688c 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1192,7 +1192,7 @@ int status_damage(struct block_list *src,struct block_list *target,int64 in_hp, struct status_change_entry *sce; #ifdef DEVOTION_REFLECT_DAMAGE - if(src && (sce = sc->data[SC_DEVOTION])) { + if (src && (sce = sc->data[SC_DEVOTION]) != NULL) { struct block_list *d_bl = map->id2bl(sce->val1); if(d_bl &&((d_bl->type == BL_MER && ((TBL_MER *)d_bl)->master && ((TBL_MER *)d_bl)->master->bl.id == target->id) @@ -1588,7 +1588,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin //on dead characters, said checks are left to skill.c [Skotlex] if (target && status->isdead(target)) return 0; - if( src && (sc = status->get_sc(src)) && sc->data[SC_COLD] && src->type != BL_MOB) + if( src && (sc = status->get_sc(src)) != NULL && sc->data[SC_COLD] && src->type != BL_MOB) return 0; } @@ -1875,8 +1875,8 @@ int status_calc_mob_(struct mob_data* md, enum e_status_calc_opt opt) { if (md->special_state.size) flag|=2; - if( md->guardian_data && md->guardian_data->g - && (guardup_lv = guild->checkskill(md->guardian_data->g,GD_GUARDUP)) ) + if (md->guardian_data && md->guardian_data->g + && (guardup_lv = guild->checkskill(md->guardian_data->g,GD_GUARDUP)) > 0) flag|=4; if (battle_config.slaves_inherit_speed && md->master_id) @@ -2704,7 +2704,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { } if( (sd->status.weapon == W_1HAXE || sd->status.weapon == W_2HAXE) && (skill_lv = pc->checkskill(sd,NC_TRAININGAXE)) > 0 ) bstatus->hit += 3*skill_lv; - if((sd->status.weapon == W_MACE || sd->status.weapon == W_2HMACE) && ((skill_lv = pc->checkskill(sd,NC_TRAININGAXE)) > 0)) + if((sd->status.weapon == W_MACE || sd->status.weapon == W_2HMACE) && (skill_lv = pc->checkskill(sd,NC_TRAININGAXE)) > 0) bstatus->hit += 2*skill_lv; // ----- FLEE CALCULATION ----- @@ -7552,11 +7552,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if( sd ) { int i; for( i = 0; i < MAX_PC_DEVOTION; i++ ) { - if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) ) + if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL); } - } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) + } else if (bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) != NULL) { status->change_start(bl, &tsd->bl, type, 10000, val1, val2, val3, val4, tick, SCFLAG_ALL); + } } //val4 signals infinite endure (if val4 == 2 it is infinite endure from Berserk) if( val4 ) @@ -7651,11 +7652,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if( sd ) { int i; for( i = 0; i < MAX_PC_DEVOTION; i++ ) { - if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) ) + if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); } - } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) + } else if (bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) != NULL) { status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); + } } break; case SC_NOEQUIPWEAPON: @@ -7909,12 +7911,13 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t if( bl->type&(BL_PC|BL_MER) ) { if( sd ) { for( i = 0; i < MAX_PC_DEVOTION; i++ ) { - if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) ) + if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); } } - else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) ) + else if (bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag && (tsd = ((TBL_MER*)bl)->master) != NULL) { status->change_start(bl, &tsd->bl, type, 10000, val1, val2, 0, 0, tick, SCFLAG_ALL); + } } } break; @@ -7930,7 +7933,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t int i; for (i = 0; i < MAX_PC_DEVOTION; i++) { //See if there are devoted characters, and pass the status to them. [Skotlex] - if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i]))) + if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL) status->change_start(bl, &tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,SCFLAG_NOAVOID); } } @@ -8067,7 +8070,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t struct block_list *d_bl; struct status_change *d_sc; - if ((d_bl = map->id2bl(val1)) && (d_sc = status->get_sc(d_bl)) && d_sc->count) { + if ((d_bl = map->id2bl(val1)) && (d_sc = status->get_sc(d_bl)) != NULL && d_sc->count) { // Inherits Status From Source const enum sc_type types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE }; int i = (map_flag_gvg(bl->m) || map->list[bl->m].flag.battleground)?2:3; @@ -9822,7 +9825,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const // Clear Status from others int i; for( i = 0; i < MAX_PC_DEVOTION; i++ ) { - if( sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) && tsd->sc.data[type] ) + if (sd->devotion[i] && (tsd = map->id2sd(sd->devotion[i])) != NULL && tsd->sc.data[type]) status_change_end(&tsd->bl, type, INVALID_TIMER); } } else if( bl->type == BL_MER && ((TBL_MER*)bl)->devotion_flag ) { @@ -9883,7 +9886,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const sd->delunit_prevline = line; } - if (sce->val4 && sce->val4 != BCT_SELF && (dsd=map->id2sd(sce->val4))) { + if (sce->val4 && sce->val4 != BCT_SELF && (dsd=map->id2sd(sce->val4)) != NULL) { // end status on partner as well dsc = dsd->sc.data[SC_DANCING]; if (dsc) { @@ -10072,7 +10075,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const struct block_list *tbl = map->id2bl(sce->val2); struct status_change *tsc = NULL; sce->val2 = 0; - if( tbl && (tsc = status->get_sc(tbl)) && tsc->data[SC_STOP] && tsc->data[SC_STOP]->val2 == bl->id ) + if (tbl && (tsc = status->get_sc(tbl)) != NULL && tsc->data[SC_STOP] && tsc->data[SC_STOP]->val2 == bl->id) status_change_end(tbl, SC_STOP, INVALID_TIMER); } break; @@ -10454,10 +10457,7 @@ int kaahi_heal_timer(int tid, int64 tick, int id, intptr_t data) { struct status_data *st; int hp; - if(!( (bl=map->id2bl(id)) - && (sc=status->get_sc(bl)) - && (sce=sc->data[SC_KAAHI]) - )) + if ((bl=map->id2bl(id)) == NULL || (sc=status->get_sc(bl)) == NULL || (sce=sc->data[SC_KAAHI]) == NULL) return 0; if(sce->val4 != tid) { @@ -10501,7 +10501,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { sc = status->get_sc(bl); st = status->get_status_data(bl); - if (!(sc && (sce = sc->data[type]))) { + if (!sc || (sce = sc->data[type]) == NULL) { ShowDebug("status_change_timer: Null pointer id: %d data: %"PRIdPTR" bl-type: %d\n", id, data, bl->type); return 0; } @@ -11838,7 +11838,7 @@ int status_natural_heal(struct block_list* bl, va_list args) { if (flag&(RGN_SHP|RGN_SSP) && regen->ssregen - && (vd = status->get_viewdata(bl)) + && (vd = status->get_viewdata(bl)) != NULL && vd->dead_sit == 2 ) { //Apply sitting regen bonus. @@ -12171,7 +12171,7 @@ void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) if ((temp = libconfig->setting_get_member(jdb, "HPTable"))) { int level = 0, avg_increment, base; config_setting_t *hp = NULL; - while (level <= MAX_LEVEL && (hp = libconfig->setting_get_elem(temp, level))) { + while (level <= MAX_LEVEL && (hp = libconfig->setting_get_elem(temp, level)) != NULL) { i32 = libconfig->setting_get_int(hp); status->dbs->HP_table[idx][++level] = min(i32, battle_config.max_hp); } @@ -12191,7 +12191,7 @@ void status_read_job_db_sub(int idx, const char *name, config_setting_t *jdb) if ((temp = libconfig->setting_get_member(jdb, "SPTable"))) { int level = 0, avg_increment, base; config_setting_t *sp = NULL; - while (level <= MAX_LEVEL && (sp = libconfig->setting_get_elem(temp, level))) { + while (level <= MAX_LEVEL && (sp = libconfig->setting_get_elem(temp, level)) != NULL) { i32 = libconfig->setting_get_int(sp); status->dbs->SP_table[idx][++level] = min(i32, battle_config.max_sp); } diff --git a/src/map/unit.c b/src/map/unit.c index 02d1f4c1a..178fc3010 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1765,10 +1765,10 @@ int unit_set_target(struct unit_data* ud, int target_id) if (ud->target != target_id) { struct unit_data * ux; struct block_list* target; - if( ud->target && (target = map->id2bl(ud->target)) && (ux = unit->bl2ud(target)) && ux->target_count > 0 ) - ux->target_count --; - if( target_id && (target = map->id2bl(target_id)) && (ux = unit->bl2ud(target)) ) - ux->target_count ++; + if (ud->target && (target = map->id2bl(ud->target)) != NULL && (ux = unit->bl2ud(target)) != NULL && ux->target_count > 0) + --ux->target_count; + if (target_id && (target = map->id2bl(target_id)) != NULL && (ux = unit->bl2ud(target)) != NULL) + ++ux->target_count; } ud->target = target_id; @@ -2268,7 +2268,7 @@ void unit_dataset(struct block_list *bl) { int unit_counttargeted(struct block_list* bl) { struct unit_data* ud; - if( bl && (ud = unit->bl2ud(bl)) ) + if (bl && (ud = unit->bl2ud(bl)) != NULL) return ud->target_count; return 0; } diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index 19d7ae2c5..345c1de9e 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -156,7 +156,7 @@ HPExport const char *Hooked (bool *fr) { HPExport bool HPM_Plugin_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) { struct HookingPointData *hpd; - if( hp_db && (hpd = strdb_get(hp_db,target)) ) { + if (hp_db && (hpd = strdb_get(hp_db,target)) != NULL) { struct HPMHookPoint **hp = NULL; int *count = NULL; diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c index 356cdd352..05f62ca7a 100644 --- a/src/tool/mapcache.c +++ b/src/tool/mapcache.c @@ -188,7 +188,7 @@ char *remove_extension(char *mapname) char *ptr, *ptr2; ptr = strchr(mapname, '.'); if (ptr) { //Check and remove extension. - while (ptr[1] && (ptr2 = strchr(ptr+1, '.'))) + while (ptr[1] && (ptr2 = strchr(ptr+1, '.')) != NULL) ptr = ptr2; //Skip to the last dot. if (strcmp(ptr,".gat") == 0) *ptr = '\0'; //Remove extension. |