Of course I don't play tetris, I found this during code-review ;->
Anybody who does play tetris and wonders why they can't get their
score beyond 04799 or 07999, here's why.
Hi Glynn, I'm not committing this since you're the active
author/maintainer.
Please advise,
Adrian
packages ChangeLog patch:
Diff command: cvs -q diff -U 0
Files affected: xemacs-packages/games/ChangeLog
Index: xemacs-packages/games/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/games/ChangeLog,v
retrieving revision 1.14
diff -u -U0 -r1.14 ChangeLog
--- xemacs-packages/games/ChangeLog 31 Oct 2003 16:52:38 -0000 1.14
+++ xemacs-packages/games/ChangeLog 6 Nov 2005 18:40:40 -0000
@@ -0,0 +1,7 @@
+2005-11-06 Adrian Aichner <adrian(a)xemacs.org>
+
+ * gamegrid.el (gamegrid-add-score): Fix loss of scores with
+ non-octal digits.
+ * tetris.el (tetris-score-file): Default to (temp-directory), not
+ "/tmp".
+
packages source patch:
Diff command: cvs -f -z3 -q diff -u -w -N
Files affected: xemacs-packages/games/tetris.el xemacs-packages/games/gamegrid.el
Index: xemacs-packages/games/gamegrid.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/games/gamegrid.el,v
retrieving revision 1.5
diff -u -w -r1.5 gamegrid.el
--- xemacs-packages/games/gamegrid.el 14 Jun 2003 18:48:26 -0000 1.5
+++ xemacs-packages/games/gamegrid.el 6 Nov 2005 18:16:37 -0000
@@ -429,7 +429,13 @@
((boundp 'user-mail-address)
user-mail-address)
(t ""))))
- (sort-numeric-fields 1 (point-min) (point-max))
+ ;; Prefixing numbers 0's will make `sort-numeric-fields' sort with
+ ;; sort-numeric-base of 8.
+ ;; One workaround is to use `sort-regexp-fields-numerically',
+ ;; on the number, excluding leading 0's.
+ (sort-regexp-fields-numerically
+ nil
+ "^[0]*\\([1-9][0-9]+\\)\\>.+$" "\\1" (point-min) (point-max))
(reverse-region (point-min) (point-max))
(goto-line (1+ gamegrid-score-file-length))
(delete-region (point) (point-max))
Index: xemacs-packages/games/tetris.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/games/tetris.el,v
retrieving revision 1.4
diff -u -w -r1.4 tetris.el
--- xemacs-packages/games/tetris.el 14 Jun 2003 18:48:27 -0000 1.4
+++ xemacs-packages/games/tetris.el 6 Nov 2005 18:16:37 -0000
@@ -136,7 +136,8 @@
(defvar tetris-score-y (+ tetris-next-y 6)
"Y position of score")
-(defvar tetris-score-file "/tmp/tetris-scores"
+(defvar tetris-score-file
+ (expand-file-name "tetris-scores" (temp-directory))
;; anybody with a well-connected server want to host this?
;(defvar tetris-score-file "/anonymous@ftp.pgt.com:/pub/cgw/tetris-scores"
"File for holding high scores")
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/