Magic-number ellimination, contiguity warnings, cleanup.

This commit is contained in:
Eric S. Raymond 2017-06-30 11:58:17 -04:00
parent a48e0ff30e
commit 1f45966dec
3 changed files with 10 additions and 8 deletions

View file

@ -92,10 +92,10 @@ static int attack(struct command_t *command)
} }
} }
spk = (dwarves > 1) ? OGRE_PANIC1 : OGRE_PANIC2; spk = (dwarves > 1) ? OGRE_PANIC1 : OGRE_PANIC2;
} else if (obj == BEAR) } else if (obj == BEAR) {
/* FIXME: Arithmetic on message numbers */ /* FIXME: Arithmetic on message numbers */
spk = BEAR_HANDS + (game.prop[BEAR] + 1) / 2; spk = BEAR_HANDS + (game.prop[BEAR] + 1) / 2;
else if (obj == DRAGON && game.prop[DRAGON] == 0) { } else if (obj == DRAGON && game.prop[DRAGON] == 0) {
/* Fun stuff for dragon. If he insists on attacking it, win! /* Fun stuff for dragon. If he insists on attacking it, win!
* Set game.prop to dead, move dragon to central loc (still * Set game.prop to dead, move dragon to central loc (still
* fixed), move rug there (not fixed), and move him there, * fixed), move rug there (not fixed), and move him there,
@ -966,8 +966,8 @@ static int say(struct command_t *command)
char word1[6]; char word1[6];
packed_to_token(command->wd1, word1); packed_to_token(command->wd1, word1);
int wd = (int) get_vocab_id(word1); int wd = (int) get_vocab_id(word1);
/* FIXME: Magic numbers */ /* FIXME: issue in lexical analyzer, last two magic numbers can't change */
if (wd == 62 || wd == 65 || wd == 71 || wd == 2025 || wd == 2034) { if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == 2025 || wd == 2034) {
/* FIXME: scribbles on the interpreter's command block */ /* FIXME: scribbles on the interpreter's command block */
wordclear(&command->wd2); wordclear(&command->wd2);
return GO_LOOKUP; return GO_LOOKUP;

View file

@ -266,9 +266,9 @@ motions: !!omap
words: !!null words: !!null
- MOT_69: - MOT_69:
words: ['cross'] words: ['cross']
- FORWARD0: - BEDQUILT:
words: ['bedqu'] words: ['bedqu']
- FORWARD1: - PLOVER:
words: ['plove'] words: ['plove']
- FORWARD2: - FORWARD2:
words: ['orien'] words: ['orien']
@ -2676,6 +2676,7 @@ arbitrary_messages: !!omap
- TROLL_SCAMPERS: 'The bear lumbers toward the troll, who lets out a startled shriek and\nscurries away. The bear soon gives up the pursuit and wanders back.' - TROLL_SCAMPERS: 'The bear lumbers toward the troll, who lets out a startled shriek and\nscurries away. The bear soon gives up the pursuit and wanders back.'
- AXE_LOST: 'The axe misses and lands near the bear where you can''t get at it.' - AXE_LOST: 'The axe misses and lands near the bear where you can''t get at it.'
- BEAR_HANDS: 'With what? Your bare hands? Against *HIS* bear hands??' - BEAR_HANDS: 'With what? Your bare hands? Against *HIS* bear hands??'
# The following three messages must be contiguous
- BEAR_CONFUSED: 'The bear is confused; he only wants to be your friend.' - BEAR_CONFUSED: 'The bear is confused; he only wants to be your friend.'
- ALREADY_DEAD: 'For crying out loud, the poor thing is already dead!' - ALREADY_DEAD: 'For crying out loud, the poor thing is already dead!'
- BEAR_TAMED: 'The bear eagerly wolfs down your food, after which he seems to calm\ndown considerably and even becomes rather friendly.' - BEAR_TAMED: 'The bear eagerly wolfs down your food, after which he seems to calm\ndown considerably and even becomes rather friendly.'
@ -2709,6 +2710,7 @@ arbitrary_messages: !!omap
- OGRE_DODGE: 'The ogre, who despite his bulk is quite agile, easily dodges your\nattack. He seems almost amused by your puny effort.' - OGRE_DODGE: 'The ogre, who despite his bulk is quite agile, easily dodges your\nattack. He seems almost amused by your puny effort.'
- OGRE_PANIC1: 'The ogre, distracted by your rush, is struck by the knife. With a\nblood-curdling yell he turns and bounds after the dwarves, who flee\nin panic. You are left alone in the room.' - OGRE_PANIC1: 'The ogre, distracted by your rush, is struck by the knife. With a\nblood-curdling yell he turns and bounds after the dwarves, who flee\nin panic. You are left alone in the room.'
- OGRE_PANIC2: 'The ogre, distracted by your rush, is struck by the knife. With a\nblood-curdling yell he turns and bounds after the dwarf, who flees\nin panic. You are left alone in the room.' - OGRE_PANIC2: 'The ogre, distracted by your rush, is struck by the knife. With a\nblood-curdling yell he turns and bounds after the dwarf, who flees\nin panic. You are left alone in the room.'
# Following three messages must be contiguous
- FREE_FLY: 'The bird flies about agitatedly for a moment.' - FREE_FLY: 'The bird flies about agitatedly for a moment.'
- CAGE_FLY: 'The bird flies agitatedly about the cage.' - CAGE_FLY: 'The bird flies agitatedly about the cage.'
- NECKLACE_FLY: 'The bird flies about agitatedly for a moment, then disappears through\nthe crack. It reappears shortly, carrying in its beak a jade\nnecklace, which it drops at your feet.' - NECKLACE_FLY: 'The bird flies about agitatedly for a moment, then disappears through\nthe crack. It reappears shortly, carrying in its beak a jade\nnecklace, which it drops at your feet.'

View file

@ -1,5 +1,5 @@
## Resume input from cheat-generated save inducing a version mismatch error ## Resume from cheat-generated save inducing version mismatch error
n n
resume resume
y y
resume_badversion.adv resume_badversion.adv