- (game.newloc == scratchloc);
- continue; /* back to top of do/while loop */
- case 3:
- /* Travel 303. Troll bridge. Must be done only as special
- * motion so that dwarves won't wander across and encounter
- * the bear. (They won't follow the player there because
- * that region is forbidden to the pirate.) If
- * game.prop(TROLL)=1, he's crossed since paying, so step out
- * and block him. (standard travel entries check for
- * game.prop(TROLL)=0.) Special stuff for bear. */
- if (game.prop[TROLL] == 1) {
- PSPEAK(TROLL, 1);
- game.prop[TROLL] = 0;
- MOVE(TROLL2, 0);
- MOVE(TROLL2 + NOBJECTS, 0);
- MOVE(TROLL, PLAC[TROLL]);
- MOVE(TROLL + NOBJECTS, FIXD[TROLL]);
- JUGGLE(CHASM);
- game.newloc = game.loc;
- return true;
- } else {
- game.newloc = PLAC[TROLL] + FIXD[TROLL] - game.loc;
- if (game.prop[TROLL] == 0)game.prop[TROLL] = 1;
- if (!TOTING(BEAR)) return true;
- RSPEAK(BRIDGE_COLLAPSE);
- game.prop[CHASM] = 1;
- game.prop[TROLL] = 2;
- DROP(BEAR, game.newloc);
- game.fixed[BEAR] = -1;
- game.prop[BEAR] = 3;
- game.oldlc2 = game.newloc;
- croak(cmdin);
- return false;
+ (traveleq(travel_entry, te_tmp));
+ travel_entry = te_tmp;
+ }
+
+ /* Found an eligible rule, now execute it */
+ enum desttype_t desttype = travel[travel_entry].desttype;
+ game.newloc = travel[travel_entry].destval;
+ if (desttype == dest_goto)
+ return;
+
+ if (desttype == dest_speak) {
+ /* Execute a speak rule */
+ rspeak(game.newloc);
+ game.newloc = game.loc;
+ return;
+ } else {
+ switch (game.newloc) {
+ case 1:
+ /* Special travel 1. Plover-alcove passage. Can carry only
+ * emerald. Note: travel table must include "useless"
+ * entries going through passage, which can never be used
+ * for actual motion, but can be spotted by "go back". */
+ game.newloc = (game.loc == LOC_PLOVER)
+ ? LOC_ALCOVE
+ : LOC_PLOVER;
+ if (game.holdng > 1 ||
+ (game.holdng == 1 && !TOTING(EMERALD))) {
+ game.newloc = game.loc;
+ rspeak(MUST_DROP);
+ }
+ return;
+ case 2:
+ /* Special travel 2. Plover transport. Drop the
+ * emerald (only use special travel if toting
+ * it), so he's forced to use the plover-passage
+ * to get it out. Having dropped it, go back and
+ * pretend he wasn't carrying it after all. */
+ drop(EMERALD, game.loc);
+ int te_tmp = travel_entry;
+ do {
+ if (travel[te_tmp].stop)
+ BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
+ ++te_tmp;
+ } while
+ (traveleq(travel_entry, te_tmp));
+ travel_entry = te_tmp;
+ continue; /* goto L12 */
+ case 3:
+ /* Special travel 3. Troll bridge. Must be done
+ * only as special motion so that dwarves won't
+ * wander across and encounter the bear. (They
+ * won't follow the player there because that
+ * region is forbidden to the pirate.) If
+ * game.prop[TROLL]=TROLL_PAIDONCE, he's crossed
+ * since paying, so step out and block him.
+ * (standard travel entries check for
+ * game.prop[TROLL]=TROLL_UNPAID.) Special stuff
+ * for bear. */
+ if (game.prop[TROLL] == TROLL_PAIDONCE) {
+ pspeak(TROLL, look, TROLL_PAIDONCE, true);
+ game.prop[TROLL] = TROLL_UNPAID;
+ move(TROLL2, LOC_NOWHERE);
+ move(TROLL2 + NOBJECTS, IS_FREE);
+ move(TROLL, objects[TROLL].plac);
+ move(TROLL + NOBJECTS, objects[TROLL].fixd);
+ juggle(CHASM);
+ game.newloc = game.loc;
+ return;
+ } else {
+ game.newloc = objects[TROLL].plac + objects[TROLL].fixd - game.loc;
+ if (game.prop[TROLL] == TROLL_UNPAID)
+ game.prop[TROLL] = TROLL_PAIDONCE;
+ if (!TOTING(BEAR))
+ return;
+ state_change(CHASM, BRIDGE_WRECKED);
+ game.prop[TROLL] = TROLL_GONE;
+ drop(BEAR, game.newloc);
+ game.fixed[BEAR] = IS_FIXED;
+ game.prop[BEAR] = BEAR_DEAD;
+ game.oldlc2 = game.newloc;
+ croak();
+ return;
+ }
+ default: // LCOV_EXCL_LINE
+ BUG(SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE