From fb81d0b823587870c3ac0ac07285671f904f6cd5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 12 Jul 2016 20:39:18 +0200 Subject: DIRECTOR: Lingo: Better error handling for 'the' entities --- engines/director/lingo/lingo-the.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index e2f63aab31..00af1dd6e8 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -195,10 +195,12 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) { void Lingo::setTheSprite(Datum &id1, int field, Datum &d) { int id = 0; - if (id1.type == INT) + if (id1.type == INT) { id = id1.u.i; - else + } else { warning("Unknown the sprite id type: %s", id1.type2str()); + return; + } d.toInt(); // Enforce Integer @@ -264,6 +266,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) { break; default: warning("Unprocessed getting field %d of entity %d", field, entity); + d.type = VOID; } return d; @@ -273,10 +276,12 @@ Datum Lingo::getTheSprite(Datum &id1, int field) { Datum d; int id = 0; - if (id1.type == INT) + if (id1.type == INT) { id = id1.u.i; - else + } else { warning("Unknown the sprite id type: %s", id1.type2str()); + return d; + } if (!_vm->_currentScore) { warning("The sprite %d field %d setting over non-active score", id, field); @@ -317,6 +322,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) { break; default: warning("Unprocessed getting field %d of sprite", field); + d.type = VOID; } return d; @@ -326,10 +332,12 @@ Datum Lingo::getTheCast(Datum &id1, int field) { Datum d; int id = 0; - if (id1.type == INT) + if (id1.type == INT) { id = id1.u.i; - else + } else { warning("Unknown the cast id type: %s", id1.type2str()); + return d; + } if (!_vm->_currentScore) { warning("The cast %d field %d setting over non-active score", id, field); @@ -391,17 +399,22 @@ Datum Lingo::getTheCast(Datum &id1, int field) { break; default: warning("Unprocessed getting field %d of cast %d", field, id); + d.type = VOID; //TODO find out about String fields } + + return d; } void Lingo::setTheCast(Datum &id1, int field, Datum &d) { int id = 0; - if (id1.type == INT) + if (id1.type == INT) { id = id1.u.i; - else + } else { warning("Unknown the cast id type: %s", id1.type2str()); + return; + } if (!_vm->_currentScore) { warning("The cast %d field %d setting over non-active score", id, field); -- cgit v1.2.3