Page 1 of 1

Game won't terminate

Posted: Fri Aug 10, 2012 3:33 pm
by Bainespal
It's about time that I ask for help with a bug in T&S that I've always known about but have no leads on. When the game ends, if the player selects "Q" to quit, the game simply goes back into normal execution. You can then re-do the action that trigged the ending, and win (or die) over and over again:
*** YOU’VE WON THE GAME! ***

The game has ended. Do you want to (R)ESTART, R(E)STORE a saved game, (U)NDO your last turn, or (Q)UIT? q

>q
Are you sure you want to quit (YES or NO)? y
I assume that the problem has to be with the endflag variable, but I have no way to prove it. I tried watching endflag in the Debugger, but the watch window always shows "endflag = 0" even when the "YOU'VE WON..." message is being displayed and the interpreter is waiting for one of the options to be selected.

In the code, I trigger the endings with the EndGlag routine, like this:

Code: Select all

Endgame(1)

Posted: Sat Aug 11, 2012 1:13 am
by Roody_Yogurt
As http://hugo.gerynarsabode.org/index.php?title=EndGame points out, EndGame is just one of those unintuitive things. You never should call it yourself. The engine calls it automatically when you change the endflag global.

Wherever you have EndGame(1), you should just have:

Code: Select all

endflag = 1

Posted: Sat Aug 11, 2012 6:12 am
by Bainespal
That's the opposite of what I had been assuming. I thought using the routine would be the better, more "official" method. But anyways, I'm glad it's a simple fix!