;;; gamegrid.el --- library for implementing grid-based games on Emacs
-;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2011 Free Software Foundation, Inc.
;; Author: Glynn Clements <glynn@sensei.co.uk>
;; Version: 1.02
(defvar gamegrid-buffer-start 1)
(defvar gamegrid-score-file-length 50
- "Number of high scores to keep")
+ "Number of high scores to keep.")
(defvar gamegrid-user-score-file-directory
- (concat user-emacs-directory "games")
+ (locate-user-emacs-file "games/")
"A directory for game scores which can't be shared.
If Emacs was built without support for shared game scores, then this
directory will be used.")
(let ((data (gamegrid-match-spec-list data-spec-list))
(color (gamegrid-match-spec-list color-spec-list)))
(case data
- ('color-x
+ (color-x
(gamegrid-make-color-x-face color))
- ('grid-x
+ (grid-x
(unless gamegrid-grid-x-face
(setq gamegrid-grid-x-face (gamegrid-make-grid-x-face)))
gamegrid-grid-x-face)
- ('mono-x
+ (mono-x
(unless gamegrid-mono-x-face
(setq gamegrid-mono-x-face (gamegrid-make-mono-x-face)))
gamegrid-mono-x-face)
- ('color-tty
+ (color-tty
(gamegrid-make-color-tty-face color))
- ('mono-tty
+ (mono-tty
(unless gamegrid-mono-tty-face
(setq gamegrid-mono-tty-face (gamegrid-make-mono-tty-face)))
gamegrid-mono-tty-face))))
'remove-locale)
(setq buffer-display-table gamegrid-display-table)))
+(declare-function image-size "image.c" (spec &optional pixels frame))
+
(defun gamegrid-setup-default-font ()
(setq gamegrid-face
(copy-face 'default
"Add the current score to the high score file.
On POSIX systems there may be a shared game directory for all users in
-which the scorefiles are kept. On such systems Emacs doesn't create
-the score file FILE in this directory, if it doesn't already exist. In
-this case Emacs searches for FILE in the directory specified by
+which the scorefiles are kept. On such systems Emacs doesn't create
+the score file FILE in this directory, if it doesn't already exist.
+In this case Emacs searches for FILE in the directory specified by
`gamegrid-user-score-file-directory' and creates it there, if
necessary.
To add the score file for a game to the system wide shared game
directory, create the file with the shell command \"touch\" in this
directory and make sure that it is owned by the correct user and
-group. You probably need special user privileges to do this.
+group. You probably need special user privileges to do this.
On non-POSIX systems Emacs searches for FILE in the directory
-specified by the variable `temporary-file-directory'. If necessary,
+specified by the variable `temporary-file-directory'. If necessary,
FILE is created there."
(case system-type
((ms-dos windows-nt)
(defvar gamegrid-shared-game-dir)
(defun gamegrid-add-score-with-update-game-score (file score)
- (let* ((result nil) ;; What is this good for? -- os
- (gamegrid-shared-game-dir
- (not (zerop (logand (file-modes
- (expand-file-name "update-game-score"
- exec-directory))
- #o4000)))))
+ (let ((gamegrid-shared-game-dir
+ (not (zerop (logand (file-modes
+ (expand-file-name "update-game-score"
+ exec-directory))
+ #o4000)))))
(cond ((file-name-absolute-p file)
(gamegrid-add-score-insecure file score))
((and gamegrid-shared-game-dir
(t ""))))
(sort-fields 1 (point-min) (point-max))
(reverse-region (point-min) (point-max))
- (goto-line (1+ gamegrid-score-file-length))
+ (goto-char (point-min))
+ (forward-line gamegrid-score-file-length)
(delete-region (point) (point-max))
(setq buffer-read-only t)
(save-buffer)))
(provide 'gamegrid)
-;; arch-tag: a96c2ff4-1c12-427e-bd3d-faeaf174cd46
;;; gamegrid.el ends here