From: Eric S. Raymond Date: Fri, 9 Jun 2017 16:09:47 +0000 (-0400) Subject: Replace an unstructured goto with a two-level break. X-Git-Tag: 1.1~471 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=2c33a29cf1a99d516421966bc56e8b2242d4883d;p=open-adventure.git Replace an unstructured goto with a two-level break. --- diff --git a/main.c b/main.c index 52e85c9..80f650a 100644 --- a/main.c +++ b/main.c @@ -345,7 +345,25 @@ static bool dwarfmove(void) continue; } if(TOTING(j)) { - goto L6021; + if(game.place[CHEST] == 0) { + /* Install chest only once, to insure it is + * the last treasure in the list. */ + MOVE(CHEST,game.chloc); + MOVE(MESSAG,game.chloc2); + } + RSPEAK(128); + for (int j=MINTRS; j<=MAXTRS; j++) { + if (!(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) { + if(AT(j) && game.fixed[j] == 0) + CARRY(j,game.loc); + if(TOTING(j)) + DROP(j,game.chloc); + } + } + game.dloc[PIRATE]=game.chloc; + game.odloc[PIRATE]=game.chloc; + game.dseen[PIRATE]=false; + goto jumpout; } if(HERE(j)) k=1; @@ -363,27 +381,6 @@ static bool dwarfmove(void) if(game.odloc[PIRATE] != game.dloc[PIRATE] && PCT(20)) RSPEAK(127); continue; - - L6021: - if(game.place[CHEST] == 0) { - /* Install chest only once, to insure it is the last treasure in - * the list. */ - MOVE(CHEST,game.chloc); - MOVE(MESSAG,game.chloc2); - } - RSPEAK(128); - for (int j=MINTRS; j<=MAXTRS; j++) { - if (!(j == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) { - if(AT(j) && game.fixed[j] == 0) - CARRY(j,game.loc); - if(TOTING(j)) - DROP(j,game.chloc); - } - } - game.dloc[PIRATE]=game.chloc; - game.odloc[PIRATE]=game.chloc; - game.dseen[PIRATE]=false; - continue; } /* This threatening little dwarf is in the room with him! */ @@ -395,6 +392,7 @@ static bool dwarfmove(void) if(randrange(1000) < 95*(game.dflag-2)) ++stick; } + jumpout:; } /* Now we know what's happening. Let's tell the poor sucker about it.