diff options
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 38 |
1 files changed, 32 insertions, 6 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; |