diff options
author | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-13 02:55:36 +0000 |
---|---|---|
committer | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-13 02:55:36 +0000 |
commit | 9b24ab2cffb38d283ea1c68c961507db0d86f7de (patch) | |
tree | 48d0e6aa53c7798f51d557717d348d2f1cca04ee /src/map/unit.c | |
parent | 0fe7b873ae06352aba2840eacf687d270d64fc2d (diff) | |
download | hercules-9b24ab2cffb38d283ea1c68c961507db0d86f7de.tar.gz hercules-9b24ab2cffb38d283ea1c68c961507db0d86f7de.tar.bz2 hercules-9b24ab2cffb38d283ea1c68c961507db0d86f7de.tar.xz hercules-9b24ab2cffb38d283ea1c68c961507db0d86f7de.zip |
- Optimised the guild aura routine which was wasting cycles by processing every unit on a map (rather than guild members)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15084 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 11 |
1 files changed, 9 insertions, 2 deletions
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) ) { |