OpenTTD Source
12.0-beta2
|
Go to the documentation of this file.
10 #ifndef SCRIPT_CONFIG_HPP
11 #define SCRIPT_CONFIG_HPP
15 #include "../core/smallmap_type.hpp"
16 #include "../core/string_compare_type.hpp"
17 #include "../company_type.h"
18 #include "../textfile_gui.h"
virtual ScriptInfo * FindInfo(const char *name, int version, bool force_exact_match)=0
This function should call back to the Scanner in charge of this Config, to find the ScriptInfo belong...
int step_size
The step size in the gui.
ScriptConfigFlags
Bitmask of flags for Script settings.
LabelMapping * labels
Text labels for the integer values.
virtual ~ScriptConfig()
Delete an Script configuration.
int medium_value
The default value on medium difficulty setting.
Owner
Enum for all companies/owners.
void ResetEditableSettings(bool yet_to_start)
Reset only editable and visible settings to their default value.
@ SCRIPTCONFIG_BOOLEAN
This value is a boolean (either 0 (false) or 1 (true) ).
int min_value
The minimal value this configuration setting can have.
Implementation of simple mapping class.
bool complete_labels
True if all values have a label.
int max_value
The maximal value this configuration setting can have.
std::list< ScriptConfigItem > ScriptConfigItemList
List of ScriptConfig items.
virtual void AddRandomDeviation()
Randomize all settings the Script requested to be randomized.
@ SSS_DEFAULT
Get the Script config from the current game mode.
class ScriptInfo * GetInfo() const
Get the ScriptInfo linked to this ScriptConfig.
const char * GetName() const
Get the name of the Script.
@ SCRIPTCONFIG_NONE
No flags set.
virtual void SetSetting(const char *name, int value)
Set the value of a setting for this config.
bool IsRandom() const
Is the current Script a randomly chosen Script?
@ SCRIPTCONFIG_INGAME
This setting can be changed while the Script is running.
@ SCRIPTCONFIG_DEVELOPER
This setting will only be visible when the Script development tools are active.
int version
Version of the Script.
void StringToSettings(const std::string &value)
Convert a string which is stored in the config file or savegames to custom settings of this Script.
SmallMap< int, char * > LabelMapping
Map-type used to map the setting numbers to labels.
int easy_value
The default value on easy difficulty setting.
int GetVersion() const
Get the version of the Script.
const char * GetTextfile(TextfileType type, CompanyID slot) const
Search a textfile file next to this script.
ScriptConfigItemList * config_list
List with all settings defined by this Script.
void ResetSettings()
Reset all settings to their default value.
int custom_value
The default value on custom difficulty setting.
class ScriptInfo * info
ScriptInfo object for related to this Script version.
void AnchorUnchangeableSettings()
As long as the default of a setting has not been changed, the value of the setting is not stored.
const char * description
The description of the configuration setting.
virtual int GetSetting(const char *name) const
Get the value of a setting for this config.
std::string SettingsToString() const
Convert the custom settings to a string that can be stored in the config file or savegames.
@ SSS_FORCE_NEWGAME
Get the newgame Script config.
@ SCRIPTCONFIG_RANDOM
When randomizing the Script, pick any value between min_value and max_value when on custom difficulty...
const char * name
Name of the Script.
ScriptConfigFlags flags
Flags for the configuration setting.
virtual void ClearConfigList()
Routine that clears the config list.
void Change(const char *name, int version=-1, bool force_exact_match=false, bool is_random=false)
Set another Script to be loaded in this slot.
std::map< const char *, int, StringCompare > SettingValueList
List with name=>value pairs of all script-specific settings.
const ScriptConfigItemList * GetConfigList()
Get the config list for this ScriptConfig.
TextfileType
Additional text files accompanying Tar archives.
virtual void PushExtraConfigList()
In case you have mandatory non-Script-definable config entries in your list, add them to this functio...
int hard_value
The default value on hard difficulty setting.
All static information from an Script like name, version, etc.
Info about a single Script setting.
@ SSS_FORCE_GAME
Get the Script config from the current game.
int random_deviation
The maximum random deviation from the default value.
const char * name
The name of the configuration setting.
bool HasScript() const
Is this config attached to an Script? In other words, is there a Script that is assigned to this slot...
ScriptConfigItem _start_date_config
Configuration for AI start date, every AI has this setting.
bool is_random
True if the AI in this slot was randomly chosen.
SettingValueList settings
List with all setting=>value pairs that are configure for this Script.
ScriptSettingSource
Where to get the config from, either default (depends on current game mode) or force either newgame o...