aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/glk/archetype/parser.cpp35
-rw-r--r--engines/glk/archetype/sys_object.cpp9
-rw-r--r--engines/glk/archetype/token.cpp9
3 files changed, 23 insertions, 30 deletions
diff --git a/engines/glk/archetype/parser.cpp b/engines/glk/archetype/parser.cpp
index 8c1c47c6f5..4867cbb7f2 100644
--- a/engines/glk/archetype/parser.cpp
+++ b/engines/glk/archetype/parser.cpp
@@ -67,8 +67,7 @@ void normalize_string(const String &first, String &second) {
j = 0;
in_word = false;
second = second + " ";
- }
- else {
+ } else {
++i;
}
@@ -102,24 +101,25 @@ void add_parse_word(TargetListType which_list, String &the_word, int the_object)
the_word += '|';
- do {
+ for (;;) {
bar = the_word.indexOf('|');
- if (bar != -1) {
- pp = new ParseType();
- tempstr = the_word.left(bar - 1).left(g_vm->Abbreviate);
+ if (bar == -1)
+ break;
- pp->word = NewConstStr(tempstr);
- pp->word->toLowercase();
- the_word = String(the_word.c_str() + bar + 1);
- pp->object = the_object;
+ pp = new ParseType();
+ tempstr = the_word.left(bar).left(g_vm->Abbreviate);
- np = new NodeType();
- np->key = pp->word->size();
- np->data = pp;
+ pp->word = NewConstStr(tempstr);
+ pp->word->toLowercase();
+ the_word = String(the_word.c_str() + bar + 1);
+ pp->object = the_object;
- insert_item(the_list, np);
- }
- } while (bar != 0);
+ np = new NodeType();
+ np->key = pp->word->size();
+ np->data = pp;
+
+ insert_item(the_list, np);
+ }
}
static void parse_sentence_substitute(int start, ParsePtr pp, int &next_starting) {
@@ -235,8 +235,7 @@ bool pop_object(int &intback, String &strback) {
// parsed object
intback = ((int)g_vm->Command[1] << 8) | ((int)g_vm->Command[2]);
g_vm->Command.del(0, 4);
- }
- else {
+ } else {
intback = -1;
i = g_vm->Command.indexOf('%');
if (i < 0)
diff --git a/engines/glk/archetype/sys_object.cpp b/engines/glk/archetype/sys_object.cpp
index ebbe88202c..761d14ef60 100644
--- a/engines/glk/archetype/sys_object.cpp
+++ b/engines/glk/archetype/sys_object.cpp
@@ -127,8 +127,7 @@ void send_to_system(int transport, String &strmsg, ResultType &result, ContextTy
if (convert_to(NUMERIC, result)) {
g_vm->Abbreviate = result._data._numeric.acl_int;
- }
- else {
+ } else {
wraperr("Warning: non-numeric abbreviation message sent to system");
cleanup(result);
}
@@ -155,8 +154,7 @@ void send_to_system(int transport, String &strmsg, ResultType &result, ContextTy
default:
break;
}
- }
- else {
+ } else {
add_parse_word(target_list, strmsg, the_caller);
}
@@ -273,8 +271,7 @@ void send_to_system(int transport, String &strmsg, ResultType &result, ContextTy
if (stfile == nullptr) {
g_vm->writeln("Error opening %s", strmsg.c_str());
cleanup(result);
- }
- else {
+ } else {
save_game_state(stfile, g_vm->Object_List);
result._kind = RESERVED;
result._data._reserved.keyword = RW_TRUE;
diff --git a/engines/glk/archetype/token.cpp b/engines/glk/archetype/token.cpp
index 9d550a56d5..060dd1d79e 100644
--- a/engines/glk/archetype/token.cpp
+++ b/engines/glk/archetype/token.cpp
@@ -188,8 +188,7 @@ bool get_token(progfile &f) {
case ';':
if (!f.newlines) {
state = START;
- }
- else {
+ } else {
f.ttype = NEWLINE;
f.tnum = (int)NEWLINE_CH;
state = STOP;
@@ -379,8 +378,7 @@ void write_token(AclType the_type, int the_number) {
case IDENT:
if (the_number < 0) {
g_vm->write("an identifier");
- }
- else {
+ } else {
g_vm->write("<identifier %d >: ", the_number);
if (index_ident(the_number, the_id_ptr))
g_vm->write("\"%s\"", the_id_ptr->id_name);
@@ -411,8 +409,7 @@ void write_token(AclType the_type, int the_number) {
else if (index_xarray(g_vm->Literals, the_number, p)) {
str_ptr = (StringPtr)p;
g_vm->write("\"%s\"", str_ptr->c_str());
- }
- else {
+ } else {
g_vm->write("<text literal %d >: ", the_number);
}
break;