/[emacs]/emacs/lisp/play/gamegrid.el
ViewVC logotype

Diff of /emacs/lisp/play/gamegrid.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by walters, Wed Apr 10 23:16:45 2002 UTC revision 1.8 by walters, Sat Apr 13 20:26:36 2002 UTC
# Line 406  static char *noname[] = { Line 406  static char *noname[] = {
406    
407  (defun gamegrid-add-score (file score)  (defun gamegrid-add-score (file score)
408    "Add the current score to the high score file."    "Add the current score to the high score file."
409      (case system-type
410        ((ms-dos windows-nt)
411         (gamegrid-add-score-insecure file score))
412        (t
413         (gamegrid-add-score-with-update-game-score file score))))
414    
415    (defun gamegrid-add-score-with-update-game-score (file score)
416    (let ((result nil)    (let ((result nil)
417          (errbuf (generate-new-buffer " *update-game-score loss*"))          (errbuf (generate-new-buffer " *update-game-score loss*"))
418          (target (if game-score-directory          (target (if game-score-directory
# Line 445  static char *noname[] = { Line 452  static char *noname[] = {
452      (save-excursion      (save-excursion
453        (find-file-read-only-other-window target))))        (find-file-read-only-other-window target))))
454                    
455    (defun gamegrid-add-score-insecure (file score)
456      (save-excursion
457        (setq file (expand-file-name file temporary-file-directory))
458        (find-file-other-window file)
459        (setq buffer-read-only nil)
460        (goto-char (point-max))
461        (insert (format "%05d\t%s\t%s <%s>\n"
462                        score
463                        (current-time-string)
464                        (user-full-name)
465                        (cond ((fboundp 'user-mail-address)
466                               (user-mail-address))
467                              ((boundp 'user-mail-address)
468                               user-mail-address)
469                              (t ""))))
470        (sort-numeric-fields 1 (point-min) (point-max))
471        (reverse-region (point-min) (point-max))
472        (goto-line (1+ gamegrid-score-file-length))
473        (delete-region (point) (point-max))
474        (setq buffer-read-only t)
475        (save-buffer)))
476    
477    
478  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
479    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26