games: Massive style(9) cleanup commit. Reduces differences to NetBSD.
authorSascha Wildner <saw@online.de>
Sat, 9 Jan 2010 23:32:31 +0000 (00:32 +0100)
committerSascha Wildner <saw@online.de>
Sat, 9 Jan 2010 23:33:27 +0000 (00:33 +0100)
Submitted-by: Ulrich Spoerlein <uqs@spoerlein.net>
450 files changed:
games/adventure/adventure.6
games/adventure/crc.c
games/adventure/done.c
games/adventure/hdr.h
games/adventure/init.c
games/adventure/io.c
games/adventure/main.c
games/adventure/save.c
games/adventure/setup.c
games/adventure/subr.c
games/adventure/vocab.c
games/adventure/wizard.c
games/arithmetic/arithmetic.6
games/arithmetic/arithmetic.c
games/atc/atc.6
games/atc/def.h
games/atc/extern.c
games/atc/extern.h
games/atc/grammar.y
games/atc/graphics.c
games/atc/include.h
games/atc/input.c
games/atc/lex.l
games/atc/list.c
games/atc/log.c
games/atc/main.c
games/atc/pathnames.h
games/atc/struct.h
games/atc/tunable.c
games/atc/tunable.h
games/atc/update.c
games/backgammon/backgammon/backgammon.6
games/backgammon/backgammon/extra.c
games/backgammon/backgammon/main.c
games/backgammon/backgammon/move.c
games/backgammon/backgammon/text.c
games/backgammon/backgammon/version.c
games/backgammon/common_source/allow.c
games/backgammon/common_source/back.h
games/backgammon/common_source/board.c
games/backgammon/common_source/check.c
games/backgammon/common_source/fancy.c
games/backgammon/common_source/init.c
games/backgammon/common_source/odds.c
games/backgammon/common_source/one.c
games/backgammon/common_source/save.c
games/backgammon/common_source/subs.c
games/backgammon/common_source/table.c
games/backgammon/teachgammon/data.c
games/backgammon/teachgammon/teach.c
games/backgammon/teachgammon/ttext1.c
games/backgammon/teachgammon/ttext2.c
games/backgammon/teachgammon/tutor.c
games/backgammon/teachgammon/tutor.h
games/battlestar/battlestar.6
games/battlestar/battlestar.c
games/battlestar/com1.c
games/battlestar/com2.c
games/battlestar/com3.c
games/battlestar/com4.c
games/battlestar/com5.c
games/battlestar/com6.c
games/battlestar/com7.c
games/battlestar/cypher.c
games/battlestar/dayfile.c
games/battlestar/dayobjs.c
games/battlestar/externs.h
games/battlestar/fly.c
games/battlestar/getcom.c
games/battlestar/globals.c
games/battlestar/init.c
games/battlestar/misc.c
games/battlestar/nightfile.c
games/battlestar/nightobjs.c
games/battlestar/parse.c
games/battlestar/pathnames.h
games/battlestar/room.c
games/battlestar/save.c
games/battlestar/words.c
games/bcd/bcd.6
games/bcd/bcd.c
games/bs/bs.c
games/caesar/caesar.6
games/caesar/caesar.c
games/caesar/rot13.sh
games/canfield/canfield/canfield.6
games/canfield/canfield/canfield.c
games/canfield/canfield/pathnames.h
games/canfield/cfscores/cfscores.c
games/cribbage/cards.c
games/cribbage/crib.c
games/cribbage/cribbage.6
games/cribbage/cribbage.h
games/cribbage/cribcur.h
games/cribbage/deck.h
games/cribbage/extern.c
games/cribbage/instr.c
games/cribbage/io.c
games/cribbage/pathnames.h
games/cribbage/score.c
games/cribbage/support.c
games/factor/factor.6
games/factor/factor.c
games/fish/fish.6
games/fish/fish.c
games/fish/pathnames.h
games/fortune/Makefile.inc
games/fortune/datfiles/dragonfly-funny
games/fortune/datfiles/dragonfly-tips
games/fortune/datfiles/fortunes2
games/fortune/fortune/fortune.6
games/fortune/fortune/fortune.c
games/fortune/fortune/pathnames.h
games/fortune/strfile/strfile.8
games/fortune/strfile/strfile.c
games/fortune/strfile/strfile.h
games/fortune/unstr/unstr.c
games/grdc/grdc.c
games/hack/Original_READ_ME
games/hack/alloc.c
games/hack/config.h
games/hack/data
games/hack/def.gen.h
games/hack/def.gold.h
games/hack/def.mkroom.h
games/hack/def.monst.h
games/hack/def.obj.h
games/hack/def.objclass.h
games/hack/def.objects.h
games/hack/def.permonst.h
games/hack/def.rm.h
games/hack/def.trap.h
games/hack/def.wseg.h
games/hack/hack.Decl.c
games/hack/hack.apply.c
games/hack/hack.bones.c
games/hack/hack.c
games/hack/hack.cmd.c
games/hack/hack.do.c
games/hack/hack.do_name.c
games/hack/hack.do_wear.c
games/hack/hack.dog.c
games/hack/hack.eat.c
games/hack/hack.end.c
games/hack/hack.engrave.c
games/hack/hack.fight.c
games/hack/hack.fix
games/hack/hack.h
games/hack/hack.invent.c
games/hack/hack.ioctl.c
games/hack/hack.lev.c
games/hack/hack.main.c
games/hack/hack.makemon.c
games/hack/hack.mhitu.c
games/hack/hack.mklev.c
games/hack/hack.mkmaze.c
games/hack/hack.mkobj.c
games/hack/hack.mkshop.c
games/hack/hack.mon.c
games/hack/hack.monst.c
games/hack/hack.o_init.c
games/hack/hack.objnam.c
games/hack/hack.options.c
games/hack/hack.pager.c
games/hack/hack.potion.c
games/hack/hack.pri.c
games/hack/hack.read.c
games/hack/hack.rip.c
games/hack/hack.rumors.c
games/hack/hack.save.c
games/hack/hack.search.c
games/hack/hack.shk.c
games/hack/hack.shknam.c
games/hack/hack.steal.c
games/hack/hack.termcap.c
games/hack/hack.timeout.c
games/hack/hack.topl.c
games/hack/hack.track.c
games/hack/hack.trap.c
games/hack/hack.tty.c
games/hack/hack.u_init.c
games/hack/hack.unix.c
games/hack/hack.vault.c
games/hack/hack.version.c
games/hack/hack.wield.c
games/hack/hack.wizard.c
games/hack/hack.worm.c
games/hack/hack.worn.c
games/hack/hack.zap.c
games/hack/makedefs.c
games/hack/pathnames.h
games/hack/rnd.c
games/hangman/Makefile
games/hangman/endgame.c
games/hangman/extern.c
games/hangman/getguess.c
games/hangman/getword.c
games/hangman/hangman.6
games/hangman/hangman.h
games/hangman/main.c
games/hangman/pathnames.h
games/hangman/playgame.c
games/hangman/prdata.c
games/hangman/prman.c
games/hangman/prword.c
games/hangman/setup.c
games/hunt/README
games/hunt/README.protocol
games/hunt/hunt/client.h
games/hunt/hunt/connect.c
games/hunt/hunt/display.c
games/hunt/hunt/display.h
games/hunt/hunt/hunt.c
games/hunt/hunt/list.c
games/hunt/hunt/list.h
games/hunt/hunt/otto.c
games/hunt/hunt/playit.c
games/hunt/huntd/answer.c
games/hunt/huntd/conf.c
games/hunt/huntd/conf.h
games/hunt/huntd/draw.c
games/hunt/huntd/driver.c
games/hunt/huntd/execute.c
games/hunt/huntd/expl.c
games/hunt/huntd/extern.c
games/hunt/huntd/hunt.h
games/hunt/huntd/makemaze.c
games/hunt/huntd/server.h
games/hunt/huntd/shots.c
games/hunt/huntd/terminal.c
games/larn/Fixed.Bugs
games/larn/README
games/larn/bill.c
games/larn/config.c
games/larn/create.c
games/larn/data.c
games/larn/datfiles/larn.help
games/larn/diag.c
games/larn/display.c
games/larn/fortune.c
games/larn/global.c
games/larn/header.h
games/larn/help.c
games/larn/holidays
games/larn/io.c
games/larn/larn.6
games/larn/main.c
games/larn/monster.c
games/larn/moreobj.c
games/larn/movem.c
games/larn/nap.c
games/larn/object.c
games/larn/pathnames.h
games/larn/regen.c
games/larn/savelev.c
games/larn/scores.c
games/larn/signal.c
games/larn/store.c
games/larn/tok.c
games/mille/comp.c
games/mille/end.c
games/mille/extern.c
games/mille/init.c
games/mille/mille.6
games/mille/mille.c
games/mille/mille.h
games/mille/misc.c
games/mille/move.c
games/mille/print.c
games/mille/roll.c
games/mille/save.c
games/mille/types.c
games/mille/varpush.c
games/morse/morse.6
games/morse/morse.c
games/number/number.6
games/number/number.c
games/phantasia/fight.c
games/phantasia/gamesupport.c
games/phantasia/interplayer.c
games/phantasia/io.c
games/phantasia/macros.h
games/phantasia/main.c
games/phantasia/misc.c
games/phantasia/pathnames.h
games/phantasia/phantdefs.h
games/phantasia/phantglobs.c
games/phantasia/phantglobs.h
games/phantasia/setup.c
games/pig/pig.6
games/pig/pig.c
games/pom/pom.6
games/pom/pom.c
games/ppt/ppt.c
games/primes/pattern.c
games/primes/pr_tbl.c
games/primes/primes.c
games/primes/primes.h
games/quiz/pathnames.h
games/quiz/quiz.6
games/quiz/quiz.c
games/quiz/quiz.h
games/quiz/rxp.c
games/rain/rain.6
games/rain/rain.c
games/random/random.6
games/random/random.c
games/random/randomize_fd.c
games/random/randomize_fd.h
games/robots/extern.c
games/robots/flush_in.c
games/robots/init_field.c
games/robots/main.c
games/robots/make_level.c
games/robots/move.c
games/robots/move_robs.c
games/robots/pathnames.h
games/robots/play_level.c
games/robots/query.c
games/robots/rnd_pos.c
games/robots/robots.6
games/robots/robots.h
games/robots/score.c
games/rogue/CHANGES
games/rogue/Makefile
games/rogue/USD.doc/rogue.me
games/rogue/hit.c
games/rogue/init.c
games/rogue/inventory.c
games/rogue/level.c
games/rogue/machdep.c
games/rogue/main.c
games/rogue/message.c
games/rogue/monster.c
games/rogue/move.c
games/rogue/object.c
games/rogue/pack.c
games/rogue/pathnames.h
games/rogue/play.c
games/rogue/random.c
games/rogue/ring.c
games/rogue/rogue.6
games/rogue/rogue.h
games/rogue/room.c
games/rogue/save.c
games/rogue/score.c
games/rogue/spec_hit.c
games/rogue/throw.c
games/rogue/trap.c
games/rogue/use.c
games/rogue/zap.c
games/sail/assorted.c
games/sail/dr_1.c
games/sail/dr_2.c
games/sail/dr_3.c
games/sail/dr_4.c
games/sail/dr_5.c
games/sail/dr_main.c
games/sail/driver.h
games/sail/externs.h
games/sail/game.c
games/sail/globals.c
games/sail/lo_main.c
games/sail/machdep.h
games/sail/main.c
games/sail/misc.c
games/sail/parties.c
games/sail/pathnames.h
games/sail/pl_1.c
games/sail/pl_2.c
games/sail/pl_3.c
games/sail/pl_4.c
games/sail/pl_5.c
games/sail/pl_6.c
games/sail/pl_7.c
games/sail/pl_main.c
games/sail/player.h
games/sail/sail.6
games/sail/sync.c
games/sail/version.c
games/snake/snake/pathnames.h
games/snake/snake/snake.6
games/snake/snake/snake.c
games/snake/snscore/Makefile
games/snake/snscore/snscore.c
games/trek/DOC/trekmanual.nr
games/trek/USD.doc/trek.me
games/trek/abandon.c
games/trek/attack.c
games/trek/autover.c
games/trek/capture.c
games/trek/cgetc.c
games/trek/check_out.c
games/trek/checkcond.c
games/trek/compkl.c
games/trek/computer.c
games/trek/damage.c
games/trek/damaged.c
games/trek/dcrept.c
games/trek/destruct.c
games/trek/dock.c
games/trek/dumpgame.c
games/trek/dumpme.c
games/trek/dumpssradio.c
games/trek/events.c
games/trek/externs.c
games/trek/getcodi.c
games/trek/getpar.c
games/trek/getpar.h
games/trek/help.c
games/trek/impulse.c
games/trek/initquad.c
games/trek/kill.c
games/trek/klmove.c
games/trek/lose.c
games/trek/lrscan.c
games/trek/main.c
games/trek/move.c
games/trek/nova.c
games/trek/out.c
games/trek/phaser.c
games/trek/play.c
games/trek/ram.c
games/trek/ranf.c
games/trek/rest.c
games/trek/schedule.c
games/trek/score.c
games/trek/setup.c
games/trek/setwarp.c
games/trek/shield.c
games/trek/snova.c
games/trek/srscan.c
games/trek/systemname.c
games/trek/torped.c
games/trek/trek.6
games/trek/trek.h
games/trek/utility.c
games/trek/visual.c
games/trek/warp.c
games/trek/win.c
games/wargames/wargames.6
games/wargames/wargames.sh
games/worm/worm.6
games/worm/worm.c
games/worms/worms.6
games/worms/worms.c
games/wump/pathnames.h
games/wump/wump.6
games/wump/wump.c
games/wump/wump.info

index c4be539..c6330d8 100644 (file)
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
index bca7735..b4966df 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
 #include <sys/types.h>
 #include "hdr.h"
 
