Resolve a particularly gnarly foto in dwarfmove.

This commit is contained in:
Eric S. Raymond 2017-06-08 06:44:25 -04:00
parent e3f3c86d1d
commit 75c2aa57aa

36
main.c
View file

@ -228,16 +228,17 @@ static bool dwarfmove(void)
J >= 20 || J >= 20 ||
game.newloc == game.dloc[I] || game.newloc == game.dloc[I] ||
FORCED(game.newloc) || FORCED(game.newloc) ||
(I == 6 && CNDBIT(game.newloc,3)) || (I == PIRATE && CNDBIT(game.newloc,3)) ||
labs(TRAVEL[kk])/1000000 == 100); labs(TRAVEL[kk])/1000000 == 100);
if (!avoided) { if (!avoided) {
TK[J++] = game.newloc; TK[J++] = game.newloc;
} }
kk=kk+1; ++kk;
} while } while
(TRAVEL[kk-1] >= 0); (TRAVEL[kk-1] >= 0);
TK[J]=game.odloc[I]; TK[J]=game.odloc[I];
if(J >= 2)J=J-1; if(J >= 2)
--J;
J=1+randrange(J); J=1+randrange(J);
game.odloc[I]=game.dloc[I]; game.odloc[I]=game.dloc[I];
game.dloc[I]=TK[J]; game.dloc[I]=TK[J];
@ -251,7 +252,8 @@ static bool dwarfmove(void)
* Note that game.place(CHEST)=0 might mean that he's thrown * Note that game.place(CHEST)=0 might mean that he's thrown
* it to the troll, but in that case he's seen the chest * it to the troll, but in that case he's seen the chest
* (game.prop=0). */ * (game.prop=0). */
if(game.loc == game.chloc || game.prop[CHEST] >= 0) continue; if(game.loc == game.chloc || game.prop[CHEST] >= 0)
continue;
K=0; K=0;
for (J=MINTRS; J<=MAXTRS; J++) { for (J=MINTRS; J<=MAXTRS; J++) {
/* Pirate won't take pyramid from plover room or dark /* Pirate won't take pyramid from plover room or dark
@ -269,17 +271,21 @@ static bool dwarfmove(void)
RSPEAK(127); RSPEAK(127);
continue; continue;
L6021: if(game.place[CHEST] != 0) goto L6022; L6021:
/* Install chest only once, to insure it is the last treasure in if(game.place[CHEST] == 0) {
* the list. */ /* Install chest only once, to insure it is the last treasure in
MOVE(CHEST,game.chloc); * the list. */
MOVE(MESSAG,game.chloc2); MOVE(CHEST,game.chloc);
L6022: RSPEAK(128); MOVE(MESSAG,game.chloc2);
/* 6023 */ for (J=50; J<=MAXTRS; J++) { }
if(J == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD])) goto L6023; RSPEAK(128);
if(AT(J) && game.fixed[J] == 0)CARRY(J,game.loc); for (J=MINTRS; J<=MAXTRS; J++) {
if(TOTING(J))DROP(J,game.chloc); if (!(J == PYRAM && (game.loc == PLAC[PYRAM] || game.loc == PLAC[EMRALD]))) {
L6023: /*etc*/ ; if(AT(J) && game.fixed[J] == 0)
CARRY(J,game.loc);
if(TOTING(J))
DROP(J,game.chloc);
}
} }
L6024: L6024:
game.dloc[PIRATE]=game.chloc; game.dloc[PIRATE]=game.chloc;