aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_cheats.h
blob: 9f36333b736469303b633638f502290fad381c5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Dragonfire
Copyright (C) 2020 Elias Fleckenstein <eliasfleckenstein@web.de>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include "cpp_api/s_base.h"
#include <vector>
#include <string>

class ScriptApiCheatsCheat
{
public:
	ScriptApiCheatsCheat(const std::string &name, const std::string &setting);
	ScriptApiCheatsCheat(const std::string &name, const int &function);
	std::string m_name;
	bool is_enabled();
	void toggle(lua_State *L, int error_handler);

private:
	std::string m_setting;
	int m_function_ref;
};

class ScriptApiCheatsCategory
{
public:
	ScriptApiCheatsCategory(const std::string &name);
	~ScriptApiCheatsCategory();
	std::string m_name;
	void read_cheats(lua_State *L);
	std::vector<ScriptApiCheatsCheat *> m_cheats;
};

class ScriptApiCheats : virtual public ScriptApiBase
{
public:
	virtual ~ScriptApiCheats();
	void init_cheats();
	void toggle_cheat(ScriptApiCheatsCheat *cheat);
	bool m_cheats_loaded = false;
	std::vector<ScriptApiCheatsCategory *> m_cheat_categories;
};