-const u_long crctab[] = {
+const unsigned long crctab[] = {
        0x7fffffff,
-       0x77073096,  0xee0e612c,  0x990951ba,  0x076dc419,  0x706af48f,
-       0xe963a535,  0x9e6495a3,  0x0edb8832,  0x79dcb8a4,  0xe0d5e91e,
-       0x97d2d988,  0x09b64c2b,  0x7eb17cbd,  0xe7b82d07,  0x90bf1d91,
-       0x1db71064,  0x6ab020f2,  0xf3b97148,  0x84be41de,  0x1adad47d,
-       0x6ddde4eb,  0xf4d4b551,  0x83d385c7,  0x136c9856,  0x646ba8c0,
-       0xfd62f97a,  0x8a65c9ec,  0x14015c4f,  0x63066cd9,  0xfa0f3d63,
-       0x8d080df5,  0x3b6e20c8,  0x4c69105e,  0xd56041e4,  0xa2677172,
-       0x3c03e4d1,  0x4b04d447,  0xd20d85fd,  0xa50ab56b,  0x35b5a8fa,
-       0x42b2986c,  0xdbbbc9d6,  0xacbcf940,  0x32d86ce3,  0x45df5c75,
-       0xdcd60dcf,  0xabd13d59,  0x26d930ac,  0x51de003a,  0xc8d75180,
-       0xbfd06116,  0x21b4f4b5,  0x56b3c423,  0xcfba9599,  0xb8bda50f,
-       0x2802b89e,  0x5f058808,  0xc60cd9b2,  0xb10be924,  0x2f6f7c87,
-       0x58684c11,  0xc1611dab,  0xb6662d3d,  0x76dc4190,  0x01db7106,
-       0x98d220bc,  0xefd5102a,  0x71b18589,  0x06b6b51f,  0x9fbfe4a5,
-       0xe8b8d433,  0x7807c9a2,  0x0f00f934,  0x9609a88e,  0xe10e9818,
-       0x7f6a0dbb,  0x086d3d2d,  0x91646c97,  0xe6635c01,  0x6b6b51f4,
-       0x1c6c6162,  0x856530d8,  0xf262004e,  0x6c0695ed,  0x1b01a57b,
-       0x8208f4c1,  0xf50fc457,  0x65b0d9c6,  0x12b7e950,  0x8bbeb8ea,
-       0xfcb9887c,  0x62dd1ddf,  0x15da2d49,  0x8cd37cf3,  0xfbd44c65,
-       0x4db26158,  0x3ab551ce,  0xa3bc0074,  0xd4bb30e2,  0x4adfa541,
-       0x3dd895d7,  0xa4d1c46d,  0xd3d6f4fb,  0x4369e96a,  0x346ed9fc,
-       0xad678846,  0xda60b8d0,  0x44042d73,  0x33031de5,  0xaa0a4c5f,
-       0xdd0d7cc9,  0x5005713c,  0x270241aa,  0xbe0b1010,  0xc90c2086,
-       0x5768b525,  0x206f85b3,  0xb966d409,  0xce61e49f,  0x5edef90e,
-       0x29d9c998,  0xb0d09822,  0xc7d7a8b4,  0x59b33d17,  0x2eb40d81,
-       0xb7bd5c3b,  0xc0ba6cad,  0xedb88320,  0x9abfb3b6,  0x03b6e20c,
-       0x74b1d29a,  0xead54739,  0x9dd277af,  0x04db2615,  0x73dc1683,
-       0xe3630b12,  0x94643b84,  0x0d6d6a3e,  0x7a6a5aa8,  0xe40ecf0b,
-       0x9309ff9d,  0x0a00ae27,  0x7d079eb1,  0xf00f9344,  0x8708a3d2,
-       0x1e01f268,  0x6906c2fe,  0xf762575d,  0x806567cb,  0x196c3671,
-       0x6e6b06e7,  0xfed41b76,  0x89d32be0,  0x10da7a5a,  0x67dd4acc,
-       0xf9b9df6f,  0x8ebeeff9,  0x17b7be43,  0x60b08ed5,  0xd6d6a3e8,
-       0xa1d1937e,  0x38d8c2c4,  0x4fdff252,  0xd1bb67f1,  0xa6bc5767,
-       0x3fb506dd,  0x48b2364b,  0xd80d2bda,  0xaf0a1b4c,  0x36034af6,
-       0x41047a60,  0xdf60efc3,  0xa867df55,  0x316e8eef,  0x4669be79,
-       0xcb61b38c,  0xbc66831a,  0x256fd2a0,  0x5268e236,  0xcc0c7795,
-       0xbb0b4703,  0x220216b9,  0x5505262f,  0xc5ba3bbe,  0xb2bd0b28,
-       0x2bb45a92,  0x5cb36a04,  0xc2d7ffa7,  0xb5d0cf31,  0x2cd99e8b,
-       0x5bdeae1d,  0x9b64c2b0,  0xec63f226,  0x756aa39c,  0x026d930a,
-       0x9c0906a9,  0xeb0e363f,  0x72076785,  0x05005713,  0x95bf4a82,
-       0xe2b87a14,  0x7bb12bae,  0x0cb61b38,  0x92d28e9b,  0xe5d5be0d,
-       0x7cdcefb7,  0x0bdbdf21,  0x86d3d2d4,  0xf1d4e242,  0x68ddb3f8,
-       0x1fda836e,  0x81be16cd,  0xf6b9265b,  0x6fb077e1,  0x18b74777,
-       0x88085ae6,  0xff0f6a70,  0x66063bca,  0x11010b5c,  0x8f659eff,
-       0xf862ae69,  0x616bffd3,  0x166ccf45,  0xa00ae278,  0xd70dd2ee,
-       0x4e048354,  0x3903b3c2,  0xa7672661,  0xd06016f7,  0x4969474d,
-       0x3e6e77db,  0xaed16a4a,  0xd9d65adc,  0x40df0b66,  0x37d83bf0,
-       0xa9bcae53,  0xdebb9ec5,  0x47b2cf7f,  0x30b5ffe9,  0xbdbdf21c,
-       0xcabac28a,  0x53b39330,  0x24b4a3a6,  0xbad03605,  0xcdd70693,
-       0x54de5729,  0x23d967bf,  0xb3667a2e,  0xc4614ab8,  0x5d681b02,
-       0x2a6f2b94,  0xb40bbe37,  0xc30c8ea1,  0x5a05df1b,  0x2d02ef8d
+       0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
+       0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e,
+       0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+       0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d,
+       0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0,
+       0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63,
+       0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
+       0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa,
+       0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75,
+       0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180,
+       0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+       0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87,
+       0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
+       0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5,
+       0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
+       0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4,
+       0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b,
+       0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea,
+       0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+       0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541,
+       0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc,
+       0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f,
+       0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
+       0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e,
+       0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
+       0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c,
+       0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+       0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b,
+       0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2,
+       0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671,
+       0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
+       0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8,
+       0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767,
+       0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6,
+       0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+       0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795,
+       0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
+       0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b,
+       0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
+       0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82,
+       0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d,
+       0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8,
+       0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+       0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff,
+       0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee,
+       0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d,
+       0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
+       0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c,
+       0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
+       0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02,
+       0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
 };
 
 /*
@@ -105,29 +101,27 @@ const u_long crctab[] = {
  *      it.
  */
 
-u_long crcval;
-u_int step;
+unsigned long crcval;
+unsigned int step;
 
-void 
+void
 crc_start(void)
 {
        crcval = step = 0;
 }
 
 /* Process nr bytes at a time; ptr points to them */
-u_long
+unsigned long
 crc(const char *ptr, int nr)
 {
-       int     i;
-       const char      *p;
+       int i;
+       const char *p;
 
        while (nr > 0)
-               for (p = ptr; nr--; ++p)
-               {
-                       if (!(i = crcval >> 24 ^ *p))
-                       {
+               for (p = ptr; nr--; ++p) {
+                       if (!(i = crcval >> 24 ^ *p)) {
                                i = step++;
-                               if (step >= sizeof(crctab)/sizeof(crctab[0]))
+                               if (step >= sizeof(crctab) / sizeof(crctab[0]))
                                        step = 0;
                        }
                        crcval = ((crcval << 8) ^ crctab[i]) & 0xffffffff;
index 212bff3..5d68e5a 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * $DragonFly: src/games/adventure/done.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
  */
 
-/*      Re-coding of advent in C: termination routines                  */
+/* Re-coding of advent in C: termination routines */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include "hdr.h"
 
-/* sort of like 20000   */
+/* sort of like 20000 */
 int
 score(void)
-{       int scor,i;
-       mxscor=scor=0;
-       for (i=50; i<=maxtrs; i++)
-       {       if (ptext[i].txtlen==0) continue;
-               k=12;
-               if (i==chest) k=14;
-               if (i>chest) k=16;
-               if (prop[i]>=0) scor += 2;
-               if (place[i]==3&&prop[i]==0) scor += k-2;
+{
+       int scor, i;
+
+       mxscor = scor = 0;
+       for (i = 50; i <= maxtrs; i++) {
+               if (ptext[i].txtlen == 0)
+                       continue;
+               k = 12;
+               if (i == chest)
+                       k = 14;
+               if (i > chest)
+                       k = 16;
+               if (prop[i] >= 0)
+                       scor += 2;
+               if (place[i] == 3 && prop[i] == 0)
+                       scor += k - 2;
                mxscor += k;
        }
-       scor += (maxdie-numdie)*10;
-       mxscor += maxdie*10;
-       if (!(scorng||gaveup)) scor += 4;
+       scor += (maxdie - numdie) * 10;
+       mxscor += maxdie * 10;
+       if (!(scorng || gaveup))
+               scor += 4;
        mxscor += 4;
-       if (dflag!=0) scor += 25;
+       if (dflag != 0)
+               scor += 25;
        mxscor += 25;
-       if (closng) scor += 25;
+       if (closng)
+               scor += 25;
        mxscor += 25;
-       if (closed)
-       {       if (bonus==0) scor += 10;
-               if (bonus==135) scor += 25;
-               if (bonus==134) scor += 30;
-               if (bonus==133) scor += 45;
+       if (closed) {
+               if (bonus == 0)
+                       scor += 10;
+               if (bonus == 135)
+                       scor += 25;
+               if (bonus == 134)
+                       scor += 30;
+               if (bonus == 133)
+                       scor += 45;
        }
        mxscor += 45;
-       if (place[magzin]==108) scor++;
+       if (place[magzin] == 108)
+               scor++;
        mxscor++;
        scor += 2;
        mxscor += 2;
-       for (i=1; i<=hntmax; i++)
-               if (hinted[i]) scor -= hints[i][2];
-       return(scor);
+       for (i = 1; i <= hntmax; i++)
+               if (hinted[i])
+                       scor -= hints[i][2];
+       return (scor);
 }
 
-/* entry=1 means goto 13000 */  /* game is over         */
-/* entry=2 means goto 20000 */ /* 3=19000 */
+/* entry=1 means goto 13000 */ /* game is over */
+/* entry=2 means goto 20000 */ /* 3=19000 */
 void
 done(int entry)
-{       int i,sc;
-       if (entry==1) mspeak(1);
-       if (entry==3) rspeak(136);
-       printf("\n\n\nYou scored %d out of a ",(sc=score()));
-       printf("possible %d using %d turns.\n",mxscor,turns);
-       for (i=1; i<=clsses; i++)
-               if (cval[i]>=sc)
-               {       speak(&ctext[i]);
-                       if (i==clsses-1)
-                       {       printf("To achieve the next higher rating");
+{
+       int i, sc;
+
+       if (entry == 1)
+               mspeak(1);
+       if (entry == 3)
+               rspeak(136);
+       printf("\n\n\nYou scored %d out of a ", (sc = score()));
+       printf("possible %d using %d turns.\n", mxscor, turns);
+       for (i = 1; i <= clsses; i++)
+               if (cval[i] >= sc) {
+                       speak(&ctext[i]);
+                       if (i == clsses - 1) {
+                               printf("To achieve the next higher rating");
                                printf(" would be a neat trick!\n\n");
                                printf("Congratulations!!\n");
                                exit(0);
                        }
-                       k=cval[i]+1-sc;
+                       k = cval[i] + 1 - sc;
                        printf("To achieve the next higher rating, you need");
-                       printf(" %d more point",k);
-                       if (k==1) printf(".\n");
-                       else printf("s.\n");
+                       printf(" %d more point", k);
+                       if (k == 1)
+                               printf(".\n");
+                       else
+                               printf("s.\n");
                        exit(0);
                }
        printf("You just went off my scale!!!\n");
        exit(0);
 }
 
-
-/* label 90             */
+/* label 90 */
 void
 die(int entry)
-{       int i;
-       if (entry != 99)
-       {       rspeak(23);
-               oldlc2=loc;
+{
+       int i;
+
+       if (entry != 99) {
+               rspeak(23);
+               oldlc2 = loc;
        }
-       if (closng)                             /* 99                   */
-       {       rspeak(131);
+       if (closng) {           /* 99 */
+               rspeak(131);
                numdie++;
                done(2);
        }
-       yea=yes(81+numdie*2,82+numdie*2,54);
+       yea = yes(81 + numdie * 2, 82 + numdie * 2, 54);
        numdie++;
-       if (numdie==maxdie || !yea) done(2);
-       place[water]=0;
-       place[oil]=0;
-       if (toting(lamp)) prop[lamp]=0;
-       for (i=100; i>=1; i--)
-       {       if (!toting(i)) continue;
-               k=oldlc2;
-               if (i==lamp) k=1;
-               drop(i,k);
+       if (numdie == maxdie || !yea)
+               done(2);
+       place[water] = 0;
+       place[oil] = 0;
+       if (toting(lamp))
+               prop[lamp] = 0;
+       for (i = 100; i >= 1; i--) {
+               if (!toting(i))
+                       continue;
+               k = oldlc2;
+               if (i == lamp)
+                       k = 1;
+               drop(i, k);
        }
-       loc=3;
-       oldloc=loc;
+       loc = 3;
+       oldloc = loc;
 }
index f45a906..9f2f964 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -50,6 +46,9 @@
  * The data file distributed with the fortran source is assumed to be called
  * "glorkz" in the directory where the program is first run.
  *
+ * The original FORTRAN version can be found at
+ * <URL:ftp://ftp.gmd.de/if-archive/games/source/advent-original.tar.gz>.
+ *
  * $FreeBSD: src/games/adventure/hdr.h,v 1.5.2.1 2001/03/05 11:43:11 kris Exp $
  * $DragonFly: src/games/adventure/hdr.h,v 1.3 2004/09/12 17:19:58 dillon Exp $
  */
 #include <sys/types.h>
 #include <signal.h>
 
-int datfd;                              /* message file descriptor      */
+int datfd;                     /* message file descriptor */
 volatile sig_atomic_t delhit;
 int yea;
-extern char data_file[];                /* Virtual data file            */
+extern char data_file[];       /* Virtual data file */
 
 #define TAB     011
 #define LF      012
 #define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0)
 #define FLUSHLF   while (next()!=LF)
 
-int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2;
-char *wd1,*wd2;                         /* the complete words           */
-int verb,obj,spk;
+int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2;
+char *wd1, *wd2;               /* the complete words */
+int verb, obj, spk;
 extern int blklin;
-int saved,savet,mxscor,latncy;
+int saved, savet, mxscor, latncy;
 
-#define SHORT 50                        /* How short is a demo game?    */
+#define SHORT 50               /* How short is a demo game? */
 
-#define MAXSTR  20                      /* max length of user's words   */
+#define MAXSTR  20             /* max length of user's words */
 
-#define HTSIZE  512                     /* max number of vocab words    */
-struct hashtab                          /* hash table for vocabulary    */
-{       int val;                        /* word type &index (ktab)      */
-       char *atab;                     /* pointer to actual string     */
+#define HTSIZE  512            /* max number of vocab words */
+struct hashtab {               /* hash table for vocabulary */
+       int val;                /* word type &index (ktab) */
+       char *atab;             /* pointer to actual string */
 } voc[HTSIZE];
 
-#define SEED 1815622                    /* "Encryption" seed            */
+#define SEED 1815622           /* "Encryption" seed */
 
-struct text
-#ifdef OLDSTUFF
-{       int seekadr;                    /* DATFILE must be < 2**16      */
-#endif /* !OLDSTUFF */
-{       char *seekadr;                  /* Msg start in virtual disk    */
-       int txtlen;                     /* length of msg starting here  */
+struct text {
+       char *seekadr;          /* Msg start in virtual disk */
+       int txtlen;             /* length of msg starting here */
 };
 
-#define RTXSIZ  205
-struct text rtext[RTXSIZ];              /* random text messages         */
+#define RTXSIZ 205
+struct text rtext[RTXSIZ];     /* random text messages */
 
-#define MAGSIZ  35
-struct text mtext[MAGSIZ];              /* magic messages               */
+#define MAGSIZ 35
+struct text mtext[MAGSIZ];     /* magic messages */
 
 int clsses;
 #define CLSMAX  12
-struct text ctext[CLSMAX];              /* classes of adventurer        */
+struct text ctext[CLSMAX];     /* classes of adventurer */
 int cval[CLSMAX];
 
-struct text ptext[101];                 /* object descriptions          */
+struct text ptext[101];                /* object descriptions */
 
-#define LOCSIZ  141                     /* number of locations          */
-struct text ltext[LOCSIZ];              /* long loc description         */
-struct text stext[LOCSIZ];              /* short loc descriptions       */
+#define LOCSIZ 141             /* number of locations */
+struct text ltext[LOCSIZ];     /* long loc description */
+struct text stext[LOCSIZ];     /* short loc descriptions */
 
-struct travlist                         /* direcs & conditions of travel*/
-{       struct travlist *next;          /* ptr to next list entry       */
-       int conditions;                 /* m in writeup (newloc / 1000) */
-       int tloc;                       /* n in writeup (newloc % 1000) */
-       int tverb;                      /* the verb that takes you there*/
-} *travel[LOCSIZ],*tkk;                 /* travel is closer to keys(...)*/
+struct travlist {              /* direcs & conditions of travel */
+       struct travlist *next;  /* ptr to next list entry */
+       int conditions;         /* m in writeup (newloc / 1000) */
+       int tloc;               /* n in writeup (newloc % 1000) */
+       int tverb;              /* the verb that takes you there */
+} *travel[LOCSIZ], *tkk;       /* travel is closer to keys(...) */
 
 int atloc[LOCSIZ];
 
-int  plac[101];                         /* initial object placement     */
-int  fixd[101],fixed[101];              /* location fixed?              */
+int plac[101];                 /* initial object placement */
+int fixd[101], fixed[101];     /* location fixed? */
 
-int actspk[35];                         /* rtext msg for verb <n>       */
+int actspk[35];                        /* rtext msg for verb <n> */
 
-int cond[LOCSIZ];                       /* various condition bits       */
+int cond[LOCSIZ];              /* various condition bits */
 
-extern int setbit[16];                  /* bit defn masks 1,2,4,...     */
+extern int setbit[16];         /* bit defn masks 1,2,4,... */
 
 int hntmax;
-int hints[20][5];                       /* info on hints                */
-int hinted[20],hintlc[20];
+int hints[20][5];              /* info on hints */
+int hinted[20], hintlc[20];
 
-int place[101], prop[101],linkx[201];
+int place[101], prop[101], linkx[201];
 int abb[LOCSIZ];
 
-int maxtrs,tally,tally2;                /* treasure values              */
+int maxtrs, tally, tally2;     /* treasure values */
 
 #define FALSE   0
 #define TRUE    1
 
-int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics                    */
-       bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin,
-       dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon,
-       chasm,troll,troll2,bear,messag,vend,batter,
-       nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain,
-       spices,
-       back,look,cave,null,entrnc,dprssn,
-       enter, stream, pour,
-       say,lock,throw,find,invent;
-
-int chloc,chloc2,dseen[7],dloc[7],      /* dwarf stuff                  */
-       odloc[7],dflag,daltlc;
-
-int tk[21],stick,dtotal,attack;
-int turns,lmwarn,iwest,knfloc,detail,   /* various flags & counters     */
-       abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2,
-       closng,panic,closed,scorng;
-
-int demo,limit;
-
-int at (int objj);
-int bug (int n);
-void carry (int, int);
-void caveclose (void);
-void checkhints (void);
-void ciao (void);
-void closing (void);
-u_long crc (const char *ptr, int nr);
-void crc_start (void);
-int dark (void);
-void datime (int *d, int *t);
-char *decr (const char *, const char *, const char *, const char *, const char *);
-void die (int entry);
-void done (int entry);
-void drop (int object,int where);
-void dstroy (int);
-int fdwarf (void);
-int forced (int locc);
-void getin (char **wrd1, char **wrd2);
-int here (int objj);
-void init (void);
-void juggle (int);
-int liq (void);
-int liqloc (int locc);
-int march (void);
-void move (int, int);
-void mspeak (int);
-int pct (int n);
-void poof (void);
-void pspeak (int m, int skip);
-int put (int, int, int);
-int ran (int range);
-void rdata (void);
-int restore (const char *infile);
-void rspeak (int);
-int save (const char *);
-int score (void);
-void speak (const struct text *);
-int Start (void);
-void startup (void);
-int toting (int objj);
-void trapdel (int sig);
-int trdrop (void);
-int trfeed (void);
-int trfill (void);
-int trkill (void);
-int tropen (void);
-int trsay (void);
-int trtake (void);
-int trtoss (void);
-int vocab (const char *,int,int);
-int yes (int x, int y, int z);
-int yesm (int x, int y, int z);
+int axe, back, batter, bear, bird, bottle,     /* mnemonics */
+    cage, cave, chain, chasm, chest, clam, coins, door, dprssn, dragon,
+    dwarf, eggs, emrald, enter, entrnc, find, fissur, food, grate, invent,
+    keys, knife, lamp, lock, look, magzin, messag, mirror, nugget, null,
+    oil, oyster, pearl, pillow, plant, plant2, pour, pyram, rod, rod2,
+    rug, say, snake, spices, steps, stream, tablet, throw, tridnt, troll,
+    troll2, vase, vend, water;
+
+int chloc, chloc2, daltlc, dflag, dloc[7],     /* dwarf stuff */
+    dseen[7], odloc[7];
+
+int attack, dtotal, stick, tk[21];
+
+int abbnum, bonus, clock1, clock2, closed,     /* various flags and counters */
+    closng, detail, dkill, foobar, holdng, iwest, knfloc,
+    lmwarn, maxdie, numdie, panic, scorng, turns;
+
+int demo, limit;
+
+int at(int objj);
+int bug(int n);
+void carry(int, int);
+void caveclose(void);
+void checkhints(void);
+void ciao(void);
+void closing(void);
+unsigned long crc(const char *ptr, int nr);
+void crc_start(void);
+int dark(void);
+void datime(int *d, int *t);
+char *decr(const char *, const char *, const char *, const char *, const char *);
+void die(int entry);
+void done(int entry);
+void drop(int object, int where);
+void dstroy(int);
+int fdwarf(void);
+int forced(int locc);
+void getin(char **wrd1, char **wrd2);
+int here(int objj);
+void init(void);
+void juggle(int);
+int liq(void);
+int liqloc(int locc);
+int march(void);
+void move(int, int);
+void mspeak(int);
+int pct(int n);
+void poof(void);
+void pspeak(int m, int skip);
+int put(int, int, int);
+int ran(int range);
+void rdata(void);
+int restore(const char *infile);
+void rspeak(int);
+int save(const char *);
+int score(void);
+void speak(const struct text *);
+int Start(void);
+void startup(void);
+int toting(int objj);
+void trapdel(int sig);
+int trdrop(void);
+int trfeed(void);
+int trfill(void);
+int trkill(void);
+int tropen(void);
+int trsay(void);
+int trtake(void);
+int trtoss(void);
+int vocab(const char *, int, int);
+int yes(int x, int y, int z);
+int yesm(int x, int y, int z);
 
 /* We need to get a little tricky to avoid strings */
 #define DECR(a,b,c,d,e) decr(#a,#b,#c,#d,#e)
index 1b4e88d..122b90d 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -40,7 +36,7 @@
  * $DragonFly: src/games/adventure/init.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
  */
 
-/*      Re-coding of advent in C: data initialization                   */
+/* Re-coding of advent in C: data initialization */
 
 #include <sys/types.h>
 #include <signal.h>
 
 int blklin = TRUE;
 
-int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000,
-                 010000,020000,040000,0100000};
+int setbit[16] = { 1, 2, 4, 010, 020, 040, 0100, 0200, 0400, 01000, 02000,
+       04000, 010000, 020000, 040000, 0100000 };
 
 static void linkdata (void);
 
-/* everything for 1st time run  */
+/* everything for 1st time run */
 void
 init(void)
 {
-       rdata();                        /* read data from orig. file    */
+       rdata();                /* read data from orig. file */
        linkdata();
        poof();
 }
@@ -78,42 +74,46 @@ decr(const char *a, const char *b, const char *c, const char *d, const char *e)
        return buf;
 }
 
-/*  secondary data manipulation */
+/* secondary data manipulation */
 static void
 linkdata(void)
-{       int i,j;
-
-       /*      array linkages          */
-       for (i=1; i<=LOCSIZ; i++)
-               if (ltext[i].seekadr!=0 && travel[i] != 0)
-                       if ((travel[i]->tverb)==1) cond[i]=2;
-       for (j=100; j>0; j--)
-               if (fixd[j]>0)
-               {       drop(j+100,fixd[j]);
-                       drop(j,plac[j]);
+{
+       int i, j;
+
+       /* array linkages */
+       for (i = 1; i <= LOCSIZ; i++)
+               if (ltext[i].seekadr != 0 && travel[i] != 0)
+                       if ((travel[i]->tverb) == 1)
+                               cond[i] = 2;
+       for (j = 100; j > 0; j--)
+               if (fixd[j] > 0) {
+                       drop(j + 100, fixd[j]);
+                       drop(j, plac[j]);
                }
-       for (j=100; j>0; j--)
-       {       fixed[j]=fixd[j];
-               if (plac[j]!=0 && fixd[j]<=0) drop(j,plac[j]);
+       for (j = 100; j > 0; j--) {
+               fixed[j] = fixd[j];
+               if (plac[j] != 0 && fixd[j] <= 0)
+                       drop(j, plac[j]);
        }
 
-       maxtrs=79;
-       tally=0;
-       tally2=0;
+       maxtrs = 79;
+       tally = 0;
+       tally2 = 0;
 
-       for (i=50; i<=maxtrs; i++)
-       {       if (ptext[i].seekadr!=0) prop[i] = -1;
+       for (i = 50; i <= maxtrs; i++) {
+               if (ptext[i].seekadr != 0)
+                       prop[i] = -1;
                tally -= prop[i];
        }
 
        /* define mnemonics */
-       keys = vocab(DECR(k,e,y,s,\0), 1, 0);
-       lamp = vocab(DECR(l,a,m,p,\0), 1, 0);
+       keys  = vocab(DECR(k,e,y,s,\0), 1, 0);
+       lamp  = vocab(DECR(l,a,m,p,\0), 1, 0);
        grate = vocab(DECR(g,r,a,t,e), 1, 0);
        cage  = vocab(DECR(c,a,g,e,\0),1, 0);
        rod   = vocab(DECR(r,o,d,\0,\0),1, 0);
-       rod2=rod+1;
-       steps=vocab(DECR(s,t,e,p,s),1, 0);
+       rod2 = rod + 1;
+       steps = vocab(DECR(s,t,e,p,s),1, 0);
        bird  = vocab(DECR(b,i,r,d,\0),1, 0);
        door  = vocab(DECR(d,o,o,r,\0),1, 0);
        pillow= vocab(DECR(p,i,l,l,o), 1, 0);
@@ -130,13 +130,13 @@ linkdata(void)
        water = vocab(DECR(w,a,t,e,r), 1, 0);
        oil   = vocab(DECR(o,i,l,\0,\0),1, 0);
        plant = vocab(DECR(p,l,a,n,t), 1, 0);
-       plant2=plant+1;
+       plant2 = plant + 1;
        axe   = vocab(DECR(a,x,e,\0,\0), 1, 0);
        mirror= vocab(DECR(m,i,r,r,o), 1, 0);
        dragon= vocab(DECR(d,r,a,g,o), 1, 0);
        chasm = vocab(DECR(c,h,a,s,m), 1, 0);
        troll = vocab(DECR(t,r,o,l,l), 1, 0);
-       troll2=troll+1;
+       troll2 = troll + 1;
        bear  = vocab(DECR(b,e,a,r,\0),1, 0);
        messag= vocab(DECR(m,e,s,s,a), 1, 0);
        vend  = vocab(DECR(v,e,n,d,i), 1, 0);
@@ -170,51 +170,53 @@ linkdata(void)
        invent= vocab(DECR(i,n,v,e,n), 2, 0);
 
        /* initialize dwarves */
-       chloc=114;
-       chloc2=140;
-       for (i=1; i<=6; i++)
-               dseen[i]=FALSE;
-       dflag=0;
-       dloc[1]=19;
-       dloc[2]=27;
-       dloc[3]=33;
-       dloc[4]=44;
-       dloc[5]=64;
-       dloc[6]=chloc;
-       daltlc=18;
+       chloc = 114;
+       chloc2 = 140;
+       for (i = 1; i <= 6; i++)
+               dseen[i] = FALSE;
+       dflag = 0;
+       dloc[1] = 19;
+       dloc[2] = 27;
+       dloc[3] = 33;
+       dloc[4] = 44;
+       dloc[5] = 64;
+       dloc[6] = chloc;
+       daltlc = 18;
 
        /* random flags & ctrs */
-       turns=0;
-       lmwarn=FALSE;
-       iwest=0;
-       knfloc=0;
-       detail=0;
-       abbnum=5;
-       for (i=0; i<=4; i++)
-               if (rtext[2*i+81].seekadr!=0) maxdie=i+1;
-       numdie=holdng=dkill=foobar=bonus=0;
-       clock1=30;
-       clock2=50;
-       saved=0;
-       closng=panic=closed=scorng=FALSE;
+       turns = 0;
+       lmwarn = FALSE;
+       iwest = 0;
+       knfloc = 0;
+       detail = 0;
+       abbnum = 5;
+       for (i = 0; i <= 4; i++)
+               if (rtext[2 * i + 81].seekadr != 0)
+                       maxdie = i + 1;
+       numdie = holdng = dkill = foobar = bonus = 0;
+       clock1 = 30;
+       clock2 = 50;
+       saved = 0;
+       closng = panic = closed = scorng = FALSE;
 }
 
-/* come here if he hits a del   */
+/* come here if he hits a del */
 void
 trapdel(int sig __unused)
-{      
-       delhit = 1;                     /* main checks, treats as QUIT  */
-       signal(2,trapdel);              /* catch subsequent DELs        */
+{
+       delhit = 1;                     /* main checks, treats as QUIT */
+       signal(SIGINT, trapdel);        /* catch subsequent DELs */
 }
 
 void
 startup(void)
 {
-       demo=Start();
+       demo = Start();
        srandomdev();
-       hinted[3]=yes(65,1,0);
-       newloc=1;
+       hinted[3] = yes(65, 1, 0);
+       newloc = 1;
        delhit = 0;
-       limit=330;
-       if (hinted[3]) limit=1000;      /* better batteries if instrucs */
+       limit = 330;
+       if (hinted[3])
+               limit = 1000;   /* better batteries if instrucs */
 }
index d5bb247..6d3ca81 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -40,7 +36,7 @@
  * $DragonFly: src/games/adventure/io.c,v 1.3 2007/04/18 18:32:12 swildner Exp $
  */
 
-/*      Re-coding of advent in C: file i/o and user i/o                 */
+/* Re-coding of advent in C: file i/o and user i/o */
 
 #include "hdr.h"
 #include <stdio.h>
 #include <string.h>
 #include <err.h>
 
-static int next (void);
-static int rnum (void);
-static void rdesc (int);
-static void rdflt (void);
-static void rhints (void);
-static void rliq (void);
-static void rlocs (void);
-static void rtrav (void);
-static void rvoc (void);
+static int next(void);
+static void rdesc(int);
+static void rdflt(void);
+static void rhints(void);
+static void rliq(void);
+static void rlocs(void);
+static int rnum(void);
+static void rtrav(void);
+static void rvoc(void);
 #ifdef DEBUG
-static void twrite (int);
+static void twrite(int);
 #endif
 
-/* get command from user        */
-/* no prompt, usually           */
+/* Get command from user. No prompt, usually. */
 void
 getin(char **wrd1, char **wrd2)
-{       char *s;
-       static char wd1buf[MAXSTR],wd2buf[MAXSTR];
+{
+       char *s;
+       static char wd1buf[MAXSTR], wd2buf[MAXSTR];
        int first, numch;
 
-       *wrd1=wd1buf;                   /* return ptr to internal string*/
-       *wrd2=wd2buf;
-       wd2buf[0]=0;                    /* in case it isn't set here    */
-       for (s=wd1buf, first=1, numch=0;;)
-       {       if ((*s=getchar())>='A' && *s <='Z') *s = *s - ('A' -'a');
-                                       /* convert to upper case        */
-               switch(*s)              /* start reading from user      */
-               {   case '\n':
-                       *s=0;
+       *wrd1 = wd1buf;                 /* return ptr to internal string */
+       *wrd2 = wd2buf;
+       wd2buf[0] = 0;                  /* in case it isn't set here */
+       for (s = wd1buf, first = 1, numch = 0;;) {
+               if ((*s = getchar()) >= 'A' && *s <= 'Z')
+                       *s = *s - ('A' - 'a');  /* convert to upper case */
+               switch (*s) {           /* start reading from user */
+               case '\n':
+                       *s = 0;
                        return;
-                   case ' ':
-                       if (s==wd1buf||s==wd2buf)  /* initial blank   */
+               case ' ':
+                       if (s == wd1buf || s == wd2buf) /* initial blank */
                                continue;
-                       *s=0;
-                       if (first)      /* finished 1st wd; start 2nd   */
-                       {       first=numch=0;
-                               s=wd2buf;
+                       *s = 0;
+                       if (first) {    /* finished 1st wd; start 2nd */
+                               first = numch = 0;
+                               s = wd2buf;
                                break;
-                       }
-                       else            /* finished 2nd word            */
-                       {       FLUSHLINE;
-                               *s=0;
+                       } else {        /* finished 2nd word */
+                               FLUSHLINE;
+                               *s = 0;
                                return;
                        }
-                   case EOF:
+               case EOF:
                        printf("user closed input stream, quitting...\n");
                        exit(0);
-                   default:
-                       if (++numch>=MAXSTR)    /* string too long      */
-                       {       printf("Give me a break!!\n");
-                               wd1buf[0]=wd2buf[0]=0;
+               default:
+                       if (++numch >= MAXSTR) {        /* string too long */
+                               printf("Give me a break!!\n");
+                               wd1buf[0] = wd2buf[0] = 0;
                                FLUSHLINE;
                                return;
                        }
@@ -108,166 +103,185 @@ getin(char **wrd1, char **wrd2)
        }
 }
 
-/* confirm with rspeak          */
+/* confirm with rspeak */
 int
 yes(int x, int y, int z)
-{       int result;
+{
+       int result;
        int ch;
 
        result = FALSE;
-       for (;;)
-       {       rspeak(x);                     /* tell him what we want*/
-               if ((ch=getchar())=='y')
-                       result=TRUE;
-               else if (ch=='n') result=FALSE;
+       for (;;) {
+               rspeak(x);      /* tell him what we want */
+               if ((ch = getchar()) == 'y')
+                       result = TRUE;
+               else if (ch == 'n')
+                       result = FALSE;
                else if (ch == EOF) {
                        printf("user closed input stream, quitting...\n");
                        exit(0);
                }
                FLUSHLINE;
-               if (ch=='y'|| ch=='n') break;
+               if (ch == 'y' || ch == 'n')
+                       break;
                printf("Please answer the question.\n");
        }
-       if (result==TRUE) rspeak(y);
-       if (result==FALSE) rspeak(z);
-       return(result);
+       if (result == TRUE)
+               rspeak(y);
+       if (result == FALSE)
+               rspeak(z);
+       return (result);
 }
 
-/* confirm with mspeak          */
+/* confirm with mspeak */
 int
 yesm(int x, int y, int z)
-{       int result;
+{
+       int result;
        int ch;
 
        result = FALSE;
-       for (;;)
-       {       mspeak(x);                     /* tell him what we want*/
-               if ((ch=getchar())=='y')
-                       result=TRUE;
-               else if (ch=='n') result=FALSE;
+       for (;;) {
+               mspeak(x);      /* tell him what we want */
+               if ((ch = getchar()) == 'y')
+                       result = TRUE;
+               else if (ch == 'n')
+                       result = FALSE;
                else if (ch == EOF) {
                        printf("user closed input stream, quitting...\n");
                        exit(0);
                }
                FLUSHLINE;
-               if (ch=='y'|| ch=='n') break;
+               if (ch == 'y' || ch == 'n')
+                       break;
                printf("Please answer the question.\n");
        }
-       if (result==TRUE) mspeak(y);
-       if (result==FALSE) mspeak(z);
-       return(result);
+       if (result == TRUE)
+               mspeak(y);
+       if (result == FALSE)
+               mspeak(z);
+       return (result);
 }
 
-/* FILE *inbuf,*outbuf; */
+/* FILE *inbuf, *outbuf; */
 
-char *inptr;                            /* Pointer into virtual disk    */
+char *inptr;                           /* Pointer into virtual disk */
 
-int outsw = 0;                         /* putting stuff to data file?  */
+int outsw = 0;                         /* putting stuff to data file? */
 
 const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l";
-const char *tape = iotape;             /* pointer to encryption tape   */
+const char *tape = iotape;             /* pointer to encryption tape */
 
-/* next virtual char, bump adr  */
+/* next virtual char, bump adr */
 static int
 next(void)
 {
        int ch;
 
-       ch=(*inptr ^ random()) & 0xFF;  /* Decrypt input data           */
-       if (outsw)                      /* putting data in tmp file     */
-       {   if (*tape==0) tape=iotape;  /* rewind encryption tape       */
-           *inptr = ch ^ *tape++;      /* re-encrypt and replace value */
+       ch = (*inptr ^ random()) & 0xFF; /* Decrypt input data */
+       if (outsw) {                    /* putting data in tmp file */
+               if (*tape == 0)
+                       tape = iotape;  /* rewind encryption tape */
+               *inptr = ch ^ *tape++;  /* re-encrypt and replace value */
        }
        inptr++;
-       return(ch);
+       return (ch);
 }
 
-char breakch;                           /* tell which char ended rnum   */
+char breakch;                          /* tell which char ended rnum */
 
-/* "read" data from virtual file*/
+/* "read" data from virtual file */
 void
 rdata(void)
-{       int sect;
+{
+       int sect;
        char ch;
 
-       inptr = data_file;              /* Pointer to virtual data file */
-       srandom(SEED);                  /* which is lightly encrypted.  */
+       inptr = data_file;              /* Pointer to virtual data file */
+       srandom(SEED);                  /* which is lightly encrypted. */
 
-       clsses=1;
-       for (;;)                        /* read data sections           */
-       {       sect=next()-'0';        /* 1st digit of section number  */
+       clsses = 1;
+       for (;;) {                      /* read data sections */
+               sect = next() - '0';    /* 1st digit of section number */
 #ifdef VERBOSE
-               printf("Section %c",sect+'0');
+               printf("Section %c", sect + '0');
 #endif
-               if ((ch=next())!=LF)    /* is there a second digit?     */
-               {
+               if ((ch = next()) != LF) {      /* is there a second digit? */
                        FLUSHLF;
 #ifdef VERBOSE
                        putchar(ch);
 #endif
-                       sect=10*sect+ch-'0';
+                       sect = 10 * sect + ch - '0';
                }
 #ifdef VERBOSE
                putchar('\n');
 #endif
-               switch(sect)
-               {   case 0:             /* finished reading database    */
+               switch (sect) {
+               case 0:         /* finished reading database */
                        return;
-                   case 1:             /* long form descriptions       */
+               case 1:         /* long form descriptions */
                        rdesc(1);
                        break;
-                   case 2:             /* short form descriptions      */
+               case 2:         /* short form descriptions */
                        rdesc(2);
                        break;
-                   case 3:             /* travel table                 */
-                       rtrav();   break;
-                   case 4:             /* vocabulary                   */
+               case 3:         /* travel table */
+                       rtrav();
+                       break;
+               case 4:         /* vocabulary */
                        rvoc();
                        break;
-                   case 5:             /* object descriptions          */
+               case 5:         /* object descriptions */
                        rdesc(5);
                        break;
-                   case 6:             /* arbitrary messages           */
+               case 6:         /* arbitrary messages */
                        rdesc(6);
                        break;
-                   case 7:             /* object locations             */
-                       rlocs();   break;
-                   case 8:             /* action defaults              */
-                       rdflt();   break;
-                   case 9:             /* liquid assets                */
-                       rliq();    break;
-                   case 10:            /* class messages               */
+               case 7:         /* object locations */
+                       rlocs();
+                       break;
+               case 8:         /* action defaults */
+                       rdflt();
+                       break;
+               case 9:         /* liquid assets */
+                       rliq();
+                       break;
+               case 10:        /* class messages */
                        rdesc(10);
                        break;
-                   case 11:            /* hints                        */
-                       rhints();  break;
-                   case 12:            /* magic messages               */
+               case 11:        /* hints */
+                       rhints();
+                       break;
+               case 12:        /* magic messages */
                        rdesc(12);
                        break;
-                   default:
-                       printf("Invalid data section number: %d\n",sect);
-                       for (;;) putchar(next());
+               default:
+                       printf("Invalid data section number: %d\n", sect);
+                       for (;;)
+                               putchar(next());
                }
-               if (breakch!=LF)        /* routines return after "-1"   */
+               if (breakch != LF)      /* routines return after "-1" */
                        FLUSHLF;
        }
 }
 
 char nbf[12];
 
-
-/* read initial location num    */
+/* read initial location num */
 static int
 rnum(void)
-{       char *s;
-       tape = iotape;                  /* restart encryption tape      */
-       for (s=nbf,*s=0;; s++)
-               if ((*s=next())==TAB || *s=='\n' || *s==LF)
+{
+       char *s;
+
+       tape = iotape;          /* restart encryption tape */
+       for (s = nbf, *s = 0;; s++)
+               if ((*s = next()) == TAB || *s == '\n' || *s == LF)
                        break;
-       breakch= *s;                    /* save char for rtrav()        */
-       *s=0;                           /* got the number as ascii      */
-       if (nbf[0]=='-') return(-1);    /* end of data                  */
-       return(atoi(nbf));              /* convert it to integer        */
+       breakch = *s;           /* save char for rtrav() */
+       *s = 0;                 /* got the number as ascii */
+       if (nbf[0] == '-')      /* end of data */
+               return (-1);
+       return (atoi(nbf));     /* convert it to integer */
 }
 
 char *seekhere;
@@ -279,118 +293,117 @@ rdesc(int sect)
        int locc;
        char *seekstart, *maystart;
 
-       seekhere = inptr;               /* Where are we in virtual file?*/
-       outsw=1;                        /* these msgs go into tmp file  */
-       for (oldloc= -1, seekstart=seekhere;;)
-       {       maystart=inptr;         /* maybe starting new entry     */
-               if ((locc=rnum())!=oldloc && oldloc>=0  /* finished msg */
-                   && ! (sect==5 && (locc==0 || locc>=100)))/* unless sect 5*/
-               {       switch(sect)    /* now put it into right table  */
-                       {   case 1:     /* long descriptions            */
-                               ltext[oldloc].seekadr=seekhere;
-                               ltext[oldloc].txtlen=maystart-seekstart;
+       seekhere = inptr;               /* Where are we in virtual file? */
+       outsw = 1;                      /* these msgs go into tmp file */
+       for (oldloc = -1, seekstart = seekhere;;) {
+               maystart = inptr;       /* maybe starting new entry */
+               if ((locc = rnum()) != oldloc && oldloc >= 0 /* finished msg */
+                   /* unless sect 5 */
+                   && !(sect == 5 && (locc == 0 || locc >= 100))) {
+                       switch (sect) { /* now put it into right table */
+                       case 1:         /* long descriptions */
+                               ltext[oldloc].seekadr = seekhere;
+                               ltext[oldloc].txtlen = maystart - seekstart;
                                break;
-                           case 2:     /* short descriptions           */
-                               stext[oldloc].seekadr=seekhere;
-                               stext[oldloc].txtlen=maystart-seekstart;
+                       case 2:         /* short descriptions */
+                               stext[oldloc].seekadr = seekhere;
+                               stext[oldloc].txtlen = maystart - seekstart;
                                break;
-                           case 5:     /* object descriptions          */
-                               ptext[oldloc].seekadr=seekhere;
-                               ptext[oldloc].txtlen=maystart-seekstart;
+                       case 5:         /* object descriptions */
+                               ptext[oldloc].seekadr = seekhere;
+                               ptext[oldloc].txtlen = maystart - seekstart;
                                break;
-                           case 6:     /* random messages              */
-                               if (oldloc>RTXSIZ)
-                               {       errx(1, "Too many random msgs");
-                               }
-                               rtext[oldloc].seekadr=seekhere;
-                               rtext[oldloc].txtlen=maystart-seekstart;
+                       case 6:         /* random messages */
+                               if (oldloc > RTXSIZ)
+                                       errx(1, "Too many random msgs");
+                               rtext[oldloc].seekadr = seekhere;
+                               rtext[oldloc].txtlen = maystart - seekstart;
                                break;
-                           case 10:    /* class messages               */
-                               ctext[clsses].seekadr=seekhere;
-                               ctext[clsses].txtlen=maystart-seekstart;
-                               cval[clsses++]=oldloc;
+                       case 10:        /* class messages */
+                               ctext[clsses].seekadr = seekhere;
+                               ctext[clsses].txtlen = maystart - seekstart;
+                               cval[clsses++] = oldloc;
                                break;
-                           case 12:    /* magic messages               */
-                               if (oldloc>MAGSIZ)
-                               {       errx(1, "Too many magic msgs");
-                               }
-                               mtext[oldloc].seekadr=seekhere;
-                               mtext[oldloc].txtlen=maystart-seekstart;
+                       case 12:        /* magic messages */
+                               if (oldloc > MAGSIZ)
+                                       errx(1, "Too many magic msgs");
+                               mtext[oldloc].seekadr = seekhere;
+                               mtext[oldloc].txtlen = maystart - seekstart;
                                break;
-                           default:
+                       default:
                                errx(1, "rdesc called with bad section");
                        }
-                       seekhere += maystart-seekstart;
+                       seekhere += maystart - seekstart;
                }
-               if (locc<0)
-               {       outsw=0;        /* turn off output              */
-                       seekhere += 3;  /* -1<delimiter>                */
+               if (locc < 0) {
+                       outsw = 0;      /* turn off output */
+                       seekhere += 3;  /* -1<delimiter> */
                        return;
                }
-               if (sect!=5 || (locc>0 && locc<100))
-               {       if (oldloc!=locc)/* starting a new message       */
-                               seekstart=maystart;
-                       oldloc=locc;
+               if (sect != 5 || (locc > 0 && locc < 100)) {
+                       if (oldloc != locc)     /* starting a new message */
+                               seekstart = maystart;
+                       oldloc = locc;
                }
-               FLUSHLF;                /* scan the line                */
+               FLUSHLF;                /* scan the line */
        }
 }
 
-
-/* read travel table            */
+/* read travel table */
 static void
 rtrav(void)
-{       int locc;
+{
+       int locc;
        struct travlist *t;
        char *s;
        char buf[12];
-       int len,m,n,entries;
+       int len, m, n, entries;
 
        entries = 0;
        t = NULL;
-       for (oldloc= -1;;)              /* get another line             */
-       {       if ((locc=rnum())!=oldloc && oldloc>=0) /* end of entry */
-               {
-                       t->next = 0;    /* terminate the old entry      */
+       for (oldloc = -1;;) {           /* get another line */
+               /* end of entry */
+               if ((locc = rnum()) != oldloc && oldloc >= 0) {
+                       t->next = 0;    /* terminate the old entry */
 #if DEBUG
-                       printf("%d:%d entries\n",oldloc,entries);
+                       printf("%d:%d entries\n", oldloc, entries);
                        twrite(oldloc);
 #endif
                }
-               if (locc== -1) return;
-               if (locc!=oldloc)        /* getting a new entry         */
-               {       t=travel[locc]=(struct travlist *) malloc(sizeof (struct travlist));
-               /*      printf("New travel list for %d\n",locc);        */
+               if (locc == -1)
+                       return;
+               if (locc != oldloc) {   /* getting a new entry */
+                       t = travel[locc] = malloc(sizeof(*t));
                        if (t == NULL)
                                errx(1, "Out of memory!");
-                       entries=0;
-                       oldloc=locc;
+                       /* printf("New travel list for %d\n", locc); */
+                       entries = 0;
+                       oldloc = locc;
                }
-               s = buf;
-               for (;; s++)      /* get the newloc number /ASCII */
-                       if ((*s=next())==TAB || *s==LF) break;
-               *s=0;
-               len=strlen(buf);      /* quad long number handling    */
-       /*      printf("Newloc: %s (%d chars)\n",buf,len);              */
-               if (len<4)              /* no "m" conditions            */
-               {       m=0;
-                       n=atoi(buf);    /* newloc mod 1000 = newloc     */
-               }
-               else                    /* a long integer               */
-               {       n=atoi(buf+len-3);
-                       buf[len-3]=0;   /* terminate newloc/1000        */
-                       m=atoi(buf);
+               for (s = buf;; s++)             /* get the newloc number /ASCII */
+                       if ((*s = next()) == TAB || *s == LF)
+                               break;
+               *s = 0;
+               len = strlen(buf);      /* quad long number handling */
+               /* printf("Newloc: %s (%d chars)\n", buf, len); */
+               if (len < 4) {          /* no "m" conditions */
+                       m = 0;
+                       n = atoi(buf);  /* newloc mod 1000 = newloc */
+               } else {                /* a long integer */
+                       n = atoi(buf + len - 3);
+                       buf[len - 3] = 0;       /* terminate newloc/1000 */
+                       m = atoi(buf);
                }
-               while (breakch!=LF)     /* only do one line at a time   */
-               {       if (entries++) {
-                               t=t->next=(struct travlist *) malloc(sizeof (struct travlist));
+               while (breakch != LF) { /* only do one line at a time */
+                       if (entries++) {
+                               t = t->next = malloc(sizeof(*t));
                                if (t == NULL)
                                        errx(1, "Out of memory!");
                        }
-                       t->tverb=rnum();/* get verb from the file       */
-                       t->tloc=n;      /* table entry mod 1000         */
-                       t->conditions=m;/* table entry / 1000           */
-               /*      printf("entry %d for %d\n",entries,locc);       */
+                       t->tverb = rnum();      /* get verb from the file */
+                       t->tloc = n;            /* table entry mod 1000 */
+                       t->conditions = m;      /* table entry / 1000 */
+                       /* printf("entry %d for %d\n", entries, locc); */
                }
        }
 }
@@ -400,104 +413,124 @@ rtrav(void)
 /* travel options from this loc */
 static void
 twrite(int loq)
-{       struct travlist *t;
+{
+       struct travlist *t;
+
        printf("If");
        speak(&ltext[loq]);
        printf("then\n");
-       for (t=travel[loq]; t!=0; t=t->next)
-       {       printf("verb %d takes you to ",t->tverb);
-               if (t->tloc<=300)
+       for (t = travel[loq]; t != 0; t = t->next) {
+               printf("verb %d takes you to ", t->tverb);
+               if (t->tloc <= 300)
                        speak(&ltext[t->tloc]);
-               else if (t->tloc<=500)
-                       printf("special code %d\n",t->tloc-300);
+               else if (t->tloc <= 500)
+                       printf("special code %d\n", t->tloc - 300);
                else
-                       rspeak(t->tloc-500);
-               printf("under conditions %d\n",t->conditions);
+                       rspeak(t->tloc - 500);
+               printf("under conditions %d\n", t->conditions);
        }
 }
-
 #endif /* DEBUG */
 
+/* read the vocabulary */
 static void
 rvoc(void)
-{       char *s;               /* read the vocabulary          */
+{
+       char *s;
        int rv_index;
        char buf[6];
-       for (;;)
-       {       rv_index=rnum();
-               if (rv_index<0) break;
-               for (s=buf,*s=0;; s++)  /* get the word                 */
-                       if ((*s=next())==TAB || *s=='\n' || *s==LF
-                               || *s==' ') break;
-                       /* terminate word with newline, LF, tab, blank  */
-               if (*s!='\n' && *s!=LF) FLUSHLF;  /* can be comments    */
-               *s=0;
-       /*      printf("\"%s\"=%d\n",buf,index);*/
-               vocab(buf,-2,rv_index);
+
+       for (;;) {
+               rv_index = rnum();
+               if (rv_index < 0)
+                       break;
+               for (s = buf, *s = 0;; s++)     /* get the word */
+                       if ((*s = next()) == TAB || *s == '\n' || *s == LF
+                           || *s == ' ')
+                               break;
+               /* terminate word with newline, LF, tab, blank */
+               if (*s != '\n' && *s != LF)
+                       FLUSHLF;                /* can be comments */
+               *s = 0;
+               /* printf("\"%s\"=%d\n", buf, rv_index); */
+               vocab(buf, -2, rv_index);
        }
 }
 
-
-/* initial object locations     */
+/* initial object locations */
 static void
 rlocs(void)
-{      for (;;)
-       {       if ((obj=rnum())<0) break;
-               plac[obj]=rnum();       /* initial loc for this obj     */
-               if (breakch==TAB)       /* there's another entry        */
-                       fixd[obj]=rnum();
-               else    fixd[obj]=0;
+{
+       for (;;) {
+               if ((obj = rnum()) < 0)
+                       break;
+               plac[obj] = rnum();     /* initial loc for this obj */
+               if (breakch == TAB)     /* there's another entry */
+                       fixd[obj] = rnum();
+               else
+                       fixd[obj] = 0;
        }
 }
 
-/* default verb messages        */
+/* default verb messages */
 static void
 rdflt(void)
-{      for (;;)
-       {       if ((verb=rnum())<0) break;
-               actspk[verb]=rnum();
+{
+       for (;;) {
+               if ((verb = rnum()) < 0)
+                       break;
+               actspk[verb] = rnum();
        }
 }
 
-/* liquid assets &c: cond bits  */
+/* liquid assets &c: cond bits */
 static void
 rliq(void)
-{       int bitnum;
-       for (;;)                        /* read new bit list            */
-       {       if ((bitnum=rnum())<0) break;
-               for (;;)                /* read locs for bits           */
-               {       cond[rnum()] |= setbit[bitnum];
-                       if (breakch==LF) break;
+{
+       int bitnum;
+
+       for (;;) {                      /* read new bit list */
+               if ((bitnum = rnum()) < 0)
+                       break;
+               for (;;) {              /* read locs for bits */
+                       cond[rnum()] |= setbit[bitnum];
+                       if (breakch == LF)
+                               break;
                }
        }
 }
 
 static void
 rhints(void)
-{       int hintnum,i;
-       hntmax=0;
-       for (;;)
-       {       if ((hintnum=rnum())<0) break;
-               for (i=1; i<5; i++)
-                       hints[hintnum][i]=rnum();
-               if (hintnum>hntmax) hntmax=hintnum;
+{
+       int hintnum, i;
+
+       hntmax = 0;
+       for (;;) {
+               if ((hintnum = rnum()) < 0)
+                       break;
+               for (i = 1; i < 5; i++)
+                       hints[hintnum][i] = rnum();
+               if (hintnum > hntmax)
+                       hntmax = hintnum;
        }
 }
 
-
 void
 rspeak(int msg)
-{       if (msg!=0) speak(&rtext[msg]);
+{
+       if (msg != 0)
+               speak(&rtext[msg]);
 }
 
-
 void
 mspeak(int msg)
-{       if (msg!=0) speak(&mtext[msg]);
+{
+       if (msg != 0)
+               speak(&mtext[msg]);
 }
 
-
-/* read, decrypt, and print a message (not ptext)      */
+/* read, decrypt, and print a message (not ptext) */
 /* msg is a pointer to seek address and length of mess */
 void
 speak(const struct text *msg)
@@ -505,62 +538,70 @@ speak(const struct text *msg)
        char *s, nonfirst;
 
        s = msg->seekadr;
-       nonfirst=0;
-       while (s - msg->seekadr < msg->txtlen)  /* read a line at a time */
-       {       tape=iotape;            /* restart decryption tape      */
-               while ((*s++ ^ *tape++) != TAB); /* read past loc num       */
-               /* assume tape is longer than location number           */
-               /*   plus the lookahead put together                    */
+       nonfirst = 0;
+       while (s - msg->seekadr < msg->txtlen) { /* read a line at a time */
+               tape = iotape;                   /* restart decryption tape */
+               while ((*s++ ^ *tape++) != TAB); /* read past loc num */
+               /* assume tape is longer than location number */
+               /* plus the lookahead put together */
                if ((*s ^ *tape) == '>' &&
-                       (*(s+1) ^ *(tape+1)) == '$' &&
-                       (*(s+2) ^ *(tape+2)) == '<') break;
-               if (blklin && !nonfirst++) putchar('\n');
-               do
-               {       if (*tape == 0) tape = iotape;/* rewind decryp tape */
+                   (*(s + 1) ^ *(tape + 1)) == '$' &&
+                   (*(s + 2) ^ *(tape + 2)) == '<')
+                       break;
+               if (blklin && !nonfirst++)
+                       putchar('\n');
+               do {
+                       if (*tape == 0)
+                               tape = iotape;  /* rewind decryp tape */
                        putchar(*s ^ *tape);
-               } while ((*s++ ^ *tape++) != LF);   /* better end with LF   */
+               } while ((*s++ ^ *tape++) != LF); /* better end with LF */
        }
 }
 
-
-/* read, decrypt an print a ptext message              */
-/* msg is the number of all the p msgs for this place  */
-/* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/
+/* read, decrypt and print a ptext message */
+/* msg is the number of all the p msgs for this place */
+/* assumes object 1 doesn't have prop 1, obj 2 no prop 2, etc. */
 void
 pspeak(int m, int skip)
 {
-       char *s,nonfirst;
+       char *s, nonfirst;
        char *numst, ps_save;
        struct text *msg;
        char *tbuf;
 
        msg = &ptext[m];
-       if ((tbuf=(char *) malloc(msg->txtlen + 1)) == 0)
+       if ((tbuf = malloc(msg->txtlen + 1)) == 0)
                errx(1, "Out of memory!");
-       memcpy(tbuf, msg->seekadr, (u_int)msg->txtlen + 1);   /* Room to null */
+       memcpy(tbuf, msg->seekadr, (unsigned)msg->txtlen + 1); /* Room to null */
        s = tbuf;
 
-       nonfirst=0;
-       while (s - tbuf < msg->txtlen) /* read line at a time */
-       {       tape=iotape;            /* restart decryption tape      */
-               for (numst=s; (*s^= *tape++)!=TAB; s++); /* get number  */
+       nonfirst = 0;
+       while (s - tbuf < msg->txtlen) {        /* read line at a time */
+               tape = iotape;                  /* restart decryption tape */
+               for (numst = s; (*s ^= *tape++) != TAB; s++) /* get number */
+                 ; /* nothing */
 
-               ps_save = *s; /* Temporarily trash the string (cringe) */
-               *s++ = 0; /* decrypting number within the string          */
+               ps_save = *s;   /* Temporarily trash the string (cringe) */
+               *s++ = 0;       /* decrypting number within the string */
 
-               if (atoi(numst) != 100 * skip && skip >= 0)
-               {       while ((*s++^*tape++)!=LF) /* flush the line    */
-                               if (*tape==0) tape=iotape;
+               if (atoi(numst) != 100 * skip && skip >= 0) {
+                       while ((*s++ ^ *tape++) != LF)  /* flush the line */
+                               if (*tape == 0)
+                                       tape = iotape;
                        continue;
                }
-               if ((*s^*tape)=='>' && (*(s+1)^*(tape+1))=='$' &&
-                       (*(s+2)^*(tape+2))=='<') break;
-               if (blklin && ! nonfirst++) putchar('\n');
-               do
-               {       if (*tape==0) tape=iotape;
-                       putchar(*s^*tape);
-               } while ((*s++^*tape++)!=LF);   /* better end with LF   */
-               if (skip<0) break;
+               if ((*s ^ *tape) == '>' && (*(s + 1) ^ *(tape + 1)) == '$' &&
+                   (*(s + 2) ^ *(tape + 2)) == '<')
+                       break;
+               if (blklin && !nonfirst++)
+                       putchar('\n');
+               do {
+                       if (*tape == 0)
+                               tape = iotape;
+                       putchar(*s ^ *tape);
+               } while ((*s++ ^ *tape++) != LF);       /* better end with LF */
+               if (skip < 0)
+                       break;
        }
        free(tbuf);
 }
index b1923b5..e5aee27 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -41,7 +37,7 @@
  * $DragonFly: src/games/adventure/main.c,v 1.3 2005/03/25 12:56:48 liamfoy Exp $
  */
 
-/*      Re-coding of advent in C: main program                          */
+/* Re-coding of advent in C: main program */
 
 #include <sys/file.h>
 #include <errno.h>
 #include <unistd.h>
 #include "hdr.h"
 
-
 int
-main(int argc, char **argv)
+main(int argc, char *argv[])
 {
        int i;
-       int rval,ll;
+       int rval, ll;
        struct text *kk;
 
-       /* revoke */
+       /* revoke setgid privileges from dm */
        setgid(getgid());
 
-       init();         /* Initialize everything */
-       signal(SIGINT,trapdel);
+       init();         /* Initialize everything */
+       signal(SIGINT, trapdel);
 
-       if (argc > 1)   /* Restore file specified */
-       {               /* Restart is label 8305 (Fortran) */
-               i = restore(argv[1]);       /* See what we've got */
-               switch(i)
-               {
-                   case 0:     /* The restore worked fine */
-                       yea=Start();
-                       k=null;
+       if (argc > 1) { /* Restore file specified */
+                       /* Restart is label 8305 (Fortran) */
+               i = restore(argv[1]);   /* See what we've got */
+               switch (i) {
+               case 0:                 /* The restore worked fine */
+                       yea = Start();
+                       k = null;
                        unlink(argv[1]);/* Don't re-use the save */
-                       goto l8;        /* Get where we're going */
-                   case 1:             /* Couldn't open it */
-                       exit(1);        /* So give up */
-                   case 2:             /* Oops -- file was altered */
-                       rspeak(202);    /* You dissolve */
-                       exit(1);        /* File could be non-adventure */
-               }                       /* So don't unlink it. */
+                       goto l8;        /* Get where we're going */
+               case 1:                 /* Couldn't open it */
+                       exit(1);        /* So give up */
+               case 2:                 /* Oops -- file was altered */
+                       rspeak(202);    /* You dissolve */
+                       exit(1);        /* File could be non-adventure */
+               }                       /* So don't unlink it. */
        }
+       startup();                      /* prepare for a user */
 
-       startup();              /* prepare for a user           */
-
-       for (;;)                        /* main command loop (label 2)  */
-       {       if (newloc<9 && newloc!=0 && closng)
-               {       rspeak(130);    /* if closing leave only by     */
-                       newloc=loc;     /*      main office             */
-                       if (!panic) clock2=15;
-                       panic=TRUE;
+       for (;;) {                      /* main command loop (label 2) */
+               if (newloc < 9 && newloc != 0 && closng) {
+                       rspeak(130);    /* if closing leave only by */
+                       newloc = loc;   /* main office */
+                       if (!panic)
+                               clock2 = 15;
+                       panic = TRUE;
                }
+               rval = fdwarf();        /* dwarf stuff */
+               if (rval == 99)
+                       die(99);
 
-               rval=fdwarf();          /* dwarf stuff                  */
-               if (rval==99) die(99);
-
-       l2000:  if (loc==0) die(99);    /* label 2000                   */
+l2000:         if (loc == 0)
+                       die(99);        /* label 2000 */
                kk = &stext[loc];
-               if ((abb[loc]%abbnum)==0 || kk->seekadr==0)
+               if ((abb[loc] % abbnum) == 0 || kk->seekadr == 0)
                        kk = &ltext[loc];
-               if (!forced(loc) && dark())
-               {       if (wzdark && pct(35))
-                       {       die(90);
+               if (!forced(loc) && dark()) {
+                       if (wzdark && pct(35)) {
+                               die(90);
                                goto l2000;
                        }
                        kk = &rtext[16];
                }
-               if (toting(bear)) rspeak(141);  /* 2001                 */
+               if (toting(bear))
+                       rspeak(141);    /* label 2001 */
                speak(kk);
-               k=1;
+               k = 1;
                if (forced(loc))
                        goto l8;
-               if (loc==33 && pct(25)&&!closng) rspeak(8);
-               if (!dark())
-               {       abb[loc]++;
-                       for (i=atloc[loc]; i!=0; i=linkx[i])     /*2004  */
-                       {       obj=i;
-                               if (obj>100) obj -= 100;
-                               if (obj==steps && toting(nugget)) continue;
-                               if (prop[obj]<0)
-                               {       if (closed) continue;
-                                       prop[obj]=0;
-                                       if (obj==rug||obj==chain)
-                                               prop[obj]=1;
+               if (loc == 33 && pct(25) && !closng)
+                       rspeak(8);
+               if (!dark()) {
+                       abb[loc]++;
+                       for (i = atloc[loc]; i != 0; i = linkx[i]) { /* 2004 */
+                               obj = i;
+                               if (obj > 100)
+                                       obj -= 100;
+                               if (obj == steps && toting(nugget))
+                                       continue;
+                               if (prop[obj] < 0) {
+                                       if (closed)
+                                               continue;
+                                       prop[obj] = 0;
+                                       if (obj == rug || obj == chain)
+                                               prop[obj] = 1;
                                        tally--;
-                                       if (tally==tally2 && tally != 0)
-                                               if (limit>35) limit=35;
+                                       if (tally == tally2 && tally != 0)
+                                               if (limit > 35)
+                                                       limit = 35;
                                }
-                               ll =  prop[obj];   /* 2006         */
-                               if (obj==steps && loc==fixed[steps])
+                               ll = prop[obj]; /* 2006 */
+                               if (obj == steps && loc == fixed[steps])
                                        ll = 1;
                                pspeak(obj, ll);
-                       }                                       /* 2008 */
+                       }                       /* 2008 */
                        goto l2012;
-       l2009:          k=54;                   /* 2009                 */
-       l2010:          spk=k;
-       l2011:          rspeak(spk);
+l2009:                 k = 54;                 /* 2009 */
+l2010:                 spk = k;
+l2011:                 rspeak(spk);
                }
-       l2012:  verb=0;                         /* 2012                 */
-               obj=0;
-       l2600:  checkhints();                   /* to 2600-2602         */
-               if (closed)
-               {       if (prop[oyster]<0 && toting(oyster))
-                               pspeak(oyster,1);
-                       for (i=1; i<100; i++)
-                               if (toting(i)&&prop[i]<0)       /*2604  */
-                                       prop[i] = -1-prop[i];
+l2012:         verb = 0;                       /* 2012 */
+               obj = 0;
+l2600:         checkhints();                   /* to 2600-2602 */
+               if (closed) {
+                       if (prop[oyster] < 0 && toting(oyster))
+                               pspeak(oyster, 1);
+                       for (i = 1; i < 100; i++)
+                               if (toting(i) && prop[i] < 0)   /* 2604 */
+                                       prop[i] = -1 - prop[i];
                }
-               wzdark=dark();                  /* 2605                 */
-               if (knfloc>0 && knfloc!=loc) knfloc=1;
-               getin(&wd1,&wd2);
-               if (delhit)                     /* user typed a DEL     */
-               {       delhit=0;               /* reset counter        */
-                       strcpy(wd1,"quit");    /* pretend he's quitting*/
-                       *wd2=0;
+               wzdark = dark();                /* 2605 */
+               if (knfloc > 0 && knfloc != loc)
+                       knfloc = 1;
+               getin(&wd1, &wd2);
+               if (delhit) {                   /* user typed a DEL */
+                       delhit = 0;             /* reset counter */
+                       strcpy(wd1, "quit");    /* pretend he's quitting */
+                       wd2[0] = 0;
                }
-       l2608:  if ((foobar = -foobar)>0) foobar=0;     /* 2608         */
-               /* should check here for "magic mode"                   */
+l2608:         if ((foobar = -foobar) > 0)
+                       foobar = 0;             /* 2608 */
+               /* should check here for "magic mode" */
                turns++;
-               if (demo && turns>=SHORT) done(1);      /* to 13000     */
+               if (demo && turns >= SHORT)
+                       done(1);                /* to 13000 */
 
-               if (verb==say && *wd2!=0) verb=0;
-               if (verb==say)
+               if (verb == say && wd2[0] != 0)
+                       verb = 0;
+               if (verb == say)
                        goto l4090;
-               if (tally==0 && loc>=15 && loc!=33) clock1--;
-               if (clock1==0)
-               {       closing();                      /* to 10000     */
+               if (tally == 0 && loc >= 15 && loc != 33)
+                       clock1--;
+               if (clock1 == 0) {
+                       closing();              /* to 10000 */
                        goto l19999;
                }
-               if (clock1<0) clock2--;
-               if (clock2==0)
-               {       caveclose();            /* to 11000             */
-                       continue;               /* back to 2            */
+               if (clock1 < 0)
+                       clock2--;
+               if (clock2 == 0) {
+                       caveclose();            /* to 11000 */
+                       continue;               /* back to 2 */
                }
-               if (prop[lamp]==1) limit--;
-               if (limit<=30 && here(batter) && prop[batter]==0
-                       && here(lamp))
-               {       rspeak(188);            /* 12000                */
-                       prop[batter]=1;
-                       if (toting(batter)) drop(batter,loc);
-                       limit=limit+2500;
-                       lmwarn=FALSE;
+               if (prop[lamp] == 1)
+                       limit--;
+               if (limit <= 30 && here(batter) && prop[batter] == 0
+                   && here(lamp)) {
+                       rspeak(188);            /* 12000 */
+                       prop[batter] = 1;
+                       if (toting(batter))
+                               drop(batter, loc);
+                       limit += 2500;
+                       lmwarn = FALSE;
                        goto l19999;
                }
-               if (limit==0)
-               {       limit = -1;             /* 12400                */
-                       prop[lamp]=0;
+               if (limit == 0) {
+                       limit = -1;             /* 12400 */
+                       prop[lamp] = 0;
                        rspeak(184);
                        goto l19999;
                }
-               if (limit<0&&loc<=8)
-               {       rspeak(185);            /* 12600                */
-                       gaveup=TRUE;
-                       done(2);                /* to 20000             */
+               if (limit < 0 && loc <= 8) {
+                       rspeak(185);            /* 12600 */
+                       gaveup = TRUE;
+                       done(2);                /* to 20000 */
                }
-               if (limit<=30)
-               {       if (lmwarn|| !here(lamp)) goto l19999;  /*12200*/
-                       lmwarn=TRUE;
-                       spk=187;
-                       if (place[batter]==0) spk=183;
-                       if (prop[batter]==1) spk=189;
+               if (limit <= 30) {
+                       if (lmwarn || !here(lamp))
+                               goto l19999;    /* 12200 */
+                       lmwarn = TRUE;
+                       spk = 187;
+                       if (place[batter] == 0)
+                               spk = 183;
+                       if (prop[batter] == 1)
+                               spk = 189;
                        rspeak(spk);
                }
-       l19999: k=43;
-               if (liqloc(loc)==water) k=70;
-               if (!strncmp(wd1,"enter",5) &&
-                   (!strncmp(wd2,"strea",5)||!strncmp(wd2,"water",5)))
+l19999:                k = 43;
+               if (liqloc(loc) == water)
+                       k = 70;
+               if (!strncmp(wd1, "enter", 5) &&
+                   (!strncmp(wd2, "strea", 5) || !strncmp(wd2, "water", 5)))
                        goto l2010;
-               if (!strncmp(wd1,"enter",5) && *wd2!=0) goto l2800;
-               if ((strncmp(wd1,"water",5)&&strncmp(wd1,"oil",3))
-                   || (strncmp(wd2,"plant",5)&&strncmp(wd2,"door",4)))
+               if (!strncmp(wd1, "enter", 5) && wd2[0] != 0)
+                       goto l2800;
+               if ((strncmp(wd1, "water", 5) && strncmp(wd1, "oil", 3))
+                   || (strncmp(wd2, "plant", 5) && strncmp(wd2, "door", 4)))
                        goto l2610;
-               if (at(vocab(wd2,1,0))) strcpy(wd2,"pour");
+               if (at(vocab(wd2, 1, 0)))
+                       strcpy(wd2, "pour");
 
-       l2610:  if (!strncmp(wd1,"west",4))
-                       if (++iwest==10) rspeak(17);
-       l2630:  i=vocab(wd1,-1,0);
-               if (i== -1)
-               {       spk=60;                 /* 3000         */
-                       if (pct(20)) spk=61;
-                       if (pct(20)) spk=13;
+l2610:         if (!strncmp(wd1, "west", 4))
+                       if (++iwest == 10)
+                               rspeak(17);
+l2630:         i = vocab(wd1, -1, 0);
+               if (i == -1) {
+                       spk = 60;               /* 3000 */
+                       if (pct(20))
+                               spk = 61;
+                       if (pct(20))
+                               spk = 13;
                        rspeak(spk);
                        goto l2600;
                }
-               k=i%1000;
-               kq=i/1000+1;
-               switch(kq)
-               {   case 1: goto l8;
-                   case 2: goto l5000;
-                   case 3: goto l4000;
-                   case 4: goto l2010;
-                   default:
+               k = i % 1000;
+               kq = i / 1000 + 1;
+               switch (kq) {
+               case 1:
+                       goto l8;
+               case 2:
+                       goto l5000;
+               case 3:
+                       goto l4000;
+               case 4:
+                       goto l2010;
+               default:
                        bug(22);
                }
 
-       l8:
-               switch(march())
-               {   case 2: continue;           /* i.e. goto l2         */
-                   case 99:
+l8:
+               switch (march()) {
+               case 2:
+                       continue;               /* i.e. goto l2 */
+               case 99:
                        die(99);
                        goto l2000;
-                   default: bug(110);
+               default:
+                       bug(110);
                }
 
-       l2800:  strcpy(wd1,wd2);
-               *wd2=0;
+l2800:         strcpy(wd1, wd2);
+               wd2[0] = 0;
                goto l2610;
 
-       l4000:  verb=k;
-               spk=actspk[verb];
-               if (*wd2!=0 && verb!=say) goto l2800;
-               if (verb==say) obj= *wd2;
-               if (obj!=0) goto l4090;
-               switch(verb)
-               {   case 1:                     /* take = 8010          */
-                       if (atloc[loc]==0||linkx[atloc[loc]]!=0) goto l8000;
-                       for (i=1; i<=5; i++)
-                               if (dloc[i]==loc&&dflag>=2) goto l8000;
-                       obj=atloc[loc];
+l4000:         verb = k;
+               spk = actspk[verb];
+               if (wd2[0] != 0 && verb != say)
+                       goto l2800;
+               if (verb == say)
+                       obj = wd2[0];
+               if (obj != 0)
+                       goto l4090;
+               switch (verb) {
+               case 1:                         /* take = 8010 */
+                       if (atloc[loc] == 0 || linkx[atloc[loc]] != 0)
+                               goto l8000;
+                       for (i = 1; i <= 5; i++)
+                               if (dloc[i] == loc && dflag >= 2)
+                                       goto l8000;
+                       obj = atloc[loc];
                        goto l9010;
-                   case 2: case 3: case 9:     /* 8000 : drop,say,wave */
-                   case 10: case 16: case 17:  /* calm,rub,toss        */
-                   case 19: case 21: case 28:  /* find,feed,break      */
-                   case 29:                    /* wake                 */
-               l8000:  printf("%s what?\n",wd1);
-                       obj=0;
+               case 2:                         /* 8000: drop */
+               case 3:                         /* say */
+               case 9:                         /* wave */
+               case 10:                        /* calm */
+               case 16:                        /* rub */
+               case 17:                        /* toss */
+               case 19:                        /* find */
+               case 21:                        /* feed */
+               case 28:                        /* break */
+               case 29:                        /* wake */
+l8000:                 printf("%s what?\n", wd1);
+                       obj = 0;
                        goto l2600;
-                   case 4: case 6:             /* 8040 open,lock       */
-                       spk=28;
-                       if (here(clam)) obj=clam;
-                       if (here(oyster)) obj=oyster;
-                       if (at(door)) obj=door;
-                       if (at(grate)) obj=grate;
-                       if (obj!=0 && here(chain)) goto l8000;
-                       if (here(chain)) obj=chain;
-                       if (obj==0) goto l2011;
+               case 4:                         /* 8040: open */
+               case 6:                         /* lock */
+                       spk = 28;
+                       if (here(clam))
+                               obj = clam;
+                       if (here(oyster))
+                               obj = oyster;
+                       if (at(door))
+                               obj = door;
+                       if (at(grate))
+                               obj = grate;
+                       if (obj != 0 && here(chain))
+                               goto l8000;
+                       if (here(chain))
+                               obj = chain;
+                       if (obj == 0)
+                               goto l2011;
                        goto l9040;
-                   case 5: goto l2009;         /* nothing              */
-                   case 7: goto l9070;         /* on                   */
-                   case 8: goto l9080;         /* off                  */
-                   case 11: goto l8000;        /* walk                 */
-                   case 12: goto l9120;        /* kill                 */
-                   case 13: goto l9130;        /* pour                 */
-                   case 14:                    /* eat: 8140            */
-                       if (!here(food)) goto l8000;
-               l8142:  dstroy(food);
-                       spk=72;
+               case 5:                         /* nothing */
+                       goto l2009;
+               case 7:                         /* on */
+                       goto l9070;
+               case 8:                         /* off */
+                       goto l9080;
+               case 11:                        /* walk */
+                       goto l8000;
+               case 12:                        /* kill */
+                       goto l9120;
+               case 13:                        /* pour */
+                       goto l9130;
+               case 14:                        /* eat: 8140 */
+                       if (!here(food))
+                               goto l8000;
+l8142:                 dstroy(food);
+                       spk = 72;
                        goto l2011;
-                   case 15: goto l9150;        /* drink                */
-                   case 18:                    /* quit: 8180           */
-                       gaveup=yes(22,54,54);
-                       if (gaveup) done(2);    /* 8185                 */
+               case 15:                        /* drink */
+                       goto l9150;
+               case 18:                        /* quit: 8180 */
+                       gaveup = yes(22, 54, 54);
+                       if (gaveup)
+                               done(2);        /* 8185 */
                        goto l2012;
-                   case 20:                    /* invent=8200          */
-                       spk=98;
-                       for (i=1; i<=100; i++)
-                       {       if (i!=bear && toting(i))
-                               {       if (spk==98) rspeak(99);
-                                       blklin=FALSE;
-                                       pspeak(i,-1);
-                                       blklin=TRUE;
-                                       spk=0;
+               case 20:                        /* invent=8200 */
+                       spk = 98;
+                       for (i = 1; i <= 100; i++) {
+                               if (i != bear && toting(i)) {
+                                       if (spk == 98)
+                                               rspeak(99);
+                                       blklin = FALSE;
+                                       pspeak(i, -1);
+                                       blklin = TRUE;
+                                       spk = 0;
                                }
                        }
-                       if (toting(bear)) spk=141;
+                       if (toting(bear))
+                               spk = 141;
                        goto l2011;
-                   case 22: goto l9220;        /* fill                 */
-                   case 23: goto l9230;        /* blast                */
-                   case 24:                    /* score: 8240          */
-                       scorng=TRUE;
+               case 22:                        /* fill */
+                       goto l9220;
+               case 23:                        /* blast */
+                       goto l9230;
+               case 24:                        /* score: 8240 */
+                       scorng = TRUE;
                        printf("If you were to quit now, you would score");
-                       printf(" %d out of a possible ",score());
-                       printf("%d.",mxscor);
-                       scorng=FALSE;
-                       gaveup=yes(143,54,54);
-                       if (gaveup) done(2);
+                       printf(" %d out of a possible ", score());
+                       printf("%d.", mxscor);
+                       scorng = FALSE;
+                       gaveup = yes(143, 54, 54);
+                       if (gaveup)
+                               done(2);
                        goto l2012;
-                   case 25:                    /* foo: 8250            */
-                       k=vocab(wd1,3,0);
-                       spk=42;
-                       if (foobar==1-k) goto l8252;
-                       if (foobar!=0) spk=151;
+               case 25:                        /* foo: 8250 */
+                       k = vocab(wd1, 3, 0);
+                       spk = 42;
+                       if (foobar == 1 - k)
+                               goto l8252;
+                       if (foobar != 0)
+                               spk = 151;
                        goto l2011;
-               l8252:  foobar=k;
-                       if (k!=4) goto l2009;
-                       foobar=0;
-                       if (place[eggs]==plac[eggs]
-                               ||(toting(eggs)&&loc==plac[eggs])) goto l2011;
-                       if (place[eggs]==0&&place[troll]==0&&prop[troll]==0)
-                               prop[troll]=1;
-                       k=2;
-                       if (here(eggs)) k=1;
-                       if (loc==plac[eggs]) k=0;
-                       move(eggs,plac[eggs]);
-                       pspeak(eggs,k);
+l8252:                 foobar = k;
+                       if (k != 4)
+                               goto l2009;
+                       foobar = 0;
+                       if (place[eggs] == plac[eggs]
+                           || (toting(eggs) && loc == plac[eggs]))
+                               goto l2011;
+                       if (place[eggs] == 0 && place[troll] == 0 &&
+                           prop[troll] == 0)
+                               prop[troll] = 1;
+                       k = 2;
+                       if (here(eggs))
+                               k = 1;
+                       if (loc == plac[eggs])
+                               k = 0;
+                       move(eggs, plac[eggs]);
+                       pspeak(eggs, k);
                        goto l2012;
-                   case 26:                    /* brief=8260           */
-                       spk=156;
-                       abbnum=10000;
-                       detail=3;
+               case 26:                        /* brief=8260 */
+                       spk = 156;
+                       abbnum = 10000;
+                       detail = 3;
                        goto l2011;
-                   case 27:                    /* read=8270            */
-                       if (here(magzin)) obj=magzin;
-                       if (here(tablet)) obj=obj*100+tablet;
-                       if (here(messag)) obj=obj*100+messag;
-                       if (closed&&toting(oyster)) obj=oyster;
-                       if (obj>100||obj==0||dark()) goto l8000;
+               case 27:                        /* read=8270 */
+                       if (here(magzin))
+                               obj = magzin;
+                       if (here(tablet))
+                               obj = obj * 100 + tablet;
+                       if (here(messag))
+                               obj = obj * 100 + messag;
+                       if (closed && toting(oyster))
+                               obj = oyster;
+                       if (obj > 100 || obj == 0 || dark())
+                               goto l8000;
                        goto l9270;
-                   case 30:                    /* suspend=8300         */
-                       spk=201;
-                       if (demo) goto l2011;
+               case 30:                        /* suspend=8300 */
+                       spk = 201;
+                       if (demo)
+                               goto l2011;
                        printf("I can suspend your adventure for you so");
                        printf(" you can resume later, but\n");
                        printf("you will have to wait at least");
-                       printf(" %d minutes before continuing.",latncy);
-                       if (!yes(200,54,54)) goto l2012;
-                       datime(&saved,&savet);
-                       ciao();                 /* Do we quit? */
-                       continue;               /* Maybe not */
-                   case 31:                    /* hours=8310           */
+                       printf(" %d minutes before continuing.", latncy);
+                       if (!yes(200, 54, 54))
+                               goto l2012;
+                       datime(&saved, &savet);
+                       ciao();                 /* Do we quit? */
+                       continue;               /* Maybe not */
+               case 31:                        /* hours=8310 */
                        printf("Colossal cave is closed 9am-5pm Mon ");
                        printf("through Fri except holidays.\n");
                        goto l2012;
-                   default: bug(23);
+               default:
+                       bug(23);
                }
 
-       l4090:
-               switch(verb)
-               {   case 1:                     /* take = 9010          */
-       l9010:          switch(trtake())
-                       {   case 2011: goto l2011;
-                           case 9220: goto l9220;
-                           case 2009: goto l2009;
-                           case 2012: goto l2012;
-                           default: bug(102);
+l4090:
+               switch (verb) {
+               case 1:                         /* take = 9010 */
+l9010:                 switch (trtake()) {
+                       case 2011:
+                               goto l2011;
+                       case 9220:
+                               goto l9220;
+                       case 2009:
+                               goto l2009;
+                       case 2012:
+                               goto l2012;
+                       default:
+                               bug(102);
                        }
-       l9020:      case 2:                     /* drop = 9020          */
-                       switch(trdrop())
-                       {   case 2011: goto l2011;
-                           case 19000: done(3);
-                           case 2012: goto l2012;
-                           default: bug(105);
+l9020:         case 2:                         /* drop = 9020 */
+                       switch (trdrop()) {
+                       case 2011:
+                               goto l2011;
+                       case 19000:
+                               done(3);
+                       case 2012:
+                               goto l2012;
+                       default:
+                               bug(105);
                        }
-                   case 3:
-                       switch(trsay())
-                       {   case 2012: goto l2012;
-                           case 2630: goto l2630;
-                           default: bug(107);
+               case 3:                         /* label 9030 */
+                       switch (trsay()) {
+                       case 2012:
+                               goto l2012;
+                       case 2630:
+                               goto l2630;
+                       default:
+                               bug(107);
                        }
-       l9040:      case 4:  case 6:            /* open, close          */
-                       switch(tropen())
-                       {   case 2011: goto l2011;
-                           case 2010: goto l2010;
-                           default: bug(106);
+l9040:         case 4:                         /* open */
+               case 6:                         /* close */
+                       switch (tropen()) {
+                       case 2011:
+                               goto l2011;
+                       case 2010:
+                               goto l2010;
+                       default:
+                               bug(106);
                        }
-                   case 5: goto l2009;         /* nothing              */
-                   case 7:                     /* on   9070            */
-       l9070:          if (!here(lamp))  goto l2011;
-                       spk=184;
-                       if (limit<0) goto l2011;
-                       prop[lamp]=1;
+               case 5:                         /* nothing */
+                       goto l2009;
+               case 7:                         /* on 9070 */
+l9070:                 if (!here(lamp))
+                               goto l2011;
+                       spk = 184;
+                       if (limit < 0)
+                               goto l2011;
+                       prop[lamp] = 1;
                        rspeak(39);
-                       if (wzdark) goto l2000;
+                       if (wzdark)
+                               goto l2000;
                        goto l2012;
 
-                   case 8:                     /* off                  */
-       l9080:          if (!here(lamp)) goto l2011;
-                       prop[lamp]=0;
+               case 8:                         /* off */
+l9080:                 if (!here(lamp))
+                               goto l2011;
+                       prop[lamp] = 0;
                        rspeak(40);
-                       if (dark()) rspeak(16);
+                       if (dark())
+                               rspeak(16);
                        goto l2012;
 
-                   case 9:                     /* wave                 */
-                       if ((!toting(obj))&&(obj!=rod||!toting(rod2)))
-                               spk=29;
-                       if (obj!=rod||!at(fissur)||!toting(obj)||closng)
+               case 9:                         /* wave */
+                       if ((!toting(obj)) && (obj != rod || !toting(rod2)))
+                               spk = 29;
+                       if (obj != rod || !at(fissur) || !toting(obj) || closng)
                                goto l2011;
-                       prop[fissur]=1-prop[fissur];
-                       pspeak(fissur,2-prop[fissur]);
+                       prop[fissur] = 1 - prop[fissur];
+                       pspeak(fissur, 2 - prop[fissur]);
                        goto l2012;
-                   case 10: case 11: case 18:  /* calm, walk, quit     */
-                   case 24: case 25: case 26:  /* score, foo, brief    */
-                   case 30: case 31:           /* suspend, hours       */
-                            goto l2011;
-       l9120:      case 12:                    /* kill                 */
-                       switch(trkill())
-                       {   case 8000: goto l8000;
-                           case 8: goto l8;
-                           case 2011: goto l2011;
-                           case 2608: goto l2608;
-                           case 19000: done(3);
-                           default: bug(112);
+               case 10:                        /* calm */
+               case 11:                        /* walk */
+               case 18:                        /* quit */
+               case 24:                        /* score */
+               case 25:                        /* foo */
+               case 26:                        /* brief */
+               case 30:                        /* suspend */
+               case 31:                        /* hours */
+                       goto l2011;
+l9120:         case 12:                        /* kill */
+                       switch (trkill()) {
+                       case 8000:
+                               goto l8000;
+                       case 8:
+                               goto l8;
+                       case 2011:
+                               goto l2011;
+                       case 2608:
+                               goto l2608;
+                       case 19000:
+                               done(3);
+                       default:
+                               bug(112);
                        }
-       l9130:      case 13:                    /* pour                 */
-                       if (obj==bottle||obj==0) obj=liq();
-                       if (obj==0) goto l8000;
-                       if (!toting(obj)) goto l2011;
-                       spk=78;
-                       if (obj!=oil&&obj!=water) goto l2011;
-                       prop[bottle]=1;
-                       place[obj]=0;
-                       spk=77;
-                       if (!(at(plant)||at(door))) goto l2011;
-                       if (at(door))
-                       {       prop[door]=0;   /* 9132                 */
-                               if (obj==oil) prop[door]=1;
-                               spk=113+prop[door];
+l9130:         case 13:                        /* pour */
+                       if (obj == bottle || obj == 0)
+                               obj = liq();
+                       if (obj == 0)
+                               goto l8000;
+                       if (!toting(obj))
+                               goto l2011;
+                       spk = 78;
+                       if (obj != oil && obj != water)
+                               goto l2011;
+                       prop[bottle] = 1;
+                       place[obj] = 0;
+                       spk = 77;
+                       if (!(at(plant) || at(door)))
+                               goto l2011;
+                       if (at(door)) {
+                               prop[door] = 0; /* 9132 */
+                               if (obj == oil)
+                                       prop[door] = 1;
+                               spk = 113 + prop[door];
                                goto l2011;
                        }
-                       spk=112;
-                       if (obj!=water) goto l2011;
-                       pspeak(plant,prop[plant]+1);
-                       prop[plant]=(prop[plant]+2)% 6;
-                       prop[plant2]=prop[plant]/2;
-                       k=null;
+                       spk = 112;
+                       if (obj != water)
+                               goto l2011;
+                       pspeak(plant, prop[plant] + 1);
+                       prop[plant] = (prop[plant] + 2)% 6;
+                       prop[plant2] = prop[plant] / 2;
+                       k = null;
                        goto l8;
-                   case 14:                    /* 9140 - eat           */
-                       if (obj==food) goto l8142;
-                       if (obj==bird||obj==snake||obj==clam||obj==oyster
-                           ||obj==dwarf||obj==dragon||obj==troll
-                           ||obj==bear) spk=71;
+               case 14:                        /* 9140: eat */
+                       if (obj == food)
+                               goto l8142;
+                       if (obj == bird || obj == snake || obj == clam
+                           || obj == oyster || obj == dwarf || obj == dragon
+                           || obj == troll || obj == bear)
+                               spk = 71;
                        goto l2011;
-       l9150:      case 15:                    /* 9150 - drink         */
-                       if (obj==0&&liqloc(loc)!=water&&(liq()!=water
-                               ||!here(bottle))) goto l8000;
-                       if (obj!=0&&obj!=water) spk=110;
-                       if (spk==110||liq()!=water||!here(bottle))
+l9150:         case 15:                        /* 9150: drink */
+                       if (obj == 0 && liqloc(loc) != water && (liq() != water
+                           || !here(bottle)))
+                               goto l8000;
+                       if (obj != 0 && obj != water)
+                               spk = 110;
+                       if (spk == 110 || liq() != water || !here(bottle))
                                goto l2011;
-                       prop[bottle]=1;
-                       place[water]=0;
-                       spk=74;
+                       prop[bottle] = 1;
+                       place[water] = 0;
+                       spk = 74;
                        goto l2011;
-                   case 16:                    /* 9160: rub            */
-                       if (obj!=lamp) spk=76;
+               case 16:                        /* 9160: rub */
+                       if (obj != lamp)
+                               spk = 76;
                        goto l2011;
-                   case 17:                    /* 9170: throw          */
-                       switch(trtoss())
-                       {   case 2011: goto l2011;
-                           case 9020: goto l9020;
-                           case 9120: goto l9120;
-                           case 8: goto l8;
-                           case 9210: goto l9210;
-                           default: bug(113);
+               case 17:                        /* 9170: throw */
+                       switch (trtoss()) {
+                       case 2011:
+                               goto l2011;
+                       case 9020:
+                               goto l9020;
+                       case 9120:
+                               goto l9120;
+                       case 8:
+                               goto l8;
+                       case 9210:
+                               goto l9210;
+                       default:
+                               bug(113);
                        }
-                   case 19: case 20:           /* 9190: find, invent   */
-                       if (at(obj)||(liq()==obj&&at(bottle))
-                               ||k==liqloc(loc)) spk=94;
-                       for (i=1; i<=5; i++)
-                               if (dloc[i]==loc&&dflag>=2&&obj==dwarf)
-                                       spk=94;
-                       if (closed) spk=138;
-                       if (toting(obj)) spk=24;
+               case 19:                        /* 9190: find */
+               case 20:                        /* invent */
+                       if (at(obj) || (liq() == obj && at(bottle))
+                           || k == liqloc(loc))
+                               spk = 94;
+                       for (i = 1; i <= 5; i++)
+                               if (dloc[i] == loc && dflag >= 2
+                                   && obj == dwarf)
+                                       spk = 94;
+                       if (closed)
+                               spk = 138;
+                       if (toting(obj))
+                               spk = 24;
                        goto l2011;
-       l9210:      case 21:                    /* feed                 */
-                       switch(trfeed())
-                       {   case 2011: goto l2011;
-                           default: bug(114);
+l9210:         case 21:                        /* feed */
+                       switch (trfeed()) {
+                       case 2011:
+                               goto l2011;
+                       default:
+                               bug(114);
                        }
-       l9220:      case 22:                    /* fill                 */
-                       switch(trfill())
-                       {   case 2011: goto l2011;
-                           case 8000: goto l8000;
-                           case 9020: goto l9020;
-                           default: bug(115);
+l9220:         case 22:                        /* fill */
+                       switch (trfill()) {
+                       case 2011:
+                               goto l2011;
+                       case 8000:
+                               goto l8000;
+                       case 9020:
+                               goto l9020;
+                       default:
+                               bug(115);
                        }
-       l9230:      case 23:                    /* blast                */
-                       if (prop[rod2]<0||!closed) goto l2011;
-                       bonus=133;
-                       if (loc==115) bonus=134;
-                       if (here(rod2)) bonus=135;
+l9230:         case 23:                        /* blast */
+                       if (prop[rod2] < 0 || !closed)
+                               goto l2011;
+                       bonus = 133;
+                       if (loc == 115)
+                               bonus = 134;
+                       if (here(rod2))
+                               bonus = 135;
                        rspeak(bonus);
                        done(2);
-       l9270:      case 27:                    /* read                 */
-                       if (dark()) goto l5190;
-                       if (obj==magzin) spk=190;
-                       if (obj==tablet) spk=196;
-                       if (obj==messag) spk=191;
-                       if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194;
-                       if (obj!=oyster||hinted[2]||!toting(oyster)
-                               ||!closed) goto l2011;
-                       hinted[2]=yes(192,193,54);
+l9270:         case 27:                        /* read */
+                       if (dark())
+                               goto l5190;
+                       if (obj == magzin)
+                               spk = 190;
+                       if (obj == tablet)
+                               spk = 196;
+                       if (obj == messag)
+                               spk = 191;
+                       if (obj == oyster && hinted[2] && toting(oyster))
+                               spk = 194;
+                       if (obj != oyster || hinted[2] || !toting(oyster)
+                           || !closed)
+                               goto l2011;
+                       hinted[2] = yes(192, 193, 54);
                        goto l2012;
-                   case 28:                    /* break                */
-                       if (obj==mirror) spk=148;
-                       if (obj==vase&&prop[vase]==0)
-                       {       spk=198;
-                               if (toting(vase)) drop(vase,loc);
-                               prop[vase]=2;
-                               fixed[vase]= -1;
+               case 28:                        /* 9280: break */
+                       if (obj == mirror)
+                               spk = 148;
+                       if (obj == vase && prop[vase] == 0) {
+                               spk = 198;
+                               if (toting(vase))
+                                       drop(vase, loc);
+                               prop[vase] = 2;
+                               fixed[vase] = -1;
                                goto l2011;
                        }
-                       if (obj!=mirror||!closed) goto l2011;
+                       if (obj != mirror || !closed)
+                               goto l2011;
                        rspeak(197);
                        done(3);
-
-                   case 29:                    /* wake                 */
-                       if (obj!=dwarf||!closed) goto l2011;
+               case 29:                        /* 9290: wake */
+                       if (obj != dwarf || !closed)
+                               goto l2011;
                        rspeak(199);
                        done(3);
 
-                   default: bug(24);
+               default:
+                       bug(24);
                }
 
-       l5000:
-               obj=k;
-               if (fixed[k]!=loc && !here(k)) goto l5100;
-       l5010:  if (*wd2!=0) goto l2800;
-               if (verb!=0) goto l4090;
-               printf("What do you want to do with the %s?\n",wd1);
+l5000:
+               obj = k;
+               if (fixed[k] != loc && !here(k))
+                       goto l5100;
+l5010:         if (wd2[0] != 0)
+                       goto l2800;
+               if (verb != 0)
+                       goto l4090;
+               printf("What do you want to do with the %s?\n", wd1);
                goto l2600;
-       l5100:  if (k!=grate) goto l5110;
-               if (loc==1||loc==4||loc==7) k=dprssn;
-               if (loc>9&&loc<15) k=entrnc;
-               if (k!=grate) goto l8;
-       l5110:  if (k!=dwarf) goto l5120;
-               for (i=1; i<=5; i++)
-                       if (dloc[i]==loc&&dflag>=2) goto l5010;
-       l5120:  if ((liq()==k&&here(bottle))||k==liqloc(loc)) goto l5010;
-               if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130;
-               obj=plant2;
+l5100:         if (k != grate)
+                       goto l5110;
+               if (loc == 1 || loc == 4 || loc == 7)
+                       k = dprssn;
+               if (loc > 9 && loc < 15)
+                       k = entrnc;
+               if (k != grate)
+                       goto l8;
+l5110:         if (k != dwarf)
+                       goto l5120;
+               for (i = 1; i <= 5; i++)
+                       if (dloc[i] == loc && dflag >= 2)
+                               goto l5010;
+l5120:         if ((liq() == k && here(bottle)) || k == liqloc(loc))
+                       goto l5010;
+               if (obj != plant || !at(plant2) || prop[plant2] == 0)
+                       goto l5130;
+               obj = plant2;
                goto l5010;
-       l5130:  if (obj!=knife||knfloc!=loc) goto l5140;
+l5130:         if (obj != knife || knfloc != loc)
+                       goto l5140;
                knfloc = -1;
-               spk=116;
+               spk = 116;
                goto l2011;
-       l5140:  if (obj!=rod||!here(rod2)) goto l5190;
-               obj=rod2;
+l5140:         if (obj != rod || !here(rod2))
+                       goto l5190;
+               obj = rod2;
                goto l5010;
-       l5190:  if ((verb==find||verb==invent)&&*wd2==0) goto l5010;
-               printf("I see no %s here\n",wd1);
+l5190:         if ((verb == find || verb == invent) && wd2[0] == 0)
+                       goto l5010;
+               printf("I see no %s here\n", wd1);
                goto l2012;
        }
 }
index a6a48a4..9693707 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
 #include <sys/types.h>
 #include "hdr.h"
 
-struct savestruct
-{
+struct savestruct {
        void *address;
        int width;
 };
 
 struct savestruct save_array[] =
 {
-       {&abbnum,        sizeof(abbnum)},
-       {&attack,        sizeof(attack)},
-       {&blklin,        sizeof(blklin)},
-       {&bonus,         sizeof(bonus)},
-       {&chloc,         sizeof(chloc)},
-       {&chloc2,        sizeof(chloc2)},
-       {&clock1,        sizeof(clock1)},
-       {&clock2,        sizeof(clock2)},
-       {&closed,        sizeof(closed)},
-       {&closng,        sizeof(closng)},
-       {&daltlc,        sizeof(daltlc)},
-       {&demo,          sizeof(demo)},
-       {&detail,        sizeof(detail)},
-       {&dflag,         sizeof(dflag)},
-       {&dkill,         sizeof(dkill)},
-       {&dtotal,        sizeof(dtotal)},
-       {&foobar,        sizeof(foobar)},
-       {&gaveup,        sizeof(gaveup)},
-       {&holdng,        sizeof(holdng)},
-       {&iwest,         sizeof(iwest)},
-       {&k,             sizeof(k)},
-       {&k2,            sizeof(k2)},
-       {&knfloc,        sizeof(knfloc)},
-       {&kq,            sizeof(kq)},
-       {&latncy,        sizeof(latncy)},
-       {&limit,         sizeof(limit)},
-       {&lmwarn,        sizeof(lmwarn)},
-       {&loc,           sizeof(loc)},
-       {&maxdie,        sizeof(maxdie)},
-       {&mxscor,        sizeof(mxscor)},
-       {&newloc,        sizeof(newloc)},
-       {&numdie,        sizeof(numdie)},
-       {&obj,           sizeof(obj)},
-       {&oldlc2,        sizeof(oldlc2)},
-       {&oldloc,        sizeof(oldloc)},
-       {&panic,         sizeof(panic)},
-       {&saved,         sizeof(saved)},
-       {&savet,         sizeof(savet)},
-       {&scorng,        sizeof(scorng)},
-       {&spk,           sizeof(spk)},
-       {&stick,         sizeof(stick)},
-       {&tally,         sizeof(tally)},
-       {&tally2,        sizeof(tally2)},
-       {&tkk,           sizeof(tkk)},
-       {&turns,         sizeof(turns)},
-       {&verb,          sizeof(verb)},
-       {&wd1,           sizeof(wd1)},
-       {&wd2,           sizeof(wd2)},
-       {&wzdark,        sizeof(wzdark)},
-       {&yea,           sizeof(yea)},
-       {atloc,          sizeof(atloc)},
-       {dloc,           sizeof(dloc)},
-       {dseen,          sizeof(dseen)},
-       {fixed,          sizeof(fixed)},
-       {hinted,         sizeof(hinted)},
-       {linkx,           sizeof(linkx)},
-       {odloc,          sizeof(odloc)},
-       {place,          sizeof(place)},
-       {prop,           sizeof(prop)},
-       {tk,             sizeof(tk)},
+       {&abbnum, sizeof(abbnum)},
+       {&attack, sizeof(attack)},
+       {&blklin, sizeof(blklin)},
+       {&bonus, sizeof(bonus)},
+       {&chloc, sizeof(chloc)},
+       {&chloc2, sizeof(chloc2)},
+       {&clock1, sizeof(clock1)},
+       {&clock2, sizeof(clock2)},
+       {&closed, sizeof(closed)},
+       {&closng, sizeof(closng)},
+       {&daltlc, sizeof(daltlc)},
+       {&demo, sizeof(demo)},
+       {&detail, sizeof(detail)},
+       {&dflag, sizeof(dflag)},
+       {&dkill, sizeof(dkill)},
+       {&dtotal, sizeof(dtotal)},
+       {&foobar, sizeof(foobar)},
+       {&gaveup, sizeof(gaveup)},
+       {&holdng, sizeof(holdng)},
+       {&iwest, sizeof(iwest)},
+       {&k, sizeof(k)},
+       {&k2, sizeof(k2)},
+       {&knfloc, sizeof(knfloc)},
+       {&kq, sizeof(kq)},
+       {&latncy, sizeof(latncy)},
+       {&limit, sizeof(limit)},
+       {&lmwarn, sizeof(lmwarn)},
+       {&loc, sizeof(loc)},
+       {&maxdie, sizeof(maxdie)},
+       {&mxscor, sizeof(mxscor)},
+       {&newloc, sizeof(newloc)},
+       {&numdie, sizeof(numdie)},
+       {&obj, sizeof(obj)},
+       {&oldlc2, sizeof(oldlc2)},
+       {&oldloc, sizeof(oldloc)},
+       {&panic, sizeof(panic)},
+       {&saved, sizeof(saved)},
+       {&savet, sizeof(savet)},
+       {&scorng, sizeof(scorng)},
+       {&spk, sizeof(spk)},
+       {&stick, sizeof(stick)},
+       {&tally, sizeof(tally)},
+       {&tally2, sizeof(tally2)},
+       {&tkk, sizeof(tkk)},
+       {&turns, sizeof(turns)},
+       {&verb, sizeof(verb)},
+       {&wd1, sizeof(wd1)},
+       {&wd2, sizeof(wd2)},
+       {&wzdark, sizeof(wzdark)},
+       {&yea, sizeof(yea)},
+       {atloc, sizeof(atloc)},
+       {dloc, sizeof(dloc)},
+       {dseen, sizeof(dseen)},
+       {fixed, sizeof(fixed)},
+       {hinted, sizeof(hinted)},
+       {linkx, sizeof(linkx)},
+       {odloc, sizeof(odloc)},
+       {place, sizeof(place)},
+       {prop, sizeof(prop)},
+       {tk, sizeof(tk)},
 
-       {NULL,   0}
+       {NULL, 0}
 };
 
-/* Two passes on data: first to get checksum, second */
-/* to output the data using checksum to start random #s */
+/*
+ * Two passes on data: first to get checksum, second
+ * to output the data using checksum to start random #s
+ */
 int
 save(const char *outfile)
 {
@@ -131,21 +128,18 @@ save(const char *outfile)
        crc_start();
        for (p = save_array; p->address != NULL; p++)
                sum = crc(p->address, p->width);
-       srandom((int) sum);
+       srandom(sum);
 
-       if ((out = fopen(outfile, "wb")) == NULL)
-       {
-           fprintf(stderr,
-               "Hmm.  The name \"%s\" appears to be magically blocked.\n",
-               outfile);
-           return 1;
+       if ((out = fopen(outfile, "wb")) == NULL) {
+               fprintf(stderr,
+                   "Hmm.  The name \"%s\" appears to be magically blocked.\n",
+                   outfile);
+               return 1;
        }
-
-       fwrite(&sum, sizeof(sum), 1, out);      /* Here's the random() key */
-       for (p = save_array; p->address != NULL; p++)
-       {
+       fwrite(&sum, sizeof(sum), 1, out);      /* Here's the random() key */
+       for (p = save_array; p->address != NULL; p++) {
                for (s = p->address, i = 0; i < p->width; i++, s++)
-                       *s = (*s ^ random()) & 0xFF;      /* Lightly encrypt */
+                       *s = (*s ^ random()) & 0xFF;    /* Lightly encrypt */
                fwrite(p->address, p->width, 1, out);
        }
        fclose(out);
@@ -162,29 +156,26 @@ restore(const char *infile)
        int i;
 
        cksum = 0;
-       if ((in = fopen(infile, "rb")) == NULL)
-       {
-           fprintf(stderr,
-               "Hmm.  The file \"%s\" appears to be magically blocked.\n",
-               infile);
-           return 1;
+       if ((in = fopen(infile, "rb")) == NULL) {
+               fprintf(stderr,
+                   "Hmm.  The file \"%s\" appears to be magically blocked.\n",
+                   infile);
+               return 1;
        }
-
-       fread(&sum, sizeof(sum), 1, in);        /* Get the seed */
-       srandom((int) sum);
-       for (p = save_array; p->address != NULL; p++)
-       {
+       fread(&sum, sizeof(sum), 1, in);        /* Get the seed */
+       srandom(sum);
+       for (p = save_array; p->address != NULL; p++) {
                fread(p->address, p->width, 1, in);
                for (s = p->address, i = 0; i < p->width; i++, s++)
-                       *s = (*s ^ random()) & 0xFF;  /* Lightly decrypt */
+                       *s = (*s ^ random()) & 0xFF;    /* Lightly decrypt */
        }
        fclose(in);
 
-       crc_start();                            /* See if she cheated */
+       crc_start();            /* See if she cheated */
        for (p = save_array; p->address != NULL; p++)
                cksum = crc(p->address, p->width);
-       if (sum != cksum)                       /* Tsk tsk */
-           return 2;                           /* Altered the file */
+       if (sum != cksum)       /* Tsk tsk */
+               return 2;       /* Altered the file */
        /* We successfully restored, so this really was a save file */
        /* Get rid of the file, but don't bother checking that we did */
        return 0;
index a83911a..1217872 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
 #include <stdio.h>
 #include <stdlib.h>
 #include <err.h>
-#include "hdr.h"        /* SEED lives in there; keep them coordinated. */
+#include "hdr.h"       /* SEED lives in there; keep them coordinated. */
 
 #define USAGE "Usage: setup file > data.c (file is typically glorkz)"
 
 #define YES 1
 #define NO  0
 
-#define LINE 10         /* How many values do we get on a line? */
+#define LINE 10                /* How many values do we get on a line? */
 
 int
 main(int argc, char **argv)
@@ -70,7 +66,8 @@ main(int argc, char **argv)
        FILE *infile;
        int c, count, linestart;
 
-       if (argc != 2) errx(1, USAGE);
+       if (argc != 2)
+               errx(1, USAGE);
 
        if ((infile = fopen(argv[1], "r")) == NULL)
                err(1, "Can't read file %s", argv[1]);
@@ -83,10 +80,8 @@ main(int argc, char **argv)
        count = 0;
        linestart = YES;
 
-       while ((c = getc(infile)) != EOF)
-       {
-               if (linestart && c == ' ') /* Convert first spaces to tab */
-               {
+       while ((c = getc(infile)) != EOF) {
+               if (linestart && c == ' ') {    /* Convert first spaces to tab */
                        if (count++ % LINE == 0)
                                printf("\n\t");
                        printf("0x%02lx,", ('\t' ^ random()) & 0xFF);
@@ -94,12 +89,11 @@ main(int argc, char **argv)
                        /* Drop the non-whitespace character through */
                        linestart = NO;
                }
-               switch(c)
-               {
-                   case '\t':
+               switch (c) {
+               case '\t':
                        linestart = NO; /* Don't need to convert spaces */
                        break;
-                   case '\n':
+               case '\n':
                        linestart = YES; /* Ready to convert spaces again */
                        break;
                }
index a4276d9..13480c2 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * $DragonFly: src/games/adventure/subr.c,v 1.4 2007/04/18 18:32:12 swildner Exp $
  */
 
-/*      Re-coding of advent in C: subroutines from main                 */
+/* Re-coding of advent in C: subroutines from main */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include "hdr.h"
 
-static void badmove (void);
-static int bitset (int,int);
-static int dropper (void);
-static int liq2 (int);
-static int mback (void);
-static int specials (void);
-static int trbridge (void);
+static void badmove(void);
+static int bitset(int, int);
+static int dropper(void);
+static int liq2(int);
+static int mback(void);
+static int specials(void);
+static int trbridge(void);
 
-/*              Statement functions     */
+/* Statement functions */
 int
 toting(int objj)
-{       if (place[objj] == -1) return(TRUE);
-       else return(FALSE);
+{
+       if (place[objj] == -1)
+               return (TRUE);
+       else
+               return (FALSE);
 }
 
 int
 here(int objj)
-{       if (place[objj]==loc || toting(objj)) return(TRUE);
-       else return(FALSE);
+{
+       if (place[objj] == loc || toting(objj))
+               return (TRUE);
+       else
+               return (FALSE);
 }
 
 int
 at(int objj)
-{       if (place[objj]==loc || fixed[objj]==loc) return(TRUE);
-       else return (FALSE);
+{
+       if (place[objj] == loc || fixed[objj] == loc)
+               return (TRUE);
+       else
+               return (FALSE);
 }
 
 static int
 liq2(int pbotl)
-{       return((1-pbotl)*water+(pbotl/2)*(water+oil));
+{
+       return ((1 - pbotl) * water + (pbotl / 2) * (water + oil));
 }
 
 int
 liq(void)
-{       int i;
-       i=prop[bottle];
-       if (i>-1-i) return(liq2(i));
-       else return(liq2(-1-i));
+{
+       int i;
+       i = prop[bottle];
+       if (i > -1 - i)
+               return (liq2(i));
+       else
+               return (liq2(-1 - i));
 }
 
 /* may want to clean this one up a bit */
 int
 liqloc(int locc)
-{       int i,j,l;
-       i=cond[locc]/2;
-       j=((i*2)%8)-5;
-       l=cond[locc]/4;
-       l=l%2;
-       return(liq2(j*l+1));
+{
+       int i, j, l;
+       i = cond[locc] / 2;
+       j = ((i * 2) % 8) - 5;
+       l = cond[locc] / 4;
+       l = l % 2;
+       return (liq2(j * l + 1));
 }
 
 static int
 bitset(int l, int n)
-{       if (cond[l] & setbit[n]) return(TRUE);
-       return(FALSE);
+{
+       if (cond[l] & setbit[n])
+               return (TRUE);
+       return (FALSE);
 }
 
 int
 forced(int locc)
-{       if (cond[locc]==2) return(TRUE);
-       return(FALSE);
+{
+       if (cond[locc] == 2)
+               return (TRUE);
+       return (FALSE);
 }
 
 int
 dark(void)
-{       if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp)))
-               return(TRUE);
-       return(FALSE);
+{
+       if ((cond[loc] % 2) == 0 && (prop[lamp] == 0 || !here(lamp)))
+               return (TRUE);
+       return (FALSE);
 }
 
 int
 pct(int n)
-{       if (ran(100)<n) return(TRUE);
-       return(FALSE);
+{
+       if (ran(100) < n)
+               return (TRUE);
+       return (FALSE);
 }
 
-
 /* 71 */
 int
 fdwarf(void)
-{      int i,j;
+{
+       int i, j;
        struct travlist *kk;
 
-       if (newloc!=loc&&!forced(loc)&&!bitset(loc,3))
-       {       for (i=1; i<=5; i++)
-               {       if (odloc[i]!=newloc||!dseen[i]) continue;
-                       newloc=loc;
+       if (newloc != loc && !forced(loc) && !bitset(loc, 3)) {
+               for (i = 1; i <= 5; i++) {
+                       if (odloc[i] != newloc || !dseen[i])
+                               continue;
+                       newloc = loc;
                        rspeak(2);
                        break;
                }
        }
-       loc=newloc;                     /* 74 */
-       if (loc==0||forced(loc)||bitset(newloc,3)) return(2000);
-       if (dflag==0)
-       {       if (loc>=15) dflag=1;
-               return(2000);
-       }
-       if (dflag==1)           /* 6000 */
-       {       if (loc<15||pct(95)) return(2000);
-               dflag=2;
-               for (i=1; i<=2; i++)
-               {       j=1+ran(5);
-                       if (pct(50)&&saved== -1) dloc[j]=0; /* 6001 */
+       loc = newloc;                                   /* 74 */
+       if (loc == 0 || forced(loc) || bitset(newloc, 3))
+               return (2000);
+       if (dflag == 0) {
+               if (loc >= 15)
+                       dflag = 1;
+               return (2000);
+       }
+       if (dflag == 1) {                               /* 6000 */
+               if (loc < 15 || pct(95))
+                       return (2000);
+               dflag = 2;
+               for (i = 1; i <= 2; i++) {
+                       j = 1 + ran(5);
+                       if (pct(50) && saved == -1)
+                               dloc[j] = 0;            /* 6001 */
                }
-               for (i=1; i<=5; i++)
-               {       if (dloc[i]==loc) dloc[i]=daltlc;
-                       odloc[i]=dloc[i];               /* 6002 */
+               for (i = 1; i <= 5; i++) {
+                       if (dloc[i] == loc)
+                               dloc[i] = daltlc;
+                       odloc[i] = dloc[i];             /* 6002 */
                }
                rspeak(3);
-               drop(axe,loc);
-               return(2000);
-       }
-       dtotal=attack=stick=0;                  /* 6010 */
-       for (i=1; i<=6; i++)                    /* loop to 6030 */
-       {       if (dloc[i]==0) continue;
-               j=1;
-               for (kk=travel[dloc[i]]; kk!=0; kk=kk->next)
-               {       newloc=kk->tloc;
-                       if (newloc>300||newloc<15||newloc==odloc[i]
-                           ||(j>1&&newloc==tk[j-1])||j>=20
-                           ||newloc==dloc[i]||forced(newloc)
-                           ||(i==6&&bitset(newloc,3))
-                           ||kk->conditions==100) continue;
-                       tk[j++]=newloc;
+               drop(axe, loc);
+               return (2000);
+       }
+       dtotal = attack = stick = 0;                    /* 6010 */
+       for (i = 1; i <= 6; i++) {                      /* loop to 6030 */
+               if (dloc[i] == 0)
+                       continue;
+               j = 1;
+               for (kk = travel[dloc[i]]; kk != 0; kk = kk->next) {
+                       newloc = kk->tloc;
+                       if (newloc > 300 || newloc < 15 || newloc == odloc[i]
+                           || (j > 1 && newloc == tk[j - 1]) || j >= 20
+                           || newloc == dloc[i] || forced(newloc)
+                           || (i == 6 && bitset(newloc, 3))
+                           || kk->conditions == 100)
+                               continue;
+                       tk[j++] = newloc;
                }
-               tk[j]=odloc[i];                 /* 6016 */
-               if (j>=2) j--;
-               j=1+ran(j);
-               odloc[i]=dloc[i];
-               dloc[i]=tk[j];
-               dseen[i]=(dseen[i]&&loc>=15)||(dloc[i]==loc||odloc[i]==loc);
-               if (!dseen[i]) continue;        /* i.e. goto 6030 */
-               dloc[i]=loc;
-               if (i==6)                       /* pirate's spotted him */
-               {       if (loc==chloc||prop[chest]>=0) continue;
-                       k=0;
-                       for (j=50; j<=maxtrs; j++)      /* loop to 6020 */
-                       {       if (j==pyram&&(loc==plac[pyram]
-                                    || loc==plac[emrald])) goto l6020;
-                               if (toting(j)) goto l6022;
-                       l6020:  if (here(j)) k=1;
-                       }                               /* 6020 */
-                       if (tally==tally2+1 && k==0 && place[chest]==0
-                           &&here(lamp) && prop[lamp]==1) goto l6025;
-                       if (odloc[6]!=dloc[6]&&pct(20))
+               tk[j] = odloc[i];                       /* 6016 */
+               if (j >= 2)
+                       j--;
+               j = 1 + ran(j);
+               odloc[i] = dloc[i];
+               dloc[i] = tk[j];
+               dseen[i] = (dseen[i] && loc >= 15) ||
+                   (dloc[i] == loc || odloc[i] == loc);
+               if (!dseen[i])                          /* i.e. goto 6030 */
+                       continue;
+               dloc[i] = loc;
+               if (i == 6) {                           /* pirate's spotted him */
+                       if (loc == chloc || prop[chest] >= 0)
+                               continue;
+                       k = 0;
+                       for (j = 50; j <= maxtrs; j++) { /* loop to 6020 */
+                               if (j == pyram && (loc == plac[pyram]
+                                   || loc == plac[emrald]))
+                                       goto l6020;
+                               if (toting(j))
+                                       goto l6022;
+l6020:                         if (here(j))
+                                       k = 1;
+                       }                               /* 6020 */
+                       if (tally == tally2 + 1 && k == 0 && place[chest] == 0
+                           && here(lamp) && prop[lamp] == 1)
+                               goto l6025;
+                       if (odloc[6] != dloc[6] && pct(20))
                                rspeak(127);
-                       continue;       /* to 6030 */
-               l6022:  rspeak(128);
-                       if (place[messag]==0) move(chest,chloc);
-                       move(messag,chloc2);
-                       for (j=50; j<=maxtrs; j++)      /* loop to 6023 */
-                       {       if (j==pyram && (loc==plac[pyram]
-                                   || loc==plac[emrald])) continue;
-                               if (at(j)&&fixed[j]==0) carry(j,loc);
-                               if (toting(j)) drop(j,chloc);
+                       continue;                       /* to 6030 */
+l6022:                 rspeak(128);
+                       if (place[messag] == 0)
+                               move(chest, chloc);
+                       move(messag, chloc2);
+                       for (j = 50; j <= maxtrs; j++) { /* loop to 6023 */
+                               if (j == pyram && (loc == plac[pyram]
+                                   || loc == plac[emrald]))
+                                       continue;
+                               if (at(j) && fixed[j] == 0)
+                                       carry(j, loc);
+                               if (toting(j))
+                                       drop(j, chloc);
                        }
-               l6024:  dloc[6]=odloc[6]=chloc;
-                       dseen[6]=FALSE;
+l6024:                 dloc[6] = odloc[6] = chloc;
+                       dseen[6] = FALSE;
                        continue;
-               l6025:  rspeak(186);
-                       move(chest,chloc);
-                       move(messag,chloc2);
+l6025:                 rspeak(186);
+                       move(chest, chloc);
+                       move(messag, chloc2);
                        goto l6024;
                }
-               dtotal++;                       /* 6027 */
-               if (odloc[i]!=dloc[i]) continue;
+               dtotal++;                               /* 6027 */
+               if (odloc[i] != dloc[i])
+                       continue;
                attack++;
-               if (knfloc>=0) knfloc=loc;
-               if (ran(1000)<95*(dflag-2)) stick++;
-       }                                       /* 6030 */
-       if (dtotal==0) return(2000);
-       if (dtotal!=1)
-       {       printf("There are %d threatening little dwarves ",dtotal);
+               if (knfloc >= 0)
+                       knfloc = loc;
+               if (ran(1000) < 95 * (dflag - 2))
+                       stick++;
+       }                                               /* 6030 */
+       if (dtotal == 0)
+               return (2000);
+       if (dtotal != 1) {
+               printf("There are %d threatening little dwarves ", dtotal);
                printf("in the room with you.\n");
-       }
-       else rspeak(4);
-       if (attack==0) return(2000);
-       if (dflag==2) dflag=3;
-       if (saved!= -1) dflag=20;
-       if (attack!=1)
-       {       printf("%d of them throw knives at you!\n",attack);
-               k=6;
-       l82:    if (stick<=1)                   /* 82 */
-               {       rspeak(k+stick);
-                       if (stick==0) return(2000);
-               }
-               else
-                       printf("%d of them get you!\n",stick);  /* 83 */
-               oldlc2=loc;
-               return(99);
+       } else
+               rspeak(4);
+       if (attack == 0)
+               return (2000);
+       if (dflag == 2)
+               dflag = 3;
+       if (saved != -1)
+               dflag = 20;
+       if (attack != 1) {
+               printf("%d of them throw knives at you!\n", attack);
+               k = 6;
+l82:           if (stick <= 1) {                       /* 82 */
+                       rspeak(k + stick);
+                       if (stick == 0)
+                               return (2000);
+               } else
+                       printf("%d of them get you!\n", stick); /* 83 */
+               oldlc2 = loc;
+               return (99);
        }
        rspeak(5);
-       k=52;
+       k = 52;
        goto l82;
 }
 
-
-/* label 8              */
+/* label 8 */
 int
 march(void)
-{       int ll1,ll2;
-
-       if ((tkk=travel[newloc=loc])==0) bug(26);
-       if (k==null) return(2);
-       if (k==cave)                            /* 40                   */
-       {       if (loc<8) rspeak(57);
-               if (loc>=8) rspeak(58);
-               return(2);
-       }
-       if (k==look)                            /* 30                   */
-       {       if (detail++<3) rspeak(15);
-               wzdark=FALSE;
-               abb[loc]=0;
-               return(2);
-       }
-       if (k==back)                            /* 20                   */
-       {       switch(mback())
-               {       case 2: return(2);
-                       case 9: goto l9;
-                       default: bug(100);
+{
+       int ll1, ll2;
+
+       if ((tkk = travel[newloc = loc]) == 0)
+               bug(26);
+       if (k == null)
+               return (2);
+       if (k == cave) {                                /* 40 */
+               if (loc < 8)
+                       rspeak(57);
+               if (loc >= 8)
+                       rspeak(58);
+               return (2);
+       }
+       if (k == look) {                                /* 30 */
+               if (detail++ < 3)
+                       rspeak(15);
+               wzdark = FALSE;
+               abb[loc] = 0;
+               return (2);
+       }
+       if (k == back) {                                /* 20 */
+               switch (mback()) {
+               case 2:
+                       return (2);
+               case 9:
+                       goto l9;
+               default:
+                       bug(100);
                }
        }
-       oldlc2=oldloc;
-       oldloc=loc;
+       oldlc2 = oldloc;
+       oldloc = loc;
 l9:
-       for (; tkk!=0; tkk=tkk->next)
-               if (tkk->tverb==1 || tkk->tverb==k) break;
-       if (tkk==0)
-       {       badmove();
-               return(2);
-       }
-l11:    ll1=tkk->conditions;                    /* 11                   */
-       ll2=tkk->tloc;
-       newloc=ll1;                             /* newloc=conditions    */
-       k=newloc%100;                           /* k used for prob      */
-       if (newloc<=300)
-       {       if (newloc<=100)                /* 13                   */
-               {       if (newloc!=0&&!pct(newloc)) goto l12;  /* 14   */
-               l16:    newloc=ll2;             /* newloc=location      */
-                       if (newloc<=300) return(2);
-                       if (newloc<=500)
-                               switch(specials())/* to 30000           */
-                               {   case 2: return(2);
-                                   case 12: goto l12;
-                                   case 99: return(99);
-                                   default: bug(101);
+       for (; tkk != 0; tkk = tkk->next)
+               if (tkk->tverb == 1 || tkk->tverb == k)
+                       break;
+       if (tkk == 0) {
+               badmove();
+               return (2);
+       }
+l11:   ll1 = tkk->conditions;                          /* 11 */
+       ll2 = tkk->tloc;
+       newloc = ll1;                                   /* newloc=conditions */
+       k = newloc % 100;                               /* k used for prob */
+       if (newloc <= 300) {
+               if (newloc <= 100) {                    /* 13 */
+                       if (newloc != 0 && !pct(newloc)) /* 14 */
+                               goto l12;
+l16:                   newloc = ll2;                   /* newloc=location */
+                       if (newloc <= 300)
+                               return (2);
+                       if (newloc <= 500)
+                               switch (specials()) {   /* to 30000 */
+                               case 2:
+                                       return (2);
+                               case 12:
+                                       goto l12;
+                               case 99:
+                                       return (99);
+                               default:
+                                       bug(101);
                                }
-                       rspeak(newloc-500);
-                       newloc=loc;
-                       return(2);
+                       rspeak(newloc - 500);
+                       newloc = loc;
+                       return (2);
                }
-               if (toting(k)||(newloc>200&&at(k))) goto l16;
+               if (toting(k) || (newloc > 200 && at(k)))
+                       goto l16;
                goto l12;
        }
-       if (prop[k]!=(newloc/100)-3) goto l16;  /* newloc still conditions*/
-l12:    /* alternative to probability move      */
-       for (; tkk!=0; tkk=tkk->next)
-               if (tkk->tloc!=ll2 || tkk->conditions!=ll1) break;
-       if (tkk==0) bug(25);
+       if (prop[k] != (newloc / 100) - 3)      /* newloc still conditions */
+               goto l16;
+l12:                                   /* alternative to probability move */
+       for (; tkk != 0; tkk = tkk->next)
+               if (tkk->tloc != ll2 || tkk->conditions != ll1)
+                       break;
+       if (tkk == 0)
+               bug(25);
        goto l11;
 }
 
-
-/* 20                   */
+/* 20 */
 static int
 mback(void)
-{       struct travlist *tk2,*j;
+{
+       struct travlist *tk2, *j;
        int ll;
-       if (forced(k=oldloc)) k=oldlc2;         /* k=location           */
-       oldlc2=oldloc;
-       oldloc=loc;
-       tk2=0;
-       if (k==loc)
-       {       rspeak(91);
-               return(2);
-       }
-       for (; tkk!=0; tkk=tkk->next)           /* 21                   */
-       {       ll=tkk->tloc;
-               if (ll==k)
-               {       k=tkk->tverb;           /* k back to verb       */
-                       tkk=travel[loc];
-                       return(9);
+
+       if (forced(k = oldloc))                         /* k=location */
+               k = oldlc2;
+       oldlc2 = oldloc;
+       oldloc = loc;
+       tk2 = 0;
+       if (k == loc) {
+               rspeak(91);
+               return (2);
+       }
+       for (; tkk != 0; tkk = tkk->next) {             /* 21 */
+               ll = tkk->tloc;
+               if (ll == k) {
+                       k = tkk->tverb;                 /* k back to verb */
+                       tkk = travel[loc];
+                       return (9);
                }
-               if (ll<=300)
-               {       j=travel[loc];
-                       if (forced(ll) && k==j->tloc) tk2=tkk;
+               if (ll <= 300) {
+                       j = travel[loc];
+                       if (forced(ll) && k == j->tloc)
+                               tk2 = tkk;
                }
        }
-       tkk=tk2;                                /* 23                   */
-       if (tkk!=0)
-       {       k=tkk->tverb;
-               tkk=travel[loc];
-               return(9);
+       tkk = tk2;                                      /* 23 */
+       if (tkk != 0) {
+               k = tkk->tverb;
+               tkk = travel[loc];
+               return (9);
        }
        rspeak(140);
-       return(2);
+       return (2);
 }
 
-
-/* 30000                */
+/* 30000 */
 static int
 specials(void)
-{       switch(newloc -= 300)
-       {   case 1:                             /* 30100                */
-               newloc = 99+100-loc;
-               if (holdng==0||(holdng==1&&toting(emrald))) return(2);
-               newloc=loc;
+{
+       switch (newloc -= 300) {
+       case 1:                                         /* 30100 */
+               newloc = 99 + 100 - loc;
+               if (holdng == 0 || (holdng == 1 && toting(emrald)))
+                       return (2);
+               newloc = loc;
                rspeak(117);
-               return(2);
-           case 2:                             /* 30200                */
-               drop(emrald,loc);
-               return(12);
-           case 3:                             /* to 30300             */
-               return(trbridge());
-           default: bug(29);
+               return (2);
+       case 2:                                         /* 30200 */
+               drop(emrald, loc);
+               return (12);
+       case 3:                                         /* to 30300 */
+               return (trbridge());
+       default:
+               bug(29);
        }
        /* NOTREACHED */
-       return(-1);
+       return (-1);
 }
 
-
-/* 30300                */
+/* 30300 */
 static int
 trbridge(void)
-{       if (prop[troll]==1)
-       {       pspeak(troll,1);
-               prop[troll]=0;
-               move(troll2,0);
-               move(troll2+100,0);
-               move(troll,plac[troll]);
-               move(troll+100,fixd[troll]);
+{
+       if (prop[troll] == 1) {
+               pspeak(troll, 1);
+               prop[troll] = 0;
+               move(troll2, 0);
+               move(troll2 + 100, 0);
+               move(troll, plac[troll]);
+               move(troll + 100, fixd[troll]);
                juggle(chasm);
-               newloc=loc;
-               return(2);
+               newloc = loc;
+               return (2);
        }
-       newloc=plac[troll]+fixd[troll]-loc;     /* 30310                */
-       if (prop[troll]==0) prop[troll]=1;
-       if (!toting(bear)) return(2);
+       newloc = plac[troll] + fixd[troll] - loc;       /* 30310 */
+       if (prop[troll] == 0)
+               prop[troll] = 1;
+       if (!toting(bear))
+               return (2);
        rspeak(162);
-       prop[chasm]=1;
-       prop[troll]=2;
-       drop(bear,newloc);
+       prop[chasm] = 1;
+       prop[troll] = 2;
+       drop(bear, newloc);
        fixed[bear] = -1;
-       prop[bear]=3;
-       if (prop[spices]<0) tally2++;
-       oldlc2=newloc;
-       return(99);
+       prop[bear] = 3;
+       if (prop[spices] < 0)
+               tally2++;
+       oldlc2 = newloc;
+       return (99);
 }
 
-
-/* 20                   */
+/* 20 */
 static void
 badmove(void)
-{       spk=12;
-       if (k>=43 && k<=50) spk=9;
-       if (k==29||k==30) spk=9;
-       if (k==7||k==36||k==37) spk=10;
-       if (k==11||k==19) spk=11;
-       if (verb==find||verb==invent) spk=59;
-       if (k==62||k==65) spk=42;
-       if (k==17) spk=80;
+{
+       spk = 12;
+       if (k >= 43 && k <= 50)
+               spk = 9;
+       if (k == 29 || k == 30)
+               spk = 9;
+       if (k == 7 || k == 36 || k == 37)
+               spk = 10;
+       if (k == 11 || k == 19)
+               spk = 11;
+       if (verb == find || verb == invent)
+               spk = 59;
+       if (k == 62 || k == 65)
+               spk = 42;
+       if (k == 17)
+               spk = 80;
        rspeak(spk);
 }
 
 int
 bug(int n)
-{       printf("Please tell jim@rand.org that fatal bug %d happened.\n",n);
+{
+       printf("Please tell jim@rand.org that fatal bug %d happened.\n", n);
        exit(1);
 }
 
-
-/* 2600 &c              */
+/* 2600 etc */
 void
 checkhints(void)
-{       int hint;
-       for (hint=4; hint<=hntmax; hint++)
-       {       if (hinted[hint]) continue;
-               if (!bitset(loc,hint)) hintlc[hint]= -1;
+{
+       int hint;
+
+       for (hint = 4; hint <= hntmax; hint++) {
+               if (hinted[hint])
+                       continue;
+               if (!bitset(loc, hint))
+                       hintlc[hint] = -1;
                hintlc[hint]++;
-               if (hintlc[hint]<hints[hint][1]) continue;
-               switch(hint)
-               {   case 4:     /* 40400 */
-                       if (prop[grate]==0&&!here(keys)) goto l40010;
+               if (hintlc[hint] < hints[hint][1])
+                       continue;
+               switch (hint) {
+               case 4:                                 /* 40400 */
+                       if (prop[grate] == 0 && !here(keys))
+                               goto l40010;
                        goto l40020;
-                   case 5:     /* 40500 */
-                       if (here(bird)&&toting(rod)&&obj==bird) goto l40010;
-                       continue;      /* i.e. goto l40030 */
-                   case 6:     /* 40600 */
-                       if (here(snake)&&!here(bird)) goto l40010;
+               case 5:                                 /* 40500 */
+                       if (here(bird) && toting(rod) && obj == bird)
+                               goto l40010;
+                       continue;                       /* i.e. goto l40030 */
+               case 6:                                 /* 40600 */
+                       if (here(snake) && !here(bird))
+                               goto l40010;
                        goto l40020;
-                   case 7:     /* 40700 */
-                       if (atloc[loc]==0&&atloc[oldloc]==0
-                           && atloc[oldlc2]==0&&holdng>1) goto l40010;
+               case 7:                                 /* 40700 */
+                       if (atloc[loc] == 0 && atloc[oldloc] == 0
+                           && atloc[oldlc2] == 0 && holdng > 1)
+                               goto l40010;
                        goto l40020;
-                   case 8:     /* 40800 */
-                       if (prop[emrald]!= -1&&prop[pyram]== -1) goto l40010;
+               case 8:                                 /* 40800 */
+                       if (prop[emrald] != -1 && prop[pyram] == -1)
+                               goto l40010;
                        goto l40020;
-                   case 9:
-                       goto l40010;    /* 40900 */
-                   default: bug(27);
+               case 9:                                 /* 40900 */
+                       goto l40010;
+               default:
+                       bug(27);
                }
-       l40010: hintlc[hint]=0;
-               if (!yes(hints[hint][3],0,54)) continue;
+l40010:                hintlc[hint] = 0;
+               if (!yes(hints[hint][3], 0, 54))
+                       continue;
                printf("I am prepared to give you a hint, but it will ");
-               printf("cost you %d points.\n",hints[hint][2]);
-               hinted[hint]=yes(175,hints[hint][4],54);
-       l40020: hintlc[hint]=0;
+               printf("cost you %d points.\n", hints[hint][2]);
+               hinted[hint] = yes(175, hints[hint][4], 54);
+l40020:                hintlc[hint] = 0;
        }
 }
 
-
-/* 9030                 */
+/* 9030 */
 int
 trsay(void)
-{       int i;
-       if (*wd2!=0) strcpy(wd1,wd2);
-       i=vocab(wd1,-1,0);
-       if (i==62||i==65||i==71||i==2025)
-       {       *wd2=0;
-               obj=0;
-               return(2630);
-       }
-       printf("\nOkay, \"%s\".\n",wd2);
-       return(2012);
-}
+{
+       int i;
 
+       if (wd2[0] != 0)
+               strcpy(wd1, wd2);
+       i = vocab(wd1, -1, 0);
+       if (i == 62 || i == 65 || i == 71 || i == 2025) {
+               wd2[0] = 0;
+               obj = 0;
+               return (2630);
+       }
+       printf("\nOkay, \"%s\".\n", wd2);
+       return (2012);
+}
 
-/* 9010                 */
+/* 9010 */
 int
 trtake(void)
 {
-       if (toting(obj)) return(2011);  /* 9010 */
-       spk=25;
-       if (obj==plant&&prop[plant]<=0) spk=115;
-       if (obj==bear&&prop[bear]==1) spk=169;
-       if (obj==chain&&prop[bear]!=0) spk=170;
-       if (fixed[obj]!=0) return(2011);
-       if (obj==water||obj==oil)
-       {       if (here(bottle)&&liq()==obj)
-               {       obj=bottle;
+       if (toting(obj))                                /* 9010 */
+               return (2011);
+       spk = 25;
+       if (obj == plant && prop[plant] <= 0)
+               spk = 115;
+       if (obj == bear && prop[bear] == 1)
+               spk = 169;
+       if (obj == chain && prop[bear] != 0)
+               spk = 170;
+       if (fixed[obj] != 0)
+               return (2011);
+       if (obj == water || obj == oil) {
+               if (here(bottle) && liq() == obj) {
+                       obj = bottle;
                        goto l9017;
                }
-               obj=bottle;
-               if (toting(bottle)&&prop[bottle]==1)
-                       return(9220);
-               if (prop[bottle]!=1) spk=105;
-               if (!toting(bottle)) spk=104;
-               return(2011);
-       }
-l9017:  if (holdng>=7)
-       {       rspeak(92);
-               return(2012);
-       }
-       if (obj==bird)
-       {       if (prop[bird]!=0) goto l9014;
-               if (toting(rod))
-               {       rspeak(26);
-                       return(2012);
+               obj = bottle;
+               if (toting(bottle) && prop[bottle] == 1)
+                       return (9220);
+               if (prop[bottle] != 1)
+                       spk = 105;
+               if (!toting(bottle))
+                       spk = 104;
+               return (2011);
+       }
+l9017: if (holdng >= 7) {
+               rspeak(92);
+               return (2012);
+       }
+       if (obj == bird) {
+               if (prop[bird] != 0)
+                       goto l9014;
+               if (toting(rod)) {
+                       rspeak(26);
+                       return (2012);
                }
-               if (!toting(cage))      /* 9013 */
-               {       rspeak(27);
-                       return(2012);
+               if (!toting(cage)) {                    /* 9013 */
+                       rspeak(27);
+                       return (2012);
                }
-               prop[bird]=1;           /* 9015 */
-       }
-l9014:  if ((obj==bird||obj==cage)&&prop[bird]!=0)
-               carry(bird+cage-obj,loc);
-       carry(obj,loc);
-       k=liq();
-       if (obj==bottle && k!=0) place[k] = -1;
-       return(2009);
+               prop[bird] = 1;                         /* 9015 */
+       }
+l9014: if ((obj == bird || obj == cage) && prop[bird] != 0)
+               carry(bird + cage - obj, loc);
+       carry(obj, loc);
+       k = liq();
+       if (obj == bottle && k != 0)
+               place[k] = -1;
+       return (2009);
 }
 
-
-/* 9021                 */
+/* 9021 */
 static int
 dropper(void)
-{       k=liq();
-       if (k==obj) obj=bottle;
-       if (obj==bottle&&k!=0) place[k]=0;
-       if (obj==cage&&prop[bird]!=0) drop(bird,loc);
-       if (obj==bird) prop[bird]=0;
-       drop(obj,loc);
-       return(2012);
+{
+       k = liq();
+       if (k == obj)
+               obj = bottle;
+       if (obj == bottle && k != 0)
+               place[k] = 0;
+       if (obj == cage && prop[bird] != 0)
+               drop(bird, loc);
+       if (obj == bird)
+               prop[bird] = 0;
+       drop(obj, loc);
+       return (2012);
 }
 
-/* 9020                 */
+/* 9020 */
 int
 trdrop(void)
 {
-       if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
-       if (!toting(obj)) return(2011);
-       if (obj==bird&&here(snake))
-       {       rspeak(30);
-               if (closed) return(19000);
+       if (toting(rod2) && obj == rod && !toting(rod))
+               obj = rod2;
+       if (!toting(obj))
+               return (2011);
+       if (obj == bird && here(snake)) {
+               rspeak(30);
+               if (closed)
+                       return (19000);
                dstroy(snake);
-               prop[snake]=1;
-               return(dropper());
+               prop[snake] = 1;
+               return (dropper());
        }
-       if (obj==coins&&here(vend))             /* 9024                 */
-       {       dstroy(coins);
-               drop(batter,loc);
-               pspeak(batter,0);
-               return(2012);
+       if (obj == coins && here(vend)) {               /* 9024 */
+               dstroy(coins);
+               drop(batter, loc);
+               pspeak(batter, 0);
+               return (2012);
        }
-       if (obj==bird&&at(dragon)&&prop[dragon]==0)     /* 9025         */
-       {       rspeak(154);
+       if (obj == bird && at(dragon) && prop[dragon] == 0) {   /* 9025 */
+               rspeak(154);
                dstroy(bird);
-               prop[bird]=0;
-               if (place[snake]==plac[snake]) tally2--;
-               return(2012);
-       }
-       if (obj==bear&&at(troll))               /* 9026                 */
-       {       rspeak(163);
-               move(troll,0);
-               move(troll+100,0);
-               move(troll2,plac[troll]);
-               move(troll2+100,fixd[troll]);
+               prop[bird] = 0;
+               if (place[snake] == plac[snake])
+                       tally2--;
+               return (2012);
+       }
+       if (obj == bear && at(troll)) {                 /* 9026 */
+               rspeak(163);
+               move(troll, 0);
+               move(troll + 100, 0);
+               move(troll2, plac[troll]);
+               move(troll2 + 100, fixd[troll]);
                juggle(chasm);
-               prop[troll]=2;
-               return(dropper());
-       }
-       if (obj!=vase||loc==plac[pillow])       /* 9027                 */
-       {       rspeak(54);
-               return(dropper());
-       }
-       prop[vase]=2;                           /* 9028                 */
-       if (at(pillow)) prop[vase]=0;
-       pspeak(vase,prop[vase]+1);
-       if (prop[vase]!=0) fixed[vase] = -1;
-       return(dropper());
+               prop[troll] = 2;
+               return (dropper());
+       }
+       if (obj != vase || loc == plac[pillow]) {       /* 9027 */
+               rspeak(54);
+               return (dropper());
+       }
+       prop[vase] = 2;                                 /* 9028 */
+       if (at(pillow))
+               prop[vase] = 0;
+       pspeak(vase, prop[vase] + 1);
+       if (prop[vase] != 0)
+               fixed[vase] = -1;
+       return (dropper());
 }
 
-
-/* 9040                 */
+/* 9040 */
 int
 tropen(void)
-{       if (obj==clam||obj==oyster)
-       {       k=0;                            /* 9046                 */
-               if (obj==oyster) k=1;
-               spk=124+k;
-               if (toting(obj)) spk=120+k;
-               if (!toting(tridnt)) spk=122+k;
-               if (verb==lock) spk=61;
-               if (spk!=124) return(2011);
+{
+       if (obj == clam || obj == oyster) {
+               k = 0;                                  /* 9046 */
+               if (obj == oyster)
+                       k = 1;
+               spk = 124 + k;
+               if (toting(obj))
+                       spk = 120 + k;
+               if (!toting(tridnt))
+                       spk = 122 + k;
+               if (verb == lock)
+                       spk = 61;
+               if (spk != 124)
+                       return (2011);
                dstroy(clam);
-               drop(oyster,loc);
-               drop(pearl,105);
-               return(2011);
-       }
-       if (obj==door) spk=111;
-       if (obj==door&&prop[door]==1) spk=54;
-       if (obj==cage) spk=32;
-       if (obj==keys) spk=55;
-       if (obj==grate||obj==chain) spk=31;
-       if (spk!=31||!here(keys)) return(2011);
-       if (obj==chain)
-       {       if (verb==lock)
-               {       spk=172;                /* 9049: lock           */
-                       if (prop[chain]!=0) spk=34;
-                       if (loc!=plac[chain]) spk=173;
-                       if (spk!=172) return(2011);
-                       prop[chain]=2;
-                       if (toting(chain)) drop(chain,loc);
-                       fixed[chain]= -1;
-                       return(2011);
+               drop(oyster, loc);
+               drop(pearl, 105);
+               return (2011);
+       }
+       if (obj == door)
+               spk = 111;
+       if (obj == door && prop[door] == 1)
+               spk = 54;
+       if (obj == cage)
+               spk = 32;
+       if (obj == keys)
+               spk = 55;
+       if (obj == grate || obj == chain)
+               spk = 31;
+       if (spk != 31 || !here(keys))
+               return (2011);
+       if (obj == chain) {
+               if (verb == lock) {
+                       spk = 172;                      /* 9049: lock */
+                       if (prop[chain] != 0)
+                               spk = 34;
+                       if (loc != plac[chain])
+                               spk = 173;
+                       if (spk != 172)
+                               return (2011);
+                       prop[chain] = 2;
+                       if (toting(chain))
+                               drop(chain, loc);
+                       fixed[chain] = -1;
+                       return (2011);
                }
-               spk=171;
-               if (prop[bear]==0) spk=41;
-               if (prop[chain]==0) spk=37;
-               if (spk!=171) return(2011);
-               prop[chain]=0;
-               fixed[chain]=0;
-               if (prop[bear]!=3) prop[bear]=2;
-               fixed[bear]=2-prop[bear];
-               return(2011);
-       }
-       if (closng)
-       {       k=130;
-               if (!panic) clock2=15;
-               panic=TRUE;
-               return(2010);
-       }
-       k=34+prop[grate];                       /* 9043                 */
-       prop[grate]=1;
-       if (verb==lock) prop[grate]=0;
-       k=k+2*prop[grate];
-       return(2010);
+               spk = 171;
+               if (prop[bear] == 0)
+                       spk = 41;
+               if (prop[chain] == 0)
+                       spk = 37;
+               if (spk != 171)
+                       return (2011);
+               prop[chain] = 0;
+               fixed[chain] = 0;
+               if (prop[bear] != 3)
+                       prop[bear] = 2;
+               fixed[bear] = 2 - prop[bear];
+               return (2011);
+       }
+       if (closng) {
+               k = 130;
+               if (!panic)
+                       clock2 = 15;
+               panic = TRUE;
+               return (2010);
+       }
+       k = 34 + prop[grate];                           /* 9043 */
+       prop[grate] = 1;
+       if (verb == lock)
+               prop[grate] = 0;
+       k = k + 2 * prop[grate];
+       return (2010);
 }
 
-
-/* 9120                         */
+/* 9120 */
 int
 trkill(void)
-{       int i;
-       for (i=1; i<=5; i++)
-               if (dloc[i]==loc&&dflag>=2) break;
-       if (i==6) i=0;
-       if (obj==0)                     /* 9122                         */
-       {       if (i!=0) obj=dwarf;
-               if (here(snake)) obj=obj*100+snake;
-               if (at(dragon)&&prop[dragon]==0) obj=obj*100+dragon;
-               if (at(troll)) obj=obj*100+troll;
-               if (here(bear)&&prop[bear]==0) obj=obj*100+bear;
-               if (obj>100) return(8000);
-               if (obj==0)
-               {       if (here(bird)&&verb!=throw) obj=bird;
-                       if (here(clam)||here(oyster)) obj=100*obj+clam;
-                       if (obj>100) return(8000);
+{
+       int i;
+
+       for (i = 1; i <= 5; i++)
+               if (dloc[i] == loc && dflag >= 2)
+                       break;
+       if (i == 6)
+               i = 0;
+       if (obj == 0) {                                 /* 9122 */
+               if (i != 0)
+                       obj = dwarf;
+               if (here(snake))
+                       obj = obj * 100 + snake;
+               if (at(dragon) && prop[dragon] == 0)
+                       obj = obj * 100 + dragon;
+               if (at(troll))
+                       obj = obj * 100 + troll;
+               if (here(bear) && prop[bear] == 0)
+                       obj = obj * 100 + bear;
+               if (obj > 100)
+                       return (8000);
+               if (obj == 0) {
+                       if (here(bird) && verb != throw)
+                               obj = bird;
+                       if (here(clam) || here(oyster))
+                               obj = 100 * obj + clam;
+                       if (obj > 100)
+                               return (8000);
                }
        }
-       if (obj==bird)                  /* 9124                         */
-       {       spk=137;
-               if (closed) return(2011);
+       if (obj == bird) {                              /* 9124 */
+               spk = 137;
+               if (closed)
+                       return (2011);
                dstroy(bird);
-               prop[bird]=0;
-               if (place[snake]==plac[snake]) tally2++;
-               spk=45;
-       }
-       if (obj==0) spk=44;             /* 9125                         */
-       if (obj==clam||obj==oyster) spk=150;
-       if (obj==snake) spk=46;
-       if (obj==dwarf) spk=49;
-       if (obj==dwarf&&closed) return(19000);
-       if (obj==dragon) spk=147;
-       if (obj==troll) spk=157;
-       if (obj==bear) spk=165+(prop[bear]+1)/2;
-       if (obj!=dragon||prop[dragon]!=0) return(2011);
+               prop[bird] = 0;
+               if (place[snake] == plac[snake])
+                       tally2++;
+               spk = 45;
+       }
+       if (obj == 0)                                   /* 9125 */
+               spk = 44;
+       if (obj == clam || obj == oyster)
+               spk = 150;
+       if (obj == snake)
+               spk = 46;
+       if (obj == dwarf)
+               spk = 49;
+       if (obj == dwarf && closed)
+               return (19000);
+       if (obj == dragon)
+               spk = 147;
+       if (obj == troll)
+               spk = 157;
+       if (obj == bear)
+               spk = 165 + (prop[bear] + 1) / 2;
+       if (obj != dragon || prop[dragon] != 0)
+               return (2011);
        rspeak(49);
-       verb=0;
-       obj=0;
-       getin(&wd1,&wd2);
-       if (strncmp(wd1,"y",1)&&strncmp(wd1,"yes",3)) return(2608);
-       pspeak(dragon,1);
-       prop[dragon]=2;
-       prop[rug]=0;
-       k=(plac[dragon]+fixd[dragon])/2;
-       move(dragon+100,-1);
-       move(rug+100,0);
-       move(dragon,k);
-       move(rug,k);
-       for (obj=1; obj<=100; obj++)
-               if (place[obj]==plac[dragon]||place[obj]==fixd[dragon])
-                       move(obj,k);
-       loc=k;
-       k=null;
-       return(8);
+       verb = 0;
+       obj = 0;
+       getin(&wd1, &wd2);
+       if (strncmp(wd1, "y", 1) && strncmp(wd1, "yes", 3))
+               return (2608);
+       pspeak(dragon, 1);
+       prop[dragon] = 2;
+       prop[rug] = 0;
+       k = (plac[dragon] + fixd[dragon]) / 2;
+       move(dragon + 100, -1);
+       move(rug + 100, 0);
+       move(dragon, k);
+       move(rug, k);
+       for (obj = 1; obj <= 100; obj++)
+               if (place[obj] == plac[dragon] || place[obj] == fixd[dragon])
+                       move(obj, k);
+       loc = k;
+       k = null;
+       return (8);
 }
 
-
-/* 9170: throw                  */
+/* 9170: throw */
 int
 trtoss(void)
-{       int i;
-       if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2;
-       if (!toting(obj)) return(2011);
-       if (obj>=50&&obj<=maxtrs&&at(troll))
-       {       spk=159;                        /* 9178                 */
-               drop(obj,0);
-               move(troll,0);
-               move(troll+100,0);
-               drop(troll2,plac[troll]);
-               drop(troll2+100,fixd[troll]);
+{
+       int i;
+
+       if (toting(rod2) && obj == rod && !toting(rod))
+               obj = rod2;
+       if (!toting(obj))
+               return (2011);
+       if (obj >= 50 && obj <= maxtrs && at(troll)) {
+               spk = 159;                              /* 9178 */
+               drop(obj, 0);
+               move(troll, 0);
+               move(troll + 100, 0);
+               drop(troll2, plac[troll]);
+               drop(troll2 + 100, fixd[troll]);
              &