ScummVM API documentation
qd_trigger_chain.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 QDENGINE_QDCORE_QD_TRIGGER_CHAIN_H
23#define QDENGINE_QDCORE_QD_TRIGGER_CHAIN_H
24
25#include "qdengine/parser/xml_fwd.h"
26#include "qdengine/qdcore/qd_trigger_element.h"
27
28namespace Common {
29class WriteStream;
30}
31
32namespace QDEngine {
33
35public:
38
39 int named_object_type() const {
40 return QD_NAMED_OBJECT_TRIGGER_CHAIN;
41 }
42
43 qdTriggerElementPtr root_element() {
44 return &_root;
45 }
46 qdTriggerElementConstPtr root_element() const {
47 return &_root;
48 }
49
50 qdTriggerElementPtr add_element(qdNamedObject *p);
51 bool remove_element(qdTriggerElementPtr p, bool free_mem = false, bool relink_elements = false);
52
53 bool can_add_element(const qdNamedObject *p) const;
54 bool init_elements();
55
57
62
63 const qdTriggerElementList &elements_list() const {
64 return _elements;
65 }
66 bool is_element_in_list(const qdNamedObject *p) const;
67 bool is_element_in_list(qdTriggerElementConstPtr p) const;
68
69 bool add_link(qdTriggerElementPtr from, qdTriggerElementPtr to, int link_type = 0, bool auto_restart = false);
70 bool remove_link(qdTriggerElementPtr from, qdTriggerElementPtr to);
71
73 bool activate_links(const qdNamedObject *from);
74
75 bool load_script(const xml::tag *p);
76 bool save_script(Common::WriteStream &fh, int indent = 0) const;
77
79 bool load_data(Common::SeekableReadStream &fh, int save_version);
82
83 void quant(float dt);
84
86 static const char *debug_comline();
87
88 void reset();
89
92
93 qdTriggerElementPtr search_element(int id);
94private:
95
96 qdTriggerElement _root;
97 qdTriggerElementList _elements;
98
99 bool reindex_elements();
100};
101
102} // namespace QDEngine
103
104#endif // QDENGINE_QDCORE_QD_TRIGGER_CHAIN_H
Definition: stream.h:745
Definition: stream.h:77
Поименованный объект.
Definition: qd_named_object.h:70
Definition: qd_trigger_chain.h:34
static const char * debug_comline()
Возвращает имя параметра командной строки для отладки тиггеров.
bool load_data(Common::SeekableReadStream &fh, int save_version)
Загрузка данных из сэйва.
int named_object_type() const
Возвращает тип объекта.
Definition: qd_trigger_chain.h:39
bool init_debug_check()
Инициализация для отладочной проверки цепочки.
bool deactivate_object_triggers(const qdNamedObject *p)
Делает неактивными все триггера объекта.
bool save_data(Common::WriteStream &fh) const
Запись данных в сэйв.
bool activate_links(const qdNamedObject *from)
Активирует все линки, идущие от элементов, содержащих объект from.
Элемент триггера.
Definition: qd_trigger_element.h:152
XML тег.
Definition: xml_tag.h:33
Definition: algorithm.h:29
Базовый класс для игровых ресурсов.
Definition: console.h:28