ScummVM API documentation
ai_tree.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 
22 #ifndef SCUMM_HE_MOONBASE_AI_TREE_H
23 #define SCUMM_HE_MOONBASE_AI_TREE_H
24 
25 #include "common/array.h"
26 #include "scumm/he/moonbase/ai_node.h"
27 
28 namespace Scumm {
29 
30 const int MAX_DEPTH = 100;
31 const int MAX_NODES = 1000000;
32 
33 class AI;
34 
35 struct TreeNode {
36  float value;
37  Node *node;
38 
39  TreeNode(float v, Node *n) { value = v; node = n; }
40 };
41 
42 class Tree {
43 private:
44  Node *pBaseNode;
45 
46  int _maxDepth;
47  int _maxNodes;
48 
49  int _currentChildIndex;
50 
52  Node *_currentNode;
53 
54  AI *_ai;
55 
56 public:
57  Tree(AI *ai);
58  Tree(IContainedObject *contents, AI *ai);
59  Tree(IContainedObject *contents, int maxDepth, AI *ai);
60  Tree(IContainedObject *contents, int maxDepth, int maxNodes, AI *ai);
61  Tree(const Tree *sourceTree, AI *ai);
62  ~Tree();
63 
64  void duplicateTree(Node *sourceNode, Node *destNode);
65 
66  Node *getBaseNode() const { return pBaseNode; }
67  void setMaxDepth(int maxDepth) { _maxDepth = maxDepth; }
68  int getMaxDepth() const { return _maxDepth; }
69 
70  void setMaxNodes(int maxNodes) { _maxNodes = maxNodes; }
71  int getMaxNodes() const { return _maxNodes; }
72 
73  Node *aStarSearch();
74 
75  Node *aStarSearch_singlePassInit();
76  Node *aStarSearch_singlePass();
77 
78  int IsBaseNode(Node *thisNode);
79 };
80 
81 } // End of namespace Scumm
82 
83 #endif
Definition: ai_node.h:64
Definition: ai_main.h:85
Definition: array.h:558
Definition: ai_tree.h:42
Definition: ai_node.h:32
Definition: actor.h:30
Definition: ai_tree.h:35