More goto elimination.

This commit is contained in:
Eric S. Raymond 2017-06-11 08:33:30 -04:00
parent 3c78ff879b
commit 0dcd87202a

27
main.c
View file

@ -581,18 +581,20 @@ static bool playermove(FILE *cmdin, token_t verb)
} }
LL=LL/1000; LL=LL/1000;
L11: for (;;) {
game.newloc=LL/1000; game.newloc=LL/1000;
K=MOD(game.newloc,100); K=MOD(game.newloc,100);
if (game.newloc <= 300) { if (game.newloc <= 300) {
if (game.newloc <= 100) if (game.newloc <= 100) {
goto L14; if (game.newloc == 0 || PCT(game.newloc))
if (TOTING(K) || (game.newloc > 200 && AT(K))) break;
goto L16; /* else fall through */
goto L12; } if (TOTING(K) || (game.newloc > 200 && AT(K)))
break;
/* else fall through */
} }
if (game.prop[K] != game.newloc/100-3) else if (game.prop[K] != game.newloc/100-3)
goto L16; break;
L12: L12:
do { do {
if (TRAVEL[KK] < 0)BUG(25); if (TRAVEL[KK] < 0)BUG(25);
@ -601,14 +603,11 @@ L12:
} while } while
(game.newloc == LL); (game.newloc == LL);
LL=game.newloc; LL=game.newloc;
goto L11; }
L14:
if (game.newloc != 0 && !PCT(game.newloc))
goto L12;
L16:
game.newloc=MOD(LL,1000); game.newloc=MOD(LL,1000);
if (game.newloc <= 300) return true; if (game.newloc <= 300)
return true;
if (game.newloc <= 500) { if (game.newloc <= 500) {
game.newloc=game.newloc-300; game.newloc=game.newloc-300;
switch (game.newloc) switch (game.newloc)