diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-08-07 13:17:23 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-08-07 13:24:41 -0700 |
commit | 05f8f9d4f74aab05f507ec8e08a56f27ba9c2c8e (patch) | |
tree | 7e97f49ea8fb8799c8e5566239e89118886cfabb | |
parent | 3a4b4ceabb509770ea37e0f9b372126ffcebed75 (diff) | |
download | tmwa-05f8f9d4f74aab05f507ec8e08a56f27ba9c2c8e.tar.gz tmwa-05f8f9d4f74aab05f507ec8e08a56f27ba9c2c8e.tar.bz2 tmwa-05f8f9d4f74aab05f507ec8e08a56f27ba9c2c8e.tar.xz tmwa-05f8f9d4f74aab05f507ec8e08a56f27ba9c2c8e.zip |
Fix a refactoring bug in mob_db parsing, give better errors
-rw-r--r-- | src/map/mob.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/map/mob.cpp b/src/map/mob.cpp index a2122d6..ebd336f 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -3415,13 +3415,13 @@ int mob_readdb(void) { int mob_class; - if (line.startswith("//")) + if (!line || line.startswith("//")) continue; struct mob_db_ mdbv {}; XString ignore; - extract(line, record<','>( + bool okay = extract(line, record<','>( &mob_class, lstripping(&mdbv.name), lstripping(&mdbv.jname), @@ -3482,8 +3482,11 @@ int mob_readdb(void) ) ); - if (mob_class <= 1000 || mob_class > 2000) + if (!okay || mob_class <= 1000 || mob_class > 2000) + { + PRINTF("bad mob line: %s\n", line); continue; + } // TODO move this lower mob_db[mob_class] = std::move(mdbv); |