diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-04-22 18:23:02 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-04-22 18:23:06 -0700 |
commit | 5e72064190a81df3ab6eeff7dcaa0bcdf9aa4d91 (patch) | |
tree | fcdf6c61847d8f779b83f56ae7ba1b1368b79085 | |
parent | 1cc5fee5904832da6564f12c858423fd5bd1b2b6 (diff) | |
download | tmwa-5e72064190a81df3ab6eeff7dcaa0bcdf9aa4d91.tar.gz tmwa-5e72064190a81df3ab6eeff7dcaa0bcdf9aa4d91.tar.bz2 tmwa-5e72064190a81df3ab6eeff7dcaa0bcdf9aa4d91.tar.xz tmwa-5e72064190a81df3ab6eeff7dcaa0bcdf9aa4d91.zip |
Fix parsing of comments in const db
-rw-r--r-- | src/map/script.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/map/script.cpp b/src/map/script.cpp index 7ee6306..f3713df 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -746,10 +746,14 @@ bool read_constdb(ZString filename) } bool rv = true; - AString line; - while (in.getline(line)) - { - if (is_comment(line)) + AString line_; + while (in.getline(line_)) + { + // is_comment only works for whole-line comments + // that could change once the Z dependency is dropped ... + LString comment = "//"_s; + XString line = line_.xislice_h(std::search(line_.begin(), line_.end(), comment.begin(), comment.end())).rstrip(); + if (!line) continue; // "%m[A-Za-z0-9_] %i %i" @@ -780,7 +784,7 @@ bool read_constdb(ZString filename) || !extract(val_, &val) || (!extract(type_, &type) && type_)) { - PRINTF("Bad const line: %s\n"_fmt, line); + PRINTF("Bad const line: %s\n"_fmt, line_); rv = false; continue; } |