From 09f08f55feee1c4368348693cf812a73d56e8fc9 Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 15 Dec 2015 20:05:57 +0100 Subject: Added const qualifier to the w1~w4 arguments of npc_parse_duplicate Signed-off-by: Haru --- src/map/npc.c | 45 +++++++++++++++++++++++++++++++++++++-------- src/map/npc.h | 2 +- 2 files changed, 38 insertions(+), 9 deletions(-) (limited to 'src/map') diff --git a/src/map/npc.c b/src/map/npc.c index 0dad88212..c74038272 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3207,14 +3207,43 @@ bool npc_duplicate_sub(struct npc_data *nd, const struct npc_data *snd, int xs, return false; } -/// Duplicate a warp, shop, cashshop or script. [Orcao] -/// warp: ,,,%TAB%duplicate()%TAB%%TAB%, -/// shop/cashshop/npc: -%TAB%duplicate()%TAB%%TAB% -/// shop/cashshop/npc: ,,,%TAB%duplicate()%TAB%%TAB% -/// npc: -%TAB%duplicate()%TAB%%TAB%,, -/// npc: ,,,%TAB%duplicate()%TAB%%TAB%,, -/// !!Only NPO_ONINIT is available trough options!! -const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath, int options, int *retval) { +/** + * Parses a duplicate warp, shop, cashshop or script NPC. [Orcao] + * + * Example: + * @code + * warp: + * ,,,duplicate(), + * shop/cashshop/npc: + * -duplicate() + * shop/cashshop/npc: + * ,,,duplicate() + * npc: + * -duplicate(),, + * npc: + * ,,,duplicate(),, + * @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. + * + * @remark + * Only `NPO_ONINIT` is available trough the options argument. + */ +const char *npc_parse_duplicate(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, m, xs = -1, ys = -1; char srcname[128]; const char *end; diff --git a/src/map/npc.h b/src/map/npc.h index cdf33962b..00b9c4d3c 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -245,7 +245,7 @@ struct npc_interface { 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); + const char *(*parse_duplicate) (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 (*duplicate4instance) (struct npc_data *snd, int16 m); void (*setcells) (struct npc_data *nd); int (*unsetcells_sub) (struct block_list *bl, va_list ap); -- cgit v1.2.3-60-g2f50