summaryrefslogtreecommitdiff
path: root/lisp/play/dunnet.el
diff options
context:
space:
mode:
authorMark Oteiza <mvoteiza@udel.edu>2017-02-20 13:33:48 -0500
committerMark Oteiza <mvoteiza@udel.edu>2017-02-20 13:33:48 -0500
commite546d3d967e12741394774f2d3aeadc07cf78483 (patch)
tree324f99e0aec52c2b7ca0adc44777e8e60e0bf31d /lisp/play/dunnet.el
parenta6e76fc7254ddac7729224a891feb8ed3f183efc (diff)
downloademacs-e546d3d967e12741394774f2d3aeadc07cf78483.tar.gz
Make dun-room-shorts a defconst
* lisp/play/dunnet.el (dun-room-shorts): Make defconst and collect initial value into the declaration. (dun-space-to-hyphen): Remove.
Diffstat (limited to 'lisp/play/dunnet.el')
-rw-r--r--lisp/play/dunnet.el35
1 files changed, 11 insertions, 24 deletions
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index bffb38a01a2..e7f45659e9b 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -1095,7 +1095,17 @@ nil nil nil nil
nil nil nil nil nil nil nil nil nil nil ;31-40
nil (list obj-platinum) nil nil nil nil nil nil nil nil))
-(defvar dun-room-shorts nil)
+(defconst dun-room-shorts
+ (let (res str)
+ (dolist (x dun-rooms)
+ (setq str (downcase (cadr x)))
+ (push (mapconcat #'identity (split-string str "[ /]+") "-") res))
+ (nreverse res)))
+
+(let ((a 0))
+ (dolist (x dun-room-shorts)
+ (eval (list 'defconst (intern x) a))
+ (setq a (+ a 1))))
(defconst dun-endgame-questions
'(("What is your password on the machine called ‘pokey’?" "robert")
@@ -2305,17 +2315,6 @@ for a moment, then straighten yourself up.
nil
result)))
-;;; Take a short room description, and change spaces and slashes to dashes.
-
-(defun dun-space-to-hyphen (string)
- (let (space)
- (if (setq space (string-match "[ /]" string))
- (progn
- (setq string (concat (substring string 0 space) "-"
- (substring string (1+ space))))
- (dun-space-to-hyphen string))
- string)))
-
;;; Given a unix style pathname, build a list of path components (recursive)
(defun dun-get-path (dirstring startlist)
@@ -2398,18 +2397,6 @@ for a moment, then straighten yourself up.
(define-key dungeon-batch-map "\r" 'exit-minibuffer)
(define-key dungeon-batch-map "\n" 'exit-minibuffer)
-(dolist (x dun-rooms)
- (setq dun-room-shorts
- (append dun-room-shorts (list (downcase
- (dun-space-to-hyphen
- (cadr x)))))))
-
-(let (a)
- (setq a 0)
- (dolist (x dun-room-shorts)
- (eval (list 'defconst (intern x) a))
- (setq a (+ a 1))))
-
;;;;
;;;; This section defines the UNIX emulation functions for dunnet.
;;;;