ScummVM API documentation
qd_minigame_config.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_MINIGAME_CONFIG_H
23#define QDENGINE_QDCORE_QD_MINIGAME_CONFIG_H
24
25#include "common/formats/ini-file.h"
26#include "common/path.h"
27
28namespace QDEngine {
30
51public:
54
55 bool operator == (const qdMinigameConfigParameter &prm) const {
56 return (_name == prm._name);
57 }
58 bool operator == (const char *str) const {
59 return !strcmp(str, name());
60 }
61
70 };
71
72 const char *name() const {
73 return _name.c_str();
74 }
75 void set_name(const char *name) {
76 _name = name;
77 }
78
79 data_type_t data_type() const {
80 return _data_type;
81 }
82 void set_data_type(data_type_t tp) {
83 _data_type = tp;
84 }
85
86 const char *data_string() const {
87 return _data_string.c_str();
88 }
89 void set_data_string(const char *str) {
90 _data_string = str;
91 }
92
93 const char *comment() const {
94 return _comment.c_str();
95 }
96 void set_comment(const char *str) {
97 _comment = str;
98 }
99
100 int data_count() const {
101 return _data_count;
102 }
103 void set_data_count(int cnt) {
104 _data_count = cnt;
105 }
106
108
113 bool is_data_valid() const {
114 return _is_data_valid;
115 }
116
118 bool load_script(const xml::tag *p);
120 bool save_script(Common::WriteStream &fh, int indent = 0) const;
121
123 bool load_ini(Common::INIFile& ini, const Common::Path &ini_file, const char *ini_section);
124
125private:
126
128 Common::String _name;
129
131 data_type_t _data_type;
132
134
141 int _data_count;
142
144
149 Common::String _data_string;
150
152 Common::String _comment;
153
155 bool _is_data_valid;
156};
157
158} // namespace QDEngine
159
160#endif // QDENGINE_QDCORE_QD_MINIGAME_CONFIG_H
Definition: ini-file.h:58
Definition: path.h:52
Definition: str.h:59
Definition: stream.h:77
Конфигурационные данные для миниигры.
Definition: qd_minigame_config.h:50
bool load_ini(Common::INIFile &ini, const Common::Path &ini_file, const char *ini_section)
Загрузка данных из .ini файла.
bool save_script(Common::WriteStream &fh, int indent=0) const
Запись данных в скрипт.
data_type_t
Тип данных.
Definition: qd_minigame_config.h:63
@ PRM_DATA_STRING
данные - строка
Definition: qd_minigame_config.h:65
@ PRM_DATA_OBJECT
данные - имя объекта из игровой сцены
Definition: qd_minigame_config.h:69
@ PRM_DATA_FILE
данные - имя файла
Definition: qd_minigame_config.h:67
bool validate_data()
Проверяет валидность данных.
bool load_script(const xml::tag *p)
Загрузка данных из скрипта.
XML тег.
Definition: xml_tag.h:33
Базовый класс для игровых ресурсов.
Definition: console.h:28