Reading in a data tree from a file

Started by
1 comment, last by Tricron2 22 years, 2 months ago
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.
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 ]
Brilliant! That was just the nice clean friendly method of storage I was looking for =)

Thanks a bunch =)

This topic is closed to new replies.

Advertisement