Re: NSDictionary
Re: NSDictionary
- Subject: Re: NSDictionary
- From: Bob Savage <email@hidden>
- Date: Wed, 30 Jan 2002 01:13:09 -0600
on 1/29/02 8:34 PM, Ricky Sharp wrote:
>
>
> place to store spaces in a game I am working on. It is a strategy game
>
> (based on a hexagonal grid) and I am storing the hex objects in a
>
> dictionary with their location (x, y) as the key.
>
>
But you could do something very similar with say a couple of graphic
>
images where the grayscale value could determine elevation.
Well, a grayscale image could determine elevation, but you couldn't ask it
what it's contents were.
I could perhaps have one image for elevation, one image that somehow mapped
values to an array of terrain types, but it sounds like I would still need
to have a dictionary for keeping the arrays of hex occupants. Then every
time someone wanted to know who was in a hex they would look it up in the
dictionary, and only hexes with contents would have keys. Of course I'll
have to come up with a different test for whether a hex works or not...
Perhaps more frightening is I seem to have lost the coherence of an OO
design. Still, it gives me something to work with, if the test you mention
below fails.
>
You may want to write some test apps that can fully "abuse" the
>
NSMutableDictionary objects. I don't think they were intended for
>
large-scale databases or game-world containers. I could be wrong.
That sounds like good advice. Will do.
thanks!
Bob