From 8b20d3d67bcec592999376ca0cb3d3dede4d6789 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Jul 2016 20:58:05 +0200 Subject: DIRECTOR: Lingo: Distinguish same name the fields for different the entities --- engines/director/lingo/lingo-lex.cpp | 14 +++++++------- engines/director/lingo/lingo-lex.l | 12 ++++++------ engines/director/lingo/lingo-the.cpp | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index fabac3f287..b40ca07fcb 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -1088,10 +1088,6 @@ YY_RULE_SETUP while (*ptr != ' ' && *ptr != '\t') field += *ptr++; - if (!g_lingo->_theEntityFields.contains(field)) { - error("Unhandled the field %s", ptr); - } - while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -1101,6 +1097,12 @@ YY_RULE_SETUP ptr++; if (g_lingo->_theEntities.contains(ptr)) { + field = Common::String::format("%d%s", g_lingo->_theEntities[ptr]->entity, field.c_str()); + + if (!g_lingo->_theEntityFields.contains(field)) { + error("Unhandled the field %s", ptr); + } + if (g_lingo->_theEntityFields[field]->entity != g_lingo->_theEntities[ptr]->entity) error("Unsupported field '%s' for entity '%s'", field.c_str(), ptr); @@ -1118,7 +1120,7 @@ YY_RULE_SETUP YY_BREAK case 32: YY_RULE_SETUP -#line 131 "engines/director/lingo/lingo-lex.l" +#line 133 "engines/director/lingo/lingo-lex.l" { count(); @@ -1134,8 +1136,6 @@ YY_RULE_SETUP return THEENTITYWITHID; else return THEENTITY; - } else if (g_lingo->_theEntityFields.contains(ptr)) { - error("the field without entity: %s", ptr); } error("Unhandled the entity %s", ptr); diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 4739d20d86..9113ac39ee 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -101,10 +101,6 @@ whitespace [\t ] while (*ptr != ' ' && *ptr != '\t') field += *ptr++; - if (!g_lingo->_theEntityFields.contains(field)) { - error("Unhandled the field %s", ptr); - } - while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -114,6 +110,12 @@ whitespace [\t ] ptr++; if (g_lingo->_theEntities.contains(ptr)) { + field = Common::String::format("%d%s", g_lingo->_theEntities[ptr]->entity, field.c_str()); + + if (!g_lingo->_theEntityFields.contains(field)) { + error("Unhandled the field %s", ptr); + } + if (g_lingo->_theEntityFields[field]->entity != g_lingo->_theEntities[ptr]->entity) error("Unsupported field '%s' for entity '%s'", field.c_str(), ptr); @@ -143,8 +145,6 @@ whitespace [\t ] return THEENTITYWITHID; else return THEENTITY; - } else if (g_lingo->_theEntityFields.contains(ptr)) { - error("the field without entity: %s", ptr); } error("Unhandled the entity %s", ptr); diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index 00af1dd6e8..b2e412f76f 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -168,7 +168,7 @@ void Lingo::initTheEntities() { TheEntityField *f = fields; while (f->entity != kTheNOEntity) { - _theEntityFields[f->name] = f; + _theEntityFields[Common::String::format("%d%s", f->entity, f->name)] = f; f++; } } -- cgit v1.2.3