diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/skill.c | 21 | ||||
-rw-r--r-- | src/map/skill.h | 2 | ||||
-rw-r--r-- | src/map/unit.c | 11 |
3 files changed, 16 insertions, 18 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index a7e75b6f4..1847ffb86 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2382,27 +2382,18 @@ static int skill_check_unit_range2 (struct block_list *bl, int x, int y, int ski type, skillid); } -int skill_guildaura_sub (struct block_list *bl, va_list ap) +int skill_guildaura_sub (struct map_session_data* sd, int id, int gid, int strvit, int agidex) { - struct map_session_data *sd; - int gid, id, strvit, agidex; - - sd = (struct map_session_data *)bl; + nullpo_ret(sd); - id = va_arg(ap,int); - gid = va_arg(ap,int); - if (sd->status.guild_id != gid) + if( sd->status.guild_id != gid ) return 0; - - if(id == sd->bl.id && battle_config.guild_aura&16) + if( id == sd->bl.id && battle_config.guild_aura&16 ) return 0; - strvit = va_arg(ap,int); - agidex = va_arg(ap,int); - - if (sd->sc.data[SC_GUILDAURA]) { + if( sd->sc.data[SC_GUILDAURA] ) { struct status_change_entry *sce = sd->sc.data[SC_GUILDAURA]; - if (sce->val3 != strvit || sce->val4 != agidex) { + if( sce->val3 != strvit || sce->val4 != agidex ) { sce->val3 = strvit; sce->val4 = agidex; status_calc_bl(&sd->bl, StatusChangeFlagTable[SC_GUILDAURA]); diff --git a/src/map/skill.h b/src/map/skill.h index 97bd54252..4670fbbf5 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -309,7 +309,7 @@ int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int struct skill_unit_group *skill_check_dancing( struct block_list *src ); // Guild skills [celest] -int skill_guildaura_sub (struct block_list *bl,va_list ap); +int skill_guildaura_sub (struct map_session_data* sd, int id, int gid, int strvit, int agidex); // 詠唱キャンセル int skill_castcancel(struct block_list *bl,int type); diff --git a/src/map/unit.c b/src/map/unit.c index 9cb198c3c..fb283a69b 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -187,8 +187,15 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data if ((skill = guild_checkskill(g, GD_SOULCOLD)) > 0) agidex |= (skill&0xFFFF)<<16; if ((skill = guild_checkskill(g, GD_HAWKEYES)) > 0) agidex |= skill&0xFFFF; if (strvit || agidex) - map_foreachinrange(skill_guildaura_sub, bl,2, BL_PC, - bl->id, sd->status.guild_id, strvit, agidex); + {// replaced redundant foreachinrange call with smaller and much more efficient iteration + for( i = 0; g->max_member > i; i++ ) + { + if( g->member[i].online && g->member[i].sd && check_distance_bl(&sd->bl, &g->member[i].sd->bl, 2) ) + {// perform the aura on the member as appropriate + skill_guildaura_sub( g->member[i].sd, g->member[i].sd->bl.id, sd->status.guild_id, strvit, agidex ); + } + } + } } } else if (md) { if( map_getcell(bl->m,x,y,CELL_CHKNPC) ) { |