summaryrefslogtreecommitdiff
path: root/src/map/map.h
diff options
context:
space:
mode:
authorPiotr HaƂaczkiewicz <piotr.halaczkiewicz@gmail.com>2013-07-17 21:13:21 +0200
committerPiotr HaƂaczkiewicz <piotr.halaczkiewicz@gmail.com>2013-07-23 16:44:24 +0200
commit86f70d9f4ff1715dccbc101b78728c366623fe7b (patch)
tree8072f2fdbf9d9ae2a3dc815d2d7ce1c45fbc162d /src/map/map.h
parent056c181e1c163b7d49c87bc07bf82ef11fdbd539 (diff)
downloadhercules-86f70d9f4ff1715dccbc101b78728c366623fe7b.tar.gz
hercules-86f70d9f4ff1715dccbc101b78728c366623fe7b.tar.bz2
hercules-86f70d9f4ff1715dccbc101b78728c366623fe7b.tar.xz
hercules-86f70d9f4ff1715dccbc101b78728c366623fe7b.zip
Refactored map_foreach* functions.
Removed a lot of duplicated code. Added some documentation & comments.
Diffstat (limited to 'src/map/map.h')
-rw-r--r--src/map/map.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 7826e00b3..4bee9c8ea 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -546,8 +546,19 @@ struct map_data {
char name[MAP_NAME_LENGTH];
uint16 index; // The map index used by the mapindex* functions.
struct mapcell* cell; // Holds the information of each map cell (NULL if the map is not on this map-server).
- struct block_list **block;
- struct block_list **block_mob;
+
+ /* 2D Orthogonal Range Search: Grid Implementation
+ "Algorithms in Java, Parts 1-4" 3.18, Robert Sedgewick
+ Map is divided into squares, called blocks (side length = BLOCK_SIZE).
+ For each block there is a linked list of objects in that block (block_list).
+ Array provides capability to access immediately the set of objects close
+ to a given object.
+ The linked lists provide the flexibility to store the objects without
+ knowing ahead how many objects fall into each block.
+ */
+ struct block_list **block; // Grid array of block_lists containing only non-BL_MOB objects
+ struct block_list **block_mob; // Grid array of block_lists containing only BL_MOB objects
+
int16 m;
int16 xs,ys; // map dimensions (in cells)
int16 bxs,bys; // map dimensions (in blocks)