]> code.delx.au - gnu-emacs/blobdiff - lisp/play/dunnet.el
Simplify pre-write-conversion for utf-8-hfs coding system
[gnu-emacs] / lisp / play / dunnet.el
index 2f4536c0820a0efbca7cc75519932a93834b43f7..8ed0bb3bbb41fe34181fa380976bc4b5df9416ba 100644 (file)
@@ -1,10 +1,10 @@
 ;;; dunnet.el --- text adventure for Emacs
 
 ;;; dunnet.el --- text adventure for Emacs
 
-;; Copyright (C) 1992-1993, 2001-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1993, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Ron Schnell <ronnie@driver-aces.com>
 ;; Created: 25 Jul 1992
 
 ;; Author: Ron Schnell <ronnie@driver-aces.com>
 ;; Created: 25 Jul 1992
-;; Version: 2.01
+;; Version: 2.02
 ;; Keywords: games
 
 ;; This file is part of GNU Emacs.
 ;; Keywords: games
 
 ;; This file is part of GNU Emacs.
@@ -894,7 +894,7 @@ to swim.")
     (dun-mprincl " endgame points out of a possible 110.")
     (if (= (dun-endgame-score) 110)
        (dun-mprincl
     (dun-mprincl " endgame points out of a possible 110.")
     (if (= (dun-endgame-score) 110)
        (dun-mprincl
-"\n\nCongratulations.  You have won.  The wizard password is 'moby'"))))
+"\n\nCongratulations.  You have won.  The wizard password is ‘moby’"))))
 
 (defun dun-help (args)
   (dun-mprincl
 
 (defun dun-help (args)
   (dun-mprincl
@@ -902,7 +902,7 @@ to swim.")
 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
 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
-  open it.  You may just use 'in' or walk in the direction of the door.
+  open it.  You may just use ‘in’ or walk in the direction of the door.
 
 - If you have a lamp, it is always lit.
 
 
 - If you have a lamp, it is always lit.
 
@@ -916,8 +916,8 @@ or more clues in here):
   If this happens, your score will decrease, and in many cases you can never
   get credit for it again.
 
   If this happens, your score will decrease, and in many cases you can never
   get credit for it again.
 
-- You can save your game with the 'save' command, and use restore it
-  with the 'restore' command.
+- You can save your game with the ‘save’ command, and use restore it
+  with the ‘restore’ command.
 
 - There are no limits on lengths of object names.
 
 
 - There are no limits on lengths of object names.
 
@@ -1053,7 +1053,7 @@ for a moment, then straighten yourself up.
 (if (not dun-endgame-questions)
     (progn
       (dun-mprincl "Your question is:")
 (if (not dun-endgame-questions)
     (progn
       (dun-mprincl "Your question is:")
-      (dun-mprincl "No more questions, just do 'answer foo'.")
+      (dun-mprincl "No more questions, just do ‘answer foo’.")
       (setq dun-correct-answer '("foo")))
   (let (which i newques)
     (setq i 0)
       (setq dun-correct-answer '("foo")))
   (let (which i newques)
     (setq i 0)
@@ -1203,7 +1203,7 @@ for a moment, then straighten yourself up.
   (interactive)
   (forward-line (- 0 (- (window-height) 2 )))
   (set-window-start (selected-window) (point))
   (interactive)
   (forward-line (- 0 (- (window-height) 2 )))
   (set-window-start (selected-window) (point))
-  (end-of-buffer))
+  (goto-char (point-max)))
 
 ;;; Insert something into the buffer, followed by newline.
 
 
 ;;; Insert something into the buffer, followed by newline.
 
@@ -1321,29 +1321,8 @@ for a moment, then straighten yourself up.
          (setq new-inven (append new-inven (list x)))))
     (setq dun-inventory new-inven)))
 
          (setq new-inven (append new-inven (list x)))))
     (setq dun-inventory new-inven)))
 
-
-(let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
-  (setq dun-translate-table (make-vector 256 0))
-  (while (< i 256)
-    (aset dun-translate-table i i)
-    (setq i (1+ i)))
-  (setq lower (concat lower lower))
-  (setq upper (upcase lower))
-  (setq i 0)
-  (while (< i 26)
-    (aset dun-translate-table (+ ?a i) (aref lower (+ i 13)))
-    (aset dun-translate-table (+ ?A i) (aref upper (+ i 13)))
-      (setq i (1+ i))))
-
 (defun dun-rot13 ()
 (defun dun-rot13 ()
-  (let (str len (i 0))
-    (setq str (buffer-substring (point-min) (point-max)))
-    (setq len (length str))
-    (while (< i len)
-      (aset str i (aref dun-translate-table (aref str i)))
-      (setq i (1+ i)))
-    (erase-buffer)
-    (insert str)))
+  (rot13-region (point-min) (point-max)))
 
 ;;;;
 ;;;; This section defines the globals that are used in dunnet.
 
 ;;;;
 ;;;; This section defines the globals that are used in dunnet.
@@ -1464,8 +1443,8 @@ kept.  The exit is to the west."
 "You are in a computer room.  It seems like most of the equipment has
 been removed.  There is a VAX 11/780 in front of you, however, with
 one of the cabinets wide open.  A sign on the front of the machine
 "You are in a computer room.  It seems like most of the equipment has
 been removed.  There is a VAX 11/780 in front of you, however, with
 one of the cabinets wide open.  A sign on the front of the machine
-says: This VAX is named 'pokey'.  To type on the console, use the
-'type' command.  The exit is to the east."
+says: This VAX is named ‘pokey’.  To type on the console, use the
+‘type’ command.  The exit is to the east."
                "Computer room"
               )
              (
                "Computer room"
               )
              (
@@ -1475,7 +1454,7 @@ to the west, and a door leads to the south."
               )
              (
 "You are in a round, stone room with a door to the east.  There
               )
              (
 "You are in a round, stone room with a door to the east.  There
-is a sign on the wall that reads: 'receiving room'."
+is a sign on the wall that reads: ‘receiving room’."
                "Receiving room"
               )
              (
                "Receiving room"
               )
              (
@@ -1552,7 +1531,7 @@ northeast through the brush you can see the bear hangout."
              (
 "The entrance to a cave is to the south.  To the north, a road leads
 towards a deep lake.  On the ground nearby there is a chute, with a sign
              (
 "The entrance to a cave is to the south.  To the north, a road leads
 towards a deep lake.  On the ground nearby there is a chute, with a sign
-that says 'put treasures here for points'."
+that says ‘put treasures here for points’."
                "Cave Entrance"                      ;28
               )
              (
                "Cave Entrance"                      ;28
               )
              (
@@ -1831,13 +1810,13 @@ starvation.  Doors lead out to the south and east."
               )
              (
 "You are in some sort of maintenance room for the museum.  There is a
               )
              (
 "You are in some sort of maintenance room for the museum.  There is a
-switch on the wall labeled 'BL'.  There are doors to the west and north."
+switch on the wall labeled ‘BL’.  There are doors to the west and north."
                "Maintenance room"                   ;87
               )
              (
 "You are in a classroom where school children were taught about natural
                "Maintenance room"                   ;87
               )
              (
 "You are in a classroom where school children were taught about natural
-history.  On the blackboard is written, 'No children allowed downstairs.'
-There is a door to the east with an 'exit' sign on it.  There is another
+history.  On the blackboard is written, ‘No children allowed downstairs.’
+There is a door to the east with an ‘exit’ sign on it.  There is another
 door to the west."
                "Classroom"                          ;88
               )
 door to the west."
                "Classroom"                          ;88
               )
@@ -1871,7 +1850,7 @@ a room to the northeast."
              (
 "You are in another computer room.  There is a computer in here larger
 than you have ever seen.  It has no manufacturers name on it, but it
              (
 "You are in another computer room.  There is a computer in here larger
 than you have ever seen.  It has no manufacturers name on it, but it
-does have a sign that says: This machine's name is 'endgame'.  The
+does have a sign that says: This machine's name is ‘endgame’.  The
 exit is to the southwest.  There is no console here on which you could
 type."
                "Endgame computer room"         ;95
 exit is to the southwest.  There is no console here on which you could
 type."
                "Endgame computer room"         ;95
@@ -1882,7 +1861,7 @@ type."
               )
              (
 "You have reached a question room.  You must answer a question correctly in
               )
              (
 "You have reached a question room.  You must answer a question correctly in
-order to get by.  Use the 'answer' command to answer the question."
+order to get by.  Use the ‘answer’ command to answer the question."
                "Question room 1"              ;97
               )
              (
                "Question room 1"              ;97
               )
              (
@@ -1913,7 +1892,7 @@ a hallway leads to the south."
              (
 "You have reached a dead end.  There is a PC on the floor here.  Above
 it is a sign that reads:
              (
 "You have reached a dead end.  There is a PC on the floor here.  Above
 it is a sign that reads:
-          Type the 'reset' command to type on the PC.
+          Type the ‘reset’ command to type on the PC.
 A hole leads north."
                "PC area"                       ;104
                )
 A hole leads north."
                "PC area"                       ;104
                )
@@ -2357,8 +2336,8 @@ nil))
 2 Megabytes of RAM onboard."
 "It looks like some kind of meat.  Smells pretty bad."
 nil
 2 Megabytes of RAM onboard."
 "It looks like some kind of meat.  Smells pretty bad."
 nil
-"The paper says: Don't forget to type 'help' for help.  Also, remember
-this word: 'worms'"
+"The paper says: Don't forget to type ‘help’ for help.  Also, remember
+this word: ‘worms’"
 "The statuette is of the likeness of Richard Stallman, the author of the
 famous EMACS editor.  You notice that he is not wearing any shoes."
 nil
 "The statuette is of the likeness of Richard Stallman, the author of the
 famous EMACS editor.  You notice that he is not wearing any shoes."
 nil
@@ -2414,10 +2393,10 @@ flush handle is so clean that you can see your reflection in it."
 nil
 nil
 "The box has a slit in the top of it, and on it, in sloppy handwriting, is
 nil
 nil
 "The box has a slit in the top of it, and on it, in sloppy handwriting, is
-written: 'For key upgrade, put key in here.'"
+written: ‘For key upgrade, put key in here.’"
 nil
 nil
-"It says 'express mail' on it."
-"It is a 35 passenger bus with the company name 'mobytours' on it."
+"It says ‘express mail’ on it."
+"It is a 35 passenger bus with the company name ‘mobytours’ on it."
 "It is a large metal gate that is too big to climb over."
 "It is a HIGH cliff."
 "Unfortunately you do not know enough about dinosaurs to tell very much about
 "It is a large metal gate that is too big to climb over."
 "It is a HIGH cliff."
 "Unfortunately you do not know enough about dinosaurs to tell very much about
@@ -2449,14 +2428,14 @@ nil
 
 (setq dun-endgame-questions '(
                          (
 
 (setq dun-endgame-questions '(
                          (
-"What is your password on the machine called 'pokey'?" "robert")
+"What is your password on the machine called ‘pokey’?" "robert")
                          (
 "What password did you use during anonymous ftp to gamma?" "foo")
                          (
 "Excluding the endgame, how many places are there where you can put
 treasures for points?" "4" "four")
                          (
                          (
 "What password did you use during anonymous ftp to gamma?" "foo")
                          (
 "Excluding the endgame, how many places are there where you can put
 treasures for points?" "4" "four")
                          (
-"What is your login name on the 'endgame' machine?" "toukmond"
+"What is your login name on the ‘endgame’ machine?" "toukmond"
 )
                          (
 "What is the nearest whole dollar to the price of the shovel?" "20" "twenty")
 )
                          (
 "What is the nearest whole dollar to the price of the shovel?" "20" "twenty")
@@ -3099,7 +3078,7 @@ File not found")))
 (defun dun-dos-boot-msg ()
   (sleep-for 3)
   (dun-mprinc "Current time is ")
 (defun dun-dos-boot-msg ()
   (sleep-for 3)
   (dun-mprinc "Current time is ")
-  (dun-mprincl (substring (current-time-string) 12 20))
+  (dun-mprincl (format-time-string "%H:%M:%S"))
   (dun-mprinc "Enter new time: ")
   (dun-read-line)
   (if (not dun-batch-mode)
   (dun-mprinc "Enter new time: ")
   (dun-read-line)
   (if (not dun-batch-mode)