diff options
author | Eugene Sandulenko | 2016-07-10 13:34:43 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 46138a2c9dc1fd333f40bee3e661dc83dff06e43 (patch) | |
tree | e40a0110bfeea498d1b639a5604f68b4024a22d4 /engines/director/lingo/lingo.cpp | |
parent | 1f0005c4e269ec8d9b848b85e40ab11d7d67a979 (diff) | |
download | scummvm-rg350-46138a2c9dc1fd333f40bee3e661dc83dff06e43.tar.gz scummvm-rg350-46138a2c9dc1fd333f40bee3e661dc83dff06e43.tar.bz2 scummvm-rg350-46138a2c9dc1fd333f40bee3e661dc83dff06e43.zip |
DIRECTOR: Lingo: Made addCode() accept const char *
Diffstat (limited to 'engines/director/lingo/lingo.cpp')
-rw-r--r-- | engines/director/lingo/lingo.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 26fdfc2edb..a7362d18b9 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -100,10 +100,10 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { Lingo::~Lingo() { } -void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { +void Lingo::addCode(const char *code, ScriptType type, uint16 id) { code += '\n'; - debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id); + debug(2, "Add code \"%s\" for type %d with id %d", code, type, id); if (_scripts[type].contains(id)) { delete _scripts[type][id]; @@ -115,15 +115,17 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { _linenumber = _colnumber = 1; + const char *begin, *end; + // macros have conflicting grammar. Thus we ease life for the parser. - if (code.contains("\nmacro ")) { - const char *begin = strstr(code.c_str(), "\nmacro ") + 1; - const char *end; + if ((begin = strstr(code, "\nmacro "))) { bool first = true; + begin += 1; + while ((end = strstr(begin, "\nmacro "))) { if (first) { - begin = code.c_str(); + begin = code; first = false; } Common::String chunk(begin, end); @@ -137,7 +139,7 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { parse(begin); } else { - parse(code.c_str()); + parse(code); code1(STOP); } |