29 #define SPECENUM_NAME sset_category
30 #define SPECENUM_VALUE0 SSET_GEOLOGY
31 #define SPECENUM_VALUE0NAME N_("Geological")
32 #define SPECENUM_VALUE1 SSET_SOCIOLOGY
33 #define SPECENUM_VALUE1NAME N_("Sociological")
34 #define SPECENUM_VALUE2 SSET_ECONOMICS
35 #define SPECENUM_VALUE2NAME N_("Economic")
36 #define SPECENUM_VALUE3 SSET_MILITARY
37 #define SPECENUM_VALUE3NAME N_("Military")
38 #define SPECENUM_VALUE4 SSET_SCIENCE
39 #define SPECENUM_VALUE4NAME N_("Scientific")
40 #define SPECENUM_VALUE5 SSET_INTERNAL
41 #define SPECENUM_VALUE5NAME N_("Internal")
42 #define SPECENUM_VALUE6 SSET_NETWORK
43 #define SPECENUM_VALUE6NAME N_("Networking")
45 #define SPECENUM_COUNT SSET_NUM_CATEGORIES
46 #include "specenum_gen.h"
49 #define SPECENUM_NAME sset_level
50 #define SPECENUM_VALUE0 SSET_NONE
51 #define SPECENUM_VALUE0NAME N_("?ssetlevel:None")
52 #define SPECENUM_VALUE1 SSET_ALL
53 #define SPECENUM_VALUE1NAME N_("All")
54 #define SPECENUM_VALUE2 SSET_VITAL
55 #define SPECENUM_VALUE2NAME N_("Vital")
56 #define SPECENUM_VALUE3 SSET_SITUATIONAL
57 #define SPECENUM_VALUE3NAME N_("Situational")
58 #define SPECENUM_VALUE4 SSET_RARE
59 #define SPECENUM_VALUE4NAME N_("Rare")
60 #define SPECENUM_VALUE5 SSET_CHANGED
61 #define SPECENUM_VALUE5NAME N_("Changed")
62 #define SPECENUM_VALUE6 SSET_LOCKED
63 #define SPECENUM_VALUE6NAME N_("Locked")
65 #define SPECENUM_COUNT OLEVELS_NUM
66 #include "specenum_gen.h"
84 size_t reject_msg_len);
86 enum cmdlevel plevel);
91 char *buf,
size_t buf_len);
93 char *buf,
size_t buf_len);
104 size_t reject_msg_len);
107 size_t reject_msg_len);
115 size_t reject_msg_len);
118 size_t reject_msg_len);
124 size_t reject_msg_len);
127 size_t reject_msg_len);
135 size_t reject_msg_len);
138 size_t reject_msg_len);
145 size_t reject_msg_len);
148 size_t reject_msg_len);
158 #define SPECLIST_TAG setting
159 #define SPECLIST_TYPE struct setting
162 #define setting_list_iterate(_setting_list, _setting) \
163 TYPED_LIST_ITERATE(struct setting, _setting_list, _setting)
164 #define setting_list_iterate_end LIST_ITERATE_END
168 #define settings_iterate(_level, _pset) \
170 struct setting_list *_setting_list = settings_list_get(_level); \
171 if (_setting_list != nullptr) { \
172 setting_list_iterate(_setting_list, _pset) \
175 #define settings_iterate_end \
177 setting_list_iterate_end; \
201 enum cmdlevel old_level,
202 enum cmdlevel new_level);
const void * secfile_data_t
struct setting_list * level[OLEVELS_NUM]
bool setting_int_validate(const struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Returns TRUE if 'val' is a valid value for this setting.
void settings_init(bool act)
Initialize stuff related to this code module.
void setting_action(const struct setting *pset)
Execute the action callback if needed.
void settings_reset()
Reset all settings iff they are changeable.
int setting_int_get(struct setting *pset)
Get value of integer setting.
void settings_game_start()
Save setting values at the start of the game.
bool setting_enum_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Returns TRUE if 'val' is a valid value for this setting.
void setting_set_to_default(struct setting *pset)
Update the setting to the default value.
void settings_game_load(struct section_file *file, const char *section)
Restore all settings from a savegame.
void settings_free()
Deinitialize stuff related to this code module.
int setting_number(const struct setting *pset)
Returns the id to the given setting.
bool setting_int_set(struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Set the setting to 'val'.
enum sset_category setting_category(const struct setting *pset)
Access function for the setting category.
bool setting_is_visible(const struct setting *pset, struct connection *caller)
Returns whether the specified server setting (option) can be seen by the caller.
bool setting_locked(const struct setting *pset)
Returns if the setting is locked by the ruleset.
bool setting_non_default(const struct setting *pset)
Returns whether the setting has non-default value.
enum sset_type setting_type(const struct setting *pset)
Access function for the setting type.
bool setting_str_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Set the setting to 'val'.
struct setting * setting_by_number(int id)
Returns the setting to the given id.
int setting_int_max(const struct setting *pset)
Returns the maximal integer value for this setting.
void setting_lock_set(struct setting *pset, bool lock)
Set the value for the lock of a setting.
bool settings_game_reset()
Reset all settings to the values at game start.
enum sset_level setting_level(const struct setting *pset)
Access function for the setting level (used by the /show command).
const char * setting_enum_val(const struct setting *pset, int val, bool pretty)
Convert the integer to the string representation of an enumerator.
struct setting_list * settings_list_get(enum sset_level level)
Get a settings list of a certain level.
bool setting_bitwise_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Set the setting to 'val'.
void settings_game_save(struct section_file *file, const char *section)
Save game settings.
bool setting_str_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Returns TRUE if 'val' is a valid value for this setting.
bool settings_ruleset(struct section_file *file, const char *section, bool act)
Load game settings from ruleset file 'game.ruleset'.
struct setting * setting_by_name(const char *name)
Returns the setting to the given name.
void setting_changed(struct setting *pset)
Mark setting changed.
const char * setting_name(const struct setting *pset)
Access function for the setting name.
enum setting_default_level setting_get_setdef(const struct setting *pset)
Is the setting in changed state, or the default.
const char * setting_value_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Compute the name of the current value of the setting.
void settings_turn()
Update stuff every turn that is related to this code module.
bool setting_enum_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Set the setting to 'val'.
void send_server_setting_control(struct connection *pconn)
Tell the client about all server settings.
const char * setting_bitwise_secfile_str(secfile_data_t data, int bit)
Convert the integer to the long support string representation of an enumerator.
int setting_int_min(const struct setting *pset)
Returns the minimal integer value for this setting.
bool setting_bitwise_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Returns TRUE if 'val' is a valid value for this setting.
const char * setting_short_help(const struct setting *pset)
Access function for the short help (not translated yet) of the setting.
const char * setting_extra_help(const struct setting *pset, bool constant)
Access function for the long (extra) help of the setting.
bool setting_bool_validate(const struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Returns TRUE if 'val' is a valid value for this setting.
void settings_list_update()
Update sorted settings (changed and locked values).
bool setting_is_changeable(const struct setting *pset, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Returns whether the specified server setting (option) can currently be changed by the caller.
char * setting_str_get(struct setting *pset)
Get value of string setting.
const char * setting_bitwise_bit(const struct setting *pset, int bit, bool pretty)
Convert the bit number to its string representation.
int setting_bitwise_get(struct setting *pset)
Get value of bitwise setting.
int settings_number()
Returns the total number of settings.
const char * setting_default_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Compute the name of the default value of the setting.
bool setting_bool_get(struct setting *pset)
Get value of boolean setting.
bool setting_is_visible_at_level(const struct setting *pset, enum cmdlevel plevel)
Returns whether the specified server setting (option) can be seen by a caller with the specified acce...
bool setting_bool_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Set the setting to 'val'.
void send_server_setting(struct conn_list *dest, const struct setting *pset)
Tell the client about just one server setting.
void send_server_settings(struct conn_list *dest)
Tell the client about all server settings.
void send_server_access_level_settings(struct conn_list *dest, enum cmdlevel old_level, enum cmdlevel new_level)
Send the server settings that got a different visibility or changability after a connection access le...
int read_enum_value(const struct setting *pset)
Helper function to read value from enumerator setting.
const char * setting_enum_secfile_str(secfile_data_t data, int val)
Convert the integer to the long support string representation of an enumerator.