Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coding question about apartments: interaction with random maps?



> Date: Mon, 5 Jun 2000 23:15:49 -0700 (PDT)
> From: Peter Mardahl <peterm@tesla.EECS.Berkeley.EDU>
> 
> 
> I've found that immediately after random maps are generated,
> crossfire goes into code dealing with apartments and unique maps.
> 
> I find this strange.  Can anyone comment on it?

Certainly.  Random maps are unique, meaning spontaneously generated.
They're not loaded from a normal map file.  Most maps have a permanent
file they default to and a temporary file they get swapped out to.
The name of the permanent map file is assumed to be a concatenation of
the map directory and the name of the map.

Apartments have a "template" file they're loaded from the first time
to create a personal copy in the player's directory.  As I understand
them, random maps don't even have a template map, just a description.
They still need a temporary file to swap out to, but they have no
permanent map file.

The connection between apartments and random maps is that they are two
cases of maps for which the usual method of determining the file name
is not applicable.


> DAMN was the author of the apartment code, apparently.

No, I just fixed some bugs in it a while back.  I never touched any of
the random map code.


> My question is about the code on line 271 of main.c.

I just updated my copy from cvs, and main.c line 271 is:

   if (EXIT_PATH(exit_ob)) {

which simply queries whether the exit leads to a different map.  Or
does the EXIT_PATH macro have some other meaning for random maps that
I'm not aware of?

If you mean the various other tests inside that if, that was one of
the bugs I fixed.  Because of the way map filenames are used as
identifiers and are calculated from settings and map names, it was
necessary to specifically check for the case of an exit leading from
an apartment to an apartment, both of which have a default map as well
as a personal map.  (see Pocket Reality)


> Newly generated random maps always seem to go through the
> apartment code for some reason.
> 
> Was this intended?

Not by me.  I never played with the random maps much, and it's been a
while since I even looked at the apartment code.  As I mentioned
above, there is some correlation, in that they're not normal maps, but
there are enough differences that perhaps they should be more cleanly
seperated.  If this were C++, one might even be tempted to make
apartments and random maps seperate sub-classes of maps.

-- 
            -Dave Noelle,                 dave@Straylight.org
            -the Villa Straylight,  http://www.straylight.org

Quote of the Day:
"Adolf built a bonfire
 and Riko played with it." - Peter Gabriel, "Games Without Frontiers"