diff options
Diffstat (limited to 'src/map/npc.h')
-rw-r--r-- | src/map/npc.h | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/src/map/npc.h b/src/map/npc.h index bf3d1494d..d5e4618a1 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -70,7 +70,7 @@ struct npc_data { unsigned short stat_point; struct npc_parse *chatdb; - char* path;/* path dir */ + const char *path; ///< Source path reference enum npc_subtype subtype; int src_id; union { @@ -109,8 +109,10 @@ struct npc_data { #define START_NPC_NUM 110000000 enum actor_classes { + FAKE_NPC = -1, WARP_CLASS = 45, HIDDEN_WARP_CLASS = 139, + MOB_TOMB = 565, WARP_DEBUG_CLASS = 722, FLAG_CLASS = 722, INVISIBLE_CLASS = 32767, @@ -120,7 +122,7 @@ enum actor_classes { #define MAX_NPC_CLASS 1000 // New NPC range #define MAX_NPC_CLASS2_START 10001 -#define MAX_NPC_CLASS2_END 10110 +#define MAX_NPC_CLASS2_END 10174 //Script NPC events. enum npce_event { @@ -225,10 +227,12 @@ struct npc_interface { void (*clearsrcfile) (void); void (*addsrcfile) (const char *name); void (*delsrcfile) (const char *name); + const char *(*retainpathreference) (const char *filepath); + void (*releasepathreference) (const char *filepath); void (*parsename) (struct npc_data *nd, const char *name, const char *start, const char *buffer, const char *filepath); int (*parseview) (const char *w4, const char *start, const char *buffer, const char *filepath); bool (*viewisid) (const char *viewid); - struct npc_data* (*create_npc) (int m, int x, int y); + struct npc_data *(*create_npc) (enum npc_subtype subtype, int m, int x, int y, uint8 dir, int16 class_); struct npc_data* (*add_warp) (char *name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y); const char* (*parse_warp) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval); const char* (*parse_shop) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval); @@ -236,6 +240,11 @@ struct npc_interface { void (*convertlabel_db) (struct npc_label_list *label_list, const char *filepath); const char* (*skip_script) (const char *start, const char *buffer, const char *filepath, int *retval); const char* (*parse_script) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int options, int *retval); + void (*add_to_location) (struct npc_data *nd); + bool (*duplicate_script_sub) (struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options); + bool (*duplicate_shop_sub) (struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options); + bool (*duplicate_warp_sub) (struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options); + bool (*duplicate_sub) (struct npc_data *nd, const struct npc_data *snd, int xs, int ys, int options); const char* (*parse_duplicate) (char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int options, int *retval); int (*duplicate4instance) (struct npc_data *snd, int16 m); void (*setcells) (struct npc_data *nd); @@ -286,32 +295,51 @@ HPShared struct npc_interface *npc; /* comes from npc_chat.c */ #ifdef PCRE_SUPPORT #include <pcre/include/pcre.h> -/* Structure containing all info associated with a single pattern block */ +#endif // PCRE_SUPPORT + +/** + * Structure containing all info associated with a single pattern block + */ struct pcrematch_entry { +#ifdef PCRE_SUPPORT struct pcrematch_entry* next; char* pattern; pcre* pcre_; pcre_extra* pcre_extra_; char* label; +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; -/* A set of patterns that can be activated and deactived with a single command */ +/** + * A set of patterns that can be activated and deactived with a single command + */ struct pcrematch_set { +#ifdef PCRE_SUPPORT struct pcrematch_set* prev; struct pcrematch_set* next; struct pcrematch_entry* head; int setid; +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; -/* +/** * Entire data structure hung off a NPC */ struct npc_parse { +#ifdef PCRE_SUPPORT struct pcrematch_set* active; struct pcrematch_set* inactive; +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; struct npc_chat_interface { +#ifdef PCRE_SUPPORT int (*sub) (struct block_list* bl, va_list ap); void (*finalize) (struct npc_data* nd); void (*def_pattern) (struct npc_data* nd, int setid, const char* pattern, const char* label); @@ -321,6 +349,9 @@ struct npc_chat_interface { void (*activate_pcreset) (struct npc_data* nd, int setid); struct pcrematch_set* (*lookup_pcreset) (struct npc_data* nd, int setid); void (*finalize_pcrematch_entry) (struct pcrematch_entry* e); +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; /** @@ -329,6 +360,7 @@ struct npc_chat_interface { * should be moved into core/perhaps its own file once hpm is enhanced for login/char **/ struct pcre_interface { +#ifdef PCRE_SUPPORT pcre *(*compile) (const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr); pcre_extra *(*study) (const pcre *code, int options, const char **errptr); int (*exec) (const pcre *code, const pcre_extra *extra, PCRE_SPTR subject, int length, int startoffset, int options, int *ovector, int ovecsize); @@ -337,6 +369,9 @@ struct pcre_interface { void (*free_substring) (const char *stringptr); int (*copy_named_substring) (const pcre *code, const char *subject, int *ovector, int stringcount, const char *stringname, char *buffer, int buffersize); int (*get_substring) (const char *subject, int *ovector, int stringcount, int stringnumber, const char **stringptr); +#else // not PCRE_SUPPORT + UNAVAILABLE_STRUCT; +#endif // PCRE_SUPPORT }; /** @@ -349,6 +384,4 @@ void npc_chat_defaults(void); HPShared struct npc_chat_interface *npc_chat; HPShared struct pcre_interface *libpcre; -#endif // PCRE_SUPPORT - #endif /* MAP_NPC_H */ |