ScummVM API documentation
tt_quotes_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 TITANIC_TT_QUOTES_TREE_H
23 #define TITANIC_TT_QUOTES_TREE_H
24 
25 #include "common/scummsys.h"
26 #include "common/stream.h"
27 #include "titanic/support/string.h"
28 
29 namespace Titanic {
30 
31 #define QUOTES_TREE_COUNT 1022
32 
33 enum QuoteTreeNum { TREE_1 = 0, TREE_2 = 1, TREE_3 = 2 };
34 
36  uint _id;
37  TTquotesTreeEntry *_subTable;
38  CString _string;
39 
40  TTquotesTreeEntry() : _id(0), _subTable(nullptr) {}
41 };
42 
43 class TTtreeResult {
44 public:
45  int _id;
46  const TTquotesTreeEntry *_treeItemP;
47 public:
48  TTtreeResult() : _id(0), _treeItemP(nullptr) {}
49 };
50 
51 class TTquotesTree {
52 private:
53  TTquotesTreeEntry _entries[QUOTES_TREE_COUNT];
54 private:
58  bool search1(const char **str, const TTquotesTreeEntry *bTree,
59  TTtreeResult *buffer, uint tagId);
60 
64  bool search2(const char **str, const TTquotesTreeEntry *bTree,
65  TTtreeResult *buffer, uint tagId);
66 
70  bool compareWord(const char **str, const char *refStr);
71 public:
75  void load();
76 
77  int search(const char *str, QuoteTreeNum treeNum,
78  TTtreeResult *buffer, uint tagId, uint *remainder);
79 };
80 
81 } // End of namespace Titanic
82 
83 #endif /* TITANIC_TT_QUOTES_TREE_H */
Definition: tt_quotes_tree.h:35
Definition: tt_quotes_tree.h:51
Definition: arm.h:30
Definition: string.h:40
Definition: tt_quotes_tree.h:43