summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-16 13:36:15 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-27 11:23:04 +0300
commitd59df7395f890f1b0e3322238726464980f0c4fd (patch)
treedd64a0b631280d893e31ea19fdb18fd370772b2e /src
parent5eca1fc09e4f93c1138382983a29cab300ba3fd3 (diff)
downloadhercules-d59df7395f890f1b0e3322238726464980f0c4fd.tar.gz
hercules-d59df7395f890f1b0e3322238726464980f0c4fd.tar.bz2
hercules-d59df7395f890f1b0e3322238726464980f0c4fd.tar.xz
hercules-d59df7395f890f1b0e3322238726464980f0c4fd.zip
Add function for parse or report about unknown object in parsing script file.
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c13
-rw-r--r--src/map/npc.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 7f373f7f3..3c3c5f605 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -4027,6 +4027,14 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
return strchr(start,'\n');// continue
}
+const char* npc_parse_unknown_object(char *w1, char *w2, char *w3, char *w4, const char* start, const char* buffer, const char* filepath, int *retval)
+{
+ ShowError("npc_parsesrcfile: Unable to parse, probably a missing or extra TAB in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
+ start = strchr(start,'\n');// skip and continue
+ *retval = EXIT_FAILURE;
+ return start;
+}
+
/**
* Parses a script file and creates NPCs/functions/mapflags/monsters/etc
* accordingly.
@@ -4215,9 +4223,7 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) {
}
else
{
- ShowError("npc_parsesrcfile: Unable to parse, probably a missing or extra TAB in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,p-buffer), w1, w2, w3, w4);
- p = strchr(p,'\n');// skip and continue
- success = EXIT_FAILURE;
+ p = npc_parse_unknown_object(w1, w2, w3, w4, p, buffer, filepath, &success);
}
}
aFree(buffer);
@@ -4691,6 +4697,7 @@ void npc_defaults(void) {
npc->parse_mapflag = npc_parse_mapflag;
npc->parse_unknown_mapflag = npc_parse_unknown_mapflag;
npc->parsesrcfile = npc_parsesrcfile;
+ npc->parse_unknown_object = npc_parse_unknown_object;
npc->script_event = npc_script_event;
npc->read_event_script = npc_read_event_script;
npc->path_db_clear_sub = npc_path_db_clear_sub;
diff --git a/src/map/npc.h b/src/map/npc.h
index efd787677..97ea7713a 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -234,6 +234,7 @@ struct npc_interface {
struct npc_data* (*add_warp) (char *name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y);
const char* (*parse_warp) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
const char* (*parse_shop) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval);
+ 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);