diff options
author | malufett <malufett.eat.my.binaries@gmail.com> | 2013-03-08 22:51:42 +0800 |
---|---|---|
committer | malufett <malufett.eat.my.binaries@gmail.com> | 2013-03-08 22:51:42 +0800 |
commit | bc63ef1225dadcfa2ba20a9b073de801ee177992 (patch) | |
tree | f25e9d9121a75925e65812d1a5f8d395aed59270 /src/map/npc.c | |
parent | de1e1856cd115feb9834ba716d562e175ac15403 (diff) | |
download | hercules-bc63ef1225dadcfa2ba20a9b073de801ee177992.tar.gz hercules-bc63ef1225dadcfa2ba20a9b073de801ee177992.tar.bz2 hercules-bc63ef1225dadcfa2ba20a9b073de801ee177992.tar.xz hercules-bc63ef1225dadcfa2ba20a9b073de801ee177992.zip |
Fixed Bug #7114
-revised/added 'npc_isnear' where it checks if an NPC is nearby when making chat rooms or using vending.
Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index e032a28a7..0c9924d46 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -113,6 +113,24 @@ struct view_data* npc_get_viewdata(int class_) return NULL; } +static int npc_isnear_sub(struct block_list* bl, va_list args) { + struct npc_data *nd = (struct npc_data*)bl; + + if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) ) + return 0; + + return 1; +} + +bool npc_isnear(struct block_list * bl) { + + if( battle_config.min_npc_vendchat_distance > 0 && + map_foreachinrange(npc_isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) ) + return true; + + return false; +} + int npc_ontouch_event(struct map_session_data *sd, struct npc_data *nd) { char name[EVENT_NAME_LENGTH]; |