summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2014-12-21 15:19:35 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2014-12-21 15:19:35 +0800
commitea34b8031646a351e8ddbbb829fb99684df5e6e5 (patch)
tree0c52d7b9b6040f187b7a299de6148847ca02cac5 /src/map/map.c
parent1134e030744e67bca61f52dc97075f33932f7a38 (diff)
downloadhercules-ea34b8031646a351e8ddbbb829fb99684df5e6e5.tar.gz
hercules-ea34b8031646a351e8ddbbb829fb99684df5e6e5.tar.bz2
hercules-ea34b8031646a351e8ddbbb829fb99684df5e6e5.tar.xz
hercules-ea34b8031646a351e8ddbbb829fb99684df5e6e5.zip
Fixed Bug#8458
-http://hercules.ws/board/tracker/issue-8458-sgs-running-and-gm-hide/?gopid=24216#entry24216 Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 010df6286..58bd944cb 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -397,6 +397,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, int64 tick) {
* Counts specified number of objects on given cell.
* flag:
* 0x1 - only count standing units
+ * 0x2 - don't count invinsible units
* TODO: merge with bl_getall_area
*------------------------------------------*/
int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) {
@@ -412,11 +413,19 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) {
if (type&~BL_MOB)
for( bl = map->list[m].block[bx+by*map->list[m].bxs] ; bl != NULL ; bl = bl->next )
- if(bl->x == x && bl->y == y && bl->type&type) {
- if(flag&1) {
- struct unit_data *ud = unit->bl2ud(bl);
- if(!ud || ud->walktimer == INVALID_TIMER)
- count++;
+ if ( bl->x == x && bl->y == y && bl->type&type ) {
+ if ( flag ) {
+ if ( flag & 2 ) { // priority over other flags
+ struct status_change *sc = status->get_sc(bl);
+ if ( !(sc && sc->option&OPTION_INVISIBLE) )
+ count++;
+ } else {
+ if ( flag & 1 ) {
+ struct unit_data *ud = unit->bl2ud(bl);
+ if ( !ud || ud->walktimer == INVALID_TIMER )
+ count++;
+ }
+ }
} else {
count++;
}
@@ -424,11 +433,19 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) {
if (type&BL_MOB)
for( bl = map->list[m].block_mob[bx+by*map->list[m].bxs] ; bl != NULL ; bl = bl->next )
- if(bl->x == x && bl->y == y) {
- if(flag&1) {
- struct unit_data *ud = unit->bl2ud(bl);
- if(!ud || ud->walktimer == INVALID_TIMER)
- count++;
+ if ( bl->x == x && bl->y == y ) {
+ if ( flag ) {
+ if ( flag & 2 ) { // priority over other flags
+ struct status_change *sc = status->get_sc(bl);
+ if ( !(sc && sc->option&OPTION_INVISIBLE) )
+ count++;
+ } else {
+ if ( flag & 1 ) {
+ struct unit_data *ud = unit->bl2ud(bl);
+ if ( !ud || ud->walktimer == INVALID_TIMER )
+ count++;
+ }
+ }
} else {
count++;
}