Freeciv-3.2
|
#include "shared.h"
#include "game.h"
#include "server_settings.h"
#include "specenum_gen.h"
#include "speclist.h"
Go to the source code of this file.
Data Structures | |
struct | sset_val_name |
struct | sf_cb_data |
Enumerations | |
enum | setting_lock_level { SLOCK_NONE = 0 , SLOCK_RULESET , SLOCK_ADMIN } |
#define setting_list_iterate | ( | _setting_list, | |
_setting | |||
) | TYPED_LIST_ITERATE(struct setting, _setting_list, _setting) |
Definition at line 181 of file settings.h.
#define setting_list_iterate_end LIST_ITERATE_END |
Definition at line 183 of file settings.h.
Definition at line 188 of file settings.h.
#define settings_iterate_end |
Definition at line 194 of file settings.h.
#define SPECENUM_COUNT SSET_NUM_CATEGORIES |
Definition at line 53 of file settings.h.
#define SPECENUM_COUNT OLEVELS_NUM |
Definition at line 53 of file settings.h.
Definition at line 37 of file settings.h.
Definition at line 37 of file settings.h.
#define SPECENUM_VALUE0 SSET_GEOLOGY |
Definition at line 38 of file settings.h.
Definition at line 38 of file settings.h.
Definition at line 39 of file settings.h.
Definition at line 39 of file settings.h.
#define SPECENUM_VALUE1 SSET_SOCIOLOGY |
Definition at line 40 of file settings.h.
Definition at line 40 of file settings.h.
Definition at line 41 of file settings.h.
Definition at line 41 of file settings.h.
#define SPECENUM_VALUE2 SSET_ECONOMICS |
Definition at line 42 of file settings.h.
#define SPECENUM_VALUE2 SSET_VITAL |
Definition at line 42 of file settings.h.
Definition at line 43 of file settings.h.
Definition at line 43 of file settings.h.
#define SPECENUM_VALUE3 SSET_MILITARY |
Definition at line 44 of file settings.h.
#define SPECENUM_VALUE3 SSET_SITUATIONAL |
Definition at line 44 of file settings.h.
Definition at line 45 of file settings.h.
Definition at line 45 of file settings.h.
#define SPECENUM_VALUE4 SSET_SCIENCE |
Definition at line 46 of file settings.h.
Definition at line 46 of file settings.h.
Definition at line 47 of file settings.h.
Definition at line 47 of file settings.h.
#define SPECENUM_VALUE5 SSET_INTERNAL |
Definition at line 48 of file settings.h.
#define SPECENUM_VALUE5 SSET_CHANGED |
Definition at line 48 of file settings.h.
Definition at line 49 of file settings.h.
Definition at line 49 of file settings.h.
#define SPECENUM_VALUE6 SSET_NETWORK |
Definition at line 50 of file settings.h.
#define SPECENUM_VALUE6 SSET_LOCKED |
Definition at line 50 of file settings.h.
Definition at line 51 of file settings.h.
Definition at line 51 of file settings.h.
Definition at line 177 of file settings.h.
Definition at line 178 of file settings.h.
Enumerator | |
---|---|
SLOCK_NONE | |
SLOCK_RULESET | |
SLOCK_ADMIN |
Definition at line 76 of file settings.h.
Helper function to read value from enumerator setting
Definition at line 3992 of file settings.c.
Referenced by plrcol_action(), save_game_ruleset(), send_server_setting(), setting_game_set(), setting_non_default(), setting_ruleset_one(), setting_value_name(), settings_game_load(), and settings_game_save().
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 level change. Usually called when the access level of the user changes.
Definition at line 5439 of file settings.c.
Referenced by conn_set_access().
Tell the client about just one server setting. Call this after a setting is saved.
Definition at line 5308 of file settings.c.
Referenced by metamessage_command(), send_server_access_level_settings(), send_server_settings(), and set_command().
void send_server_setting_control | ( | struct connection * | pconn | ) |
Tell the client about all server settings.
Definition at line 5471 of file settings.c.
Referenced by establish_new_connection().
Tell the client about all server settings.
Definition at line 5427 of file settings.c.
Referenced by establish_new_connection(), load_command(), reset_command(), settings_ruleset(), and srv_running().
Execute the action callback if needed.
Definition at line 4366 of file settings.c.
Referenced by set_command(), settings_game_load(), settings_init(), settings_reset(), and settings_ruleset().
Clear admin level lock from the setting
Definition at line 4721 of file settings.c.
Referenced by settings_init(), and unlock_command().
Set admin level lock for the setting
Definition at line 4701 of file settings.c.
Referenced by lock_command().
Convert the bit number to its string representation. Return NULL if 'bit' is not a valid bit.
Definition at line 4085 of file settings.c.
Referenced by manual_settings(), and show_help_option().
Get value of bitwise setting
Definition at line 4254 of file settings.c.
Referenced by save_game_ruleset(), and server_ss_val_bitwise_get().
const char * setting_bitwise_secfile_str | ( | secfile_data_t | data, |
int | bit | ||
) |
Convert the integer to the long support string representation of an enumerator. This function must match the secfile_enum_name_data_fn_t type.
Definition at line 4062 of file settings.c.
Referenced by compat_load_030200(), save_game_ruleset(), setting_ruleset_one(), settings_game_load(), and settings_game_save().
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'. Returns TRUE on success. If it fails, the reason of the failure is available in the optional parameter 'reject_msg'.
Definition at line 4220 of file settings.c.
Referenced by compat_load_030200(), set_command(), setting_game_restore(), and setting_ruleset_one().
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. If it's not, the reason of the failure is available in the optional parameter 'reject_msg'.
Definition at line 4241 of file settings.c.
Referenced by set_command().
Get value of boolean setting
Definition at line 3673 of file settings.c.
Referenced by save_game_ruleset(), and server_ss_val_bool_get().
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'. Returns TRUE on success. If it's not, the reason of the failure is available in the optional parameter 'reject_msg'.
Definition at line 3654 of file settings.c.
Referenced by set_command(), and setting_game_restore().
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. If it's not, the reason of the failure is available in the optional parameter 'reject_msg'.
Definition at line 3685 of file settings.c.
Referenced by set_command().
Returns the setting to the given name.
Definition at line 3306 of file settings.c.
Referenced by api_server_setting_get(), autolock_settings(), compat_load_030200(), metamessage_command(), sanity_check_setting_is_game_rule(), server_ss_by_name(), setting_ruleset_one(), and srv_ready().
Returns the setting to the given id.
Definition at line 3298 of file settings.c.
Referenced by optname_accessor(), sanity_check_req_individual(), sanity_check_server_setting_value_in_req(), server_ss_name_get(), server_ss_type_get(), server_ss_val_bitwise_get(), server_ss_val_bool_get(), server_ss_val_int_get(), settings_list_init(), settings_list_update(), show_help_option(), show_settings(), and validate_setting_arg().
enum sset_category setting_category | ( | const struct setting * | pset | ) |
Access function for the setting category.
Definition at line 3375 of file settings.c.
Referenced by manual_settings(), and sanity_check_setting_is_game_rule().
Mark setting changed
Definition at line 5637 of file settings.c.
Referenced by metamessage_command(), and set_command().
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.
Definition at line 4300 of file settings.c.
Referenced by manual_settings(), and show_help_option().
const char * setting_enum_secfile_str | ( | secfile_data_t | data, |
int | val | ||
) |
Convert the integer to the long support string representation of an enumerator. This function must match the secfile_enum_name_data_fn_t type.
Definition at line 3867 of file settings.c.
Referenced by save_game_ruleset(), setting_ruleset_one(), settings_game_load(), and settings_game_save().
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'. Returns TRUE on success. If it fails, the reason of the failure is available in the optional parameter 'reject_msg'.
Definition at line 4019 of file settings.c.
Referenced by autolock_settings(), set_command(), setting_game_restore(), and srv_ready().
Convert the integer to the string representation of an enumerator. Return NULL if 'val' is not a valid enumerator.
Definition at line 3890 of file settings.c.
Referenced by manual_settings(), and show_help_option().
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. If it's not, the reason of the failure is available in the optional parameter 'reject_msg'.
Definition at line 4048 of file settings.c.
Referenced by set_command().
Access function for the long (extra) help of the setting. If 'constant' is TRUE, static, not-yet-translated string is always returned.
Definition at line 3347 of file settings.c.
Referenced by manual_settings(), send_server_setting_control(), and show_help_option().
enum setting_default_level setting_get_setdef | ( | const struct setting * | pset | ) |
Is the setting in changed state, or the default
Definition at line 5645 of file settings.c.
Referenced by save_game_ruleset(), settings_game_save(), and show_settings_one().
Get value of integer setting
Definition at line 3785 of file settings.c.
Referenced by save_game_ruleset(), and server_ss_val_int_get().
Returns the maximal integer value for this setting.
Definition at line 3730 of file settings.c.
Referenced by manual_settings(), show_help_option(), and show_settings_one().
Returns the minimal integer value for this setting.
Definition at line 3721 of file settings.c.
Referenced by manual_settings(), show_help_option(), and show_settings_one().
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'. Returns TRUE on success. If it fails, the reason of the failure is available by the function setting_error().
Definition at line 3740 of file settings.c.
Referenced by set_command(), setting_game_restore(), and setting_ruleset_one().
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. If it's not, the reason of the failure is available by the function setting_error().
FIXME: also check the access level of pconn.
Definition at line 3760 of file settings.c.
Referenced by set_command(), and setting_int_set().
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. If it returns FALSE, the reason of the failure is available by the function setting_error().
Definition at line 3457 of file settings.c.
Referenced by default_command(), manual_settings(), set_command(), setting_bitwise_set(), setting_bool_set(), setting_enum_set(), setting_game_restore(), setting_int_set(), setting_status(), setting_str_set(), settings_game_load(), settings_reset(), and show_help_option().
Returns whether the specified server setting (option) can be seen by the caller.
Definition at line 3503 of file settings.c.
Referenced by set_command(), show_help_option(), show_help_option_list(), and show_settings().
Returns whether the specified server setting (option) can be seen by a caller with the specified access level.
Definition at line 3493 of file settings.c.
Referenced by sanity_check_setting_is_seen(), and setting_is_visible().
enum sset_level setting_level | ( | const struct setting * | pset | ) |
Access function for the setting level (used by the /show command).
Definition at line 3367 of file settings.c.
Referenced by manual_settings(), and settings_list_init().
Returns if the setting is locked by the ruleset.
Definition at line 4673 of file settings.c.
Referenced by setting_ruleset_one(), setting_status(), settings_list_update(), and settings_ruleset().
Access function for the setting name.
Definition at line 3330 of file settings.c.
Referenced by manual_settings(), optname_accessor(), save_game_ruleset(), send_server_setting_control(), server_ss_name_get(), set_command(), setcompat_S3_2_val_from_S3_1(), setting_bitwise_secfile_str(), setting_default_name(), setting_game_restore(), setting_is_changeable(), setting_is_free_to_change(), setting_non_default(), setting_ruleset_one(), setting_value_name(), settings_game_load(), settings_game_save(), settings_list_cmp(), settings_list_init(), show_help_option(), show_help_option_list(), show_settings(), show_settings_one(), srv_ready(), tolua_server_server_setting_get00(), and write_init_script().
Returns whether the setting has non-default value.
Definition at line 4647 of file settings.c.
Referenced by manual_settings(), settings_list_update(), and show_settings_one().
Returns the id to the given setting.
Definition at line 3321 of file settings.c.
Referenced by manual_settings(), send_server_setting_control(), server_ss_by_name(), setting_default_name(), setting_is_free_to_change(), setting_non_default(), and setting_value_name().
Clear ruleset level lock from the setting
Definition at line 4709 of file settings.c.
Referenced by autolock_settings(), settings_init(), and settings_ruleset().
Set ruleset level lock for the setting
Definition at line 4689 of file settings.c.
Referenced by autolock_settings(), and setting_ruleset_one().
Returns if the setting is locked by the ruleset.
Definition at line 4681 of file settings.c.
Referenced by manual_settings(), and save_game_ruleset().
Update the setting to the default value
Definition at line 4336 of file settings.c.
Referenced by default_command(), setting_game_restore(), settings_init(), settings_reset(), and settings_ruleset().
Access function for the short help (not translated yet) of the setting.
Definition at line 3338 of file settings.c.
Referenced by manual_settings(), send_server_setting_control(), and show_help_option().
Get value of string setting
Definition at line 3856 of file settings.c.
Referenced by save_game_ruleset().
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'. Returns TRUE on success. If it fails, the reason of the failure is available by the function setting_error().
Definition at line 3811 of file settings.c.
Referenced by set_command(), setting_game_restore(), setting_ruleset_one(), and settings_game_load().
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. If it's not, the reason of the failure is available by the function setting_error().
FIXME: also check the access level of pconn.
Definition at line 3831 of file settings.c.
Referenced by set_command(), and setting_str_set().
Access function for the setting type.
Definition at line 3359 of file settings.c.
Referenced by manual_settings(), save_game_ruleset(), send_server_setting(), server_ss_type_get(), set_command(), setting_bitwise_get(), setting_bool_get(), setting_game_free(), setting_game_restore(), setting_game_set(), setting_int_get(), setting_non_default(), setting_str_get(), settings_game_save(), show_help_option(), and show_settings_one().
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.
Definition at line 4264 of file settings.c.
Referenced by api_server_setting_get(), compat_load_030200(), manual_settings(), set_command(), setting_ruleset_one(), settings_game_load(), show_help_option(), show_settings_one(), srv_ready(), and write_init_script().
Deinitialize stuff related to this code module.
Definition at line 5287 of file settings.c.
Referenced by server_quit().
void settings_game_load | ( | struct section_file * | file, |
const char * | section | ||
) |
Restore all settings from a savegame.
Definition at line 4946 of file settings.c.
Referenced by sg_load_settings(), and sg_load_settings().
Reset all settings to the values at game start.
Definition at line 5228 of file settings.c.
Referenced by reset_command().
void settings_game_save | ( | struct section_file * | file, |
const char * | section | ||
) |
Save setting values at the start of the game.
Definition at line 4845 of file settings.c.
Referenced by srv_ready().
Initialize stuff related to this code module.
Definition at line 5245 of file settings.c.
Referenced by main(), and srv_prepare().
struct setting_list * settings_list_get | ( | enum sset_level | level | ) |
Get a settings list of a certain level. Call settings_list_update() before if something was changed.
Definition at line 5608 of file settings.c.
Update sorted settings (changed and locked values).
Definition at line 5566 of file settings.c.
Referenced by settings_init(), and show_settings().
Returns the total number of settings.
Definition at line 5299 of file settings.c.
Referenced by explain_option(), lookup_option(), show_help(), and universal_kind_values().
Reset all settings iff they are changeable.
Definition at line 5265 of file settings.c.
Referenced by reset_command().
Load game settings from ruleset file 'game.ruleset'.
Definition at line 4376 of file settings.c.
Referenced by load_rulesetdir(), and reload_rulesets_settings().
Update stuff every turn that is related to this code module. Run this on turn end.
Definition at line 5279 of file settings.c.
Referenced by end_turn().