From 5e72064190a81df3ab6eeff7dcaa0bcdf9aa4d91 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 22 Apr 2014 18:23:02 -0700 Subject: Fix parsing of comments in const db --- src/map/script.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/map') 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; } -- cgit v1.2.3-60-g2f50