(Langband Tour)
The first file in this tour is game.lisp
. It's
mostly uninteresting unless you're a die-hard lisper. The trick
with it is that it loads the show. The show is started with the
intuitive and apparent command (lb::a)
. The
a
function is defined in the init.lisp file.
init.lisp
This is the file which starts the eminent show. The crucial
function is game-init&
. The funny ampersand
says that the function alters the global environment, and that
is probably what one would expect. This function is
non-trivial though. What it does:
- initialises the random state
- opens a file for warnings if settings say so [probaly not]
- The absolutely evil think of calling
load-variant&
(which also alters the global
environment). The returned variant-object is activated.
- It initialises the line-of-sight code (which resides in the
file view.lisp) by calling
vinfo-init&
.
- If we're in test-mode it runs the post-tests. The
post-tests are run post/after variant is loaded. Ask on the
mailing-list for details.
- Then a lot of cruft calls the C-side to let it know this is
Lisp calling. If you're lucky it will even give C a
callback-function on the lisp-side.
init-c-side&
is a function that is called.
- One way or the other,
play-game&
is
called. Probably from the C-side.
The bad call is the one to load-variant&
which
does more than most would hope for. I hope to write more on it
another day.
view.lisp
This file basically has line-of-sight code. It's partly
optimised.
Stig E. Sandø
Last modified: Fri Sep 21 22:28:46 CEST 2001