diff options
Diffstat (limited to 'engines/glk/archetype')
-rw-r--r-- | engines/glk/archetype/archetype.cpp | 2 | ||||
-rw-r--r-- | engines/glk/archetype/array.cpp | 6 | ||||
-rw-r--r-- | engines/glk/archetype/interpreter.cpp | 4 | ||||
-rw-r--r-- | engines/glk/archetype/wrap.cpp | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/engines/glk/archetype/archetype.cpp b/engines/glk/archetype/archetype.cpp index 78ba906d3c..4f388da521 100644 --- a/engines/glk/archetype/archetype.cpp +++ b/engines/glk/archetype/archetype.cpp @@ -274,7 +274,7 @@ bool Archetype::send_message(int transport, int message_sent, int recipient, void *p; ContextType c; - if (message_sent == -1) { + if (message_sent == 0) { cleanup(result); return false; } diff --git a/engines/glk/archetype/array.cpp b/engines/glk/archetype/array.cpp index b816306fc3..79a486faf1 100644 --- a/engines/glk/archetype/array.cpp +++ b/engines/glk/archetype/array.cpp @@ -38,15 +38,15 @@ void append_to_xarray(XArrayType &the_xarray, void *element) { } bool access_xarray(XArrayType &the_xarray, int index, void *&result, AccessType direction) { - if (index < 0 || index >= (int)the_xarray.size()) + if (index < 1 || index > (int)the_xarray.size()) return false; switch (direction) { case PEEK_ACCESS: - result = the_xarray[index]; + result = the_xarray[index - 1]; break; case POKE_ACCESS: - the_xarray[index] = result; + the_xarray[index - 1] = result; break; } diff --git a/engines/glk/archetype/interpreter.cpp b/engines/glk/archetype/interpreter.cpp index 21f732b827..3beca744a5 100644 --- a/engines/glk/archetype/interpreter.cpp +++ b/engines/glk/archetype/interpreter.cpp @@ -43,14 +43,14 @@ StringPtr MakeNewDynStr(const String &s) { int find_message(const String &message) { void *p; - for (uint i = 0; i < g_vm->Vocabulary.size(); ++i) { + for (uint i = 1; i <= g_vm->Vocabulary.size(); ++i) { if (!index_xarray(g_vm->Vocabulary, i, p)) g_vm->writeln("Internal error - cannot index element %d of Vocabulary", i); else if (message == *((StringPtr)p)) return i; } - return -1; + return 0; } bool convert_to(AclType target_type, ResultType &the_scalar) { diff --git a/engines/glk/archetype/wrap.cpp b/engines/glk/archetype/wrap.cpp index 6ef961f0d3..44fddb864b 100644 --- a/engines/glk/archetype/wrap.cpp +++ b/engines/glk/archetype/wrap.cpp @@ -72,7 +72,7 @@ void wrapout(const String &str, bool terminate) { const char CHARS[7] = { '.', ',', ':', ';', ')', '-', '"' }; for (int i = 0; i < 7; ++i) { - if (s[0] == CHARS[i]) { + if (!s.empty() && s[0] == CHARS[i]) { maxchars += SAFETY_MARGIN; break; } |