• Advertisement

Archived

This topic is now archived and is closed to further replies.

Reading in a data tree from a file

This topic is 5825 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 I''ve come across a stumper for myself. heres the deal: I''m trying to make a simple combo system, where a node would look like this struct combo_sequence { action result; combo_sequence* links[5]; } There are 5 different input buttons, the path you take in the tree is dependant on which button you press. Some paths lead to NULL, which results in the combo ending. Heres the problem, I need to load in the data tree from a file. (and the data tree is not constant). How can I do this without having a lot of 0''s in the file to represent NULL areas? just throw out any ideas you have, I''m currently only working on paper, so theres really no restrictions.

Share this post


Link to post
Share on other sites
Advertisement
Well, only store the valid combinations, and have the tree assume that anything it doesn''t load in is NULL. You probably want to do a depth-first traversal of the tree, writing it out in a hierarchical manner (like XML or HTML).

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites
Brilliant! That was just the nice clean friendly method of storage I was looking for =)

Thanks a bunch =)

Share this post


Link to post
Share on other sites

  • Advertisement