summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-15 19:58:38 +0100
committerHaru <haru@dotalux.com>2015-12-15 20:21:28 +0100
commitc3aeb496b7016ce85f55da938d1939fa330d1c60 (patch)
treecf8adf4b480b32d60257c59f4b4ca053385e95f5
parent0c4b3b1c57a8e75f1b13456fb60de3a69e680f45 (diff)
downloadhercules-c3aeb496b7016ce85f55da938d1939fa330d1c60.tar.gz
hercules-c3aeb496b7016ce85f55da938d1939fa330d1c60.tar.bz2
hercules-c3aeb496b7016ce85f55da938d1939fa330d1c60.tar.xz
hercules-c3aeb496b7016ce85f55da938d1939fa330d1c60.zip
Added const qualifier to the w1~w4 arguments of npc_parse_script
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/npc.c38
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/script.h2
3 files changed, 34 insertions, 8 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 1912235b8..0dad88212 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2922,12 +2922,38 @@ const char* npc_skip_script(const char* start, const char* buffer, const char* f
return p+1;// return after the last '}'
}
-/// Parses a npc script.
-///
-/// -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
-/// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
-/// <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
-const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int options, int *retval)
+/**
+ * Parses a NPC script.
+ *
+ * Example:
+ * @code
+ * -<TAB>script<TAB><NPC Name><TAB>-1,{
+ * <code>
+ * }
+ * <map name>,<x>,<y>,<facing><TAB>script<TAB><NPC Name><TAB><sprite id>,{
+ * <code>
+ * }
+ * <map name>,<x>,<y>,<facing><TAB>script<TAB><NPC Name><TAB><sprite id>,<triggerX>,<triggerY>,{
+ * <code>
+ * }
+ * @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[in] options NPC parse/load options (@see enum npc_parse_options).
+ * @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_script(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int options, int *retval)
{
int x, y, dir = 0, m, xs = 0, ys = 0; // [Valaris] thanks to fov
struct script_code *scriptroot;
diff --git a/src/map/npc.h b/src/map/npc.h
index 9f8767877..cdf33962b 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -239,7 +239,7 @@ struct npc_interface {
const char* (*parse_unknown_object) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
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);
+ const char *(*parse_script) (const char *w1, const char *w2, const char *w3, const 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);
diff --git a/src/map/script.h b/src/map/script.h
index b153cf81a..d4a3d8db2 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -596,7 +596,7 @@ struct script_interface {
FILE *lang_export_fp;
char *lang_export_file;/* for lang_export_fp */
/* set and unset on npc_parse_script */
- char *parser_current_npc_name;
+ const char *parser_current_npc_name;
/* */
int buildin_mes_offset;
int buildin_select_offset;