DIRECTOR: LINGO: Suppress var not found warnings

This commit is contained in:
djsrv 2020-07-20 11:47:47 -04:00
parent 7ae8fc0ff0
commit 5176a39a90
3 changed files with 5 additions and 4 deletions

View File

@ -1356,7 +1356,7 @@ void LC::call(const Common::String &name, int nargs, SymbolType bltinType) {
if (firstArg.lazy) { // first arg could be method name
Datum objName(name);
objName.type = VAR;
Datum obj = g_lingo->varFetch(objName);
Datum obj = g_lingo->varFetch(objName, false, nullptr, true);
if (obj.type == OBJECT && (obj.u.obj->getObjType() & (kFactoryObj | kXObj))) {
debugC(3, kDebugLingoExec, "Method called on object: <%s>", obj.asString(true).c_str());
AbstractObject *target = obj.u.obj;

View File

@ -1269,7 +1269,7 @@ void Lingo::varAssign(Datum &var, Datum &value, bool global, DatumHash *localvar
}
}
Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars) {
Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars, bool silent) {
if (localvars == nullptr) {
localvars = _localvars;
}
@ -1307,7 +1307,8 @@ Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars) {
return _globalvars[name];
}
warning("varFetch: variable %s not found", name.c_str());
if (!silent)
warning("varFetch: variable %s not found", name.c_str());
return result;
} else if (var.type == FIELDREF) {
CastMember *cast = _vm->getCurrentMovie()->getCastMember(var.u.i);

View File

@ -288,7 +288,7 @@ public:
void cleanLocalVars();
int castIdFetch(Datum &var);
void varAssign(Datum &var, Datum &value, bool global = false, DatumHash *localvars = nullptr);
Datum varFetch(Datum &var, bool global = false, DatumHash *localvars = nullptr);
Datum varFetch(Datum &var, bool global = false, DatumHash *localvars = nullptr, bool silent = false);
int getAlignedType(const Datum &d1, const Datum &d2);