diff options
| author | Mark Oteiza | 2017-02-23 13:14:44 -0500 |
|---|---|---|
| committer | Mark Oteiza | 2017-02-23 13:14:44 -0500 |
| commit | 6f225b7fdfb47b09ee9a9b881740e2090acdf862 (patch) | |
| tree | 9c1599b931378795515910072dd84984434d743f | |
| parent | 7204577bf90ba8574a0199680626a5ae3f075554 (diff) | |
| download | emacs-6f225b7fdfb47b09ee9a9b881740e2090acdf862.tar.gz emacs-6f225b7fdfb47b09ee9a9b881740e2090acdf862.zip | |
Declare dun-line and dun-line-list
Previously, there were free variables 'line' and 'line-list'.
* lisp/play/dunnet.el (dun-line, dun-line-list): New variables.
(dun-press, dun-vparse, dun-parse2, dun-unix-parse, dun-batch-parse):
(dun-batch-parse2, dun-batch-loop, dun-batch-dos-interface):
(dun-batch-unix-interface): Use them.
| -rw-r--r-- | lisp/play/dunnet.el | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index f553c16d15b..1483d2c01a8 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el | |||
| @@ -1135,6 +1135,9 @@ treasures for points?" "4" "four") | |||
| 1135 | 1135 | ||
| 1136 | (defconst dun-combination (prin1-to-string (+ 100 (random 899)))) | 1136 | (defconst dun-combination (prin1-to-string (+ 100 (random 899)))) |
| 1137 | 1137 | ||
| 1138 | (defvar dun-line nil) | ||
| 1139 | (defvar dun-line-list nil) | ||
| 1140 | |||
| 1138 | 1141 | ||
| 1139 | ;;;; Mode definitions for interactive mode | 1142 | ;;;; Mode definitions for interactive mode |
| 1140 | 1143 | ||
| @@ -1924,7 +1927,7 @@ disk bursts into flames, and disintegrates.") | |||
| 1924 | (member objnum (nth dun-current-room dun-room-silents)))) | 1927 | (member objnum (nth dun-current-room dun-room-silents)))) |
| 1925 | (dun-mprincl "I don't see that here.")) | 1928 | (dun-mprincl "I don't see that here.")) |
| 1926 | ((not (member objnum (list obj-button obj-switch))) | 1929 | ((not (member objnum (list obj-button obj-switch))) |
| 1927 | (dun-mprincl "You can't " (car line-list) " that.")) | 1930 | (dun-mprincl "You can't " (car dun-line-list) " that.")) |
| 1928 | ((= objnum obj-button) | 1931 | ((= objnum obj-button) |
| 1929 | (dun-mprincl | 1932 | (dun-mprincl |
| 1930 | "As you press the button, you notice a passageway open up, but | 1933 | "As you press the button, you notice a passageway open up, but |
| @@ -2235,13 +2238,13 @@ for a moment, then straighten yourself up. | |||
| 2235 | 2238 | ||
| 2236 | (defun dun-vparse (ignore verblist line) | 2239 | (defun dun-vparse (ignore verblist line) |
| 2237 | (dun-mprinc "\n") | 2240 | (dun-mprinc "\n") |
| 2238 | (setq line-list (dun-listify-string (concat line " "))) | 2241 | (setq dun-line-list (dun-listify-string (concat line " "))) |
| 2239 | (dun-doverb ignore verblist (car line-list) (cdr line-list))) | 2242 | (dun-doverb ignore verblist (car dun-line-list) (cdr dun-line-list))) |
| 2240 | 2243 | ||
| 2241 | (defun dun-parse2 (ignore verblist line) | 2244 | (defun dun-parse2 (ignore verblist line) |
| 2242 | (dun-mprinc "\n") | 2245 | (dun-mprinc "\n") |
| 2243 | (setq line-list (dun-listify-string2 (concat line " "))) | 2246 | (setq dun-line-list (dun-listify-string2 (concat line " "))) |
| 2244 | (dun-doverb ignore verblist (car line-list) (cdr line-list))) | 2247 | (dun-doverb ignore verblist (car dun-line-list) (cdr dun-line-list))) |
| 2245 | 2248 | ||
| 2246 | ;;; Read a line, in window mode | 2249 | ;;; Read a line, in window mode |
| 2247 | 2250 | ||
| @@ -2397,13 +2400,13 @@ for a moment, then straighten yourself up. | |||
| 2397 | (if (and (not (= beg (point))) | 2400 | (if (and (not (= beg (point))) |
| 2398 | (string= "$" (buffer-substring (- beg 2) (- beg 1)))) | 2401 | (string= "$" (buffer-substring (- beg 2) (- beg 1)))) |
| 2399 | (progn | 2402 | (progn |
| 2400 | (setq line (downcase (buffer-substring beg (point)))) | 2403 | (setq dun-line (downcase (buffer-substring beg (point)))) |
| 2401 | (princ line) | 2404 | (princ dun-line) |
| 2402 | (if (eq (dun-parse2 nil dun-unix-verbs line) -1) | 2405 | (if (eq (dun-parse2 nil dun-unix-verbs dun-line) -1) |
| 2403 | (progn | 2406 | (progn |
| 2404 | (if (setq esign (string-match "=" line)) | 2407 | (if (setq esign (string-match "=" dun-line)) |
| 2405 | (dun-doassign line esign) | 2408 | (dun-doassign dun-line esign) |
| 2406 | (dun-mprinc (car line-list)) | 2409 | (dun-mprinc (car dun-line-list)) |
| 2407 | (dun-mprincl ": not found."))))) | 2410 | (dun-mprincl ": not found."))))) |
| 2408 | (goto-char (point-max)) | 2411 | (goto-char (point-max)) |
| 2409 | (dun-mprinc "\n")) | 2412 | (dun-mprinc "\n")) |
| @@ -3111,12 +3114,12 @@ File not found"))) | |||
| 3111 | (send-string-to-terminal "\n")) | 3114 | (send-string-to-terminal "\n")) |
| 3112 | 3115 | ||
| 3113 | (defun dun-batch-parse (ignore verblist line) | 3116 | (defun dun-batch-parse (ignore verblist line) |
| 3114 | (setq line-list (dun-listify-string (concat line " "))) | 3117 | (setq dun-line-list (dun-listify-string (concat line " "))) |
| 3115 | (dun-doverb ignore verblist (car line-list) (cdr line-list))) | 3118 | (dun-doverb ignore verblist (car dun-line-list) (cdr dun-line-list))) |
| 3116 | 3119 | ||
| 3117 | (defun dun-batch-parse2 (ignore verblist line) | 3120 | (defun dun-batch-parse2 (ignore verblist line) |
| 3118 | (setq line-list (dun-listify-string2 (concat line " "))) | 3121 | (setq dun-line-list (dun-listify-string2 (concat line " "))) |
| 3119 | (dun-doverb ignore verblist (car line-list) (cdr line-list))) | 3122 | (dun-doverb ignore verblist (car dun-line-list) (cdr dun-line-list))) |
| 3120 | 3123 | ||
| 3121 | (defun dun-batch-read-line () | 3124 | (defun dun-batch-read-line () |
| 3122 | (read-from-minibuffer "" nil dungeon-batch-map)) | 3125 | (read-from-minibuffer "" nil dungeon-batch-map)) |
| @@ -3133,8 +3136,8 @@ File not found"))) | |||
| 3133 | (dun-describe-room dun-current-room) | 3136 | (dun-describe-room dun-current-room) |
| 3134 | (setq dun-room dun-current-room))) | 3137 | (setq dun-room dun-current-room))) |
| 3135 | (dun-mprinc ">") | 3138 | (dun-mprinc ">") |
| 3136 | (setq line (downcase (dun-read-line))) | 3139 | (setq dun-line (downcase (dun-read-line))) |
| 3137 | (if (eq (dun-vparse dun-ignore dun-verblist line) -1) | 3140 | (if (eq (dun-vparse dun-ignore dun-verblist dun-line) -1) |
| 3138 | (dun-mprinc "I don't understand that.\n")))))) | 3141 | (dun-mprinc "I don't understand that.\n")))))) |
| 3139 | 3142 | ||
| 3140 | (defun dun-batch-dos-interface () | 3143 | (defun dun-batch-dos-interface () |
| @@ -3142,8 +3145,8 @@ File not found"))) | |||
| 3142 | (setq dungeon-mode 'dos) | 3145 | (setq dungeon-mode 'dos) |
| 3143 | (while (eq dungeon-mode 'dos) | 3146 | (while (eq dungeon-mode 'dos) |
| 3144 | (dun-dos-prompt) | 3147 | (dun-dos-prompt) |
| 3145 | (setq line (downcase (dun-read-line))) | 3148 | (setq dun-line (downcase (dun-read-line))) |
| 3146 | (if (eq (dun-parse2 nil dun-dos-verbs line) -1) | 3149 | (if (eq (dun-parse2 nil dun-dos-verbs dun-line) -1) |
| 3147 | (progn | 3150 | (progn |
| 3148 | (sleep-for 1) | 3151 | (sleep-for 1) |
| 3149 | (dun-mprincl "Bad command or file name")))) | 3152 | (dun-mprincl "Bad command or file name")))) |
| @@ -3157,12 +3160,12 @@ File not found"))) | |||
| 3157 | (setq dungeon-mode 'unix) | 3160 | (setq dungeon-mode 'unix) |
| 3158 | (while (eq dungeon-mode 'unix) | 3161 | (while (eq dungeon-mode 'unix) |
| 3159 | (dun-mprinc "$ ") | 3162 | (dun-mprinc "$ ") |
| 3160 | (setq line (downcase (dun-read-line))) | 3163 | (setq dun-line (downcase (dun-read-line))) |
| 3161 | (if (eq (dun-parse2 nil dun-unix-verbs line) -1) | 3164 | (if (eq (dun-parse2 nil dun-unix-verbs dun-line) -1) |
| 3162 | (let (esign) | 3165 | (let (esign) |
| 3163 | (if (setq esign (string-match "=" line)) | 3166 | (if (setq esign (string-match "=" dun-line)) |
| 3164 | (dun-doassign line esign) | 3167 | (dun-doassign dun-line esign) |
| 3165 | (dun-mprinc (car line-list)) | 3168 | (dun-mprinc (car dun-line-list)) |
| 3166 | (dun-mprincl ": not found."))))) | 3169 | (dun-mprincl ": not found."))))) |
| 3167 | (goto-char (point-max)) | 3170 | (goto-char (point-max)) |
| 3168 | (dun-mprinc "\n")))) | 3171 | (dun-mprinc "\n")))) |