diff options
-rw-r--r-- | src/common/cbasetypes.h | 7 | ||||
-rw-r--r-- | src/common/db.c | 1 | ||||
-rw-r--r-- | src/common/sql.c | 9 | ||||
-rw-r--r-- | src/map/battle.c | 14 | ||||
-rw-r--r-- | src/map/battleground.c | 10 | ||||
-rw-r--r-- | src/map/clif.c | 1 | ||||
-rw-r--r-- | src/map/homunculus.c | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 7 | ||||
-rw-r--r-- | src/map/mob.c | 7 | ||||
-rw-r--r-- | src/map/npc_chat.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/quest.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 4 | ||||
-rw-r--r-- | src/map/skill.c | 43 | ||||
-rw-r--r-- | src/map/status.c | 35 |
16 files changed, 128 insertions, 20 deletions
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index d3db86543..33d617b13 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -298,6 +298,13 @@ typedef uintptr_t uintptr; #define PRAGMA_GCC45(str) #endif // ! defined(__GNUC__) && (defined(__clang__) || GCC_VERSION >= 40500) +// fallthrough attribute only enabled on gcc >= 7.0 +#if defined(__GNUC__) && (GCC_VERSION >= 70000) +#define FALLTHROUGH __attribute__ ((fallthrough)); +#else // ! defined(__GNUC__) && (GCC_VERSION >= 70000) +#define FALLTHROUGH +#endif // ! defined(__GNUC__) && (GCC_VERSION >= 70000) + // boolean types for C #if !defined(_MSC_VER) || _MSC_VER >= 1800 // MSVC doesn't have stdbool.h yet as of Visual Studio 2012 (MSVC version 17.00) diff --git a/src/common/db.c b/src/common/db.c index bbcac4b33..0c7bc2ae0 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -2418,6 +2418,7 @@ enum DBOptions db_fix_options(enum DBType type, enum DBOptions options) default: ShowError("db_fix_options: Unknown database type %u with options %x\n", type, options); + FALLTHROUGH case DB_STRING: case DB_ISTRING: // String databases, no fix required return options; diff --git a/src/common/sql.c b/src/common/sql.c index be0bd43e3..7e3e2e46f 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -422,39 +422,48 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, break; // fixed size case SQLDT_UINT8: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_INT8: bind->buffer_type = MYSQL_TYPE_TINY; buffer_len = 1; break; case SQLDT_UINT16: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_INT16: bind->buffer_type = MYSQL_TYPE_SHORT; buffer_len = 2; break; case SQLDT_UINT32: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_INT32: bind->buffer_type = MYSQL_TYPE_LONG; buffer_len = 4; break; case SQLDT_UINT64: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_INT64: bind->buffer_type = MYSQL_TYPE_LONGLONG; buffer_len = 8; break; // platform dependent size case SQLDT_UCHAR: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_CHAR: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(char)); buffer_len = sizeof(char); break; case SQLDT_USHORT: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_SHORT: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(short)); buffer_len = sizeof(short); break; case SQLDT_UINT: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_INT: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int)); buffer_len = sizeof(int); break; case SQLDT_ULONG: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_LONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(long)); buffer_len = sizeof(long); break; case SQLDT_ULONGLONG: bind->is_unsigned = 1; + FALLTHROUGH case SQLDT_LONGLONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int64)); buffer_len = sizeof(int64); break; diff --git a/src/map/battle.c b/src/map/battle.c index 01072702d..daef8f6a8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -693,6 +693,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in #ifdef RENEWAL if((skill_lv = pc->checkskill(sd,AM_AXEMASTERY)) > 0) damage += (skill_lv * 3); + FALLTHROUGH #endif case W_DAGGER: if((skill_lv = pc->checkskill(sd,SM_SWORD)) > 0) @@ -737,6 +738,7 @@ int64 battle_addmastery(struct map_session_data *sd,struct block_list *target,in if((skill_lv = pc->checkskill(sd,TK_RUN)) > 0) damage += (skill_lv * 10); // No break, fall through to Knuckles + FALLTHROUGH case W_KNUCKLE: if((skill_lv = pc->checkskill(sd,MO_IRONHAND)) > 0) damage += (skill_lv * 3); @@ -3005,6 +3007,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam case W_WHIP: if(!t_sd->state.arrow_atk) break; + FALLTHROUGH case W_BOW: case W_REVOLVER: case W_RIFLE: @@ -4256,7 +4259,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * switch( skill_id ) { case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: - if( md.damage == 1 ) break; + if (md.damage == 1) + break; + FALLTHROUGH case RA_CLUSTERBOMB: { struct Damage wd; @@ -4556,16 +4561,19 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.div_ = 5; break; } + FALLTHROUGH case 4: if( chance < 7){// 6 % chance to attack 4 times. wd.div_ = 4; break; } + FALLTHROUGH case 3: if( chance < 10){// 9 % chance to attack 3 times. wd.div_ = 3; break; } + FALLTHROUGH case 2: case 1: if( chance < 13){// 12 % chance to attack 2 times. @@ -4619,6 +4627,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if(!(sc && sc->data[SC_AUTOCOUNTER])) break; status_change_end(src, SC_AUTOCOUNTER, INVALID_TIMER); + FALLTHROUGH case KN_AUTOCOUNTER: if(battle_config.auto_counter_type && (battle_config.auto_counter_type&src->type)) @@ -5074,7 +5083,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list wd.damage = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage, wd.div_, 0, flag.weapon); wd.damage = battle->calc_cardfix2(src, target, wd.damage, s_ele, nk, wd.flag); } - /* Fall through */ + FALLTHROUGH #endif default: ATK_RATE(battle->calc_skillratio(BF_WEAPON, src, target, skill_id, skill_lv, skillratio, wflag)); @@ -6546,6 +6555,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f case RK_DRAGONBREATH_WATER: if( !map->list[m].flag.pvp && !map->list[m].flag.gvg ) break; + FALLTHROUGH case 0://you can hit them without skills case MA_REMOVETRAP: case HT_REMOVETRAP: diff --git a/src/map/battleground.c b/src/map/battleground.c index 5231ce3d2..7419a1928 100644 --- a/src/map/battleground.c +++ b/src/map/battleground.c @@ -862,11 +862,11 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ count++; } if ( count < arena->min_team_players ) { - char response[117]; + char response[121]; if( count != sd->guild->connect_member && sd->guild->connect_member >= arena->min_team_players ) - sprintf(response, "Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d",arena->min_team_players); + sprintf(response, "Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d", arena->min_team_players); else - sprintf(response, "Can't apply: not enough members in your team/guild, minimum is %d",arena->min_team_players); + sprintf(response, "Can't apply: not enough members in your team/guild, minimum is %d", arena->min_team_players); clif->messagecolor_self(sd->fd, COLOR_RED, response); return BGQA_FAIL_TEAM_COUNT; } @@ -894,9 +894,9 @@ enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_ return BGQA_NOT_PARTY_GUILD_LEADER; if( count < arena->min_team_players ) { - char response[117]; + char response[121]; if( count != p->party.count && p->party.count >= arena->min_team_players ) - sprintf(response, "Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d",arena->min_team_players); + sprintf(response, "Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d", arena->min_team_players); else sprintf(response, "Can't apply: not enough members in your team/party, minimum is %d",arena->min_team_players); clif->messagecolor_self(sd->fd, COLOR_RED, response); diff --git a/src/map/clif.c b/src/map/clif.c index 09e8bbb6b..040f86a58 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -13833,6 +13833,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) case MAPID_TAEKWON: if (!sd->state.rest) break; + FALLTHROUGH case MAPID_SUPER_NOVICE: sd->state.doridori=1; break; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 080a314b8..cc920b888 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -1215,7 +1215,7 @@ void homunculus_read_db(void) { if( i > 0 ) { char filepath[256]; - sprintf(filepath, "%s/%s", map->db_path, filename[i]); + snprintf(filepath, 256, "%s/%s", map->db_path, filename[i]); if( !exists(filepath) ) { continue; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 350697a08..2e44393fe 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1376,7 +1376,7 @@ void itemdb_read_combos(void) char filepath[256]; FILE* fp; - sprintf(filepath, "%s/%s", map->db_path, DBPATH"item_combo_db.txt"); + snprintf(filepath, 256, "%s/%s", map->db_path, DBPATH"item_combo_db.txt"); if ((fp = fopen(filepath, "r")) == NULL) { ShowError("itemdb_read_combos: File not found \"%s\".\n", filepath); diff --git a/src/map/map.c b/src/map/map.c index 47e22fa9b..0a60a92b4 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1929,6 +1929,7 @@ int map_quit(struct map_session_data *sd) { case SC_GDSKILL_REGENERATION: if( !sd->sc.data[i]->val4 ) break; + FALLTHROUGH default: status_change_end(&sd->bl, (sc_type)i, INVALID_TIMER); } @@ -3738,8 +3739,8 @@ int map_readallmaps (void) { if( map->enable_grf ) ShowStatus("Loading maps (using GRF files)...\n"); else { - char mapcachefilepath[254]; - sprintf(mapcachefilepath,"%s/%s%s",map->db_path,DBPATH,"map_cache.dat"); + char mapcachefilepath[256]; + snprintf(mapcachefilepath, 256, "%s/%s%s", map->db_path, DBPATH, "map_cache.dat"); ShowStatus("Loading maps (using %s as map cache)...\n", mapcachefilepath); if( (fp = fopen(mapcachefilepath, "rb")) == NULL ) { ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", mapcachefilepath); @@ -4394,7 +4395,7 @@ struct map_zone_data *map_merge_zone(struct map_zone_data *main, struct map_zone nullpo_retr(NULL, main); nullpo_retr(NULL, other); - sprintf(newzone, "%s+%s",main->name,other->name); + snprintf(newzone, MAP_ZONE_NAME_LENGTH, "%s+%s", main->name, other->name); if( (zone = strdb_get(map->zone_db, newzone)) ) return zone;/* this zone has already been merged */ diff --git a/src/map/mob.c b/src/map/mob.c index bede7deed..590cbf856 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1099,6 +1099,7 @@ int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap) case BL_PC: if (BL_UCCAST(BL_PC, bl)->state.gangsterparadise && !(status_get_mode(&md->bl)&MD_BOSS)) return 0; //Gangster paradise protection. + FALLTHROUGH default: if (battle_config.hom_setting&0x4 && (*target) && (*target)->type == BL_HOM && bl->type != BL_HOM) @@ -1326,6 +1327,7 @@ int mob_unlocktarget(struct mob_data *md, int64 tick) { break; //Because it is not unset when the mob finishes walking. md->state.skillstate = MSS_IDLE; + FALLTHROUGH case MSS_IDLE: // Idle skill. if (!(++md->ud.walk_count%IDLE_SKILL_INTERVAL) && mob->skill_use(md, tick, -1)) @@ -3289,6 +3291,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { bl = map->id2bl(md->master_id); if (bl) //Otherwise, fall through. break; + FALLTHROUGH case MST_FRIEND: bl = fbl?fbl:(fmd?&fmd->bl:&md->bl); break; @@ -3331,6 +3334,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { bl = map->id2bl(md->master_id); if (bl) //Otherwise, fall through. break; + FALLTHROUGH case MST_FRIEND: if (fbl) { bl = fbl; @@ -3339,6 +3343,7 @@ int mobskill_use(struct mob_data *md, int64 tick, int event) { bl = &fmd->bl; break; } // else fall through + FALLTHROUGH default: bl = &md->bl; break; @@ -5057,7 +5062,7 @@ void mob_readskilldb(void) { for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) { if(fi > 0) { char filepath[256]; - sprintf(filepath, "%s/%s", map->db_path, filename[fi]); + snprintf(filepath, 256, "%s/%s", map->db_path, filename[fi]); if(!exists(filepath)) { continue; } diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 4bd7d416d..7eb317e49 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -393,7 +393,7 @@ int npc_chat_sub(struct block_list* bl, va_list ap) // save out the matched strings for (i = 0; i < r; i++) { - char var[12], val[255]; + char var[15], val[255]; snprintf(var, sizeof(var), "$@p%i$", i); libpcre->copy_substring(msg, offsets, r, i, val, sizeof(val)); script->set_var(sd, var, val); diff --git a/src/map/pc.c b/src/map/pc.c index 51d02ff40..0674f0137 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -11504,7 +11504,7 @@ void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update )) Sql_ShowDebug(map->mysql_handle); } - /* yes we want it to fall */ + FALLTHROUGH case PAUC_REFRESH: for( i = 0; i < sd->vend_num; i++ ) { if( sd->vending[i].amount == 0 ) diff --git a/src/map/quest.c b/src/map/quest.c index ecaa8720e..544ddf985 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -541,7 +541,7 @@ int quest_read_db(void) int i = 0, count = 0; const char *filename = "quest_db.conf"; - sprintf(filepath, "%s/%s", map->db_path, filename); + snprintf(filepath, 256, "%s/%s", map->db_path, filename); if (!libconfig->load_file(&quest_db_conf, filepath)) return -1; diff --git a/src/map/script.c b/src/map/script.c index f8754660c..a1efbb3b8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2291,7 +2291,7 @@ void read_constdb(void) struct config_setting_t *t; int i = 0; - sprintf(filepath, "%s/constants.conf", map->db_path); + snprintf(filepath, 256, "%s/constants.conf", map->db_path); if (!libconfig->load_file(&constants_conf, filepath)) return; @@ -9269,7 +9269,7 @@ BUILDIN(bonus) { val1 = skill->name2id(script_getstr(st, 3)); break; } - // else fall through + FALLTHROUGH default: val1 = script_getnum(st,3); break; diff --git a/src/map/skill.c b/src/map/skill.c index ab1c026f3..2559a7a5b 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -557,6 +557,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_THERE_ARE_NPC_AROUND,0); return 1; } + FALLTHROUGH case MC_IDENTIFY: return 0; // always allowed case WZ_ICEWALL: @@ -2508,6 +2509,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr case KO_MUCHANAGE: if( dmg.dmg_lv == ATK_FLEE ) break; + FALLTHROUGH case WL_SOULEXPANSION: case WL_COMET: case NJ_HUUMA: @@ -2520,6 +2522,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr case LG_OVERBRAND: /* Fall through */ dmg.amotion = status_get_amotion(src) * 2; + FALLTHROUGH case LG_OVERBRAND_PLUSATK: dmg.dmotion = clif->skill_damage(dsrc,bl,tick,status_get_amotion(src),dmg.dmotion,damage,dmg.div_,skill_id,-1,BDT_SPLASH); break; @@ -2578,6 +2581,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr dmg.dmotion = clif->skill_damage(src,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, (flag&SD_LEVEL) ? -1 : skill_lv, BDT_SPLASH); if( dsrc != src ) // avoid damage display redundancy break; + FALLTHROUGH case HT_LANDMINE: dmg.dmotion = clif->skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -1, type); break; @@ -2590,6 +2594,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr case AB_DUPLELIGHT_MELEE: case AB_DUPLELIGHT_MAGIC: dmg.amotion = 300;/* makes the damage value not overlap with previous damage (when displayed by the client) */ + FALLTHROUGH default: skill->attack_display_unknown(&attack_type, src, dsrc, bl, &skill_id, &skill_lv, &tick, &flag, &type, &dmg, &damage); break; @@ -3003,6 +3008,7 @@ int skill_check_unit_range_sub(struct block_list *bl, va_list ap) case AL_PNEUMA: if(g_skill_id == SA_LANDPROTECTOR) break; + FALLTHROUGH case MG_SAFETYWALL: case MH_STEINWAND: case SC_MAELSTROM: @@ -3425,6 +3431,7 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) { skill->blown(src,target,skill->get_blewcount(skl->skill_id, skl->skill_lv), -1, 0x0 ); break; } + FALLTHROUGH } default: skill->timerskill_target_unknown(tid, tick, src, target, ud, skl); @@ -3451,6 +3458,7 @@ int skill_timerskill(int tid, int64 tick, int id, intptr_t data) { map->foreachinarea(skill->cell_overlap,src->m,skl->x-i,skl->y-i,skl->x+i,skl->y+i,BL_SKILL,skl->skill_id,&dummy,src); } + FALLTHROUGH // fall through ... case WL_EARTHSTRAIN: skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,(skl->type<<16)|skl->flag); @@ -3958,6 +3966,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 case MC_CARTREVOLUTION: case NPC_SPLASHATTACK: flag |= SD_PREAMBLE; // a fake packet will be sent for the first target to be hit + FALLTHROUGH case AS_SPLASHER: case HT_BLITZBEAT: case AC_SHOWER: @@ -4338,6 +4347,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 if( (tsc = status->get_sc(bl)) && tsc->data[SC_HIDING] ) break; } + FALLTHROUGH case HVAN_EXPLOSION: if (src != bl) skill->attack(BF_MISC,src,src,bl,skill_id,skill_lv,tick,flag); @@ -4595,6 +4605,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 } break; } + FALLTHROUGH case RA_WUGBITE: if( path->search(NULL,src,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKNOREACH) ) { skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); @@ -5353,6 +5364,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0) ; break ; } + FALLTHROUGH case AL_HEAL: /** @@ -7592,6 +7604,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin // remove trap should be used instead break; // otherwise fall through to below + FALLTHROUGH case UNT_BLASTMINE: case UNT_SKIDTRAP: case UNT_LANDMINE: @@ -7629,7 +7642,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start4(src,bl,type,100,skill_lv,skill_id,src->id,skill->get_time(skill_id,skill_lv),1000)); #ifndef RENEWAL - if (sd) skill->blockpc_start (sd, skill_id, skill->get_time(skill_id, skill_lv)+3000); + if (sd) + skill->blockpc_start(sd, skill_id, skill->get_time(skill_id, skill_lv) + 3000); #endif break; @@ -10406,6 +10420,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } + FALLTHROUGH case MG_SAFETYWALL: { @@ -10415,6 +10430,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui return 0; // Don't consume gems if cast on LP } } + FALLTHROUGH case MG_FIREWALL: case MG_THUNDERSTORM: @@ -10525,6 +10541,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui case RL_B_TRAP: case MH_XENO_SLASHER: flag|=1;//Set flag to 1 to prevent deleting ammo (it will be deleted on group-delete). + FALLTHROUGH case GS_GROUNDDRIFT: //Ammo should be deleted right away. if ( skill_id == WM_SEVERE_RAINSTORM ) sc_start(src,src,SC_NO_SWITCH_EQUIP,100,0,skill->get_time(skill_id,skill_lv)); @@ -11284,8 +11301,10 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ case HT_ANKLESNARE: if( flag&2 ) val3 = SC_ESCAPE; + FALLTHROUGH case HT_SHOCKWAVE: val1=skill_lv*15+10; + FALLTHROUGH case HT_SANDMAN: case MA_SANDMAN: case HT_CLAYMORETRAP: @@ -11470,12 +11489,16 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ { case ELE_FIRE: subunt++; + FALLTHROUGH case ELE_WATER: subunt++; + FALLTHROUGH case ELE_POISON: subunt++; + FALLTHROUGH case ELE_DARK: subunt++; + FALLTHROUGH case ELE_WIND: break; default: @@ -11512,6 +11535,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ target = BCT_ALL; val1 = skill_lv + 1; val2 = 1; + FALLTHROUGH case WM_POEMOFNETHERWORLD: // Can't be placed on top of Land Protector. case SO_WATER_INSIGNIA: case SO_FIRE_INSIGNIA: @@ -11836,6 +11860,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick case UNT_HERMODE: if (sg->src_id!=bl->id && battle->check_target(&src->bl,bl,BCT_PARTY|BCT_GUILD) > 0) status->change_clear_buffs(bl,1); //Should dispell only allies. + FALLTHROUGH case UNT_RICHMANKIM: case UNT_ETERNALCHAOS: case UNT_DRUMBATTLEFIELD: @@ -11854,6 +11879,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick if (!battle_config.song_timer_reset && sc && sce) return 0; // Let it fall through + FALLTHROUGH case UNT_WHISTLE: case UNT_ASSASSINCROSS: case UNT_POEMBRAGI: @@ -12238,11 +12264,13 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 case UNT_VERDURETRAP: if( bl->type == BL_PC )// it won't work on players break; + FALLTHROUGH case UNT_FIRINGTRAP: case UNT_ICEBOUNDTRAP: case UNT_CLUSTERBOMB: if( bl->id == ss->id )// it won't trigger on caster break; + FALLTHROUGH case UNT_LANDMINE: case UNT_BLASTMINE: case UNT_SHOCKWAVE: @@ -12534,6 +12562,7 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 case UNT_STEALTHFIELD: if( bl->id == sg->src_id ) break; // Don't work on Self (video shows that) + FALLTHROUGH case UNT_NEUTRALBARRIER: sc_start(ss,bl,type,100,sg->skill_lv,sg->interval + 100); break; @@ -13315,6 +13344,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id case KO_YAMIKUMO: if( sc && sc->data[status->skill2sc(skill_id)] ) return 1; + FALLTHROUGH default: { int ret = skill->check_condition_castbegin_off_unknown(sc, &skill_id); @@ -13421,6 +13451,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } + FALLTHROUGH case SA_CASTCANCEL: if(sd->ud.skilltimer == INVALID_TIMER) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -13670,6 +13701,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } + FALLTHROUGH case GD_EMERGENCYCALL: // other checks were already done in skillnotok() if (!sd->status.guild_id || !sd->state.gmaster_flag) @@ -13692,6 +13724,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } + FALLTHROUGH case NJ_BUNSINJYUTSU: if (!(sc && sc->data[SC_NJ_NEN])) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -14018,6 +14051,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } + FALLTHROUGH case ST_CART: if(!pc_iscarton(sd)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_CART,0); @@ -14111,11 +14145,13 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } + FALLTHROUGH case ST_MH_GRAPPLING: if (!(sc && sc->data[SC_STYLE_CHANGE] && sc->data[SC_STYLE_CHANGE]->val2 == MH_MD_GRAPPLING)){ clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 0; } + FALLTHROUGH case ST_PECO: if (!pc_isridingpeco(sd)) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); @@ -14989,6 +15025,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 case WZ_FIREPILLAR: if(skill_lv < 5) break; + FALLTHROUGH case HW_GRAVITATION: case MG_SAFETYWALL: case MG_STONECURSE: @@ -16740,6 +16777,7 @@ int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap) skill->delunit(su); break; } + FALLTHROUGH case UNT_SKIDTRAP: case UNT_LANDMINE: case UNT_SHOCKWAVE: @@ -17404,12 +17442,15 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, case ITEMID_HAGALAZ: case ITEMID_OTHILA: D -= 500; //Rank C + FALLTHROUGH case ITEMID_ISA: case ITEMID_WYRD: D -= 500; //Rank B + FALLTHROUGH case ITEMID_NAUTHIZ: case ITEMID_URUZ: D -= 500; //Rank A + FALLTHROUGH case ITEMID_BERKANA: case ITEMID_LUX_ANIMA: D -= 500; //Rank S diff --git a/src/map/status.c b/src/map/status.c index f10f5fd9f..5e65244ef 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1821,9 +1821,13 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin switch (sc->data[SC_BLADESTOP]->val1) { case 5: if (skill_id == MO_EXTREMITYFIST) break; + FALLTHROUGH case 4: if (skill_id == MO_CHAINCOMBO) break; + FALLTHROUGH case 3: if (skill_id == MO_INVESTIGATE) break; + FALLTHROUGH case 2: if (skill_id == MO_FINGEROFFENSIVE) break; + FALLTHROUGH default: return 0; } } @@ -1987,6 +1991,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin return 0; // Can't use Weapon endow skills on Mercenary (only Master) if( skill_id == AM_POTIONPITCHER && ( target->type == BL_MER || target->type == BL_ELEM) ) return 0; // Can't use Potion Pitcher on Mercenaries + FALLTHROUGH default: //Check for chase-walk/hiding/cloaking opponents. if( tsc ) { @@ -7457,8 +7462,10 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_GOLDENE_FERSE: if ((type==SC_GOLDENE_FERSE && sc->data[SC_ANGRIFFS_MODUS]) || (type==SC_ANGRIFFS_MODUS && sc->data[SC_GOLDENE_FERSE]) - ) + ) { return 0; + } + FALLTHROUGH case SC_VACUUM_EXTREME: if(sc->data[SC_HALLUCINATIONWALK]) return 0; @@ -7466,10 +7473,12 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_STONE: if(sc->data[SC_POWER_OF_GAIA]) return 0; + FALLTHROUGH case SC_FREEZE: //Undead are immune to Freeze/Stone if (undead_flag && !(flag&SCFLAG_NOAVOID)) return 0; + FALLTHROUGH case SC_SLEEP: case SC_STUN: case SC_FROSTMISTY: @@ -7502,6 +7511,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_OVERTHRUST: if (sc->data[SC_OVERTHRUSTMAX]) return 0; // Overthrust can't take effect if under Max Overthrust. [Skotlex] + FALLTHROUGH case SC_OVERTHRUSTMAX: if (sc->option&OPTION_MADOGEAR) return 0; // Overthrust and Overthrust Max cannot be used on Mado Gear [Ind] @@ -7527,6 +7537,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_TWOHANDQUICKEN: if (sc->data[SC_DEC_AGI]) return 0; + FALLTHROUGH case SC_CONCENTRATION: case SC_SPEARQUICKEN: case SC_TRUESIGHT: @@ -7535,6 +7546,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_ASSNCROS: if (sc->option&OPTION_MADOGEAR) return 0; // Mado is immune to wind walk, cart boost, etc (others above) [Ind] + FALLTHROUGH case SC_INC_AGI: if (sc->data[SC_QUAGMIRE]) return 0; @@ -7799,11 +7811,13 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t status_change_end(bl, SC_CONCENTRATION, INVALID_TIMER); status_change_end(bl, SC_TRUESIGHT, INVALID_TIMER); status_change_end(bl, SC_WINDWALK, INVALID_TIMER); + FALLTHROUGH //Also blocks the ones below... case SC_DEC_AGI: case SC_ADORAMUS: status_change_end(bl, SC_CARTBOOST, INVALID_TIMER); //Also blocks the ones below... + FALLTHROUGH case SC_DONTFORGETME: status_change_end(bl, SC_INC_AGI, INVALID_TIMER); status_change_end(bl, SC_ADRENALINE, INVALID_TIMER); @@ -8124,6 +8138,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_LERADS_DEW: if (sc && sc->data[SC_BERSERK]) return 0; + FALLTHROUGH case SC_SHAPESHIFT: case SC_PROPERTYWALK: break; @@ -8136,6 +8151,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_JOINTBEAT: val2 |= sce->val2; // stackable ailments + FALLTHROUGH default: if(sce->val1 > val1) return 1; //Return true to not mess up skill animations. [Skotlex] @@ -8149,6 +8165,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_ADORAMUS: sc_start(src,bl,SC_BLIND,100,val1,skill->get_time(status->sc2skill(type),val1)); // Fall through to SC_INC_AGI + FALLTHROUGH case SC_DEC_AGI: case SC_INC_AGI: val2 = 2 + val1; //Agi change @@ -8232,6 +8249,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_ENCHANTPOISON: val2= 250+50*val1; //Poisoning Chance (2.5+0.5%) in 1/10000 rate + FALLTHROUGH case SC_ASPERSIO: case SC_PROPERTYFIRE: case SC_PROPERTYWATER: @@ -8738,6 +8756,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t switch (val1) { case 3: //33*3 + 1 -> 100% val2++; + FALLTHROUGH case 1: case 2: //33, 66% val2 += 33*val1; @@ -8818,6 +8837,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_ADRENALINE2: case SC_ADRENALINE: val3 = (val2) ? 300 : 200; // aspd increase + FALLTHROUGH case SC_WEAPONPERFECT: if(sd && pc->checkskill(sd,BS_HILTBINDING)>0) tick += tick / 10; @@ -9513,17 +9533,20 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_WILD_STORM: case SC_UPHEAVAL: val2 += 10; + FALLTHROUGH case SC_HEATER: case SC_COOLER: case SC_BLAST: case SC_CURSED_SOIL: val2 += 10; + FALLTHROUGH case SC_PYROTECHNIC: case SC_AQUAPLAY: case SC_GUST: case SC_PETROLOGY: val2 += 5; val3 += 9000; + FALLTHROUGH case SC_CIRCLE_OF_FIRE: case SC_WATER_SCREEN: case SC_WIND_STEP: @@ -9605,6 +9628,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t break; case SC_KAGEMUSYA: val3 = val1 * 2; + FALLTHROUGH case SC_IZAYOI: val2 = tick/1000; tick_time = 1000; @@ -9911,14 +9935,17 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t case SC_DEEP_SLEEP: if (sd && pc_issit(sd)) //Avoid sprite sync problems. pc->setstand(sd); + FALLTHROUGH case SC_TRICKDEAD: status_change_end(bl, SC_DANCING, INVALID_TIMER); // Cancel cast when get status [LuzZza] if (battle_config.sc_castcancel&bl->type) unit->skillcastcancel(bl, 0); + FALLTHROUGH case SC_FALLENEMPIRE: case SC_WHITEIMPRISON: unit->stop_attack(bl); + FALLTHROUGH case SC_STOP: case SC_CONFUSION: case SC_RG_CCONFINE_M: @@ -10010,6 +10037,7 @@ int status_change_start(struct block_list *src, struct block_list *bl, enum sc_t opt_flag = 0; break; } + FALLTHROUGH case SC_EXPLOSIONSPIRITS: sc->opt3 |= OPT3_EXPLOSIONSPIRITS; opt_flag = 0; @@ -10323,6 +10351,7 @@ int status_change_clear(struct block_list* bl, int type) case SC_ARMOR_PROPERTY://Only when its Holy or Dark that it doesn't dispell on death if( sc->data[i]->val2 != ELE_HOLY && sc->data[i]->val2 != ELE_DARK ) break; + FALLTHROUGH default: continue; } @@ -10403,6 +10432,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const //trigger when it also removed one case SC_STONE: sce->val3 = 0; //Petrify time counter. + FALLTHROUGH case SC_FREEZE: case SC_STUN: case SC_SLEEP: @@ -10971,6 +11001,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const opt_flag = 0; break; } + FALLTHROUGH case SC_EXPLOSIONSPIRITS: sc->opt3 &= ~OPT3_EXPLOSIONSPIRITS; opt_flag = 0; @@ -11256,6 +11287,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) case SC_POISON: if(st->hp <= max(st->max_hp>>2, sce->val4)) //Stop damaging after 25% HP left. break; + FALLTHROUGH case SC_DPOISON: if (--(sce->val3) > 0) { if (!sc->data[SC_SLOWPOISON]) { @@ -11386,6 +11418,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) //Moonlit's cost is 4sp*skill_lv [Skotlex] sp= 4*(sce->val1>>16); //Upkeep is also every 10 secs. + FALLTHROUGH case DC_DONTFORGETME: s=10; break; |