diff options
| author | Colin Walters | 2002-04-13 20:26:36 +0000 |
|---|---|---|
| committer | Colin Walters | 2002-04-13 20:26:36 +0000 |
| commit | 744ee133cdb52c5a4f559d09940622864b49f288 (patch) | |
| tree | 14a18e7c5240e25685f63d919ac8c23e8d363543 | |
| parent | 685fc579ad33256c0aa4407db483ff27b20f32af (diff) | |
| download | emacs-744ee133cdb52c5a4f559d09940622864b49f288.tar.gz emacs-744ee133cdb52c5a4f559d09940622864b49f288.zip | |
(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.
| -rw-r--r-- | lisp/play/gamegrid.el | 29 |
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[] = { | |||
| 406 | 406 | ||
| 407 | (defun gamegrid-add-score (file score) | 407 | (defun gamegrid-add-score (file score) |
| 408 | "Add the current score to the high score file." | 408 | "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) | ||
| 409 | (let ((result nil) | 416 | (let ((result nil) |
| 410 | (errbuf (generate-new-buffer " *update-game-score loss*")) | 417 | (errbuf (generate-new-buffer " *update-game-score loss*")) |
| 411 | (target (if game-score-directory | 418 | (target (if game-score-directory |
| @@ -445,6 +452,28 @@ static char *noname[] = { | |||
| 445 | (save-excursion | 452 | (save-excursion |
| 446 | (find-file-read-only-other-window target)))) | 453 | (find-file-read-only-other-window target)))) |
| 447 | 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 | |||
| 448 | 477 | ||
| 449 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 478 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 450 | 479 | ||