summaryrefslogtreecommitdiff
path: root/src/map/map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/map.h')
-rw-r--r--src/map/map.h110
1 files changed, 77 insertions, 33 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 3a7990dcb..270931689 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -2,8 +2,8 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#ifndef _MAP_H_
-#define _MAP_H_
+#ifndef _MAP_MAP_H_
+#define _MAP_MAP_H_
#include "../common/cbasetypes.h"
#include "../common/core.h" // CORE_ST_LAST
@@ -26,7 +26,7 @@ enum E_MAPSERVER_ST {
};
#define MAX_NPC_PER_MAP 512
-#define AREA_SIZE battle_config.area_size
+#define AREA_SIZE (battle_config.area_size)
#define DAMAGELOG_SIZE 30
#define LOOTITEM_SIZE 10
#define MAX_MOBSKILL 50
@@ -39,7 +39,7 @@ enum E_MAPSERVER_ST {
#define MAX_LEVEL 150
#define MAX_IGNORE_LIST 20 // official is 14
#define MAX_VENDING 12
-#define MAX_MAP_SIZE 512*512 // Wasn't there something like this already? Can't find it.. [Shinryo]
+#define MAX_MAP_SIZE (512*512) // Wasn't there something like this already? Can't find it.. [Shinryo]
#define BLOCK_SIZE 8
#define block_free_max 1048576
@@ -221,7 +221,7 @@ enum {
#define CHAT_SIZE_MAX (255 + 1)
// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 )
-#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
+#define DEFAULT_AUTOSAVE_INTERVAL (5*60*1000)
// Specifies maps where players may hit each other
#define map_flag_vs(m) (map->list[m].flag.pvp || map->list[m].flag.gvg_dungeon || map->list[m].flag.gvg || ((map->agit_flag || map->agit2_flag) && map->list[m].flag.gvg_castle) || map->list[m].flag.battleground)
// Specifies maps that have special GvG/WoE restrictions
@@ -339,7 +339,7 @@ struct flooritem_data {
unsigned char subx,suby;
int cleartimer;
int first_get_charid,second_get_charid,third_get_charid;
- unsigned int first_get_tick,second_get_tick,third_get_tick;
+ int64 first_get_tick,second_get_tick,third_get_tick;
struct item item_data;
};
@@ -360,6 +360,9 @@ enum _sp {
SP_KILLEDRID=122,
SP_SLOTCHANGE=123,
SP_CHARRENAME=124,
+ SP_MOD_EXP=125,
+ SP_MOD_DROP=126,
+ SP_MOD_DEATH=127,
// Mercenaries
SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190,
@@ -406,7 +409,11 @@ enum _sp {
SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, //2041-2045
SP_EMATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2049
SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054
- SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST //2055-2058
+ SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST, //2055-2058
+
+
+ /* must be the last, plugins add bonuses from this value onwards */
+ SP_LAST_KNOWN,
};
enum _look {
@@ -436,7 +443,6 @@ typedef enum {
CELL_LANDPROTECTOR,
CELL_NOVENDING,
CELL_NOCHAT,
- CELL_MAELSTROM,
CELL_ICEWALL,
} cell_t;
@@ -460,7 +466,6 @@ typedef enum {
CELL_CHKLANDPROTECTOR,
CELL_CHKNOVENDING,
CELL_CHKNOCHAT,
- CELL_CHKMAELSTROM,
CELL_CHKICEWALL,
} cell_chk;
@@ -479,7 +484,6 @@ struct mapcell {
landprotector : 1,
novending : 1,
nochat : 1,
- maelstrom : 1,
icewall : 1;
#ifdef CELL_NOSTACK
@@ -524,7 +528,7 @@ struct map_zone_skill_damage_cap_entry {
enum map_zone_skill_subtype subtype;
};
-#define MAP_ZONE_NAME_LENGTH 30
+#define MAP_ZONE_NAME_LENGTH 60
#define MAP_ZONE_ALL_NAME "All"
#define MAP_ZONE_NORMAL_NAME "Normal"
#define MAP_ZONE_PVP_NAME "PvP"
@@ -545,6 +549,9 @@ struct map_zone_data {
int disabled_commands_count;
struct map_zone_skill_damage_cap_entry **capped_skills;
int capped_skills_count;
+ struct {
+ unsigned int special : 2;/* 1: whether this is a mergeable zone; 2: whether it is a merged zone */
+ } info;
};
struct map_drop_list {
@@ -553,6 +560,17 @@ struct map_drop_list {
int drop_per;
};
+
+struct questinfo {
+ struct npc_data *nd;
+ unsigned short icon;
+ unsigned char color;
+ int quest_id;
+ bool hasJob;
+ unsigned short job;/* perhaps a mapid mask would be most flexible? */
+};
+
+
struct map_data {
char name[MAP_NAME_LENGTH];
uint16 index; // The map index used by the mapindex* functions.
@@ -628,6 +646,7 @@ struct map_data {
unsigned chsysnolocalaj : 1;
unsigned noknockback : 1;
unsigned notomb : 1;
+ unsigned nocashshop : 1;
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
@@ -686,6 +705,17 @@ struct map_data {
int (*getcellp)(struct map_data* m,int16 x,int16 y,cell_chk cellchk);
void (*setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag);
char *cellPos;
+
+ /* ShowEvent Data Cache */
+ struct questinfo *qi_data;
+ unsigned short qi_count;
+
+ /* speeds up clif_updatestatus processing by causing hpmeter to run only when someone with the permission can view it */
+ unsigned short hpmeter_visible;
+
+ /* HPM Custom Struct */
+ struct HPluginData **hdata;
+ unsigned int hdatac;
};
/// Stores information about a remote map (for multi-mapserver setups).
@@ -698,7 +728,7 @@ struct map_data_other_server {
uint16 port;
};
-#define map_id2index(id) map->list[(id)].index
+#define map_id2index(id) (map->list[(id)].index)
/// Bitfield of flags for the iterator.
enum e_mapitflags {
@@ -721,11 +751,11 @@ struct mapit_interface {
struct mapit_interface *mapit;
-#define mapit_getallusers() mapit->alloc(MAPIT_NORMAL,BL_PC)
-#define mapit_geteachpc() mapit->alloc(MAPIT_NORMAL,BL_PC)
-#define mapit_geteachmob() mapit->alloc(MAPIT_NORMAL,BL_MOB)
-#define mapit_geteachnpc() mapit->alloc(MAPIT_NORMAL,BL_NPC)
-#define mapit_geteachiddb() mapit->alloc(MAPIT_NORMAL,BL_ALL)
+#define mapit_getallusers() (mapit->alloc(MAPIT_NORMAL,BL_PC))
+#define mapit_geteachpc() (mapit->alloc(MAPIT_NORMAL,BL_PC))
+#define mapit_geteachmob() (mapit->alloc(MAPIT_NORMAL,BL_MOB))
+#define mapit_geteachnpc() (mapit->alloc(MAPIT_NORMAL,BL_NPC))
+#define mapit_geteachiddb() (mapit->alloc(MAPIT_NORMAL,BL_ALL))
//Useful typedefs from jA [Skotlex]
typedef struct map_session_data TBL_PC;
@@ -774,6 +804,7 @@ struct map_cache_map_info {
struct map_interface {
/* vars */
+ bool minimal;
int count;
int autosave_interval;
@@ -812,6 +843,8 @@ struct map_interface {
char mob_skill_db_db[32];
char mob_skill_db2_db[32];
char interreg_db[32];
+ char autotrade_merchants_db[32];
+ char autotrade_data_db[32];
char default_codepage[32];
@@ -825,8 +858,8 @@ struct map_interface {
int port;
int users;
int enable_grf; //To enable/disable reading maps from GRF files, bypassing mapcache [blackhole89]
- int ip_set;
- int char_ip_set;
+ bool ip_set;
+ bool char_ip_set;
int16 index2mapid[MAX_MAPINDEX];
/* */
@@ -842,18 +875,25 @@ struct map_interface {
DBMap* iwall_db;
/* order respected by map_defaults() in order to zero */
/* from block_free until zone_pk */
- struct block_list *block_free[block_free_max];
- int block_free_count, block_free_lock;
- struct block_list *bl_list[BL_LIST_MAX];
- int bl_list_count;
+ struct block_list **block_free;
+ int block_free_count, block_free_lock, block_free_list_size;
+ struct block_list **bl_list;
+ int bl_list_count, bl_list_size;
struct block_list bl_head;
struct map_zone_data zone_all;/* used as a base on all maps */
struct map_zone_data zone_pk;/* used for (pk_mode) */
+ /* */
struct map_session_data *cpsd;
struct map_data *list;
/* [Ind/Hercules] */
struct eri *iterator_ers;
char *cache_buffer; // Has the uncompressed gat data of all maps, so just one allocation has to be made
+ /* */
+ struct eri *flooritem_ers;
+ /* */
+ int bonus_id;
+ /* */
+ bool cpsd_active;
/* funcs */
void (*zone_init) (void);
void (*zone_remove) (int m);
@@ -876,7 +916,7 @@ struct map_interface {
// blocklist manipulation
int (*addblock) (struct block_list* bl);
int (*delblock) (struct block_list* bl);
- int (*moveblock) (struct block_list *bl, int x1, int y1, unsigned int tick);
+ int (*moveblock) (struct block_list *bl, int x1, int y1, int64 tick);
//blocklist nb in one cell
int (*count_oncell) (int16 m,int16 x,int16 y,int type);
struct skill_unit * (*find_skill_unit_oncell) (struct block_list* target,int16 x,int16 y,uint16 skill_id,struct skill_unit* out_unit, int flag);
@@ -888,8 +928,8 @@ struct map_interface {
// npc
bool (*addnpc) (int16 m,struct npc_data *nd);
// map item
- int (*clearflooritem_timer) (int tid, unsigned int tick, int id, intptr_t data);
- int (*removemobs_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*clearflooritem_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*removemobs_timer) (int tid, int64 tick, int id, intptr_t data);
void (*clearflooritem) (struct block_list* bl);
int (*addflooritem) (struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
// player to map session
@@ -939,11 +979,11 @@ struct map_interface {
struct chat_data* (*id2cd) (int id);
struct block_list * (*id2bl) (int id);
bool (*blid_exists) (int id);
- int16 (*mapindex2mapid) (unsigned short mapindex);
+ int16 (*mapindex2mapid) (unsigned short map_index);
int16 (*mapname2mapid) (const char* name);
int (*mapname2ipport) (unsigned short name, uint32* ip, uint16* port);
- int (*setipport) (unsigned short mapindex, uint32 ip, uint16 port);
- int (*eraseipport) (unsigned short mapindex, uint32 ip, uint16 port);
+ int (*setipport) (unsigned short map_index, uint32 ip, uint16 port);
+ int (*eraseipport) (unsigned short map_index, uint32 ip, uint16 port);
int (*eraseallipport) (void);
void (*addiddb) (struct block_list *bl);
void (*deliddb) (struct block_list *bl);
@@ -977,7 +1017,7 @@ struct map_interface {
void (*do_shutdown) (void);
- int (*freeblock_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*freeblock_timer) (int tid, int64 tick, int id, intptr_t data);
int (*searchrandfreecell) (int16 m, int16 *x, int16 *y, int stack);
int (*count_sub) (struct block_list *bl, va_list ap);
DBData (*create_charid2nick) (DBKey key, va_list args);
@@ -993,7 +1033,7 @@ struct map_interface {
int (*eraseallipport_sub) (DBKey key, DBData *data, va_list va);
char* (*init_mapcache) (FILE *fp);
int (*readfromcache) (struct map_data *m, char *buffer);
- int (*addmap) (char *mapname);
+ int (*addmap) (const char *mapname);
void (*delmapid) (int id);
void (*zone_db_clear) (void);
void (*list_final) (void);
@@ -1017,13 +1057,17 @@ struct map_interface {
int (*abort_sub) (struct map_session_data *sd, va_list ap);
void (*helpscreen) (bool do_exit);
void (*versionscreen) (bool do_exit);
- bool (*arg_next_value) (const char *option, int i, int argc);
+ bool (*arg_next_value) (const char *option, int i, int argc, bool must);
void (*addblcell) (struct block_list *bl);
void (*delblcell) (struct block_list *bl);
+ int (*get_new_bonus_id) (void);
+ void (*add_questinfo) (int m, struct questinfo *qi);
+ bool (*remove_questinfo) (int m, struct npc_data *nd);
+ struct map_zone_data *(*merge_zone) (struct map_zone_data *main, struct map_zone_data *other);
};
struct map_interface *map;
void map_defaults(void);
-#endif /* _MAP_H_ */
+#endif /* _MAP_MAP_H_ */