From 38e5463601d7d8cb0687076adba488f8ea398d92 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Nov 2019 14:41:18 -0800 Subject: GLK: ARCHETYPE: Further cleanup and debug reroute --- engines/glk/archetype/archetype.cpp | 16 ++++++++++------ engines/glk/archetype/semantic.cpp | 12 ++++++------ engines/glk/archetype/wrap.cpp | 4 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'engines') diff --git a/engines/glk/archetype/archetype.cpp b/engines/glk/archetype/archetype.cpp index 572aea4012..8aeafa1172 100644 --- a/engines/glk/archetype/archetype.cpp +++ b/engines/glk/archetype/archetype.cpp @@ -245,7 +245,7 @@ void Archetype::lookup(int the_obj, int the_attr, ResultType &result, ContextTyp result._kind = ATTR_PTR; result._data._attr.acl_attr = np; } else { - // inherited - must create new node } + // inherited - must create new node result._kind = ATTR_PTR; result._data._attr.acl_attr = new NodeType(); @@ -264,6 +264,8 @@ void Archetype::lookup(int the_obj, int the_attr, ResultType &result, ContextTyp } } +static int scummvm = 0; + bool Archetype::send_message(int transport, int message_sent, int recipient, ResultType &result, ContextType &context) { bool done, find_other; @@ -280,6 +282,9 @@ bool Archetype::send_message(int transport, int message_sent, int recipient, } if (DebugMan.isDebugChannelEnabled(DEBUG_MSGS)) { + ++scummvm; + debugN(String::format("%d ", scummvm).c_str()); + r._kind = IDENT; r._data._ident.ident_kind = OBJECT_ID; r._data._ident.ident_int = context.self; @@ -347,8 +352,7 @@ bool Archetype::send_message(int transport, int message_sent, int recipient, op = original; find_other = true; } - } - else if (index_xarray(Type_List, op->inherited_from, p)) { + } else if (index_xarray(Type_List, op->inherited_from, p)) { op = (ObjectPtr)p; } else { wraperr("Internal error: invalid inheritance"); @@ -396,7 +400,7 @@ void Archetype::eval_expr(ExprTree the_expr, ResultType &result, ContextType &co if (the_expr->_data._reserved.keyword == RW_READ) result._data._str.acl_str = ReadLine(true); // read full line else - result._data._str.acl_str = ReadLine(false); // read single key + result._data._str.acl_str = ReadLine(false); // read single key Rows = 0; cursor_reset(); // user will have had to hit @@ -549,7 +553,7 @@ void Archetype::eval_expr(ExprTree the_expr, ResultType &result, ContextType &co // For the random operator, we must be careful: ? "01234" should select a random digit // out of that set, not attempt to convert it to 1234 and take a random number in the // range 1 - 1234. However, we can neither immediately convert it to string, because - // ? 6 should produce a value in the range 1 - 6, not the character "6". } + // ? 6 should produce a value in the range 1 - 6, not the character "6" case OP_RANDOM: eval_expr(the_expr->_data._oper.right, result, context, RVALUE); if (result._kind == NUMERIC) @@ -651,7 +655,7 @@ void Archetype::eval_expr(ExprTree the_expr, ResultType &result, ContextType &co if (convert_to(STR_PTR, r1) && convert_to(STR_PTR, r2)) { result._kind = NUMERIC; result._data._numeric.acl_int = r2._data._str.acl_str->indexOf(*r1._data._str.acl_str); - if (result._data._numeric.acl_int == -1) + if (result._data._numeric.acl_int == 0) cleanup(result); } break; diff --git a/engines/glk/archetype/semantic.cpp b/engines/glk/archetype/semantic.cpp index 5f84adeef7..c7ed368ece 100644 --- a/engines/glk/archetype/semantic.cpp +++ b/engines/glk/archetype/semantic.cpp @@ -145,21 +145,21 @@ bool display_undefined() { while (iterate_list(g_vm->Overlooked, np)) { if (!exists) { - g_vm->writeln("The following identifiers were not explicitly defined."); + debugN("The following identifiers were not explicitly defined."); exists = true; } ip = (IntegerPtr)np->data; - g_vm->write("Used %d", *ip); + debugN("Used %d", *ip); if (*ip == 1) - g_vm->write(" time: "); + debugN(" time: "); else - g_vm->write(" times: "); + debugN(" times: "); if (index_ident(np->key, id_rec)) - g_vm->writeln("%s", id_rec->id_name->c_str()); + debug("%s", id_rec->id_name->c_str()); else - g_vm->writeln(""); + debug(""); delete ip; } diff --git a/engines/glk/archetype/wrap.cpp b/engines/glk/archetype/wrap.cpp index 44fddb864b..ddc3850043 100644 --- a/engines/glk/archetype/wrap.cpp +++ b/engines/glk/archetype/wrap.cpp @@ -51,7 +51,7 @@ static void wrap_wait() { ch := ReadKey; write(chr(13)); NormVideo; - ClrScr; //or ClrEol if you don't want the whole screen } + ClrScr; // or ClrEol if you don't want the whole screen Rows : = 0 #endif } @@ -67,7 +67,7 @@ void wrapout(const String &str, bool terminate) { // 'thisline' starts out as the maximum number of characters that can be // written before a newline; it gets trimmed back to being the number of - // characters from the string that are actually written on this line. } + // characters from the string that are actually written on this line maxchars = MAXCOLS - cursor; const char CHARS[7] = { '.', ',', ':', ';', ')', '-', '"' }; -- cgit v1.2.3