diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-01-03 21:36:40 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-01-03 21:36:40 +0000 |
commit | 1b241817a93f892a24379866a06e046e7e6c5e86 (patch) | |
tree | 72e6e27d29b8eca173b32b64d3b31592de7208c6 /src/map/map.h | |
parent | 50418d820226fbcdf7609fb619028e3b75a2fa9e (diff) | |
download | hercules-1b241817a93f892a24379866a06e046e7e6c5e86.tar.gz hercules-1b241817a93f892a24379866a06e046e7e6c5e86.tar.bz2 hercules-1b241817a93f892a24379866a06e046e7e6c5e86.tar.xz hercules-1b241817a93f892a24379866a06e046e7e6c5e86.zip |
Map cell mechanism rewrite
- defined a data structure for map cells (replaces 3 various cell arrays)
- both terrain (gat) and dynamic (cell) information is now stored as C-style bit flags instead of #defines and bitmasks
- added map_gat2cell() and map_cell2gat() for terrain type conversions
- changing terrain information via 'setcell' is temporarily disabled
- mapserver startup now takes longer, as it needs to adapt mapcache data to internal representation, cell by cell (new mapcache format anyone?)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12003 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.h')
-rw-r--r-- | src/map/map.h | 205 |
1 files changed, 114 insertions, 91 deletions
diff --git a/src/map/map.h b/src/map/map.h index fa165609d..67e6d04fc 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1014,93 +1014,6 @@ struct pet_data { struct map_session_data *msd; }; -struct map_data { - char name[MAP_NAME_LENGTH]; - unsigned short index; // The map index used by the mapindex* functions. - unsigned char *gat; // Holds the type of each map cell (NULL if the map is not on this map-server). - unsigned char *cell; // Contains temporary cell data that is set/unset on tiles. -#ifdef CELL_NOSTACK - unsigned char *cell_bl; //Holds amount of bls in any given cell. -#endif - struct block_list **block; - struct block_list **block_mob; - int m; - short xs,ys; // map dimensions (in cells) - short bxs,bys; // map dimensions (in blocks) - int npc_num; - int users; - struct map_flag { - unsigned nomemo : 1; - unsigned noteleport : 1; - unsigned noreturn : 1; - unsigned monster_noteleport : 1; - unsigned nosave : 1; - unsigned nobranch : 1; - unsigned noexppenalty : 1; - unsigned pvp : 1; - unsigned pvp_noparty : 1; - unsigned pvp_noguild : 1; - unsigned pvp_nightmaredrop :1; - unsigned pvp_nocalcrank : 1; - unsigned gvg_castle : 1; - unsigned gvg : 1; // Now it identifies gvg versus maps that are active 24/7 - unsigned gvg_dungeon : 1; // Celest - unsigned gvg_noparty : 1; - unsigned nozenypenalty : 1; - unsigned notrade : 1; - unsigned noskill : 1; - unsigned nowarp : 1; - unsigned nowarpto : 1; - unsigned noicewall : 1; // [Valaris] - unsigned snow : 1; // [Valaris] - unsigned clouds : 1; - unsigned clouds2 : 1; // [Valaris] - unsigned fog : 1; // [Valaris] - unsigned fireworks : 1; - unsigned sakura : 1; // [Valaris] - unsigned leaves : 1; // [Valaris] - unsigned rain : 1; // [Valaris] - unsigned indoors : 1; // celest - unsigned nogo : 1; // [Valaris] - unsigned nobaseexp : 1; // [Lorky] added by Lupus - unsigned nojobexp : 1; // [Lorky] - unsigned nomobloot : 1; // [Lorky] - unsigned nomvploot : 1; // [Lorky] - unsigned nightenabled :1; //For night display. [Skotlex] - unsigned restricted : 1; // [Komurka] - unsigned nodrop : 1; - unsigned novending : 1; - unsigned loadevent : 1; - unsigned nochat :1; - unsigned partylock :1; - unsigned guildlock :1; - } flag; - struct point save; - struct npc_data *npc[MAX_NPC_PER_MAP]; - struct { - int drop_id; - int drop_type; - int drop_per; - } drop_list[MAX_DROP_PER_MAP]; - - struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer] - int mob_delete_timer; // [Skotlex] - int zone; // zone number (for item/skill restrictions) - int jexp; // map experience multiplicator - int bexp; // map experience multiplicator - int nocommand; //Blocks @/# commands for non-gms. [Skotlex] -}; - -/// Stores information about a remote map (for multi-mapserver setups). -/// Beginning of data structure matches 'map_data', to allow typecasting. -struct map_data_other_server { - char name[MAP_NAME_LENGTH]; - unsigned short index; //Index is the map index used by the mapindex* functions. - unsigned char *gat; // If this is NULL, the map is not on this map-server - uint32 ip; - uint16 port; -}; - struct flooritem_data { struct block_list bl; unsigned char subx,suby; @@ -1207,15 +1120,17 @@ enum _look { * map_getcell()で使用されるフラグ */ typedef enum { - CELL_CHKWALL=0, // 壁(セルタイプ1) + CELL_GETTYPE, // セルタイプを返す + + CELL_CHKWALL, // 壁(セルタイプ1) CELL_CHKWATER, // 水場(セルタイプ3) - CELL_CHKGROUND, // 地面障害物(セルタイプ5) + CELL_CHKCLIFF, // 地面障害物(セルタイプ5) + CELL_CHKPASS, // 通過可能(セルタイプ1,5以外) CELL_CHKREACH, // Same as PASS, but ignores the cell-stacking mod. CELL_CHKNOPASS, // 通過不可(セルタイプ1,5) CELL_CHKNOREACH, // Same as NOPASS, but ignores the cell-stacking mod. - CELL_GETTYPE, // セルタイプを返す - CELL_GETCELLTYPE, + CELL_CHKNPC=0x10, // タッチタイプのNPC(セルタイプ0x80フラグ) CELL_CHKREGEN, // cells that improve regeneration CELL_CHKPNEUMA, @@ -1226,6 +1141,7 @@ typedef enum { CELL_CHKSTACK, CELL_CHKNOVENDING, } cell_t; + // map_setcell()で使用されるフラグ enum { CELL_SETNPC=0x10, // タッチタイプのNPCをセット @@ -1245,6 +1161,113 @@ enum { CELL_CLRNOVENDING, }; +struct mapcell +{ + // terrain flags + unsigned char + walkable : 1, + shootable : 1, + water : 1; + + // dynamic flags + unsigned char + npc : 1, + regen : 1, + pneuma : 1, + safetywall : 1, + landprotector : 1, + basilica : 1, + icewall : 1, + novending : 1; + +#ifdef CELL_NOSTACK + unsigned char cell_bl; //Holds amount of bls in this cell. +#endif +}; + +struct map_data { + char name[MAP_NAME_LENGTH]; + unsigned short 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; + int m; + short xs,ys; // map dimensions (in cells) + short bxs,bys; // map dimensions (in blocks) + int npc_num; + int users; + struct map_flag { + unsigned nomemo : 1; + unsigned noteleport : 1; + unsigned noreturn : 1; + unsigned monster_noteleport : 1; + unsigned nosave : 1; + unsigned nobranch : 1; + unsigned noexppenalty : 1; + unsigned pvp : 1; + unsigned pvp_noparty : 1; + unsigned pvp_noguild : 1; + unsigned pvp_nightmaredrop :1; + unsigned pvp_nocalcrank : 1; + unsigned gvg_castle : 1; + unsigned gvg : 1; // Now it identifies gvg versus maps that are active 24/7 + unsigned gvg_dungeon : 1; // Celest + unsigned gvg_noparty : 1; + unsigned nozenypenalty : 1; + unsigned notrade : 1; + unsigned noskill : 1; + unsigned nowarp : 1; + unsigned nowarpto : 1; + unsigned noicewall : 1; // [Valaris] + unsigned snow : 1; // [Valaris] + unsigned clouds : 1; + unsigned clouds2 : 1; // [Valaris] + unsigned fog : 1; // [Valaris] + unsigned fireworks : 1; + unsigned sakura : 1; // [Valaris] + unsigned leaves : 1; // [Valaris] + unsigned rain : 1; // [Valaris] + unsigned indoors : 1; // celest + unsigned nogo : 1; // [Valaris] + unsigned nobaseexp : 1; // [Lorky] added by Lupus + unsigned nojobexp : 1; // [Lorky] + unsigned nomobloot : 1; // [Lorky] + unsigned nomvploot : 1; // [Lorky] + unsigned nightenabled :1; //For night display. [Skotlex] + unsigned restricted : 1; // [Komurka] + unsigned nodrop : 1; + unsigned novending : 1; + unsigned loadevent : 1; + unsigned nochat :1; + unsigned partylock :1; + unsigned guildlock :1; + } flag; + struct point save; + struct npc_data *npc[MAX_NPC_PER_MAP]; + struct { + int drop_id; + int drop_type; + int drop_per; + } drop_list[MAX_DROP_PER_MAP]; + + struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer] + int mob_delete_timer; // [Skotlex] + int zone; // zone number (for item/skill restrictions) + int jexp; // map experience multiplicator + int bexp; // map experience multiplicator + int nocommand; //Blocks @/# commands for non-gms. [Skotlex] +}; + +/// Stores information about a remote map (for multi-mapserver setups). +/// Beginning of data structure matches 'map_data', to allow typecasting. +struct map_data_other_server { + char name[MAP_NAME_LENGTH]; + unsigned short index; //Index is the map index used by the mapindex* functions. + struct mapcell* cell; // If this is NULL, the map is not on this map-server + uint32 ip; + uint16 port; +}; + extern struct map_data map[]; extern int map_num; extern int autosave_interval; |