Remove goto L12 - take two
On't know if you let me near this code again but here is a second stab at removing "goto L12" Previous attempt failed because of trying to continue the outer do{}while(false) Adding an extra for(;;) loop where the only repeat is the former "goto L12" is replaced by continue. All other exits are returns and a break;
This commit is contained in:
parent
c2df849dad
commit
2fe36df4e2
1 changed files with 89 additions and 79 deletions
14
main.c
14
main.c
|
@ -623,6 +623,7 @@ static bool playermove(token_t verb, int motion)
|
||||||
* block travel and then redo it once the blocking condition has been
|
* block travel and then redo it once the blocking condition has been
|
||||||
* removed.
|
* removed.
|
||||||
*/
|
*/
|
||||||
|
for (;;) { /* L12 loop */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
game.newloc = scratchloc / 1000;
|
game.newloc = scratchloc / 1000;
|
||||||
motion = MOD(game.newloc, 100);
|
motion = MOD(game.newloc, 100);
|
||||||
|
@ -637,7 +638,6 @@ static bool playermove(token_t verb, int motion)
|
||||||
/* else fall through */
|
/* else fall through */
|
||||||
} else if (game.prop[motion] != game.newloc / 100 - 3)
|
} else if (game.prop[motion] != game.newloc / 100 - 3)
|
||||||
break;
|
break;
|
||||||
L12:
|
|
||||||
do {
|
do {
|
||||||
if (TRAVEL[kk] < 0)
|
if (TRAVEL[kk] < 0)
|
||||||
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
|
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
|
||||||
|
@ -672,7 +672,15 @@ L12:
|
||||||
* plover-passage to get it out. Having dropped it, go back and
|
* plover-passage to get it out. Having dropped it, go back and
|
||||||
* pretend he wasn't carrying it after all. */
|
* pretend he wasn't carrying it after all. */
|
||||||
DROP(EMERALD, game.loc);
|
DROP(EMERALD, game.loc);
|
||||||
goto L12;
|
do {
|
||||||
|
if (TRAVEL[kk] < 0)
|
||||||
|
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
|
||||||
|
++kk;
|
||||||
|
game.newloc = labs(TRAVEL[kk]) / 1000;
|
||||||
|
} while
|
||||||
|
(game.newloc == scratchloc);
|
||||||
|
scratchloc = game.newloc;
|
||||||
|
continue; /* goto L12 */
|
||||||
case 3:
|
case 3:
|
||||||
/* Travel 303. Troll bridge. Must be done only as special
|
/* Travel 303. Troll bridge. Must be done only as special
|
||||||
* motion so that dwarves won't wander across and encounter
|
* motion so that dwarves won't wander across and encounter
|
||||||
|
@ -707,6 +715,8 @@ L12:
|
||||||
}
|
}
|
||||||
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST);
|
BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST);
|
||||||
}
|
}
|
||||||
|
break; /* Leave L12 loop */
|
||||||
|
}
|
||||||
} while
|
} while
|
||||||
(false);
|
(false);
|
||||||
/* FIXME: Arithmetic on location number, becoming a message number */
|
/* FIXME: Arithmetic on location number, becoming a message number */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue