From 8084989605853dd23e265a1f649e36611bdbfd99 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 9 Jul 2016 17:11:33 +0200 Subject: DIRECTOR: Lingo: Implemented chars() function and added more debug for type printing --- engines/director/lingo/lingo.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'engines/director/lingo/lingo.cpp') diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index fec6b645ea..9ec89ff0af 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -188,7 +188,7 @@ int Datum::toInt() { type = INT; break; default: - warning("Incorrect operation toInt() for type: %d", type); + warning("Incorrect operation toInt() for type: %s", type2str()); } return u.i; @@ -204,7 +204,7 @@ float Datum::toFloat() { // no-op break; default: - warning("Incorrect operation toFloat() for type: %d", type); + warning("Incorrect operation toFloat() for type: %s", type2str()); } return u.f; @@ -223,7 +223,7 @@ Common::String *Datum::toString() { delete s; s = u.s; default: - warning("Incorrect operation toInt() for type: %d", type); + warning("Incorrect operation toInt() for type: %s", type2str()); } u.s = s; @@ -232,4 +232,22 @@ Common::String *Datum::toString() { return u.s; } +const char *Datum::type2str() { + static char res[20]; + + switch (type) { + case INT: + return "INT"; + case FLOAT: + return "FLOAT"; + case STRING: + return "STRING"; + case CASTREF: + return "CASTREF"; + default: + snprintf(res, 20, "-- (%d) --", type); + return res; + } +} + } // End of namespace Director -- cgit v1.2.3