[Scummvm-git-logs] scummvm master -> 67acfcccd6c8c629dd9c8ecd519196740598dbd1

dreammaster paulfgilbert at gmail.com
Sun May 12 04:56:52 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
67acfcccd6 GLK: HUGO: Fixes for startup and shutdown


Commit: 67acfcccd6c8c629dd9c8ecd519196740598dbd1
    https://github.com/scummvm/scummvm/commit/67acfcccd6c8c629dd9c8ecd519196740598dbd1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-05-12T12:35:29+10:00

Commit Message:
GLK: HUGO: Fixes for startup and shutdown

Changed paths:
    engines/glk/hugo/heglk.cpp
    engines/glk/hugo/hemisc.cpp
    engines/glk/hugo/herun.cpp
    engines/glk/hugo/hugo.cpp
    engines/glk/hugo/hugo.h


diff --git a/engines/glk/hugo/heglk.cpp b/engines/glk/hugo/heglk.cpp
index f6f4081..c4c3eec 100644
--- a/engines/glk/hugo/heglk.cpp
+++ b/engines/glk/hugo/heglk.cpp
@@ -61,8 +61,10 @@ void Hugo::hugo_getline(const char *prmpt) {
 	/* Request line input */
 	glk_request_line_event(currentwin, buffer, MAXBUFFER, 0);
 
-	while (!gotline)
-	{
+	while (!gotline) {
+		if (shouldQuit())
+			return;
+
 		/* Grab an event */
 		glk_select(&ev);
 
diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp
index 4115abe..03a62c5 100644
--- a/engines/glk/hugo/hemisc.cpp
+++ b/engines/glk/hugo/hemisc.cpp
@@ -1112,6 +1112,8 @@ void Hugo::LoadGame() {
 		if ((game = TrytoOpen(gamefile, "rb", "object"))==nullptr)
 			FatalError(OPEN_E);
 	}
+#else
+	game = &_gameFile;
 #endif
 
 	hugo_fseek(game, 0, SEEK_END);
@@ -1202,7 +1204,7 @@ void Hugo::LoadGame() {
 	/* Allocate as much memory as is required */
 	if ((!loaded_in_memory) || (mem = (unsigned char *)hugo_blockalloc(filelength))==nullptr)
 	{
-		loaded_in_memory = 0;
+		loaded_in_memory = false;
 		if ((mem = (unsigned char *)hugo_blockalloc(codeend))==nullptr)
 			FatalError(MEMORY_E);
 	}
diff --git a/engines/glk/hugo/herun.cpp b/engines/glk/hugo/herun.cpp
index 8a6d9cd..cb33ef9 100644
--- a/engines/glk/hugo/herun.cpp
+++ b/engines/glk/hugo/herun.cpp
@@ -299,6 +299,8 @@ FreshInput:
 							goto NormalTermination;
 						runaway_counter = 0;
 #endif
+						if (shouldQuit())
+							return;
 
 						SeparateWords();
 
diff --git a/engines/glk/hugo/hugo.cpp b/engines/glk/hugo/hugo.cpp
index 8d85c68..3435308 100644
--- a/engines/glk/hugo/hugo.cpp
+++ b/engines/glk/hugo/hugo.cpp
@@ -30,7 +30,7 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam
 		runtime_warnings(false), dbnest(0), address_scale(16),
 		SCREENWIDTH(0), SCREENHEIGHT(0), FIXEDCHARWIDTH(0), FIXEDLINEHEIGHT(0),
 		// heexpr
-		evalcount(0), incdec(0), getaddress(0), inexpr(0), inobj(0),
+		evalcount(0), incdec(0), getaddress(0), inexpr(0), inobj(0), last_precedence(0),
 		// hemedia
 		mchannel(nullptr), schannel(nullptr),
 		// hemisc
@@ -39,7 +39,7 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam
 		codestart(0), objtable(0), eventtable(0), proptable(0), arraytable(0), dicttable(0), 
 		syntable(0), initaddr(0), mainaddr(0), parseaddr(0), parseerroraddr(0), 
 		findobjectaddr(0), endgameaddr(0), speaktoaddr(0), performaddr(0), 
-		objects(0), events(0), dictcount(0), syncount(0), mem(nullptr), loaded_in_memory(0),
+		objects(0), events(0), dictcount(0), syncount(0), mem(nullptr), loaded_in_memory(true),
 		defseg(0), gameseg(0), codeptr(0), codeend(0), currentpos(0), currentline(0), full(0),
 		def_fcolor(0), def_bgcolor(0), def_slfcolor(0), def_slbgcolor(0), fcolor(0), bgcolor(0),
 		icolor(0), default_bgcolor(0), currentfont(0), capital(0), textto(0),
@@ -83,15 +83,15 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam
 	Common::fill(&var[0], &var[MAXLOCALS + MAXGLOBALS], 0);
 
 	// hemedia
-	Common::fill(&resids[0][0], &resids[2][MAXRES], 0);
+	Common::fill(&resids[0][0], &resids[2][0], 0);
 	numres[0] = numres[1] = 0;
 
 	// hemisc		
-	Common::fill(&context_command[0][0], &context_command[MAX_CONTEXT_COMMANDS][64], 0);
+	Common::fill(&context_command[0][0], &context_command[MAX_CONTEXT_COMMANDS][0], 0);
 	Common::fill(&id[0], &id[3], '\0');
 	Common::fill(&serial[0], &serial[9], '\0');
 	Common::fill(&pbuffer[0], &pbuffer[MAXBUFFER * 2 + 1], 0);
-	Common::fill(&undostack[0][0], &undostack[MAXUNDO][5], 0);
+	Common::fill(&undostack[0][0], &undostack[MAXUNDO][0], 0);
 	
 	// heparse
 	Common::fill(&buffer[0], &buffer[MAXBUFFER + MAXWORDS], '\0');
@@ -120,8 +120,8 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam
 	debug_line[0] = '\0';
 	Common::fill(&objectname[0], &objectname[MAX_OBJECT], (char *)nullptr);
 	Common::fill(&propertyname[0], &propertyname[MAX_PROPERTY], (char *)nullptr);
-	Common::fill(&codeline[0][0], &codeline[9][100], 0);
-	Common::fill(&localname[0][0], &localname[9][100], 0);
+	Common::fill(&codeline[0][0], &codeline[9][0], 0);
+	Common::fill(&localname[0][0], &localname[9][0], 0);
 	Common::fill(&code_history[0], &code_history[MAX_CODE_HISTORY], 0);
 	Common::fill(&dbnest_history[0], &dbnest_history[MAX_CODE_HISTORY], 0);
 #endif
diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h
index e49e313..400bc65 100644
--- a/engines/glk/hugo/hugo.h
+++ b/engines/glk/hugo/hugo.h
@@ -59,7 +59,6 @@ private:
 	char getaddress;					///< true when finding &routine
 	char inexpr;						///< true when in expression
 	char inobj;							///< true when in object compound
-
 	int last_precedence;
 
 	// hemedia
@@ -103,7 +102,7 @@ private:
 	char context_command[MAX_CONTEXT_COMMANDS][64];
 	int context_commands;
 	unsigned char *mem;
-	int loaded_in_memory;
+	bool loaded_in_memory;
 	unsigned int defseg;
 	unsigned int gameseg;
 	long codeptr;
@@ -243,7 +242,7 @@ private:
 	CALL call[MAXCALLS];
 	int routines;
 	int properties;
-	WINDOW window[99];
+	WINDOW window[9];
 	int codeline[9][100];
 	char localname[9][100];
 	int current_locals;
@@ -1017,7 +1016,7 @@ private:
 	*/
 
 	int hugo_fseek(Common::SeekableReadStream *s, long int offset, int whence) {
-		return s->seek(offset, whence);
+		return !s->seek(offset, whence);
 	}
 	int hugo_fseek(strid_t s, long int offset, int whence) {
 		Common::SeekableReadStream *rs = *s;





More information about the Scummvm-git-logs mailing list