Atrinik Client 2.5
Functions | Variables
client/settings.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static void setting_load_value (setting_struct *setting, const char *str)
void settings_init ()
void settings_load ()
void settings_save ()
void settings_deinit ()
void * setting_get (setting_struct *setting)
const char * setting_get_str (int cat, int setting)
sint64 setting_get_int (int cat, int setting)
static int setting_apply_always (int cat, int setting)
static void setting_apply_runtime (int cat, int setting)
void settings_apply ()
void settings_apply_change ()
void setting_set_int (int cat, int setting, sint64 val)
int setting_is_text (setting_struct *setting)
sint64 category_from_name (const char *name)
sint64 setting_from_name (const char *name)

Variables

static const char *const opt_types [OPT_TYPE_NUM]
setting_category ** setting_categories = NULL
size_t setting_categories_num = 0
static uint8 setting_update_mapsize = 0

Detailed Description

Handles client settings.

Definition in file settings.c.


Function Documentation

sint64 category_from_name ( const char *  name)

Find a category ID by its name.

Parameters:
nameThe name.
Returns:
Category ID if found, -1 otherwise.

Definition at line 661 of file settings.c.

static int setting_apply_always ( int  cat,
int  setting 
) [static]

Apply a setting change, which needs to be handled regardless of whether it's changed at runtime or at startup.

Parameters:
catID of the category the setting is in.
settingSetting ID inside the category.
Returns:
1 if the change was handled, 0 otherwise.

Definition at line 476 of file settings.c.

static void setting_apply_runtime ( int  cat,
int  setting 
) [static]

Apply a setting change at run-time.

Parameters:
catID of the category the setting is in.
settingSetting ID inside the category.

Definition at line 508 of file settings.c.

sint64 setting_from_name ( const char *  name)

Find a setting ID by its name.

Note:
All categories are checked.
Parameters:
nameThe name.
Returns:
Setting ID if found, -1 otherwise.

Definition at line 682 of file settings.c.

void* setting_get ( setting_struct setting)

Get pointer to a setting's value.

Parameters:
settingThe setting.
Returns:
Pointer to the setting's value.

Definition at line 432 of file settings.c.

sint64 setting_get_int ( int  cat,
int  setting 
)

Get setting's integer value.

Parameters:
catID of the category the setting is in.
settingSetting ID inside the category.
Returns:
The setting's integer value.

Definition at line 465 of file settings.c.

const char* setting_get_str ( int  cat,
int  setting 
)

Get setting's string value.

Parameters:
catID of the category the setting is in.
settingSetting ID inside the category.
Returns:
The setting's string value.

Definition at line 455 of file settings.c.

int setting_is_text ( setting_struct setting)

Check if the specified setting has a string value.

Parameters:
settingThe setting.
Returns:
1 if it has a string value, 0 otherwise.

Definition at line 646 of file settings.c.

static void setting_load_value ( setting_struct setting,
const char *  str 
) [static]

Load a setting value from file.

Parameters:
settingThe setting to load the value into.
strThe value to load.

Definition at line 51 of file settings.c.

void setting_set_int ( int  cat,
int  setting,
sint64  val 
)

Set setting's integer value.

Parameters:
catID of the category the setting is in.
settingSetting ID inside the category.
valValue to set.

Definition at line 629 of file settings.c.

void settings_apply ( )

Apply all settings that need to be applied at start-time (after everything has been initialized successfully).

Definition at line 595 of file settings.c.

void settings_apply_change ( )

Apply a change of settings at run-time (through the settings GUI, for example).

Definition at line 611 of file settings.c.

void settings_deinit ( )

Deinitialize the settings.

User's settings are also saved to file using settings_save().

Definition at line 364 of file settings.c.

void settings_init ( )

Initialize the setting defaults.

Definition at line 91 of file settings.c.

void settings_load ( )

Load user's settings (if any).

Definition at line 255 of file settings.c.

void settings_save ( )

Save the user's settings to file.

Definition at line 322 of file settings.c.


Variable Documentation

const char* const opt_types[OPT_TYPE_NUM] [static]
Initial value:
{
    "bool", "input_num", "input_text", "range", "select", "int"
}

Text representations of the setting types.

Definition at line 33 of file settings.c.

List of setting categories.

Definition at line 39 of file settings.c.

Number of setting_categories.

Definition at line 41 of file settings.c.

Whether we need to send a setup command to server to request mapsize change.

Definition at line 45 of file settings.c.