Skip to content

Commit

Permalink
GLK: ADVSYS: Fix inputs with indirect objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jun 17, 2019
1 parent 0bf2dc6 commit fee7221
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions engines/glk/advsys/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ bool VM::parseInput() {
preposition = *_wordPtr++;

// Get the indirect object
noun2 = _adjectiveList.size();
noun2 = _adjectiveList.size() + 1;
for (;;) {
// Get the indirect object
if (!getNoun())
Expand Down Expand Up @@ -615,10 +615,15 @@ uint VM::getNoun() {
_adjectiveList.push_back(AdjectiveEntry());
assert(_adjectiveList.size() <= 20);

if (_wordPtr == _words.end() || getWordType(*_wordPtr) != WT_NOUN) {
parseError();
return NIL;
}

// Add a noun entry to the list
Noun n;
n._adjective = &_adjectiveList[alStart];
n._noun = (_wordPtr == _words.end()) ? 0 : *_wordPtr++;
n._noun = *_wordPtr++;
n._num = _wordPtr - _words.begin() - 1;
_nouns.push_back(n);

Expand Down

0 comments on commit fee7221

Please sign in to comment.