summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-15 19:44:42 +0100
committerHaru <haru@dotalux.com>2015-12-15 20:21:28 +0100
commit6d6ee8c436aa37aaf0afa9e5873e5778234cef37 (patch)
tree154d9769d49e49a161cc15c93c13a063d2f3c04b
parenta2dcf96e55ca3fba3f9571464f4c38f7b35f5600 (diff)
downloadhercules-6d6ee8c436aa37aaf0afa9e5873e5778234cef37.tar.gz
hercules-6d6ee8c436aa37aaf0afa9e5873e5778234cef37.tar.bz2
hercules-6d6ee8c436aa37aaf0afa9e5873e5778234cef37.tar.xz
hercules-6d6ee8c436aa37aaf0afa9e5873e5778234cef37.zip
Added const qualifier to the w1~w4 arguments of npc_parse_mapflag
- This is necessary before merging #960 Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/npc.c42
-rw-r--r--src/map/npc.h4
2 files changed, 37 insertions, 9 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 3bd14bf41..be03d5ab5 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3705,19 +3705,47 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st
return strchr(start,'\n');// continue
}
-void npc_parse_unknown_mapflag(const char *name, char *w3, char *w4, const char* start, const char* buffer, const char* filepath, int *retval)
+/**
+ * Parses an unknown mapflag.
+ *
+ * The purpose of this function is to be an override or hooking point for plugins.
+ *
+ * @see npc_parse_mapflag
+ */
+void npc_parse_unknown_mapflag(const char *name, const char *w3, const char *w4, const char* start, const char* buffer, const char* filepath, int *retval)
{
ShowError("npc_parse_mapflag: unrecognized mapflag '%s' in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer));
if (retval)
*retval = EXIT_FAILURE;
}
-/*==========================================
- * Set or disable mapflag on map
- * eg : bat_c01<TAB>mapflag<TAB>battleground<TAB>2
- * also chking if mapflag conflict with another
- *------------------------------------------*/
-const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int *retval) {
+/**
+ * Parses a mapflag and sets or disables it on a map.
+ *
+ * @remark
+ * This also checks if the mapflag conflicts with another.
+ *
+ * Example:
+ * @code
+ * bat_c01<TAB>mapflag<TAB>battleground<TAB>2
+ * @endcode
+ *
+ * @param[in] w1 First tab-delimited part of the string to parse.
+ * @param[in] w2 Second tab-delimited part of the string to parse.
+ * @param[in] w3 Third tab-delimited part of the string to parse.
+ * @param[in] w4 Fourth tab-delimited part of the string to parse.
+ * @param[in] start Pointer to the beginning of the string inside buffer.
+ * This must point to the same buffer as `buffer`.
+ * @param[in] buffer Pointer to the buffer containing the script. For
+ * single-line mapflags not inside a script, this may be
+ * an empty (but initialized) single-character buffer.
+ * @param[in] filepath Source file path.
+ * @param[out] retval Pointer to return the success (EXIT_SUCCESS) or failure
+ * (EXIT_FAILURE) status. May be NULL.
+ * @return A pointer to the advanced buffer position.
+ */
+const char *npc_parse_mapflag(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval)
+{
int16 m;
char mapname[32];
int state = 1;
diff --git a/src/map/npc.h b/src/map/npc.h
index d5e4618a1..3d046008b 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -257,8 +257,8 @@ struct npc_interface {
const char* (*parse_function) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
void (*parse_mob2) (struct spawn_data *mobspawn);
const char* (*parse_mob) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
- const char* (*parse_mapflag) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
- void (*parse_unknown_mapflag) (const char *name, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
+ const char *(*parse_mapflag) (const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
+ void (*parse_unknown_mapflag) (const char *name, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
int (*parsesrcfile) (const char *filepath, bool runOnInit);
int (*script_event) (struct map_session_data *sd, enum npce_event type);
void (*read_event_script) (void);