Re: Linked Lists and Arrays

From: Patrick Dughi (dughi@imaxx.net)
Date: 05/02/00


> Actually, I just noticed that in order to create a pseudo multi-dimensional
> array, you still need to know the max size of either the x or y dimensions,
> something I'm not sure how to get easily (I could always do it just by brute
> force, but I'd rather not).  Any ideas on get sizeX or sizeY?
>

        I'm not following you.  You mean that inorder to create something
you have to know how big you're going to make it?  That is valid but also
common sense.  Ouch, this one is making my head hurt.  Maybe I can give
you some examples of how a world map is generated, and you can rephrase
your question to make more sense.

        Based on mapsnip.txt patch, the macros MAP_ROWS, and MAP_COLS are
defined.  These specifiy the size of the array.  This array is fully
static.  This is quick and simple.  The sizes of x and y come out of your
head.

        My personal system will involve reading a bmp or gif file and
determining dimensions by pixel.  There will be a function which gives me
these two x and y magnitudes, and then I'll dynamically create a 2-d array
of that size.  This is not really as simple at first, but ends up with the
same thing as above as far as maintainability.  The sizes of x and y start
in your head, and end up as part of the picture you're using as a map.

        One system I have seen is an adaption of DK's idea, only applied
on a zone per zone basis;  the zone itself was a 2d array, but parts of
the array were segmented and those sections were assigned a height.  What
happened was that each time a builder switched to a level of height the
room was gained by advancing by the offset of the height - that is, if I
was on the 2'nd floor (1 floor up) then my room numbering would start at
sizeof(first_floor).  This took a decent amount of effort to maintain, and
setup however.  This gets your max values of x and y again, from your
head.

        No matter what system you choose, it will be more than severely
difficult to alter this setup on the fly.

                                        PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT