-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
game_classification.hpp
91 lines (73 loc) · 3.1 KB
/
game_classification.hpp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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.
See the COPYING file for more details.
*/
#pragma once
#include "utils/make_enum.hpp"
#include <vector>
#include <set>
class config;
/** The default difficulty setting for campaigns. */
extern const std::string DEFAULT_DIFFICULTY;
//meta information of the game
class game_classification
{
public:
game_classification() = default;
game_classification(const config& cfg);
std::string label; /**< Name of the game (e.g. name of save file). */
std::string version; /**< Version game was created with. */
MAKE_ENUM (CAMPAIGN_TYPE, /**< Type of the game - campaign, multiplayer etc. */
(SCENARIO, "scenario")
(MULTIPLAYER, "multiplayer")
(TEST, "test")
(TUTORIAL, "tutorial")
)
CAMPAIGN_TYPE campaign_type;
std::string campaign_define; /**< If there is a define the campaign uses to customize data */
std::vector<std::string> campaign_xtra_defines; /**< more customization of data */
std::string scenario_define; /**< If there is a define the scenario uses to customize data */
std::string era_define; /**< If there is a define the era uses to customize data */
std::vector<std::string> mod_defines; /**< If there are defines the modifications use to customize data */
std::vector<std::string> active_mods;
std::string era_id;
std::string campaign; /**< The id of the campaign being played */
std::string campaign_name; /**< The name of the campaign being played. */
std::string abbrev; /**< the campaign abbreviation */
bool end_credits = true; /**< whether to show the standard credits at the end */
std::string end_text; /**< end-of-campaign text */
unsigned int end_text_duration; /**< for how long the end-of-campaign text is shown */
std::string difficulty = DEFAULT_DIFFICULTY; /**< The difficulty level the game is being played on. */
std::string random_mode = "";
bool oos_debug = false;
config to_config() const;
std::string get_tagname() const;
std::set<std::string> active_addons(const std::string& scenario_id) const;
bool is_normal_mp_game() const
{
return is_multiplayer() && campaign.empty();
}
bool is_scenario() const
{
return campaign_type == CAMPAIGN_TYPE::SCENARIO;
}
bool is_multiplayer() const
{
return campaign_type == CAMPAIGN_TYPE::MULTIPLAYER;
}
bool is_test() const
{
return campaign_type == CAMPAIGN_TYPE::TEST;
}
bool is_tutorial() const
{
return campaign_type == CAMPAIGN_TYPE::TUTORIAL;
}
};