emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/play/gamegrid.el


From: Colin Walters
Subject: [Emacs-diffs] Changes to emacs/lisp/play/gamegrid.el
Date: Sat, 13 Apr 2002 16:26:37 -0400

Index: emacs/lisp/play/gamegrid.el
diff -c emacs/lisp/play/gamegrid.el:1.7 emacs/lisp/play/gamegrid.el:1.8
*** emacs/lisp/play/gamegrid.el:1.7     Wed Apr 10 19:16:45 2002
--- emacs/lisp/play/gamegrid.el Sat Apr 13 16:26:36 2002
***************
*** 406,411 ****
--- 406,418 ----
  
  (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,450 ****
--- 452,479 ----
      (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)))
+ 
  
  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]