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);
|
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*/
|
/* 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;
|
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
|
* rails. It may have unintended consequences if that function is ever
|
||||||
* extended, though. */
|
* extended, though. */
|
||||||
ReinitGuiAfterToggleElrail(disable);
|
ReinitGuiAfterToggleElrail(disable);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,6 @@ void DrawRailCatenary(const TileInfo *ti);
|
|||||||
void DrawRailCatenaryOnTunnel(const TileInfo *ti);
|
void DrawRailCatenaryOnTunnel(const TileInfo *ti);
|
||||||
void DrawRailCatenaryOnBridge(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 */
|
#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_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_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_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_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_WRONG_PASSWORD :{WHITE}Wrong password
|
||||||
STR_NETWORK_ERROR_SERVER_FULL :{WHITE}The server is full
|
STR_NETWORK_ERROR_SERVER_FULL :{WHITE}The server is full
|
||||||
|
@@ -865,10 +865,6 @@ void NetworkClientJoinGame()
|
|||||||
|
|
||||||
static void NetworkInitGameInfo()
|
static void NetworkInitGameInfo()
|
||||||
{
|
{
|
||||||
if (_settings_client.network.server_name.empty()) {
|
|
||||||
_settings_client.network.server_name = "Unnamed Server";
|
|
||||||
}
|
|
||||||
|
|
||||||
FillStaticNetworkServerGameInfo();
|
FillStaticNetworkServerGameInfo();
|
||||||
/* The server is a client too */
|
/* The server is a client too */
|
||||||
_network_game_info.clients_on = _network_dedicated ? 0 : 1;
|
_network_game_info.clients_on = _network_dedicated ? 0 : 1;
|
||||||
@@ -881,6 +877,25 @@ static void NetworkInitGameInfo()
|
|||||||
ci->client_name = _settings_client.network.client_name;
|
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
|
* 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.
|
* value and tell the user to change this as soon as possible.
|
||||||
@@ -890,12 +905,14 @@ static void NetworkInitGameInfo()
|
|||||||
static void CheckClientAndServerName()
|
static void CheckClientAndServerName()
|
||||||
{
|
{
|
||||||
static const std::string fallback_client_name = "Unnamed Client";
|
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) {
|
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());
|
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;
|
_settings_client.network.client_name = fallback_client_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string fallback_server_name = "Unnamed Server";
|
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) {
|
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());
|
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;
|
_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);
|
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(_network_own_client_id);
|
||||||
|
|
||||||
if (ci == nullptr) return;
|
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 */
|
/* 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) {
|
if (!_network_server) {
|
||||||
MyClient::SendSetName(_settings_client.network.client_name.c_str());
|
MyClient::SendSetName(client_name.c_str());
|
||||||
} else {
|
} else {
|
||||||
/* Copy to a temporary buffer so no #n gets added after our name in the settings when there are duplicate names. */
|
/* 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];
|
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))) {
|
if (NetworkFindName(temporary_name, lastof(temporary_name))) {
|
||||||
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, temporary_name);
|
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, temporary_name);
|
||||||
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 NetworkIsValidClientName(const std::string_view client_name);
|
||||||
bool NetworkValidateClientName();
|
bool NetworkValidateClientName();
|
||||||
bool NetworkValidateClientName(std::string &client_name);
|
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);
|
bool NetworkCompanyHasClients(CompanyID company);
|
||||||
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
|
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
|
||||||
void NetworkReboot();
|
void NetworkReboot();
|
||||||
|
@@ -1110,6 +1110,7 @@ struct NetworkStartServerWindow : public Window {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_NSS_GENERATE_GAME: // Start game
|
case WID_NSS_GENERATE_GAME: // Start game
|
||||||
|
if (!CheckServerName()) return;
|
||||||
_is_network_server = true;
|
_is_network_server = true;
|
||||||
if (_ctrl_pressed) {
|
if (_ctrl_pressed) {
|
||||||
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
|
||||||
@@ -1119,16 +1120,19 @@ struct NetworkStartServerWindow : public Window {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_NSS_LOAD_GAME:
|
case WID_NSS_LOAD_GAME:
|
||||||
|
if (!CheckServerName()) return;
|
||||||
_is_network_server = true;
|
_is_network_server = true;
|
||||||
ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD);
|
ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_NSS_PLAY_SCENARIO:
|
case WID_NSS_PLAY_SCENARIO:
|
||||||
|
if (!CheckServerName()) return;
|
||||||
_is_network_server = true;
|
_is_network_server = true;
|
||||||
ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);
|
ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_NSS_PLAY_HEIGHTMAP:
|
case WID_NSS_PLAY_HEIGHTMAP:
|
||||||
|
if (!CheckServerName()) return;
|
||||||
_is_network_server = true;
|
_is_network_server = true;
|
||||||
ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
|
ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD);
|
||||||
break;
|
break;
|
||||||
@@ -1148,11 +1152,13 @@ struct NetworkStartServerWindow : public Window {
|
|||||||
this->SetDirty();
|
this->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEditboxChanged(int wid) override
|
bool CheckServerName()
|
||||||
{
|
{
|
||||||
if (wid == WID_NSS_GAMENAME) {
|
std::string str = this->name_editbox.text.buf;
|
||||||
_settings_client.network.server_name = this->name_editbox.text.buf;
|
if (!NetworkValidateServerName(str)) return false;
|
||||||
}
|
|
||||||
|
SetSettingValue(GetSettingFromName("network.server_name")->AsStringSetting(), str);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTimeout() override
|
void OnTimeout() override
|
||||||
@@ -2214,16 +2220,13 @@ public:
|
|||||||
case WID_CL_SERVER_NAME_EDIT: {
|
case WID_CL_SERVER_NAME_EDIT: {
|
||||||
if (!_network_server) break;
|
if (!_network_server) break;
|
||||||
|
|
||||||
SetSettingValue(GetSettingFromName("network.server_name")->AsStringSetting(), StrEmpty(str) ? "Unnamed Server" : str);
|
SetSettingValue(GetSettingFromName("network.server_name")->AsStringSetting(), str);
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WID_CL_CLIENT_NAME_EDIT: {
|
case WID_CL_CLIENT_NAME_EDIT: {
|
||||||
std::string client_name(str);
|
SetSettingValue(GetSettingFromName("network.client_name")->AsStringSetting(), str);
|
||||||
if (!NetworkValidateClientName(client_name)) break;
|
|
||||||
|
|
||||||
SetSettingValue(GetSettingFromName("network.client_name")->AsStringSetting(), client_name.c_str());
|
|
||||||
this->InvalidateData();
|
this->InvalidateData();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -292,15 +292,13 @@ void GRFParameterInfo::Finalize()
|
|||||||
/**
|
/**
|
||||||
* Update the palettes of the graphics from the config file.
|
* Update the palettes of the graphics from the config file.
|
||||||
* Called when changing the default palette in advanced settings.
|
* Called when changing the default palette in advanced settings.
|
||||||
* @param p1 Unused.
|
* @param new_value Unused.
|
||||||
* @return Always true.
|
|
||||||
*/
|
*/
|
||||||
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_newgame; c != nullptr; c = c->next) c->SetSuitablePalette();
|
||||||
for (GRFConfig *c = _grfconfig_static; 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();
|
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);
|
GRFTextWrapper FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create);
|
||||||
|
|
||||||
void UpdateNewGRFScanStatus(uint num, const char *name);
|
void UpdateNewGRFScanStatus(uint num, const char *name);
|
||||||
bool UpdateNewGRFConfigPalette(int32 p1 = 0);
|
void UpdateNewGRFConfigPalette(int32 new_value = 0);
|
||||||
|
|
||||||
#endif /* NEWGRF_CONFIG_H */
|
#endif /* NEWGRF_CONFIG_H */
|
||||||
|
@@ -2390,10 +2390,9 @@ static void SetDefaultRailGui()
|
|||||||
/**
|
/**
|
||||||
* Updates the current signal variant used in the signal GUI
|
* Updates the current signal variant used in the signal GUI
|
||||||
* to the one adequate to current year.
|
* to the one adequate to current year.
|
||||||
* @param p needed to be called when a setting changes
|
* @param new_value needed to be called when a setting changes
|
||||||
* @return success, needed for settings
|
|
||||||
*/
|
*/
|
||||||
bool ResetSignalVariant(int32 p)
|
void ResetSignalVariant(int32 new_value)
|
||||||
{
|
{
|
||||||
SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
|
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;
|
_cur_signal_variant = new_variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
struct Window *ShowBuildRailToolbar(RailType railtype);
|
struct Window *ShowBuildRailToolbar(RailType railtype);
|
||||||
void ReinitGuiAfterToggleElrail(bool disable);
|
void ReinitGuiAfterToggleElrail(bool disable);
|
||||||
bool ResetSignalVariant(int32 = 0);
|
void ResetSignalVariant(int32 = 0);
|
||||||
void InitializeRailGUI();
|
void InitializeRailGUI();
|
||||||
DropDownList GetRailTypeDropDownList(bool for_replacement = false, bool all_option = false);
|
DropDownList GetRailTypeDropDownList(bool for_replacement = false, bool all_option = false);
|
||||||
|
|
||||||
|
578
src/settings.cpp
578
src/settings.cpp
File diff suppressed because it is too large
Load Diff
@@ -79,8 +79,6 @@ struct SettingOnGuiCtrlData {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct IniItem;
|
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 bool OnGuiCtrl(SettingOnGuiCtrlData &data); ///< callback prototype for GUI operations
|
||||||
typedef int64 OnXrefValueConvert(int64 val); ///< callback prototype for xref value conversion
|
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. */
|
/** Base integer type, including boolean, settings. Only these are shown in the settings UI. */
|
||||||
struct IntSettingDesc : SettingDesc {
|
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,
|
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,
|
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),
|
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() {}
|
virtual ~IntSettingDesc() {}
|
||||||
|
|
||||||
int32 def; ///< default value given when none is present
|
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_help; ///< (Translated) string with help text; gui only.
|
||||||
StringID str_val; ///< (Translated) first string describing the value.
|
StringID str_val; ///< (Translated) first string describing the value.
|
||||||
SettingCategory cat; ///< assigned categories of the setting
|
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
|
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; }
|
bool IsIntSetting() const override { return true; }
|
||||||
|
|
||||||
void ChangeValue(const void *object, int32 newvalue) const;
|
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;
|
virtual size_t ParseValue(const char *str) const;
|
||||||
void FormatValue(char *buf, const char *last, const void *object) const override;
|
void FormatValue(char *buf, const char *last, const void *object) const override;
|
||||||
void ParseValue(const IniItem *item, void *object) const override;
|
void ParseValue(const IniItem *item, void *object) const override;
|
||||||
bool IsSameValue(const IniItem *item, void *object) const override;
|
bool IsSameValue(const IniItem *item, void *object) const override;
|
||||||
int32 Read(const void *object) const;
|
int32 Read(const void *object) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void MakeValueValid(int32 &value) const;
|
||||||
|
void Write(const void *object, int32 value) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Boolean setting. */
|
/** Boolean setting. */
|
||||||
struct BoolSettingDesc : IntSettingDesc {
|
struct BoolSettingDesc : IntSettingDesc {
|
||||||
BoolSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, bool def,
|
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) :
|
StringID str, StringID str_help, StringID str_val, SettingCategory cat,
|
||||||
IntSettingDesc(save, name, flags, guiproc, startup, patx_name, def, 0, 1, 0, str, str_help, str_val, cat, proc, nullptr) {}
|
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() {}
|
virtual ~BoolSettingDesc() {}
|
||||||
|
|
||||||
bool IsBoolSetting() const override { return true; }
|
bool IsBoolSetting() const override { return true; }
|
||||||
@@ -213,10 +233,13 @@ struct BoolSettingDesc : IntSettingDesc {
|
|||||||
|
|
||||||
/** One of many setting. */
|
/** One of many setting. */
|
||||||
struct OneOfManySettingDesc : IntSettingDesc {
|
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,
|
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) :
|
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);
|
for (auto one : many) this->many.push_back(one);
|
||||||
}
|
}
|
||||||
@@ -236,10 +259,11 @@ struct OneOfManySettingDesc : IntSettingDesc {
|
|||||||
/** Many of many setting. */
|
/** Many of many setting. */
|
||||||
struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
||||||
ManyOfManySettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name,
|
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) :
|
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,
|
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() {}
|
virtual ~ManyOfManySettingDesc() {}
|
||||||
|
|
||||||
size_t ParseValue(const char *str) const override;
|
size_t ParseValue(const char *str) const override;
|
||||||
@@ -248,23 +272,43 @@ struct ManyOfManySettingDesc : OneOfManySettingDesc {
|
|||||||
|
|
||||||
/** String settings. */
|
/** String settings. */
|
||||||
struct StringSettingDesc : SettingDesc {
|
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,
|
StringSettingDesc(SaveLoad save, const char *name, SettingGuiFlag flags, OnGuiCtrl *guiproc, bool startup, const char *patx_name, const char *def,
|
||||||
uint32 max_length, OnChange proc) :
|
uint32 max_length, PreChangeCheck pre_check, PostChangeCallback post_callback) :
|
||||||
SettingDesc(save, name, flags, guiproc, startup, patx_name), def(def), max_length(max_length), proc(proc) {}
|
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() {}
|
virtual ~StringSettingDesc() {}
|
||||||
|
|
||||||
const char *def; ///< default value given when none is present
|
std::string def; ///< Default value given when none is present
|
||||||
uint32 max_length; ///< maximum length of the string, 0 means no maximum length
|
uint32 max_length; ///< Maximum length of the string, 0 means no maximum length
|
||||||
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.
|
||||||
|
|
||||||
bool IsStringSetting() const override { return true; }
|
bool IsStringSetting() const override { return true; }
|
||||||
void ChangeValue(const void *object, const char *newval) const;
|
void ChangeValue(const void *object, std::string &newval) const;
|
||||||
void Write_ValidateSetting(const void *object, const char *str) const;
|
|
||||||
|
|
||||||
void FormatValue(char *buf, const char *last, const void *object) const override;
|
void FormatValue(char *buf, const char *last, const void *object) const override;
|
||||||
void ParseValue(const IniItem *item, void *object) const override;
|
void ParseValue(const IniItem *item, void *object) const override;
|
||||||
bool IsSameValue(const IniItem *item, void *object) const override;
|
bool IsSameValue(const IniItem *item, void *object) const override;
|
||||||
const std::string &Read(const void *object) const;
|
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. */
|
/** 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);
|
const SettingDesc *GetSettingFromName(const char *name, bool ignore_version = false);
|
||||||
bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame = 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);
|
uint GetSettingIndex(const SettingDesc *sd);
|
||||||
|
|
||||||
#endif /* SETTINGS_INTERNAL_H */
|
#endif /* SETTINGS_INTERNAL_H */
|
||||||
|
@@ -5,23 +5,20 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
[pre-amble]
|
[pre-amble]
|
||||||
static bool CheckInterval(int32 p1);
|
static void UpdateServiceInterval(int32 new_value);
|
||||||
static bool InvalidateDetailsWindow(int32 p1);
|
static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value);
|
||||||
static bool UpdateIntervalTrains(int32 p1);
|
static void UpdateServiceInterval(VehicleType type, int32 new_value);
|
||||||
static bool UpdateIntervalRoadVeh(int32 p1);
|
|
||||||
static bool UpdateIntervalShips(int32 p1);
|
|
||||||
static bool UpdateIntervalAircraft(int32 p1);
|
|
||||||
|
|
||||||
static const SettingTable _company_settings{
|
static const SettingTable _company_settings{
|
||||||
[post-amble]
|
[post-amble]
|
||||||
};
|
};
|
||||||
[templates]
|
[templates]
|
||||||
SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $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($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $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),
|
SDT_NULL = SDT_NULL($length, $from, $to, $extver),
|
||||||
|
|
||||||
[validation]
|
[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]
|
[defaults]
|
||||||
flags = 0
|
flags = 0
|
||||||
@@ -30,7 +27,8 @@ interval = 0
|
|||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
strval = STR_NULL
|
strval = STR_NULL
|
||||||
proc = nullptr
|
pre_cb = nullptr
|
||||||
|
post_cb = nullptr
|
||||||
guiproc = nullptr
|
guiproc = nullptr
|
||||||
load = nullptr
|
load = nullptr
|
||||||
from = SL_MIN_VERSION
|
from = SL_MIN_VERSION
|
||||||
@@ -43,7 +41,6 @@ patxname = nullptr
|
|||||||
|
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
base = CompanySettings
|
|
||||||
var = engine_renew
|
var = engine_renew
|
||||||
def = true
|
def = true
|
||||||
str = STR_CONFIG_SETTING_AUTORENEW_VEHICLE
|
str = STR_CONFIG_SETTING_AUTORENEW_VEHICLE
|
||||||
@@ -51,7 +48,6 @@ strhelp = STR_CONFIG_SETTING_AUTORENEW_VEHICLE_HELPTEXT
|
|||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
|
||||||
var = engine_renew_months
|
var = engine_renew_months
|
||||||
type = SLE_INT16
|
type = SLE_INT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_DISPLAY_ABS
|
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
|
strval = STR_CONFIG_SETTING_AUTORENEW_MONTHS_VALUE_BEFORE
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
|
||||||
var = engine_renew_money
|
var = engine_renew_money
|
||||||
type = SLE_UINT
|
type = SLE_UINT
|
||||||
guiflags = SGF_PER_COMPANY | SGF_CURRENCY
|
guiflags = SGF_PER_COMPANY | SGF_CURRENCY
|
||||||
@@ -75,7 +70,6 @@ strhelp = STR_CONFIG_SETTING_AUTORENEW_MONEY_HELPTEXT
|
|||||||
strval = STR_JUST_CURRENCY_LONG
|
strval = STR_JUST_CURRENCY_LONG
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
base = CompanySettings
|
|
||||||
var = renew_keep_length
|
var = renew_keep_length
|
||||||
def = false
|
def = false
|
||||||
|
|
||||||
@@ -85,15 +79,13 @@ length = 1
|
|||||||
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP, 2)
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP, 2)
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
base = CompanySettings
|
|
||||||
var = vehicle.servint_ispercent
|
var = vehicle.servint_ispercent
|
||||||
def = false
|
def = false
|
||||||
str = STR_CONFIG_SETTING_SERVINT_ISPERCENT
|
str = STR_CONFIG_SETTING_SERVINT_ISPERCENT
|
||||||
strhelp = STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT
|
||||||
proc = CheckInterval
|
post_cb = UpdateServiceInterval
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
|
||||||
var = vehicle.servint_trains
|
var = vehicle.servint_trains
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||||
@@ -103,10 +95,10 @@ max = 800
|
|||||||
str = STR_CONFIG_SETTING_SERVINT_TRAINS
|
str = STR_CONFIG_SETTING_SERVINT_TRAINS
|
||||||
strhelp = STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
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]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
|
||||||
var = vehicle.servint_roadveh
|
var = vehicle.servint_roadveh
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||||
@@ -116,10 +108,10 @@ max = 800
|
|||||||
str = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES
|
str = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES
|
||||||
strhelp = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
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]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
|
||||||
var = vehicle.servint_ships
|
var = vehicle.servint_ships
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||||
@@ -129,10 +121,10 @@ max = 800
|
|||||||
str = STR_CONFIG_SETTING_SERVINT_SHIPS
|
str = STR_CONFIG_SETTING_SERVINT_SHIPS
|
||||||
strhelp = STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
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]
|
[SDT_VAR]
|
||||||
base = CompanySettings
|
|
||||||
var = vehicle.servint_aircraft
|
var = vehicle.servint_aircraft
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
guiflags = SGF_PER_COMPANY | SGF_0ISDISABLED
|
||||||
@@ -142,7 +134,8 @@ max = 800
|
|||||||
str = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
|
str = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
|
||||||
strhelp = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
|
||||||
strval = STR_CONFIG_SETTING_SERVINT_VALUE
|
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]
|
[SDT_BOOL]
|
||||||
base = CompanySettings
|
base = CompanySettings
|
||||||
|
@@ -9,11 +9,11 @@ static const SettingTable _currency_settings{
|
|||||||
[post-amble]
|
[post-amble]
|
||||||
};
|
};
|
||||||
[templates]
|
[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_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($base, $var, $type, $flags, $guiflags, $def, $proc, $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]
|
[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]
|
[defaults]
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
@@ -22,7 +22,8 @@ interval = 0
|
|||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
strval = STR_NULL
|
strval = STR_NULL
|
||||||
proc = nullptr
|
pre_cb = nullptr
|
||||||
|
post_cb = nullptr
|
||||||
guiproc = nullptr
|
guiproc = nullptr
|
||||||
load = nullptr
|
load = nullptr
|
||||||
from = SL_MIN_VERSION
|
from = SL_MIN_VERSION
|
||||||
@@ -34,7 +35,6 @@ extver = SlXvFeatureTest()
|
|||||||
|
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = CurrencySpec
|
|
||||||
var = rate
|
var = rate
|
||||||
type = SLE_UINT16
|
type = SLE_UINT16
|
||||||
def = 1
|
def = 1
|
||||||
@@ -42,14 +42,12 @@ min = 0
|
|||||||
max = UINT16_MAX
|
max = UINT16_MAX
|
||||||
|
|
||||||
[SDT_SSTR]
|
[SDT_SSTR]
|
||||||
base = CurrencySpec
|
|
||||||
var = separator
|
var = separator
|
||||||
type = SLE_STRQ
|
type = SLE_STRQ
|
||||||
def = "".""
|
def = "".""
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = CurrencySpec
|
|
||||||
var = to_euro
|
var = to_euro
|
||||||
type = SLE_INT32
|
type = SLE_INT32
|
||||||
def = 0
|
def = 0
|
||||||
@@ -57,13 +55,11 @@ min = MIN_YEAR
|
|||||||
max = MAX_YEAR
|
max = MAX_YEAR
|
||||||
|
|
||||||
[SDT_SSTR]
|
[SDT_SSTR]
|
||||||
base = CurrencySpec
|
|
||||||
var = prefix
|
var = prefix
|
||||||
type = SLE_STRQ
|
type = SLE_STRQ
|
||||||
def = nullptr
|
def = nullptr
|
||||||
|
|
||||||
[SDT_SSTR]
|
[SDT_SSTR]
|
||||||
base = CurrencySpec
|
|
||||||
var = suffix
|
var = suffix
|
||||||
type = SLE_STRQ
|
type = SLE_STRQ
|
||||||
def = "" credits""
|
def = "" credits""
|
||||||
|
@@ -37,20 +37,20 @@ static const SettingTable _gameopt_settings{
|
|||||||
[post-amble]
|
[post-amble]
|
||||||
};
|
};
|
||||||
[templates]
|
[templates]
|
||||||
SDTG_LIST = SDTG_LIST($name, $type, $flags, $guiflags, $var, $def, $length, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
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),
|
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),
|
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, $proc, $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($base, $var, $type, $flags, $guiflags, $def, $max, $full, $str, $strhelp, $strval, $proc, $from, $to, $extver, $load, $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($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $extver, $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]
|
[validation]
|
||||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
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");
|
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");
|
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_OMANY = static_assert($max <= MAX_$type, "Maximum value for GameSettings.$var exceeds storage size");
|
||||||
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 GameSettings.$var exceeds storage size");
|
||||||
|
|
||||||
[defaults]
|
[defaults]
|
||||||
flags = 0
|
flags = 0
|
||||||
@@ -59,7 +59,8 @@ interval = 0
|
|||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
strval = STR_NULL
|
strval = STR_NULL
|
||||||
proc = nullptr
|
pre_cb = nullptr
|
||||||
|
post_cb = nullptr
|
||||||
guiproc = nullptr
|
guiproc = nullptr
|
||||||
load = nullptr
|
load = nullptr
|
||||||
from = SL_MIN_VERSION
|
from = SL_MIN_VERSION
|
||||||
@@ -105,7 +106,6 @@ max = SP_CUSTOM
|
|||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_OMANY]
|
[SDT_OMANY]
|
||||||
base = GameSettings
|
|
||||||
var = locale.currency
|
var = locale.currency
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
flags = SLF_NO_NETWORK_SYNC
|
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
|
# 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.
|
# these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
|
||||||
[SDT_OMANY]
|
[SDT_OMANY]
|
||||||
base = GameSettings
|
|
||||||
var = game_creation.town_name
|
var = game_creation.town_name
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
def = 0
|
def = 0
|
||||||
@@ -136,7 +135,6 @@ full = _town_names
|
|||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_OMANY]
|
[SDT_OMANY]
|
||||||
base = GameSettings
|
|
||||||
var = game_creation.landscape
|
var = game_creation.landscape
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
def = 0
|
def = 0
|
||||||
@@ -146,7 +144,6 @@ load = ConvertLandscape
|
|||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
base = GameSettings
|
|
||||||
var = game_creation.snow_line_height
|
var = game_creation.snow_line_height
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
def = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT
|
def = DEF_SNOWLINE_HEIGHT * TILE_HEIGHT
|
||||||
@@ -180,7 +177,6 @@ full = _autosave_interval
|
|||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
[SDT_OMANY]
|
[SDT_OMANY]
|
||||||
base = GameSettings
|
|
||||||
var = vehicle.road_side
|
var = vehicle.road_side
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
def = 1
|
def = 1
|
||||||
|
@@ -22,12 +22,12 @@ static const SettingTable _misc_settings{
|
|||||||
[post-amble]
|
[post-amble]
|
||||||
};
|
};
|
||||||
[templates]
|
[templates]
|
||||||
SDTG_LIST = SDTG_LIST($name, $type, $flags, $guiflags, $var, $def, $length, $from, $to, $extver, $cat, $guiproc, $startup, nullptr),
|
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_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, $proc, $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, $proc, $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, $proc, $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, $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),
|
||||||
|
|
||||||
[validation]
|
[validation]
|
||||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||||
@@ -40,7 +40,8 @@ interval = 0
|
|||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
strval = STR_NULL
|
strval = STR_NULL
|
||||||
proc = nullptr
|
pre_cb = nullptr
|
||||||
|
post_cb = nullptr
|
||||||
guiproc = nullptr
|
guiproc = nullptr
|
||||||
load = nullptr
|
load = nullptr
|
||||||
from = SL_MIN_VERSION
|
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.
|
/* Macros for various objects to go in the configuration file.
|
||||||
* This section is for global variables */
|
* 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)\
|
#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, proc, nullptr)
|
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)\
|
#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, proc)
|
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)\
|
#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)
|
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)\
|
#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, proc)
|
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)\
|
#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, proc, full, nullptr)
|
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)\
|
#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, proc, full, nullptr)
|
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)\
|
#define SDTG_NULL(length, from, to, extver)\
|
||||||
NSD(Null, SLE_CONDNULL_X(length, from, to, extver))
|
NSD(Null, SLE_CONDNULL_X(length, from, to, extver))
|
||||||
|
|
||||||
/* Macros for various objects to go in the configuration file.
|
/* Macros for various objects to go in the configuration file.
|
||||||
* This section is for structures where their various members are saved */
|
* 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)\
|
#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, proc, nullptr)
|
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)\
|
#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, proc, 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)\
|
#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, proc)
|
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)\
|
#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)
|
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)\
|
#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, proc)
|
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)\
|
#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, proc, full, load)
|
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)\
|
#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, proc, full, nullptr)
|
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)\
|
#define SDT_NULL(length, from, to, extver)\
|
||||||
NSD(Null, SLE_CONDNULL_X(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)\
|
#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, proc, 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)\
|
#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, proc, 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)\
|
#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)
|
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)\
|
#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, proc, 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)\
|
#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, proc, 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)\
|
#define SDT_XREF(from, to, extver, xref, xrefcvt)\
|
||||||
NSD(Xref, SLE_CONDNULL_X(0, from, to, extver), SettingsXref(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 */
|
#endif /* _WIN32 */
|
||||||
[templates]
|
[templates]
|
||||||
SDTG_BOOL = SDTG_BOOL($name, $flags, $guiflags, $var, $def, $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, $proc, $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]
|
[validation]
|
||||||
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size");
|
||||||
@@ -27,7 +27,8 @@ interval = 0
|
|||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
strval = STR_NULL
|
strval = STR_NULL
|
||||||
proc = nullptr
|
pre_cb = nullptr
|
||||||
|
post_cb = nullptr
|
||||||
guiproc = nullptr
|
guiproc = nullptr
|
||||||
load = nullptr
|
load = nullptr
|
||||||
from = SL_MIN_VERSION
|
from = SL_MIN_VERSION
|
||||||
|
@@ -10,21 +10,21 @@ static const SettingTable _window_settings{
|
|||||||
[post-amble]
|
[post-amble]
|
||||||
};
|
};
|
||||||
[templates]
|
[templates]
|
||||||
SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $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($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $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]
|
[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]
|
[defaults]
|
||||||
base = WindowDesc
|
|
||||||
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
|
||||||
guiflags = SGF_NONE
|
guiflags = SGF_NONE
|
||||||
interval = 0
|
interval = 0
|
||||||
str = STR_NULL
|
str = STR_NULL
|
||||||
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
|
||||||
strval = STR_NULL
|
strval = STR_NULL
|
||||||
proc = nullptr
|
pre_cb = nullptr
|
||||||
|
post_cb = nullptr
|
||||||
guiproc = nullptr
|
guiproc = nullptr
|
||||||
load = nullptr
|
load = nullptr
|
||||||
from = SL_MIN_VERSION
|
from = SL_MIN_VERSION
|
||||||
|
Reference in New Issue
Block a user