The naive way to make the entire game non-dark is to give each room the
light
attribute. This, of course, is a nuisance. A more
clever way is to give the player light
. However, this can
still lead to bugs if you use ChangePlayer()
.
Here's an even cleverer method:
Replace OffersLight; [ OffersLight obj; if (obj == nothing) rfalse; else rtrue; ]; |
(As usual for Replace
d library routines, you should put the
Replace
statement before the "Parser" and "Verblib" library
files are included, and the new OffersLight()
definition
afterward.)
The OffersLight()
routine determines whether a room (or
other enterable) is lit. The version in the library searches the room
for a light source. This function replaces that search with a trivial
test: everything in the game offers light! This is not only simpler, but
faster.
(Okay, not a lot faster. But it doesn't hurt.)