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:
6150e3b
)
Improve documentation if the *most* obscure span of code.
author
Eric S. Raymond
<esr@thyrsus.com>
Thu, 29 Jun 2017 00:24:29 +0000
(20:24 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Thu, 29 Jun 2017 00:24:29 +0000
(20:24 -0400)
main.c
patch
|
blob
|
history
newdungeon.py
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index 8f98db577ec1d199292cbb5649149392878ceacf..75cdf371229852fda434b5ed43f0fee0e05ca20a 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-625,20
+625,24
@@
static bool playermove(token_t verb, int motion)
for (;;) { /* L12 loop */
for (;;) {
game.newloc = scratchloc / 1000;
for (;;) { /* L12 loop */
for (;;) {
game.newloc = scratchloc / 1000;
-
motion
= MOD(game.newloc, 100);
+
long arg
= MOD(game.newloc, 100);
if (!SPECIAL(game.newloc)) {
if (!SPECIAL(game.newloc)) {
+ /* YAML N and [pct N] conditionals */
if (game.newloc <= 100) {
if (game.newloc == 0 || PCT(game.newloc))
break;
/* else fall through */
}
if (game.newloc <= 100) {
if (game.newloc == 0 || PCT(game.newloc))
break;
/* else fall through */
}
- /*
handles the YAML "with"
clause */
- if (TOTING(
motion) || (game.newloc > 200 && AT(motion
)))
+ /*
YAML [with OBJ]
clause */
+ if (TOTING(
arg) || (game.newloc > 200 && AT(arg
)))
break;
break;
- /* else fall through */
- } else if (game.prop[
motion
] != game.newloc / 100 - 3)
+ /* else fall through
to check [not OBJ STATE]
*/
+ } else if (game.prop[
arg
] != game.newloc / 100 - 3)
break;
break;
- do {
+
+ /* We arrive here on conditional failure.
+ * Skip to next non-matching destination */
+ do {
if (travel[kk].stop)
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
++kk;
if (travel[kk].stop)
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
++kk;
diff --git
a/newdungeon.py
b/newdungeon.py
index f2e801f587d91e7735d50ecfa8061cb92663e062..022580c62a4a0c2b9efbe280319dac0d5be1858c 100755
(executable)
--- a/
newdungeon.py
+++ b/
newdungeon.py
@@
-150,7
+150,8
@@
typedef struct {{
* encoding description for travel.
*/
#define T_DESTINATION(entry) MOD((entry).dest, 1000)
* encoding description for travel.
*/
#define T_DESTINATION(entry) MOD((entry).dest, 1000)
-#define T_NODWARVES(entry) ((entry).dest / 1000 == 100)
+#define T_CONDITION(entry) ((entry).dest / 1000)
+#define T_NODWARVES(entry) (T_CONDITION(entry) == 100)
#define T_HIGH(entry) ((entry).dest)
#define T_TERMINATE(entry) ((entry).motion == 1)
#define L_SPEAK(loc) ((loc) - 500)
#define T_HIGH(entry) ((entry).dest)
#define T_TERMINATE(entry) ((entry).motion == 1)
#define L_SPEAK(loc) ((loc) - 500)