[Scummvm-git-logs] scummvm master -> f9f1293de6ca2b8438f9cfa3f25a96241c417834
dreammaster
paulfgilbert at gmail.com
Sat Jun 15 22:36:08 CEST 2019
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5f7955daa5 GLK: ADVSYS: Tweak debug line, added input line prompt character
f7e389db3b GLK: ADVSYS: Fix parsing input words
f9f1293de6 GLK: ADVSYS: Input line processing fixes
Commit: 5f7955daa547fbc1c65280c753b90ffccb4b677c
https://github.com/scummvm/scummvm/commit/5f7955daa547fbc1c65280c753b90ffccb4b677c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-06-14T20:22:34-07:00
Commit Message:
GLK: ADVSYS: Tweak debug line, added input line prompt character
Changed paths:
engines/glk/advsys/glk_interface.cpp
engines/glk/advsys/vm.cpp
diff --git a/engines/glk/advsys/glk_interface.cpp b/engines/glk/advsys/glk_interface.cpp
index be164f2..3ec2d33 100644
--- a/engines/glk/advsys/glk_interface.cpp
+++ b/engines/glk/advsys/glk_interface.cpp
@@ -43,6 +43,7 @@ Common::String GlkInterface::readLine() {
event_t ev;
char line[200];
+ print(": ");
glk_request_line_event(_window, line, 199, 0);
do {
diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp
index b1ba7a0..95e1cec 100644
--- a/engines/glk/advsys/vm.cpp
+++ b/engines/glk/advsys/vm.cpp
@@ -109,7 +109,7 @@ void VM::executeOpcode() {
if (gDebugLevel > 0) {
Common::String s;
for (int idx = (int)_stack.size() - 1; idx >= 0; --idx) s += Common::String::format(" %d", _stack[idx]);
- debug("%.4x - %.2x - %d%s", _pc - 1, opcode, _stack.size(), s.c_str());
+ debugC(kDebugScripts, "%.4x - %.2x - %d%s", _pc - 1, opcode, _stack.size(), s.c_str());
}
if (opcode >= OP_BRT && opcode <= OP_VOWEL) {
Commit: f7e389db3b6625f2fa4d978b9b591e32e40ff2ff
https://github.com/scummvm/scummvm/commit/f7e389db3b6625f2fa4d978b9b591e32e40ff2ff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-06-14T21:40:07-07:00
Commit Message:
GLK: ADVSYS: Fix parsing input words
Changed paths:
engines/glk/advsys/glk_interface.cpp
engines/glk/advsys/vm.cpp
diff --git a/engines/glk/advsys/glk_interface.cpp b/engines/glk/advsys/glk_interface.cpp
index 3ec2d33..01abd2f 100644
--- a/engines/glk/advsys/glk_interface.cpp
+++ b/engines/glk/advsys/glk_interface.cpp
@@ -50,12 +50,13 @@ Common::String GlkInterface::readLine() {
glk_select(&ev);
if (ev.type == evtype_Quit)
return "";
- else if (ev.type == evtype_LineInput)
- break;
+ else if (ev.type == evtype_LineInput) {
+ line[ev.val1] = '\0';
+ return Common::String(line);
+ }
} while (!shouldQuit() && ev.type != evtype_Quit);
- line[199] = '\0';
- return Common::String(line);
+ return "";
}
} // End of namespace AdvSys
diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp
index 95e1cec..a2ce0f2 100644
--- a/engines/glk/advsys/vm.cpp
+++ b/engines/glk/advsys/vm.cpp
@@ -590,11 +590,11 @@ bool VM::getWord(Common::String &line) {
if (iw._number) {
_words.push_back(iw);
- return false;
+ return true;
} else {
Common::String msg = Common::String::format(_("I don't know the word \"%s\".\n"), iw._text.c_str());
print(msg);
- return true;
+ return false;
}
}
Commit: f9f1293de6ca2b8438f9cfa3f25a96241c417834
https://github.com/scummvm/scummvm/commit/f9f1293de6ca2b8438f9cfa3f25a96241c417834
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-06-15T13:35:58-07:00
Commit Message:
GLK: ADVSYS: Input line processing fixes
Changed paths:
engines/glk/advsys/game.cpp
engines/glk/advsys/vm.cpp
diff --git a/engines/glk/advsys/game.cpp b/engines/glk/advsys/game.cpp
index ea8bac9..3b6133d 100644
--- a/engines/glk/advsys/game.cpp
+++ b/engines/glk/advsys/game.cpp
@@ -243,7 +243,7 @@ int Game::getObjectLocation(int obj) const {
}
int Game::getActionLocation(int action) const {
- if (action < 1 || action >= _actionCount)
+ if (action < 1 || action > _actionCount)
error("Invalid action number %d", action);
return READ_LE_UINT16(_actionTable + action * 2);
@@ -297,18 +297,16 @@ bool Game::hasVerb(int act, const Common::Array<int> &verbs) const {
Common::Array<int>::const_iterator verb = verbs.begin();
int word = readWord(link + L_DATA);
- for (; verb < verbs.end() && word; link = readWord(link + L_NEXT)) {
+ for (; verb < verbs.end() && word; ++verb, word = readWord(word + L_NEXT)) {
if (*verb != readWord(word + L_DATA))
break;
-
- ++verb;
}
if (verb == verbs.end() && !word)
return true;
}
- return true;
+ return false;
}
bool Game::inList(int link, int word) const {
diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp
index a2ce0f2..8c6072c 100644
--- a/engines/glk/advsys/vm.cpp
+++ b/engines/glk/advsys/vm.cpp
@@ -444,8 +444,9 @@ bool VM::parseInput() {
// Initialize the parser result fields
_actor = _action = _dObject = _iObject = 0;
_ndObjects = 0;
- _adjectiveList.clear();
_nouns.clear();
+ _adjectiveList.clear();
+ _adjectiveList.reserve(20);
// Get the input line
if (!getLine())
@@ -460,7 +461,7 @@ bool VM::parseInput() {
}
// Check for a verb
- if (getVerb())
+ if (!getVerb())
return false;
// Get direct object, preposition, and/or indirect object
@@ -517,8 +518,7 @@ bool VM::parseInput() {
_dObject = noun1;
_ndObjects = cnt1;
_iObject = noun2;
- }
- else if (noun2) {
+ } else if (noun2) {
if (cnt1 > 1) {
parseError();
return false;
@@ -540,7 +540,7 @@ bool VM::parseInput() {
flags |= A_IOBJECT;
// Find the action
- if (!(_action == findAction(_verbs, preposition, flags))) {
+ if (!(_action = findAction(_verbs, preposition, flags))) {
parseError();
return false;
}
@@ -612,6 +612,7 @@ uint VM::getNoun() {
_adjectiveList.push_back(ae);
}
_adjectiveList.push_back(AdjectiveEntry());
+ assert(_adjectiveList.size() <= 20);
// Add a noun entry to the list
Noun n;
@@ -626,7 +627,7 @@ uint VM::getNoun() {
bool VM::getVerb() {
_verbs.clear();
- if (*_wordPtr == NIL || getWordType(*_wordPtr) != WT_VERB) {
+ if (_wordPtr == _words.end() || getWordType(*_wordPtr) != WT_VERB) {
parseError();
return false;
}
@@ -634,8 +635,8 @@ bool VM::getVerb() {
_verbs.push_back(*_wordPtr++);
// Check for a word following the verb
- if (!_words.empty()) {
- _verbs.push_back(_words.front());
+ if (_wordPtr < _words.end()) {
+ _verbs.push_back(*_wordPtr);
if (checkVerb(_verbs)) {
++_wordPtr;
More information about the Scummvm-git-logs
mailing list