aboutsummaryrefslogtreecommitdiff
path: root/engines/gargoyle
diff options
context:
space:
mode:
authorPaul Gilbert2018-10-17 20:15:05 -0700
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit9c6aca1d5790e0c09dca8313e138f4744b4f9130 (patch)
treef2b776d5509efcc6bc12f2f134497e8e646ce836 /engines/gargoyle
parent22648145a91ae42ed0e1ab69b1dc9ad564e9fd1d (diff)
downloadscummvm-rg350-9c6aca1d5790e0c09dca8313e138f4744b4f9130.tar.gz
scummvm-rg350-9c6aca1d5790e0c09dca8313e138f4744b4f9130.tar.bz2
scummvm-rg350-9c6aca1d5790e0c09dca8313e138f4744b4f9130.zip
GLK: SCOTT: Minor stream and event loop fixes
Diffstat (limited to 'engines/gargoyle')
-rw-r--r--engines/gargoyle/scott/scott.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/engines/gargoyle/scott/scott.cpp b/engines/gargoyle/scott/scott.cpp
index 02096c6f27..42a9088b21 100644
--- a/engines/gargoyle/scott/scott.cpp
+++ b/engines/gargoyle/scott/scott.cpp
@@ -211,10 +211,9 @@ void Scott::Delay(int seconds) {
glk_request_timer_events(1000 * seconds);
- do
- {
+ do {
glk_select(&ev);
- } while (ev.type != evtype_Timer);
+ } while (ev.type != evtype_Timer && ev.type != evtype_Quit);
glk_request_timer_events(0);
}
@@ -283,8 +282,7 @@ int Scott::MatchUpItem(const char *text, int loc) {
return -1;
}
-char *Scott::ReadString(Common::SeekableReadStream *f)
-{
+char *Scott::ReadString(Common::SeekableReadStream *f) {
char tmp[1024];
char *t;
int c, nc;
@@ -296,12 +294,12 @@ char *Scott::ReadString(Common::SeekableReadStream *f)
Fatal("Initial quote expected");
}
- do {
- c = f->readByte();
- if (c == EOF)
+ for (;;) {
+ if (f->pos() >= f->size())
Fatal("EOF in string");
- if (c == '"')
- {
+
+ c = f->readByte();
+ if (c == '"') {
nc = f->readByte();
if (nc != '"') {
f->seek(-1, SEEK_CUR);