diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-16 10:59:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-27 11:23:03 +0300 |
commit | 5eca1fc09e4f93c1138382983a29cab300ba3fd3 (patch) | |
tree | d9d5b39f1cfaf5640cf7f50ba20819ca8dc40c17 /src/map | |
parent | 1e81c48a5e13f0a0b0a94d93f40fdfda529acd61 (diff) | |
download | hercules-5eca1fc09e4f93c1138382983a29cab300ba3fd3.tar.gz hercules-5eca1fc09e4f93c1138382983a29cab300ba3fd3.tar.bz2 hercules-5eca1fc09e4f93c1138382983a29cab300ba3fd3.tar.xz hercules-5eca1fc09e4f93c1138382983a29cab300ba3fd3.zip |
Add function for parse/report unknown map flag.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/npc.c | 12 | ||||
-rw-r--r-- | src/map/npc.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index ce668bfae..7f373f7f3 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3606,6 +3606,14 @@ const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const char* st return strchr(start,'\n');// continue } + +void npc_parse_unknown_mapflag(const char *name, char *w3, char *w4, const char* start, const char* buffer, const char* filepath, int *retval) +{ + ShowError("npc_parse_mapflag: unrecognized mapflag '%s' in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer)); + if (retval) + *retval = EXIT_FAILURE; +} + /*========================================== * Set or disable mapflag on map * eg : bat_c01<TAB>mapflag<TAB>battleground<TAB>2 @@ -4013,8 +4021,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char } else if ( !strcmpi(w3,"nocashshop") ) { map->list[m].flag.nocashshop = (state) ? 1 : 0; } else { - ShowError("npc_parse_mapflag: unrecognized mapflag '%s' in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer)); - if (retval) *retval = EXIT_FAILURE; + npc->parse_unknown_mapflag(mapname, w3, w4, start, buffer, filepath, retval); } return strchr(start,'\n');// continue @@ -4682,6 +4689,7 @@ void npc_defaults(void) { npc->parse_mob2 = npc_parse_mob2; npc->parse_mob = npc_parse_mob; npc->parse_mapflag = npc_parse_mapflag; + npc->parse_unknown_mapflag = npc_parse_unknown_mapflag; npc->parsesrcfile = npc_parsesrcfile; npc->script_event = npc_script_event; npc->read_event_script = npc_read_event_script; diff --git a/src/map/npc.h b/src/map/npc.h index 9c497ffe9..efd787677 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -250,6 +250,7 @@ struct npc_interface { 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) (char *w1, char *w2, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval); + void (*parse_unknown_mapflag) (const char *name, char *w3, char *w4, const char *start, const char *buffer, const char *filepath, int *retval); int (*parsesrcfile) (const char *filepath, bool runOnInit); int (*script_event) (struct map_session_data *sd, enum npce_event type); void (*read_event_script) (void); |