Merge branch 'master' into jgrpp-beta
# Conflicts: # src/economy.cpp # src/lang/traditional_chinese.txt # src/order_gui.cpp # src/settings.cpp # src/settings_internal.h # src/table/company_settings.ini # src/table/currency_settings.ini # src/table/gameopt_settings.ini # src/table/misc_settings.ini # src/table/settings.h.preamble # src/table/settings.ini # src/table/win32_settings.ini # src/table/window_settings.ini
This commit is contained in:
@@ -695,9 +695,9 @@ void DrawRailCatenary(const TileInfo *ti)
|
||||
DrawRailCatenaryRailway(ti);
|
||||
}
|
||||
|
||||
bool SettingsDisableElrail(int32 p1)
|
||||
void SettingsDisableElrail(int32 new_value)
|
||||
{
|
||||
bool disable = (p1 != 0);
|
||||
bool disable = (new_value != 0);
|
||||
|
||||
/* we will now walk through all electric train engines and change their railtypes if it is the wrong one*/
|
||||
const RailType old_railtype = disable ? RAILTYPE_ELECTRIC : RAILTYPE_RAIL;
|
||||
@@ -741,5 +741,4 @@ bool SettingsDisableElrail(int32 p1)
|
||||
* rails. It may have unintended consequences if that function is ever
|
||||
* extended, though. */
|
||||
ReinitGuiAfterToggleElrail(disable);
|
||||
return true;
|
||||
}
|
||||
|
@@ -36,6 +36,6 @@ void DrawRailCatenary(const TileInfo *ti);
|
||||
void DrawRailCatenaryOnTunnel(const TileInfo *ti);
|
||||
void DrawRailCatenaryOnBridge(const TileInfo *ti);
|
||||
|
||||
bool SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
|
||||
void SettingsDisableElrail(int32 new_value); ///< _settings_game.disable_elrail callback
|
||||
|
||||
#endif /* ELRAIL_FUNC_H */
|
||||
|
@@ -2642,6 +2642,7 @@ STR_NETWORK_ERROR_CLIENT_START :{WHITE}Could no
|
||||
STR_NETWORK_ERROR_TIMEOUT :{WHITE}Connection #{NUM} timed out
|
||||
STR_NETWORK_ERROR_SERVER_ERROR :{WHITE}A protocol error was detected and the connection was closed
|
||||
STR_NETWORK_ERROR_BAD_PLAYER_NAME :{WHITE}Your player name has not been set. The name can be set at the top of the Multiplayer window
|
||||
STR_NETWORK_ERROR_BAD_SERVER_NAME :{WHITE}Your server name has not been set. The name can be set at the top of the Multiplayer window
|
||||
STR_NETWORK_ERROR_WRONG_REVISION :{WHITE}The revision of this client does not match the server's revision
|
||||
STR_NETWORK_ERROR_WRONG_PASSWORD :{WHITE}Wrong password
|
||||
STR_NETWORK_ERROR_SERVER_FULL :{WHITE}The server is full
|
||||
|
@@ -865,10 +865,6 @@ void NetworkClientJoinGame()
|
||||
|
||||
static void NetworkInitGameInfo()
|
||||
{
|
||||
if (_settings_client.network.server_name.empty()) {
|
||||
_settings_client.network.server_name = "Unnamed Server";
|
||||
}
|
||||
|
||||
FillStaticNetworkServerGameInfo();
|
||||
/* The server is a client too */
|
||||
_network_game_info.clients_on = _network_dedicated ? 0 : 1;
|
||||
@@ -881,6 +877,25 @@ static void NetworkInitGameInfo()
|
||||
ci->client_name = _settings_client.network.client_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim the given server name in place, i.e. remove leading and trailing spaces.
|
||||
* After the trim check whether the server name is not empty.
|
||||
* When the server name is empty a GUI error message is shown telling the
|
||||
* user to set the servername and this function returns false.
|
||||
*
|
||||
* @param server_name The server name to validate. It will be trimmed of leading
|
||||
* and trailing spaces.
|
||||
* @return True iff the server name is valid.
|
||||
*/
|
||||
bool NetworkValidateServerName(std::string &server_name)
|
||||
{
|
||||
StrTrimInPlace(server_name);
|
||||
if (!server_name.empty()) return true;
|
||||
|
||||
ShowErrorMessage(STR_NETWORK_ERROR_BAD_SERVER_NAME, INVALID_STRING_ID, WL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the client and server name are set, for a dedicated server and if not set them to some default
|
||||
* value and tell the user to change this as soon as possible.
|
||||
@@ -890,12 +905,14 @@ static void NetworkInitGameInfo()
|
||||
static void CheckClientAndServerName()
|
||||
{
|
||||
static const std::string fallback_client_name = "Unnamed Client";
|
||||
StrTrimInPlace(_settings_client.network.client_name);
|
||||
if (_settings_client.network.client_name.empty() || _settings_client.network.client_name.compare(fallback_client_name) == 0) {
|
||||
DEBUG(net, 1, "No \"client_name\" has been set, using \"%s\" instead. Please set this now using the \"name <new name>\" command", fallback_client_name.c_str());
|
||||
_settings_client.network.client_name = fallback_client_name;
|
||||
}
|
||||
|
||||
static const std::string fallback_server_name = "Unnamed Server";
|
||||
StrTrimInPlace(_settings_client.network.server_name);
|
||||
if (_settings_client.network.server_name.empty() || _settings_client.network.server_name.compare(fallback_server_name) == 0) {
|
||||
DEBUG(net, 1, "No \"server_name\" has been set, using \"%s\" instead. Please set this now using the \"server_name <new name>\" command", fallback_server_name.c_str());
|
||||
_settings_client.network.server_name = fallback_server_name;
|
||||
|
@@ -1563,27 +1563,22 @@ bool NetworkValidateClientName()
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the server our name.
|
||||
* Send the server our name as callback from the setting.
|
||||
* @param newname The new client name.
|
||||
*/
|
||||
void NetworkUpdateClientName()
|
||||
void NetworkUpdateClientName(const std::string &client_name)
|
||||
{
|
||||
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(_network_own_client_id);
|
||||
|
||||
if (ci == nullptr) return;
|
||||
/* There is no validation on string settings, it is actually a post change callback.
|
||||
* This method is called from that post change callback. So, when the client name is
|
||||
* changed via the console there is no easy way to prevent an invalid name. Though,
|
||||
* we can prevent it getting sent here. */
|
||||
if (!NetworkValidateClientName()) return;
|
||||
|
||||
/* Don't change the name if it is the same as the old name */
|
||||
if (_settings_client.network.client_name.compare(ci->client_name) != 0) {
|
||||
if (client_name.compare(ci->client_name) != 0) {
|
||||
if (!_network_server) {
|
||||
MyClient::SendSetName(_settings_client.network.client_name.c_str());
|
||||
MyClient::SendSetName(client_name.c_str());
|
||||
} else {
|
||||
/* Copy to a temporary buffer so no #n gets added after our name in the settings when there are duplicate names. */
|
||||
char temporary_name[NETWORK_CLIENT_NAME_LENGTH];
|
||||
strecpy(temporary_name, _settings_client.network.client_name.c_str(), lastof(temporary_name));
|
||||
strecpy(temporary_name, client_name.c_str(), lastof(temporary_name));
|
||||
if (NetworkFindName(temporary_name, lastof(temporary_name))) {
|
||||
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, temporary_name);
|
||||
ci->client_name = temporary_name;
|
||||
|
@@ -38,7 +38,8 @@ byte NetworkSpectatorCount();
|
||||
bool NetworkIsValidClientName(const std::string_view client_name);
|
||||
bool NetworkValidateClientName();
|
||||
bool NetworkValidateClientName(std::string &client_name);
|
||||
void NetworkUpdateClientName();
|
||||
bool NetworkValidateServerName(std::string &server_name);
|
||||
void NetworkUpdateClientName(const std::string &client_name);
|
||||
bool NetworkCompanyHasClients(CompanyID company);
|
||||
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
|
||||
void NetworkReboot();
|
||||
|
@@ -1110,6 +1110,7 @@ struct NetworkStartServerWindow : public Window {
|
||||
break;
|
||||
|
||||
case WID_NSS_GENERATE_GAME: // Start game
|
||||
if (!CheckServerName()) return;
|
||||
_is_network_server = true;
|
||||
if (_ctrl_pressed) {
|
||||
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
||||
@@ -1119,16 +1120,19 @@ struct NetworkStartServerWindow : public Window {
|
||||
break;
|
||||
|
||||
case WID_NSS_LOAD_GAME:
|
||||
if (!CheckServerName()) return;
|
||||
_is_network_server = true;
|
||||
ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD);
|
||||
break;
|
||||
|
||||
case WID_NSS_PLAY_SCENARIO:
|
||||
if (!CheckServerName()) return;
|
||||
_is_network_server = true;
|
||||
ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);
|
||||
break;
|
||||
|
||||
case WID_NSS_PLAY_HEIGHTMAP:
|
||||
if (!CheckServerName()) return;
|
||||
_is_network_server = true;
|
||||
ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
|
||||
break;
|
||||
@@ -1148,11 +1152,13 @@ struct NetworkStartServerWindow : public Window {
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
void OnEditboxChanged(int wid) override
|
||||
bool CheckServerName()
|
||||
{
|
||||
if (wid == WID_NSS_GAMENAME) {
|
||||
_settings_client.network.server_name = this->name_editbox.text.buf;
|
||||
}
|
||||
std::string str = this->name_editbox.text.buf;
|
||||
if (!NetworkValidateServerName(str)) return false;
|
||||
|
||||
SetSettingValue(GetSettingFromName("network.server_name")->AsStringSetting(), str);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnTimeout() override
|
||||
@@ -2214,16 +2220,13 @@ public:
|
||||
case WID_CL_SERVER_NAME_EDIT: {
|
||||
if (!_network_server) break;
|
||||
|
||||
SetSettingValue(GetSettingFromName("network.server_name")->AsStringSetting(), StrEmpty(str) ? "Unnamed Server" : str);
|
||||
SetSettingValue(GetSettingFromName("network.server_name")->AsStringSetting(), str);
|
||||
this->InvalidateData();
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_CL_CLIENT_NAME_EDIT: {
|
||||
std::string client_name(str);
|
||||
if (!NetworkValidateClientName(client_name)) break;
|
||||
|
||||
SetSettingValue(GetSettingFromName("network.client_name")->AsStringSetting(), client_name.c_str());
|
||||
SetSettingValue(GetSettingFromName("network.client_name")->AsStringSetting(), str);
|
||||
this->InvalidateData();
|
||||
break;
|
||||
}
|
||||
|
@@ -292,15 +292,13 @@ void GRFParameterInfo::Finalize()
|
||||
/**
|
||||
* Update the palettes of the graphics from the config file.
|
||||
* Called when changing the default palette in advanced settings.
|
||||
* @param p1 Unused.
|
||||
* @return Always true.
|
||||
* @param new_value Unused.
|
||||
*/
|
||||
bool UpdateNewGRFConfigPalette(int32 p1)
|
||||
void UpdateNewGRFConfigPalette(int32 new_value)
|
||||
{
|
||||
for (GRFConfig *c = _grfconfig_newgame; c != nullptr; c = c->next) c->SetSuitablePalette();
|
||||
for (GRFConfig *c = _grfconfig_static; c != nullptr; c = c->next) c->SetSuitablePalette();
|
||||
for (GRFConfig *c = _all_grfs; c != nullptr; c = c->next) c->SetSuitablePalette();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -249,6 +249,6 @@ void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFC
|
||||
GRFTextWrapper FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
|
||||
|
||||
void UpdateNewGRFScanStatus(uint num, const char *name);
|
||||
bool UpdateNewGRFConfigPalette(int32 p1 = 0);
|
||||
void UpdateNewGRFConfigPalette(int32 new_value = 0);
|
||||
|
||||
#endif /* NEWGRF_CONFIG_H */
|
||||
|
@@ -2390,10 +2390,9 @@ static void SetDefaultRailGui()
|
||||
/**
|
||||
* Updates the current signal variant used in the signal GUI
|
||||
* to the one adequate to current year.
|
||||
* @param p needed to be called when a setting changes
|
||||
* @return success, needed for settings
|
||||
* @param new_value needed to be called when a setting changes
|
||||
*/
|
||||
bool ResetSignalVariant(int32 p)
|
||||
void ResetSignalVariant(int32 new_value)
|
||||
{
|
||||
SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
||||
|
||||
@@ -2405,8 +2404,6 @@ bool ResetSignalVariant(int32 p)
|
||||
}
|
||||
_cur_signal_variant = new_variant;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
struct Window *ShowBuildRailToolbar(RailType railtype);
|
||||
void ReinitGuiAfterToggleElrail(bool disable);
|
||||
bool ResetSignalVariant(int32 = 0);
|
||||
void ResetSignalVariant(int32 = 0);
|
||||
void InitializeRailGUI();
|
||||
DropDownList GetRailTypeDropDownList(bool for_replacement = false, bool all_option = false);
|
||||
|
||||
|
570
src/settings.cpp
570
src/settings.cpp
File diff suppressed because it is too large
Load Diff
@@ -79,8 +79,6 @@ struct SettingOnGuiCtrlData {
|
||||
};
|
||||
|
||||
struct IniItem;
|
||||
typedef bool OnChange(int32 var); ///< callback prototype on data modification
|
||||
typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error
|
||||
typedef bool OnGuiCtrl(SettingOnGuiCtrlData &data); ///< callback prototype for GUI operations
|
||||
typedef int64 OnXrefValueConvert(int64 val); ///< callback prototype for xref value conversion
|
||||
|
||||
@@ -163,11 +161,27 @@ struct SettingDesc {
|
||||
|
||||
/** Base integer type, including boolean, settings. Only these are shown in the settings UI. */
|
||||
struct IntSettingDesc : SettingDesc {
|
||||
/**
|
||||
* A check to be performed before the setting gets changed. The passed integer may be
|
||||
* changed by the check if that is important, for example to remove some unwanted bit.
|
||||
* The return value denotes whether the value, potentially after the changes,
|
||||
* is allowed to be used/set in the configuration.
|
||||
* @param value The prospective new value for the setting.
|
||||
* @return True when the setting is accepted.
|
||||
*/
|
||||
typedef bool PreChangeCheck(int32 &value);
|
||||
/**
|
||||
* A callback to denote that a setting has been changed.
|
||||
* @param The new value for the setting.
|
||||
*/
|
||||
typedef void PostChangeCallback(int32 value);
|
||||
|
||||
IntSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, int32 def,
|
||||
int32 min, uint32 max, int32 interval, StringID str, StringID str_help, StringID str_val,
|
||||
SettingCategory cat, OnChange *proc, const SettingDescEnumEntry *enumlist) :
|
||||
SettingCategory cat, PreChangeCheck pre_check, PostChangeCallback post_callback, const SettingDescEnumEntry *enumlist) :
|
||||
SettingDesc(save, name, flags, guiproc, startup, patx_name), def(def), min(min), max(max), interval(interval),
|
||||
str(str), str_help(str_help), str_val(str_val), cat(cat), proc(proc), enumlist(enumlist) {}
|
||||
str(str), str_help(str_help), str_val(str_val), cat(cat), pre_check(pre_check),
|
||||
post_callback(post_callback), enumlist(enumlist) {}
|
||||
virtual ~IntSettingDesc() {}
|
||||
|
||||
int32 def; ///< default value given when none is present
|
||||
@@ -178,7 +192,8 @@ struct IntSettingDesc : SettingDesc {
|
||||
StringID str_help; ///< (Translated) string with help text; gui only.
|
||||
StringID str_val; ///< (Translated) first string describing the value.
|
||||
SettingCategory cat; ///< assigned categories of the setting
|
||||
OnChange *proc; ///< callback procedure for when the value is changed
|
||||
PreChangeCheck *pre_check; ///< Callback to check for the validity of the setting.
|
||||
PostChangeCallback *post_callback; ///< Callback when the setting has been changed.
|
||||
|
||||
const SettingDescEnumEntry *enumlist; ///< For SGF_ENUM. The last entry must use STR_NULL
|
||||
|
||||
@@ -190,20 +205,25 @@ struct IntSettingDesc : SettingDesc {
|
||||
bool IsIntSetting() const override { return true; }
|
||||
|
||||
void ChangeValue(const void *object, int32 newvalue) const;
|
||||
void Write_ValidateSetting(const void *object, int32 value) const;
|
||||
void MakeValueValidAndWrite(const void *object, int32 value) const;
|
||||
|
||||
virtual size_t ParseValue(const char *str) const;
|
||||
void FormatValue(char *buf, const char *last, const void *object) const override;
|
||||
void ParseValue(const IniItem *item, void *object) const override;
|
||||
bool IsSameValue(const IniItem *item, void *object) const override;
|
||||
int32 Read(const void *object) const;
|
||||
|
||||
private:
|
||||
void MakeValueValid(int32 &value) const;
|
||||
void Write(const void *object, int32 value) const;
|
||||
};
|
||||
|
||||
/** Boolean setting. */
|
||||
struct BoolSettingDesc : IntSettingDesc {
|
||||
BoolSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, bool def,
|
||||
StringID str, StringID str_help, StringID str_val, SettingCategory cat, OnChange *proc) :
|
||||
IntSettingDesc(save, name, flags, guiproc, startup, patx_name, def, 0, 1, 0, str, str_help, str_val, cat, proc, nullptr) {}
|
||||
StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||
PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
||||
IntSettingDesc(save, name, flags, guiproc, startup, patx_name, def, 0, 1, 0, str, str_help, str_val, cat, pre_check, post_callback, nullptr) {}
|
||||
virtual ~BoolSettingDesc() {}
|
||||
|
||||
bool IsBoolSetting() const override { return true; }
|
||||
@@ -213,10 +233,13 @@ struct BoolSettingDesc : IntSettingDesc {
|
||||
|
||||
/** One of many setting. */
|
||||
struct OneOfManySettingDesc : IntSettingDesc {
|
||||
typedef size_t OnConvert(const char *value); ///< callback prototype for conversion error
|
||||
|
||||
OneOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name,
|
||||
int32 def, int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat, OnChange *proc,
|
||||
int32 def, int32 max, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||
PreChangeCheck pre_check, PostChangeCallback post_callback,
|
||||
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
|
||||
IntSettingDesc(save, name, flags, guiproc, startup, patx_name, def, 0, max, 0, str, str_help, str_val, cat, proc, nullptr), many_cnvt(many_cnvt)
|
||||
IntSettingDesc(save, name, flags, guiproc, startup, patx_name, def, 0, max, 0, str, str_help, str_val, cat, pre_check, post_callback, nullptr), many_cnvt(many_cnvt)
|
||||
{
|
||||
for (auto one : many) this->many.push_back(one);
|
||||
}
|
||||
@@ -236,10 +259,11 @@ struct OneOfManySettingDesc : IntSettingDesc {
|
||||
/** Many of many setting. */
|
||||
struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
||||
ManyOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name,
|
||||
int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat, OnChange *proc,
|
||||
int32 def, StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||
PreChangeCheck pre_check, PostChangeCallback post_callback,
|
||||
std::initializer_list<const char *> many, OnConvert *many_cnvt) :
|
||||
OneOfManySettingDesc(save, name, flags, guiproc, startup, patx_name, def, (1 << many.size()) - 1, str, str_help,
|
||||
str_val, cat, proc, many, many_cnvt) {}
|
||||
str_val, cat, pre_check, post_callback, many, many_cnvt) {}
|
||||
virtual ~ManyOfManySettingDesc() {}
|
||||
|
||||
size_t ParseValue(const char *str) const override;
|
||||
@@ -248,23 +272,43 @@ struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
||||
|
||||
/** String settings. */
|
||||
struct StringSettingDesc : SettingDesc {
|
||||
/**
|
||||
* A check to be performed before the setting gets changed. The passed string may be
|
||||
* changed by the check if that is important, for example to remove unwanted white
|
||||
* space. The return value denotes whether the value, potentially after the changes,
|
||||
* is allowed to be used/set in the configuration.
|
||||
* @param value The prospective new value for the setting.
|
||||
* @return True when the setting is accepted.
|
||||
*/
|
||||
typedef bool PreChangeCheck(std::string &value);
|
||||
/**
|
||||
* A callback to denote that a setting has been changed.
|
||||
* @param The new value for the setting.
|
||||
*/
|
||||
typedef void PostChangeCallback(const std::string &value);
|
||||
|
||||
StringSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, const char *def,
|
||||
uint32 max_length, OnChange proc) :
|
||||
SettingDesc(save, name, flags, guiproc, startup, patx_name), def(def), max_length(max_length), proc(proc) {}
|
||||
uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
||||
SettingDesc(save, name, flags, guiproc, startup, patx_name), def(def == nullptr ? "" : def), max_length(max_length),
|
||||
pre_check(pre_check), post_callback(post_callback) {}
|
||||
virtual ~StringSettingDesc() {}
|
||||
|
||||
const char *def; ///< default value given when none is present
|
||||
uint32 max_length; ///< maximum length of the string, 0 means no maximum length
|
||||
OnChange *proc; ///< callback procedure for when the value is changed
|
||||
std::string def; ///< Default value given when none is present
|
||||
uint32 max_length; ///< Maximum length of the string, 0 means no maximum length
|
||||
PreChangeCheck *pre_check; ///< Callback to check for the validity of the setting.
|
||||
PostChangeCallback *post_callback; ///< Callback when the setting has been changed.
|
||||
|
||||
bool IsStringSetting() const override { return true; }
|
||||
void ChangeValue(const void *object, const char *newval) const;
|
||||
void Write_ValidateSetting(const void *object, const char *str) const;
|
||||
void ChangeValue(const void *object, std::string &newval) const;
|
||||
|
||||
void FormatValue(char *buf, const char *last, const void *object) const override;
|
||||
void ParseValue(const IniItem *item, void *object) const override;
|
||||
bool IsSameValue(const IniItem *item, void *object) const override;
|
||||
const std::string &Read(const void *object) const;
|
||||
|
||||
private:
|
||||
void MakeValueValid(std::string &str) const;
|
||||
void Write(const void *object, const std::string &str) const;
|
||||
};
|
||||
|
||||
/** List/array settings. */
|
||||
@@ -306,7 +350,7 @@ typedef std::initializer_list<std::unique_ptr<const SettingDesc>> SettingTable;
|
||||
|
||||
const SettingDesc *GetSettingFromName(const char *name, bool ignore_version = false);
|
||||
bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame = false);
|
||||
bool SetSettingValue(const StringSettingDesc *sd, const char *value, bool force_newgame = false);
|
||||
bool SetSettingValue(const StringSettingDesc *sd, const std::string value, bool force_newgame = false);
|
||||
uint GetSettingIndex(const SettingDesc *sd);
|
||||
|
||||
#endif /* SETTINGS_INTERNAL_H */
|
||||
|
@@ -5,23 +5,20 @@
|
||||
;
|
||||
|
||||
[pre-amble]
|
||||
static bool CheckInterval(int32 p1);
|
||||
static bool InvalidateDetailsWindow(int32 p1);
|
||||
static bool UpdateIntervalTrains(int32 p1);
|
||||
static bool UpdateIntervalRoadVeh(int32 p1);
|
||||
static bool UpdateIntervalShips(int32 p1);
|
||||
static bool UpdateIntervalAircraft(int32 p1);
|
||||
static void UpdateServiceInterval(int32 new_value);
|
||||
static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value);
|
||||
static void UpdateServiceInterval(VehicleType type, int32 new_value);
|
||||
|
||||
static const SettingTable _company_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, $patxname),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, $patxname),
|
||||
SDT_BOOL = SDT_BOOL(CompanySettings, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, $patxname),
|
||||
SDT_VAR = SDT_VAR(CompanySettings, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, $patxname),
|
||||
SDT_NULL = SDT_NULL($length, $from, $to, $extver),
|
||||
|
||||
[validation]
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for CompanySettings.$var exceeds storage size");
|
||||
|
||||
[defaults]
|
||||
flags = 0
|
||||
@@ -30,7 +27,8 @@ interval = 0
|
||||
str = STR_NULL
|
||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||
strval = STR_NULL
|
||||
proc = nullptr
|
||||
pre_cb = nullptr
|
||||
post_cb = nullptr
|
||||
guiproc = nullptr
|
||||
load = nullptr
|
||||
from = SL_MIN_VERSION
|
||||
@@ -43,7 +41,6 @@ patxname = nullptr
|
||||
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = engine_renew
|
||||
def = true
|
||||
str = STR_CONFIG_SETTING_AUTORENEW_VEHICLE
|
||||
@@ -51,7 +48,6 @@ strhelp = STR_CONFIG_SETTING_AUTORENEW_VEHICLE_HELPTEXT
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = engine_renew_months
|
||||
type = SLE_INT16
|
||||
guiflags = SGF_PER_COMPANY | SGF_DISPLAY_ABS
|
||||
@@ -63,7 +59,6 @@ strhelp = STR_CONFIG_SETTING_AUTORENEW_MONTHS_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = engine_renew_money
|
||||
type = SLE_UINT
|
||||
guiflags = SGF_PER_COMPANY | SGF_CURRENCY
|
||||
@@ -75,7 +70,6 @@ strhelp = STR_CONFIG_SETTING_AUTORENEW_MONEY_HELPTEXT
|
||||
strval = STR_JUST_CURRENCY_LONG
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = renew_keep_length
|
||||
def = false
|
||||
|
||||
@@ -85,15 +79,13 @@ length = 1
|
||||
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP, 2)
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
var = vehicle.servint_ispercent
|
||||
def = false
|
||||
str = STR_CONFIG_SETTING_SERVINT_ISPERCENT
|
||||
strhelp = STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT
|
||||
proc = CheckInterval
|
||||
post_cb = UpdateServiceInterval
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = vehicle.servint_trains
|
||||
type = SLE_UINT16
|
||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||
@@ -103,10 +95,10 @@ max = 800
|
||||
str = STR_CONFIG_SETTING_SERVINT_TRAINS
|
||||
strhelp = STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
||||
proc = UpdateIntervalTrains
|
||||
pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_TRAIN, new_value); }
|
||||
post_cb = [](auto new_value) { UpdateServiceInterval(VEH_TRAIN, new_value); }
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = vehicle.servint_roadveh
|
||||
type = SLE_UINT16
|
||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||
@@ -116,10 +108,10 @@ max = 800
|
||||
str = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES
|
||||
strhelp = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
||||
proc = UpdateIntervalRoadVeh
|
||||
pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_ROAD, new_value); }
|
||||
post_cb = [](auto new_value) { UpdateServiceInterval(VEH_ROAD, new_value); }
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = vehicle.servint_ships
|
||||
type = SLE_UINT16
|
||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||
@@ -129,10 +121,10 @@ max = 800
|
||||
str = STR_CONFIG_SETTING_SERVINT_SHIPS
|
||||
strhelp = STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
||||
proc = UpdateIntervalShips
|
||||
pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_SHIP, new_value); }
|
||||
post_cb = [](auto new_value) { UpdateServiceInterval(VEH_SHIP, new_value); }
|
||||
|
||||
[SDT_VAR]
|
||||
base = CompanySettings
|
||||
var = vehicle.servint_aircraft
|
||||
type = SLE_UINT16
|
||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||
@@ -142,7 +134,8 @@ max = 800
|
||||
str = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
|
||||
strhelp = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
|
||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
||||
proc = UpdateIntervalAircraft
|
||||
pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_AIRCRAFT, new_value); }
|
||||
post_cb = [](auto new_value) { UpdateServiceInterval(VEH_AIRCRAFT, new_value); }
|
||||
|
||||
[SDT_BOOL]
|
||||
base = CompanySettings
|
||||
|
@@ -9,11 +9,11 @@ static const SettingTable _currency_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
SDT_VAR = SDT_VAR ($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_SSTR = SDT_SSTR($base, $var, $type, $flags, $guiflags, $def, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_VAR = SDT_VAR (CurrencySpec, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_SSTR = SDT_SSTR(CurrencySpec, $var, $type, $flags, $guiflags, $def, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
|
||||
[validation]
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for CurrencySpec.$var exceeds storage size");
|
||||
|
||||
[defaults]
|
||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||
@@ -22,7 +22,8 @@ interval = 0
|
||||
str = STR_NULL
|
||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||
strval = STR_NULL
|
||||
proc = nullptr
|
||||
pre_cb = nullptr
|
||||
post_cb = nullptr
|
||||
guiproc = nullptr
|
||||
load = nullptr
|
||||
from = SL_MIN_VERSION
|
||||
@@ -34,7 +35,6 @@ extver = SlXvFeatureTest()
|
||||
|
||||
|
||||
[SDT_VAR]
|
||||
base = CurrencySpec
|
||||
var = rate
|
||||
type = SLE_UINT16
|
||||
def = 1
|
||||
@@ -42,14 +42,12 @@ min = 0
|
||||
max = UINT16_MAX
|
||||
|
||||
[SDT_SSTR]
|
||||
base = CurrencySpec
|
||||
var = separator
|
||||
type = SLE_STRQ
|
||||
def = "".""
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_VAR]
|
||||
base = CurrencySpec
|
||||
var = to_euro
|
||||
type = SLE_INT32
|
||||
def = 0
|
||||
@@ -57,13 +55,11 @@ min = MIN_YEAR
|
||||
max = MAX_YEAR
|
||||
|
||||
[SDT_SSTR]
|
||||
base = CurrencySpec
|
||||
var = prefix
|
||||
type = SLE_STRQ
|
||||
def = nullptr
|
||||
|
||||
[SDT_SSTR]
|
||||
base = CurrencySpec
|
||||
var = suffix
|
||||
type = SLE_STRQ
|
||||
def = "" credits""
|
||||
|
@@ -38,19 +38,19 @@ static const SettingTable _gameopt_settings{
|
||||
};
|
||||
[templates]
|
||||
SDTG_LIST = SDTG_LIST($name, $type, $flags, $guiflags, $var, $def, $length, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_NULL = SDT_NULL( $length, $from, $to, $extver),
|
||||
SDTC_OMANY = SDTC_OMANY( $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_OMANY = SDT_OMANY($base, $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $extver, $load, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTC_OMANY = SDTC_OMANY( $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_OMANY = SDT_OMANY(GameSettings, $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $load, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_VAR = SDT_VAR(GameSettings, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
SDTG_OMANY = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
SDTC_OMANY = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
SDT_OMANY = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
SDT_OMANY = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");
|
||||
|
||||
[defaults]
|
||||
flags = 0
|
||||
@@ -59,7 +59,8 @@ interval = 0
|
||||
str = STR_NULL
|
||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||
strval = STR_NULL
|
||||
proc = nullptr
|
||||
pre_cb = nullptr
|
||||
post_cb = nullptr
|
||||
guiproc = nullptr
|
||||
load = nullptr
|
||||
from = SL_MIN_VERSION
|
||||
@@ -105,7 +106,6 @@ max = SP_CUSTOM
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_OMANY]
|
||||
base = GameSettings
|
||||
var = locale.currency
|
||||
type = SLE_UINT8
|
||||
flags = SLF_NO_NETWORK_SYNC
|
||||
@@ -127,7 +127,6 @@ cat = SC_BASIC
|
||||
# There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
|
||||
# these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
|
||||
[SDT_OMANY]
|
||||
base = GameSettings
|
||||
var = game_creation.town_name
|
||||
type = SLE_UINT8
|
||||
def = 0
|
||||
@@ -136,7 +135,6 @@ full = _town_names
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_OMANY]
|
||||
base = GameSettings
|
||||
var = game_creation.landscape
|
||||
type = SLE_UINT8
|
||||
def = 0
|
||||
@@ -146,7 +144,6 @@ load = ConvertLandscape
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_VAR]
|
||||
base = GameSettings
|
||||
var = game_creation.snow_line_height
|
||||
type = SLE_UINT8
|
||||
def = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT
|
||||
@@ -180,7 +177,6 @@ full = _autosave_interval
|
||||
cat = SC_BASIC
|
||||
|
||||
[SDT_OMANY]
|
||||
base = GameSettings
|
||||
var = vehicle.road_side
|
||||
type = SLE_UINT8
|
||||
def = 1
|
||||
|
@@ -23,11 +23,11 @@ static const SettingTable _misc_settings{
|
||||
};
|
||||
[templates]
|
||||
SDTG_LIST = SDTG_LIST($name, $type, $flags, $guiflags, $var, $def, $length, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_MMANY = SDTG_MMANY($name, $type, $flags, $guiflags, $var, $def, $full, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_SSTR = SDTG_SSTR($name, $type, $flags, $guiflags, $var, $def, 0, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_MMANY = SDTG_MMANY($name, $type, $flags, $guiflags, $var, $def, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_OMANY = SDTG_OMANY($name, $type, $flags, $guiflags, $var, $def, $max, $full, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_SSTR = SDTG_SSTR($name, $type, $flags, $guiflags, $var, $def, 0, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
@@ -40,7 +40,8 @@ interval = 0
|
||||
str = STR_NULL
|
||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||
strval = STR_NULL
|
||||
proc = nullptr
|
||||
pre_cb = nullptr
|
||||
post_cb = nullptr
|
||||
guiproc = nullptr
|
||||
load = nullptr
|
||||
from = SL_MIN_VERSION
|
||||
|
@@ -58,67 +58,67 @@ static size_t ConvertLandscape(const char *value);
|
||||
|
||||
/* Macros for various objects to go in the configuration file.
|
||||
* This section is for global variables */
|
||||
#define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, interval, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Int, SLEG_GENERAL_X(SL_VAR, var, type | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, min, max, interval, str, strhelp, strval, cat, proc, nullptr)
|
||||
#define SDTG_VAR(name, type, flags, guiflags, var, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Int, SLEG_GENERAL_X(SL_VAR, var, type | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, min, max, interval, str, strhelp, strval, cat, pre_check, post_callback, nullptr)
|
||||
|
||||
#define SDTG_BOOL(name, flags, guiflags, var, def, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Bool, SLEG_GENERAL_X(SL_VAR, var, SLE_BOOL | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, proc)
|
||||
#define SDTG_BOOL(name, flags, guiflags, var, def, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Bool, SLEG_GENERAL_X(SL_VAR, var, SLE_BOOL | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, pre_check, post_callback)
|
||||
|
||||
#define SDTG_LIST(name, type, flags, guiflags, var, def, length, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(List, SLEG_GENERAL_X(SL_ARR, var, type | flags, length, from, to, extver), name, guiflags, guiproc, startup, patxname, def)
|
||||
|
||||
#define SDTG_SSTR(name, type, flags, guiflags, var, def, max_length, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(String, SLEG_GENERAL_X(SL_STDSTR, var, type | flags, sizeof(var), from, to, extver), name, guiflags, guiproc, startup, patxname, def, max_length, proc)
|
||||
#define SDTG_SSTR(name, type, flags, guiflags, var, def, max_length, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(String, SLEG_GENERAL_X(SL_STDSTR, var, type | flags, sizeof(var), from, to, extver), name, guiflags, guiproc, startup, patxname, def, max_length, pre_check, post_callback)
|
||||
|
||||
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(OneOfMany, SLEG_GENERAL_X(SL_VAR, var, type | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, max, str, strhelp, strval, cat, proc, full, nullptr)
|
||||
#define SDTG_OMANY(name, type, flags, guiflags, var, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(OneOfMany, SLEG_GENERAL_X(SL_VAR, var, type | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, max, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
|
||||
|
||||
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(ManyOfMany, SLEG_GENERAL_X(SL_VAR, var, type | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, proc, full, nullptr)
|
||||
#define SDTG_MMANY(name, type, flags, guiflags, var, def, full, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(ManyOfMany, SLEG_GENERAL_X(SL_VAR, var, type | flags, 1, from, to, extver), name, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
|
||||
|
||||
#define SDTG_NULL(length, from, to, extver)\
|
||||
NSD(Null, SLE_CONDNULL_X(length, from, to, extver))
|
||||
|
||||
/* Macros for various objects to go in the configuration file.
|
||||
* This section is for structures where their various members are saved */
|
||||
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Int, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, min, max, interval, str, strhelp, strval, cat, proc, nullptr)
|
||||
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Int, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, min, max, interval, str, strhelp, strval, cat, pre_check, post_callback, nullptr)
|
||||
|
||||
#define SDT_ENUM(base, var, type, flags, guiflags, def, str, strhelp, proc, from, to, extver, cat, guiproc, startup, patxname, enumlist)\
|
||||
NSD(Int, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags | SGF_ENUM, guiproc, startup, patxname, def, 0, 0, 0, str, strhelp, STR_NULL, cat, proc, enumlist)
|
||||
#define SDT_ENUM(base, var, type, flags, guiflags, def, str, strhelp, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname, enumlist)\
|
||||
NSD(Int, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags | SGF_ENUM, guiproc, startup, patxname, def, 0, 0, 0, str, strhelp, STR_NULL, cat, pre_check, post_callback, enumlist)
|
||||
|
||||
#define SDT_BOOL(base, var, flags, guiflags, def, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Bool, SLE_GENERAL_X(SL_VAR, base, var, SLE_BOOL | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, proc)
|
||||
#define SDT_BOOL(base, var, flags, guiflags, def, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(Bool, SLE_GENERAL_X(SL_VAR, base, var, SLE_BOOL | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, pre_check, post_callback)
|
||||
|
||||
#define SDT_LIST(base, var, type, flags, guiflags, def, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(List, SLE_GENERAL_X(SL_ARR, base, var, type | flags, lengthof(((base*)8)->var), from, to, extver), #var, guiflags, guiproc, startup, patxname, def)
|
||||
|
||||
#define SDT_SSTR(base, var, type, flags, guiflags, def, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(String, SLE_GENERAL_X(SL_STDSTR, base, var, type | flags, sizeof(((base*)8)->var), from, to, extver), #var, guiflags, guiproc, startup, patxname, def, 0, proc)
|
||||
#define SDT_SSTR(base, var, type, flags, guiflags, def, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(String, SLE_GENERAL_X(SL_STDSTR, base, var, type | flags, sizeof(((base*)8)->var), from, to, extver), #var, guiflags, guiproc, startup, patxname, def, 0, pre_check, post_callback)
|
||||
|
||||
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, extver, load, cat, guiproc, startup, patxname)\
|
||||
NSD(OneOfMany, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, max, str, strhelp, strval, cat, proc, full, load)
|
||||
#define SDT_OMANY(base, var, type, flags, guiflags, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, extver, load, cat, guiproc, startup, patxname)\
|
||||
NSD(OneOfMany, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, max, str, strhelp, strval, cat, pre_check, post_callback, full, load)
|
||||
|
||||
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, proc, strhelp, strval, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(ManyOfMany, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, proc, full, nullptr)
|
||||
#define SDT_MMANY(base, var, type, flags, guiflags, def, full, str, pre_check, post_callback, strhelp, strval, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
NSD(ManyOfMany, SLE_GENERAL_X(SL_VAR, base, var, type | flags, 1, from, to, extver), #var, guiflags, guiproc, startup, patxname, def, str, strhelp, strval, cat, pre_check, post_callback, full, nullptr)
|
||||
|
||||
#define SDT_NULL(length, from, to, extver)\
|
||||
NSD(Null, SLE_CONDNULL_X(length, from, to, extver))
|
||||
|
||||
#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_VAR(#var, type, flags, guiflags, _settings_client.var, def, min, max, interval, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)
|
||||
#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_VAR(#var, type, flags, guiflags, _settings_client.var, def, min, max, interval, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)
|
||||
|
||||
#define SDTC_BOOL(var, flags, guiflags, def, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_BOOL(#var, flags, guiflags, _settings_client.var, def, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)
|
||||
#define SDTC_BOOL(var, flags, guiflags, def, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_BOOL(#var, flags, guiflags, _settings_client.var, def, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)
|
||||
|
||||
#define SDTC_LIST(var, type, flags, guiflags, def, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_LIST(#var, type, flags, guiflags, _settings_client.var, def, lengthof(_settings_client.var), from, to, extver, cat, guiproc, startup, patxname)
|
||||
|
||||
#define SDTC_SSTR(var, type, flags, guiflags, def, max_length, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_SSTR(#var, type, flags, guiflags, _settings_client.var, def, max_length, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
#define SDTC_SSTR(var, type, flags, guiflags, def, max_length, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_SSTR(#var, type, flags, guiflags, _settings_client.var, def, max_length, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
|
||||
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_OMANY(#var, type, flags, guiflags, _settings_client.var, def, max, full, str, strhelp, strval, proc, from, to, extver, cat, guiproc, startup, patxname)
|
||||
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)\
|
||||
SDTG_OMANY(#var, type, flags, guiflags, _settings_client.var, def, max, full, str, strhelp, strval, pre_check, post_callback, from, to, extver, cat, guiproc, startup, patxname)
|
||||
|
||||
#define SDT_XREF(from, to, extver, xref, xrefcvt)\
|
||||
NSD(Xref, SLE_CONDNULL_X(0, from, to, extver), SettingsXref(xref, xrefcvt))
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,8 @@ static const SettingTable _win32_settings{
|
||||
};
|
||||
#endif /* _WIN32 */
|
||||
[templates]
|
||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $guiproc, $startup, $extver, nullptr),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $guiproc, $startup, $extver, nullptr),
|
||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $guiproc, $startup, $extver, nullptr),
|
||||
SDTG_VAR = SDTG_VAR($name, $type, $flags, $guiflags, $var, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $guiproc, $startup, $extver, nullptr),
|
||||
|
||||
[validation]
|
||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||
@@ -27,7 +27,8 @@ interval = 0
|
||||
str = STR_NULL
|
||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||
strval = STR_NULL
|
||||
proc = nullptr
|
||||
pre_cb = nullptr
|
||||
post_cb = nullptr
|
||||
guiproc = nullptr
|
||||
load = nullptr
|
||||
from = SL_MIN_VERSION
|
||||
|
@@ -10,21 +10,21 @@ static const SettingTable _window_settings{
|
||||
[post-amble]
|
||||
};
|
||||
[templates]
|
||||
SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_BOOL = SDT_BOOL(WindowDesc, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
SDT_VAR = SDT_VAR(WindowDesc, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
||||
|
||||
[validation]
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
|
||||
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for WindowDesc.$var exceeds storage size");
|
||||
|
||||
[defaults]
|
||||
base = WindowDesc
|
||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||
guiflags = SGF_NONE
|
||||
interval = 0
|
||||
str = STR_NULL
|
||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||
strval = STR_NULL
|
||||
proc = nullptr
|
||||
pre_cb = nullptr
|
||||
post_cb = nullptr
|
||||
guiproc = nullptr
|
||||
load = nullptr
|
||||
from = SL_MIN_VERSION
|
||||
|
Reference in New Issue
Block a user