From 417a9ab25eb346be8ae383bf521b213e19fe0ac2 Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 15 Dec 2015 20:09:59 +0100 Subject: Added const qualifier to the w1~w4 arguments of npc_parse_function Signed-off-by: Haru --- src/map/npc.c | 29 ++++++++++++++++++++++++++--- src/map/npc.h | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.c b/src/map/npc.c index c74038272..8bc874615 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3562,9 +3562,32 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c return 0; } -/// Parses a function. -/// function%TAB%script%TAB%%TAB%{} -const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int *retval) { +/** + * Parses a function. + * + * Example: + * @code + * functionscript{ + * + * } + * @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_function(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) +{ DBMap* func_db; DBData old_data; struct script_code *scriptroot; diff --git a/src/map/npc.h b/src/map/npc.h index 00b9c4d3c..969f77f3d 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -254,7 +254,7 @@ struct npc_interface { void (*setdisplayname) (struct npc_data *nd, const char *newname); void (*setclass) (struct npc_data *nd, short class_); int (*do_atcmd_event) (struct map_session_data *sd, const char *command, const char *message, const char *eventname); - const char* (*parse_function) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval); + const char *(*parse_function) (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_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) (const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval); -- cgit v1.2.3-60-g2f50