Skip to content

Commit 28d13b6

Browse files
committed
moving the in-package to main; adding make-random-state to get real random numbers
1 parent 9b69eca commit 28d13b6

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

globals.lisp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ generateing the map. ")
102102

103103
(defun load-file-set-parameters (filename)
104104
"read one file and load all the parameters"
105-
;; without this, the settings won't work
106-
(in-package :org.xzpeter.game.starwar)
105+
;; here, we MUST make sure that we are in the RIGHT package (that is the
106+
;; starwar package. or the parameters will not be set!
107107
(with-open-file (s filename)
108108
(do ((form (read s) (read s nil 'eof)))
109109
((eq form 'eof) nil)
@@ -163,6 +163,9 @@ INIT-AMOUNT is how many planets one player own at the beginning of game"
163163
(setq vlist (cons v vlist)))))))))
164164

165165
(defun clear-global-vars ()
166+
;; without this, all the random numbers will be the same after saving
167+
;; the lisp core image
168+
(setq *random-state* (make-random-state t))
166169
(setq *planet-list* nil)
167170
(setq *running* nil)
168171
(setq *paused* nil

starwar.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
;; configuration file for starwar game
22

33
(fullscreen t)
4-
(screen-width 640)
5-
(screen-height 480)
4+
(screen-width 1024)
5+
(screen-height 768)
66

77
(star-speed-max 3.0)
88
(star-speed-min 0.5)

starwar.lisp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ the outter rect. the rect is filled by VALUE/FULL-VALUE"
257257
(defun main ()
258258
;; this might be useful when making binary images
259259
(in-package :org.xzpeter.game.starwar)
260-
(setf *running* t
261-
*paused* nil)
262260
(sdl:with-init (sdl:sdl-init-video)
263261
(setq sdl:*default-font* (sdl:initialise-font sdl:*font-8x13o*))
264262
;; (sdl:initialise-default-font sdl:*font-9x18b*)

0 commit comments

Comments
 (0)