Jump to content
  • Advertisement
Sign in to follow this  
mrhodes

Advice on data type please...

This topic is 3015 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!