ScummVM API documentation
forest.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 #ifndef TOT_FOREST_H
22 #define TOT_FOREST_H
23 
24 #include "tot/util.h"
25 
26 namespace Tot {
27 
28 struct nodeElement {
29  char spoken;
30  uint index;
31 };
32 
33 typedef struct TreeDef *Tree;
34 
35 struct TreeDef {
36  nodeElement element;
37  Tree parent, sibling, child;
38 
39  ~TreeDef() {
40  delete sibling;
41  delete child;
42  }
43 };
44 
45 void initTree(Tree &a, nodeElement data);
46 
47 bool isRoot(Tree node);
48 
49 Tree rightSibling(Tree node);
50 
51 Tree parent(Tree node);
52 
53 Tree leftChild(Tree node);
54 
55 int depth(Tree node);
56 
57 void expandNode(Tree &node, nodeElement data);
58 
59 void preOrder(Tree a, Common::String &string_);
60 
61 void saveConversations(Common::SeekableWriteStream *s, Tree a, uint location);
62 
63 void readTree(Common::SeekableReadStream &f, Tree &a, uint location);
64 void readTree(Common::String f, Tree &a, uint location);
65 
66 } // End of namespace Tot
67 #endif
Definition: str.h:59
Definition: stream.h:745
Definition: forest.h:35
Definition: forest.h:28
Definition: anims.h:26
Definition: stream.h:351