Refactor main command loop to eliminate L2000.

This commit is contained in:
Eric S. Raymond 2017-06-12 09:42:43 -04:00
parent 1c4097314a
commit d85ef403af

17
main.c
View file

@ -712,7 +712,6 @@ static bool closecheck(void)
if (game.tally == 0 && INDEEP(game.loc) && game.loc != 33)
--game.clock1;
/* When the first warning comes, we lock the grate, destroy
* the bridge, kill all the dwarves (and the pirate), remove
* the troll and bear (unless dead), and set "closng" to
@ -888,6 +887,7 @@ static void listobjects(void)
}
static bool do_command(FILE *cmdin)
/* Get and execute a command */
{
long KQ, VERB, KK, V1, V2;
long i, k, KMOD;
@ -923,9 +923,7 @@ static bool do_command(FILE *cmdin)
/* Describe the current location and (maybe) get next command. */
/* Print text for current loc. */
L2000:
for (;;) {
if (game.loc == 0)
croak(cmdin);
char* msg = short_location_descriptions[game.loc];
@ -938,7 +936,7 @@ L2000:
RSPEAK(23);
game.oldlc2 = game.loc;
croak(cmdin);
goto L2000;
continue; /* back to top of main interpreter loop */
}
msg=arbitrary_messages[16];
}
@ -948,7 +946,7 @@ L2000:
if (playermove(cmdin, VERB, 1))
return true;
else
goto L2000;
continue; /* back to top of main interpreter loop */
}
if (game.loc == 33 && PCT(25) && !game.closng)RSPEAK(7);
@ -1061,7 +1059,7 @@ L2630:
if (playermove(cmdin, VERB, KMOD))
return true;
else
goto L2000;
continue; /* back to top of main interpreter loop */
case 1: part=unknown; obj = KMOD; break;
case 2: part=intransitive; VERB = KMOD; break;
case 3: RSPEAK(KMOD); goto L2012;
@ -1075,7 +1073,7 @@ Laction:
case 8:
playermove(cmdin, VERB, NUL);
return true;
case 2000: goto L2000;
case 2000: continue; /* back to top of main interpreter loop */
case 2012: goto L2012;
case 2600: goto L2600;
case 2607: goto L2607;
@ -1102,5 +1100,6 @@ Laction:
BUG(99);
}
}
}
/* EMD */
/* end */