projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e66b456
)
Minor refactor - create an equality function to simplify skip logic.
author
Eric S. Raymond
<esr@thyrsus.com>
Sat, 1 Jul 2017 18:03:01 +0000
(14:03 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Sat, 1 Jul 2017 18:07:23 +0000
(14:07 -0400)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index fc4f9bea8fbcb77524915bea5c8b80e3f07e98dd..98be245ebbdf1e6ea01e9be4b6bad33f55a7c86e 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-491,6
+491,13
@@
static void croak(void)
}
}
}
}
+static bool traveleq(long a, long b)
+/* Are two travel entries equal for purposes of skip after failed condition? */
+{
+ return (travel[a].cond == travel[b].cond)
+ && (travel[a].dest == travel[b].dest);
+}
+
/* Given the current location in "game.loc", and a motion verb number in
* "motion", put the new location in "game.newloc". The current loc is saved
* in "game.oldloc" in case he wants to retreat. The current
/* Given the current location in "game.loc", and a motion verb number in
* "motion", put the new location in "game.newloc". The current loc is saved
* in "game.oldloc" in case he wants to retreat. The current
@@
-628,7
+635,7
@@
static bool playermove( int motion)
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
++te_tmp;
} while
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
++te_tmp;
} while
-
((T_DESTINATION(travel[travel_entry]) == T_DESTINATION(travel[te_tmp])) && (T_CONDITION(travel[travel_entry]) == T_CONDITION(travel[te_tmp])
));
+
(traveleq(travel_entry, te_tmp
));
travel_entry = te_tmp;
}
travel_entry = te_tmp;
}
@@
-670,7
+677,7
@@
static bool playermove( int motion)
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
++te_tmp;
} while
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
++te_tmp;
} while
- (
(T_DESTINATION(travel[travel_entry]) == T_DESTINATION(travel[te_tmp])) && (T_CONDITION(travel[travel_entry]) == T_CONDITION(travel[te_tmp])
));
+ (
traveleq(travel_entry, te_tmp
));
travel_entry = te_tmp;
continue; /* goto L12 */
case 3:
travel_entry = te_tmp;
continue; /* goto L12 */
case 3: