aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan2/main.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-19 20:38:48 -0700
committerPaul Gilbert2019-06-22 14:40:49 -0700
commitdf7465232108c15ca613db0b5e709e34378dbd8c (patch)
treed8c9167360cb13ed4e3ed15aa72189484d0aadad /engines/glk/alan2/main.cpp
parentb4ae2ec4374a8f920fa3287b6906e09c6c68f57f (diff)
downloadscummvm-rg350-df7465232108c15ca613db0b5e709e34378dbd8c.tar.gz
scummvm-rg350-df7465232108c15ca613db0b5e709e34378dbd8c.tar.bz2
scummvm-rg350-df7465232108c15ca613db0b5e709e34378dbd8c.zip
GLK: ALAN2: Added shouldQuit checks to break out of game loops
Diffstat (limited to 'engines/glk/alan2/main.cpp')
-rw-r--r--engines/glk/alan2/main.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/engines/glk/alan2/main.cpp b/engines/glk/alan2/main.cpp
index a508041f7d..63ab5456f9 100644
--- a/engines/glk/alan2/main.cpp
+++ b/engines/glk/alan2/main.cpp
@@ -1763,7 +1763,9 @@ static void movactor()
cur.loc = where(cur.act);
if (cur.act == HERO) {
parse();
- fail = FALSE; /* fail only aborts one actor */
+ if (g_vm->shouldQuit())
+ return;
+ fail = FALSE; /* fail only aborts one actor */
rules();
} else if (act->script != 0) {
for (scr = (ScrElem *) addrTo(act->scradr); !endOfTable(scr); scr++)
@@ -1902,30 +1904,33 @@ static void openFiles()
*/
void run() {
- openFiles();
+ openFiles();
- // Set default line and column
- col = lin = 1;
+ // Set default line and column
+ col = lin = 1;
- //setjmp(restart_label); /* Return here if he wanted to restart */
+ //setjmp(restart_label); /* Return here if he wanted to restart */
- init(); /* Load, initialise and start the adventure */
+ init(); /* Load, initialise and start the adventure */
- while (TRUE) {
+ while (TRUE) {
#ifdef MALLOC
- if (malloc_verify() == 0) syserr("Error in heap.");
+ if (malloc_verify() == 0) syserr("Error in heap.");
#endif
- if (dbgflg)
- debug();
+ if (dbgflg)
+ debug();
- eventchk();
- cur.tick++;
-// (void) setjmp(jmpbuf);
+ eventchk();
+ cur.tick++;
+ // (void) setjmp(jmpbuf);
- /* Move all characters */
- for (cur.act = ACTMIN; cur.act <= ACTMAX; cur.act++)
- movactor();
- }
+ // Move all characters
+ for (cur.act = ACTMIN; cur.act <= ACTMAX; cur.act++) {
+ movactor();
+ if (g_vm->shouldQuit())
+ return;
+ }
+ }
}
} // End of namespace Alan2