Sign in to follow this  
mrhodes

Advice on data type please...

Recommended Posts

mrhodes    380
Hey everyone, I am writing a little utility program to help with editing layouts in Everquest2. EQ2 uses them as a way of saving the positions, rotations, etc of all the items that are stored in a player house or guild hall. I am wondering if I can get some advice from you guys on what type of data container I should use, or what are some good options. I want to load in all the items and store them in memory in some organized way. They are all randomly just listed in this text file. I'd like to maybe organize them by room and then by height. Having the item with the highest y value first and so on. So, 2 things that come to mind are linked lists and a tree. I can do a list, but never done trees before. I'm sure I can figure it out easy enough... I just don't want to over complicate this. Once loaded all the items will go in a treelistctrl (wxWidgets) organized by room. So, any ideas ? I also thought about an array too.. I guess that would be the simplest. Thanks Michael

Share this post


Link to post
Share on other sites
ApochPiQ    23058
What language are you planning on using?

I'd suggest a plain array/vector for storing each object, then a map/dictionary that links each room's ID to the array/vector of objects within that room. In C++, for instance, you'd have a std::map<std::string, std::vector<Object> > container.

Share this post


Link to post
Share on other sites
mrhodes    380
I am using C++....

Here are a couple lines from the file I am getting this data from

4047956068,880356,6.38,-4.75,4.36,0.00,0.00,0.00,0.82,false,"Rose Mystique Rug"
4047956068,880357,4.44,-4.75,10.49,89.99,0.00,0.00,0.60,false,"Rose Mystique Rug"
3291598659,880358,-3.98,13.04,-0.96,2.40,0.00,0.00,1.00,false,"Grassy Knoll of Fireflies"
872004668,880359,5.32,-4.69,-0.82,179.97,0.00,0.00,1.00,false,"Humble Altar of Bristlebane"

I have a CItem class to hold all this info, plus more info that my program uses.

I don't know much about maps at all, but from what you said it sounds ok. I was partially thinking about storing all the items in something, and for filtering/searching create a second, temporary container with the results as pointers to the main container.

So, maybe a good solution is to use a vector to hold everything.... and would an array of pointers be good to hold results of searches and filtering items ?

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this