The Refc. says:
For each area type defined, one area object is created at runtime. So for areas on the map, all squares with the same area type belong to the same instance of the area.
Additional instances of rooms may be created from the same type by explicitly creating them with null as the initial location. That is, the first argument to new() should either be null or left unspecified.
So, what I'm wondering is, if I haven't drawn any instances of an area on the map, can I create multiple instances and then assign turfs to their contents lists? This could come in pretty handy for me--I could probably create my own "virtual area" datum as a substitute, but since turfs already have a loc var, it would be a shame to leave it unused and create another var to do the same thing...
ID:137580
Sep 26 2001, 10:21 am
|
|
So, what I'm wondering is, if I haven't drawn any instances of an area on the map, can I create multiple instances and then assign turfs to their contents lists? Yes. The only thing to keep in mind is that if you ever wished to save the state of your map into a .dmp file, the current .dmp format would not be able to distinguish between multiple instances of the area unless they happened to have at least one variable (other than contents) with a different value. In other words, area "instances" are recognized by doing an exact match on the type + initial values. --Dan |
In response to Dan
|
|
In other words, area "instances" are recognized by doing an exact match on the type + initial values. So if create multiple instances of it and set the variables (for example, name) *after* creating the instance, the areas won't be handled by the auto-save--I'd need to explicitly create each in the DM code as a separate type. Is that the correct way to understand it? |
In response to Gughunter
|
|
In other words, area "instances" are recognized by doing an exact match on the type + initial values. I was just talking about the dmp format. The savefile stuff goes off of the actual instances you write to the file at runtime. If you were to write your world to a .dmp file (there is a nifty lib for the purpose) then you would just have to be aware about how area instances are recognized in that case. Otherwise, it doesn't matter at all. --Dan |
Hmm. I don't know the answer, but it strikes me that if the answer is "yes", this could go a long way toward providing the solution to dynamic map problems of the sort brought up on the old "Map Musings" thread.
Lummox JR