summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-12-26 18:16:12 +0100
committerHaru <haru@dotalux.com>2014-12-26 18:20:44 +0100
commita576c4effdb7b79d7db9b3a178d6e811a7ae82c2 (patch)
tree0b73d7166cdf674808b930f24f432c14155c1df1 /src/map/map.c
parent70c52a254ad7faf3a7433172bc4b8611445a1e04 (diff)
downloadhercules-a576c4effdb7b79d7db9b3a178d6e811a7ae82c2.tar.gz
hercules-a576c4effdb7b79d7db9b3a178d6e811a7ae82c2.tar.bz2
hercules-a576c4effdb7b79d7db9b3a178d6e811a7ae82c2.tar.xz
hercules-a576c4effdb7b79d7db9b3a178d6e811a7ae82c2.zip
Allowed flag values of map_count_oncell to stack
- Follow-up to ea34b80 - It is now possible to stack 0x1|0x2 as a valid flag value. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c64
1 files changed, 30 insertions, 34 deletions
diff --git a/src/map/map.c b/src/map/map.c
index 58bd944cb..e5574eaf7 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -411,45 +411,41 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type, int flag) {
bx = x/BLOCK_SIZE;
by = y/BLOCK_SIZE;
- 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 ) {
- 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++;
+ 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&0x2) {
+ struct status_change *sc = status->get_sc(bl);
+ if (sc && (sc->option&OPTION_INVISIBLE))
+ continue;
}
+ if (flag&0x1) {
+ struct unit_data *ud = unit->bl2ud(bl);
+ if (ud && ud->walktimer != INVALID_TIMER)
+ continue;
+ }
+ count++;
}
+ }
+ }
- 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 ) {
- 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++;
+ 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&0x2) {
+ struct status_change *sc = status->get_sc(bl);
+ if (sc && (sc->option&OPTION_INVISIBLE))
+ continue;
}
+ if (flag&0x1) {
+ struct unit_data *ud = unit->bl2ud(bl);
+ if (ud && ud->walktimer != INVALID_TIMER)
+ continue;
+ }
+ count++;
}
+ }
+ }
return count;
}