summaryrefslogtreecommitdiff
path: root/lisp/play/gamegrid.el
diff options
context:
space:
mode:
authorColin Walters <walters@gnu.org>2002-04-13 20:26:36 +0000
committerColin Walters <walters@gnu.org>2002-04-13 20:26:36 +0000
commit744ee133cdb52c5a4f559d09940622864b49f288 (patch)
tree14a18e7c5240e25685f63d919ac8c23e8d363543 /lisp/play/gamegrid.el
parent685fc579ad33256c0aa4407db483ff27b20f32af (diff)
downloademacs-744ee133cdb52c5a4f559d09940622864b49f288.tar.gz
(gamegrid-add-score-with-update-game-score): Renamed from `gamegrid-add-score'.
(gamegrid-add-score-insecure): Restored from the old `update-game-score'. (gamegrid-add-score): Just dispatch on `system-type' to one of the previous two functions.
Diffstat (limited to 'lisp/play/gamegrid.el')
-rw-r--r--lisp/play/gamegrid.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index 342b7a5cd14..edafee550e2 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -406,6 +406,13 @@ static char *noname[] = {
(defun gamegrid-add-score (file score)
"Add the current score to the high score file."
+ (case system-type
+ ((ms-dos windows-nt)
+ (gamegrid-add-score-insecure file score))
+ (t
+ (gamegrid-add-score-with-update-game-score file score))))
+
+(defun gamegrid-add-score-with-update-game-score (file score)
(let ((result nil)
(errbuf (generate-new-buffer " *update-game-score loss*"))
(target (if game-score-directory
@@ -445,6 +452,28 @@ static char *noname[] = {
(save-excursion
(find-file-read-only-other-window target))))
+(defun gamegrid-add-score-insecure (file score)
+ (save-excursion
+ (setq file (expand-file-name file temporary-file-directory))
+ (find-file-other-window file)
+ (setq buffer-read-only nil)
+ (goto-char (point-max))
+ (insert (format "%05d\t%s\t%s <%s>\n"
+ score
+ (current-time-string)
+ (user-full-name)
+ (cond ((fboundp 'user-mail-address)
+ (user-mail-address))
+ ((boundp 'user-mail-address)
+ user-mail-address)
+ (t ""))))
+ (sort-numeric-fields 1 (point-min) (point-max))
+ (reverse-region (point-min) (point-max))
+ (goto-line (1+ gamegrid-score-file-length))
+ (delete-region (point) (point-max))
+ (setq buffer-read-only t)
+ (save-buffer)))
+
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;