]> code.delx.au - gnu-emacs/blobdiff - lisp/play/dunnet.el
Merge from emacs-24; up to 2014-06-22T05:00:14Z!dmantipov@yandex.ru
[gnu-emacs] / lisp / play / dunnet.el
index 2d59d205f3fc66937e1532d8a09246c52965f37f..3f4b8e8c5b8671a57f7af51da527d5896cd84fc2 100644 (file)
@@ -1,7 +1,6 @@
-;;; dunnet.el --- text adventure for Emacs -*-  byte-compile-warnings: nil -*-
+;;; dunnet.el --- text adventure for Emacs
 
-;; Copyright (C) 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1993, 2001-2014 Free Software Foundation, Inc.
 
 ;; Author: Ron Schnell <ronnie@driver-aces.com>
 ;; Created: 25 Jul 1992
 
 (defun dun-describe-room (room)
   (if (and (not (member (abs room) dun-light-rooms))
-          (not (member obj-lamp dun-inventory)))
+          (not (member obj-lamp dun-inventory))
+          (not (member obj-lamp (nth dun-current-room dun-room-objects))))
       (dun-mprincl "It is pitch dark.  You are likely to be eaten by a grue.")
     (dun-mprincl (cadr (nth (abs room) dun-rooms)))
     (if (and (and (or (member room dun-visited)
@@ -616,7 +616,8 @@ just try dropping it.")
 
 (defun dun-move (dir)
   (if (and (not (member dun-current-room dun-light-rooms))
-          (not (member obj-lamp dun-inventory)))
+          (not (member obj-lamp dun-inventory))
+          (not (member obj-lamp (nth dun-current-room dun-room-objects))))
       (progn
        (dun-mprinc
 "You trip over a grue and fall into a pit and break every bone in your
@@ -897,7 +898,7 @@ to swim.")
 
 (defun dun-help (args)
   (dun-mprincl
-"Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com).
+"Welcome to dunnet (2.02), by Ron Schnell (ronnie@driver-aces.com - @RonnieSchnell).
 Here is some useful information (read carefully because there are one
 or more clues in here):
 - If you have a key that can open a door, you do not need to explicitly
@@ -1386,8 +1387,8 @@ for a moment, then straighten yourself up.
 (setq dungeon-mode 'dungeon)
 (setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo)
                       (exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd)
-                      (rlogin . dun-rlogin) (uncompress . dun-uncompress)
-                      (cat . dun-cat) (zippy . dun-zippy)))
+                      (rlogin . dun-rlogin) (ssh . dun-rlogin)
+                      (uncompress . dun-uncompress) (cat . dun-cat)))
 
 (setq dun-dos-verbs '((dir . dun-dos-dir) (type . dun-dos-type)
                      (exit . dun-dos-exit) (command . dun-dos-spawn)
@@ -2184,7 +2185,7 @@ A hole leads north."
         nil nil nil nil nil
         (list obj-box)                        ;; stair-landing
         nil nil nil
-        (list obj-axe)                        ;; smal-crawlspace
+        (list obj-axe)                        ;; small-crawlspace
         nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
         nil nil nil nil nil
         (list obj-special)                    ;; fourth-vermont-intersection
@@ -2538,25 +2539,31 @@ treasures for points?" "4" "four")
          (dun-mprincl "Incorrect.")))
 
     (let (varname epoint afterq i value)
-      (setq varname (substring line 0 esign))
-      (if (not (setq epoint (string-match ")" line)))
-         (if (string= (substring line (1+ esign) (+ esign 2))
-                      "\"")
-             (progn
-               (setq afterq (substring line (+ esign 2)))
-               (setq epoint (+
-                             (string-match "\"" afterq)
-                             (+ esign 3))))
-
-           (if (not (setq epoint (string-match " " line)))
-               (setq epoint (length line))))
-       (setq epoint (1+ epoint))
-       (while (and
-               (not (= epoint (length line)))
-               (setq i (string-match ")" (substring line epoint))))
-         (setq epoint (+ epoint i 1))))
-      (setq value (substring line (1+ esign) epoint))
-      (dun-eval varname value))))
+      (setq varname (replace-regexp-in-string " " "" (substring line 0 esign)))
+
+      (if (or (= (length varname) 0) (< (- (length line) esign) 2))
+         (progn
+           (dun-mprinc line)
+           (dun-mprincl " : not found."))
+
+       (if (not (setq epoint (string-match ")" line)))
+           (if (string= (substring line (1+ esign) (+ esign 2))
+                        "\"")
+               (progn
+                 (setq afterq (substring line (+ esign 2)))
+                 (setq epoint (+
+                               (string-match "\"" afterq)
+                               (+ esign 3))))
+
+             (if (not (setq epoint (string-match " " line)))
+                 (setq epoint (length line))))
+         (setq epoint (1+ epoint))
+         (while (and
+                 (not (= epoint (length line)))
+                 (setq i (string-match ")" (substring line epoint))))
+           (setq epoint (+ epoint i 1))))
+       (setq value (substring line (1+ esign) epoint))
+       (dun-eval varname value)))))
 
 (defun dun-eval (varname value)
   (let (eval-error)
@@ -2740,16 +2747,20 @@ drwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..")
                  (if dun-batch-mode
                      (dun-mprincl "Login failed.")
                    (dun-mprincl "\nLogin failed."))
-               (if dun-batch-mode
-                  (dun-mprincl
-                   "Guest login okay, user access restrictions apply.")
-                 (dun-mprincl
-                  "\nGuest login okay, user access restrictions apply."))
-               (dun-ftp-commands)
-               (setq newlist
+               (if (= (length ident) 0)
+                   (if dun-batch-mode
+                       (dun-mprincl "Password is required.")
+                     (dun-mprincl "\nPassword is required."))
+                 (if dun-batch-mode
+                     (dun-mprincl
+                      "Guest login okay, user access restrictions apply.")
+                   (dun-mprincl
+                    "\nGuest login okay, user access restrictions apply."))
+                 (dun-ftp-commands)
+                 (setq newlist
 '("What password did you use during anonymous ftp to gamma?"))
-               (setq newlist (append newlist (list ident)))
-               (rplaca (nthcdr 1 dun-endgame-questions) newlist)))))))))
+                 (setq newlist (append newlist (list ident)))
+                 (rplaca (nthcdr 1 dun-endgame-questions) newlist))))))))))
 
 (defun dun-ftp-commands ()
     (setq dun-exitf nil)
@@ -2997,9 +3008,6 @@ drwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..")
                (dun-mprincl "Ascii files only.")
              (dun-mprincl "File not found."))))))))
 
-(defun dun-zippy (args)
-  (dun-mprincl (yow)))
-
 (defun dun-rlogin-endgame ()
   (if (not (= (dun-score nil) 90))
       (dun-mprincl
@@ -3011,7 +3019,6 @@ drwxr-xr-x  3 root     staff          2048 Jan 1 1970 ..")
     (dun-uexit nil)))
 
 
-(random t)
 (setq tloc (+ 60 (random 18)))
 (dun-replace dun-room-objects tloc
             (append (nth tloc dun-room-objects) (list 18)))
@@ -3357,5 +3364,8 @@ File not found")))
 
 (provide 'dunnet)
 
-;; arch-tag: 4cc8e47c-d9e1-4ef4-936b-578e7f529558
 ;;; dunnet.el ends here
+
+;; Local Variables:
+;; byte-compile-warnings: (not free-vars lexical)
+;; End: