_________ __ __
/ _____// |_____________ _/ |______ ____ __ __ ______
\_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
/ \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \
/_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
\/ \/ \//_____/ \/
______________________ ______________________
T H E W A R B E G I N S
Stratagus - A free fantasy real time strategy game engine
Go to the documentation of this file.
30 #ifndef __SETTINGS_H__
31 #define __SETTINGS_H__
50 #define USING_TOLUAPP 1
53 #define ENUM_CLASS enum
55 #define ENUM_CLASS enum class
130 static_assert(
MAX_RACES < 256,
"Race selection needs to fit into 8 bits");
131 static_assert(
PlayerMax < 256,
"Team number must fit into 8 bits");
140 void Save(
const std::function <
void (std::string)>& f) {
141 f(std::string(
"PlayerColor = ") + std::to_string(
PlayerColor));
142 f(std::string(
"AIScript = \"") +
AIScript +
"\"");
143 f(std::string(
"Race = ") + std::to_string(
Race));
144 f(std::string(
"Team = ") + std::to_string(
Team));
145 f(std::string(
"Type = ") + std::to_string(
static_cast<int>(
Type)));
153 Type = PlayerTypes::MapDefault;
175 SettingsSinglePlayerGame,
196 SettingsGameTypeOneOnOne,
197 SettingsGameTypeCaptureTheFlag,
198 SettingsGameTypeGreed,
199 SettingsGameTypeSlaughter,
200 SettingsGameTypeSuddenDeath,
201 SettingsGameTypeTeamMelee,
202 SettingsGameTypeTeamCaptureTheFlag
288 void Save(
const std::function <
void (std::string)>& f,
bool withPlayers =
true) {
289 f(std::string(
"NetGameType = ") + std::to_string(
static_cast<int>(
NetGameType)));
293 f(std::string(
"Presets[") + std::to_string(i) +
"]." + field);
297 f(std::string(
"Resources = ") + std::to_string(
Resources));
298 f(std::string(
"NumUnits = ") + std::to_string(
NumUnits));
299 f(std::string(
"Opponents = ") + std::to_string(
Opponents));
300 f(std::string(
"Difficulty = ") + std::to_string(
Difficulty));
301 f(std::string(
"GameType = ") + std::to_string(
static_cast<int>(
GameType)));
302 f(std::string(
"FoV = ") + std::to_string(
static_cast<int>(
FoV)));
303 f(std::string(
"RevealMap = ") + std::to_string(
static_cast<int>(
RevealMap)));
304 f(std::string(
"DefeatReveal = ") + std::to_string(
static_cast<int>(
DefeatReveal)));
305 f(std::string(
"Flags = ") + std::to_string(
_Bitfield));
309 if (field ==
"NetGameType") {
311 }
else if (field ==
"Resources") {
313 }
else if (field ==
"NumUnits") {
315 }
else if (field ==
"Opponents") {
317 }
else if (field ==
"Difficulty") {
319 }
else if (field ==
"GameType") {
321 }
else if (field ==
"FoV") {
323 }
else if (field ==
"RevealMap") {
325 }
else if (field ==
"DefeatReveal") {
327 }
else if (field ==
"Flags") {
336 NetGameType = NetGameTypes::SettingsSinglePlayerGame;
345 GameType = GameTypes::SettingsGameTypeMapDefault;
373 #endif // !__SETTINGS_H__
void InitSettings()
Game settings.
Definition: game.cpp:1082
unsigned AiExplores
if game uses interior tileset or is generally "inside" for the purpose of obstacles
Definition: settings.h:250
ENUM_CLASS NetGameTypes
Revelation types.
Definition: settings.h:175
ENUM_CLASS NumOfTypes
Definition: settings.h:219
constexpr unsigned short UpgradeMax
How many unit types supported.
Definition: settings.h:64
ENUM_CLASS SettingsGameTypeMelee
Definition: settings.h:185
ENUM_CLASS SettingsGameTypeManVsMachine
Definition: settings.h:189
GameTypes GameType
Terrain type (summer,winter,...)
Definition: settings.h:242
ENUM_CLASS cNumOfModes
Definition: settings.h:213
NetGameTypes NetGameType
Definition: settings.h:231
constexpr unsigned char PlayerNumNeutral
Definition: settings.h:66
ENUM_CLASS SettingsGameTypeManTeamVsMachine
Definition: settings.h:190
ENUM_CLASS Unset
Definition: settings.h:178
ENUM_CLASS SettingsGameTypeMachineVsMachineTraining
Definition: settings.h:204
int8_t Difficulty
Preset # of ai-opponents.
Definition: settings.h:241
uint32_t _Bitfield
Definition: settings.h:255
MapRevealModes RevealMap
Which field of view is used - important to be shared for unit sight.
Definition: settings.h:244
int8_t Team
Race of the player.
Definition: settings.h:137
ENUM_CLASS GameTypes
Definition: settings.h:184
ENUM_CLASS PlayerRescueActive
rescued passive
Definition: settings.h:125
ENUM_CLASS cExplored
Definition: settings.h:211
void Init()
Definition: settings.h:335
int8_t PlayerColor
Definition: settings.h:134
ENUM_CLASS RevealTypes
Definition: settings.h:166
bool operator==(const SettingsPresets &other) const
Definition: settings.h:156
ENUM_CLASS cSimpleRadial
Definition: settings.h:217
unsigned UserGameSettings
If false, the AI can do upgrades even if the dependencies are not met. This can be desirable to simpl...
Definition: settings.h:253
constexpr unsigned char FRAMES_PER_SECOND
this is the neutral player slot
Definition: settings.h:69
unsigned AiChecksDependencies
Use alternate target choosing algorithm for auto attack mode (idle, attack-move, patrol,...
Definition: settings.h:252
int8_t Race
AI script for computer to use.
Definition: settings.h:136
ENUM_CLASS PlayerPerson
computer player
Definition: settings.h:123
ENUM_CLASS FieldOfViewTypes
Definition: settings.h:216
ENUM_CLASS SettingsGameTypeMachineVsMachine
Definition: settings.h:191
constexpr unsigned char CYCLES_PER_SECOND
Game cycles per second to simulate (original 30-40)
Definition: settings.h:71
int8_t Opponents
Preset # of units.
Definition: settings.h:240
bool operator==(const Settings &other) const
Definition: settings.h:268
SettingsPresets Presets[PlayerMax]
Multiplayer or single player.
Definition: settings.h:235
ENUM_CLASS PlayerComputer
unused slot
Definition: settings.h:122
ENUM_CLASS PlayerUnset
use default
Definition: settings.h:119
constexpr unsigned char PlayerMax
Definition: settings.h:62
ENUM_CLASS SettingsGameTypeFreeForAll
Definition: settings.h:186
RevealTypes DefeatReveal
Reveal map kind.
Definition: settings.h:245
ENUM_CLASS cAllUnits
Definition: settings.h:167
unsigned NoFogOfWar
Definition: settings.h:248
ENUM_CLASS MapRevealModes
Definition: settings.h:209
PlayerTypes Type
Team of player.
Definition: settings.h:138
Definition: settings.h:230
ENUM_CLASS cBuildingsOnly
Definition: settings.h:169
unsigned Inside
if dynamic fog of war is disabled
Definition: settings.h:249
ENUM_CLASS SettingsMultiPlayerGame
Definition: settings.h:176
ENUM_CLASS SettingsGameTypeLeftVsRight
Definition: settings.h:188
ENUM_CLASS PlayerRescuePassive
human player
Definition: settings.h:124
ENUM_CLASS cKnown
Definition: settings.h:210
FieldOfViewTypes FoV
Game type (melee, free for all,...)
Definition: settings.h:243
void Save(const std::function< void(std::string)> &f)
Type of player (for network games)
Definition: settings.h:140
bool GetUserGameSetting(int i)
Definition: settings.h:258
void Save(const std::function< void(std::string)> &f, bool withPlayers=true)
Definition: settings.h:288
std::string PlayerTypeNames[static_cast< int >(PlayerTypes::PlayerRescueActive)+1]
Definition: game.cpp:280
int8_t Resources
Definition: settings.h:238
bool SetField(std::string field, int value)
Definition: settings.h:308
int8_t NumUnits
Preset resource factor.
Definition: settings.h:239
unsigned SimplifiedAutoTargeting
If true, AI sends explorers to search for resources (almost useless thing)
Definition: settings.h:251
Definition: settings.h:133
constexpr unsigned char MAX_RACES
How many upgrades supported.
Definition: settings.h:65
void SetUserGameSetting(int i, bool v)
Definition: settings.h:262
constexpr unsigned short UnitTypeMax
How many players are supported.
Definition: settings.h:63
ENUM_CLASS PlayerNobody
neutral
Definition: settings.h:121
constexpr int8_t SettingsPresetMapDefault
Definition: settings.h:77
ENUM_CLASS PlayerNeutral
not set
Definition: settings.h:120
Settings GameSettings
Definition: game.cpp:87
void Init()
Definition: settings.h:148
ENUM_CLASS SettingsGameTypeTopVsBottom
Definition: settings.h:187
ENUM_CLASS PlayerTypes
Special: Use map supplied.
Definition: settings.h:118
std::string AIScript
Color of a player.
Definition: settings.h:135
#define ENUM_CLASS
Definition: settings.h:53
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.