diff options
author | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-03 19:20:42 +0000 |
---|---|---|
committer | FlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-02-03 19:20:42 +0000 |
commit | 42817756b603d2dc76c1408d0a6f432673350bd7 (patch) | |
tree | b9e0780f47c550e7bce922bc84de0941beee9a93 /src/map/map.h | |
parent | f010f32adb51f7d4d2648abd475a900ecf07bafa (diff) | |
download | hercules-42817756b603d2dc76c1408d0a6f432673350bd7.tar.gz hercules-42817756b603d2dc76c1408d0a6f432673350bd7.tar.bz2 hercules-42817756b603d2dc76c1408d0a6f432673350bd7.tar.xz hercules-42817756b603d2dc76c1408d0a6f432673350bd7.zip |
* Added an iterator to map.h/c.
Will be used instead of map_getallusers, which has problems with dangling pointers (returned array isn't updated).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12170 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.h')
-rw-r--r-- | src/map/map.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/map/map.h b/src/map/map.h index 436fbca33..81b83257c 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1324,6 +1324,25 @@ void map_foreachmob(int (*func)(DBKey,void*,va_list),...); int map_foreachiddb(int (*)(DBKey,void*,va_list),...); struct map_session_data * map_nick2sd(const char*); +/// Bitfield of flags for the iterator. +enum e_mapitflags +{ + MAPIT_NORMAL = 0, + MAPIT_PCISPLAYING = 1,// player is authed, not waiting disconnect and not in final save +}; +struct s_mapiterator; +struct s_mapiterator* mapit_alloc(enum e_mapitflags flags, enum bl_type types); +void mapit_free(struct s_mapiterator* mapit); +struct block_list* mapit_first(struct s_mapiterator* mapit); +struct block_list* mapit_last(struct s_mapiterator* mapit); +struct block_list* mapit_next(struct s_mapiterator* mapit); +struct block_list* mapit_prev(struct s_mapiterator* mapit); +bool mapit_exists(struct s_mapiterator* mapit); +#define mapit_getallusers() mapit_alloc(MAPIT_PCISPLAYING,BL_PC) +#define mapit_geteachpc() mapit_alloc(MAPIT_NORMAL,BL_PC) +#define mapit_geteachmob() mapit_alloc(MAPIT_NORMAL,BL_MOB) +#define mapit_geteachiddb() mapit_alloc(MAPIT_NORMAL,BL_ALL) + // ‚»‚Ì‘¼ int map_check_dir(int s_dir,int t_dir); unsigned char map_calc_dir( struct block_list *src,int x,int y); |