Archived

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

Tricron2

Reading in a data tree from a file

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
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