DungeonCrawl
Loading...
Searching...
No Matches
stats_mode_local.h File Reference

Exposes functions and enums for working with localization in the map mode. More...

Go to the source code of this file.

Enumerations

enum  stats_mode_index {
  PLAYER_MENU_TITLE , STATS_MENU_TITLE , INVENTORY_MENU_TITLE , HEALTH_STR ,
  STAMINA_STR , MANA_STR , STRENGTH_STR , INTELLIGENCE_STR ,
  DEXTERITY_STR , CONSTITUTION_STR , LEVEL_STR , EXP_STR ,
  ARMOR_STR , MAGIC_RESISTANCE_STR , AVAILABLE_SKILL_POINTS_STR , EQUIPPED_ARMOR_STR ,
  EMPTY_ARMOR_SLOT_STR , MAX_STATS_STRINGS
}

Functions

void update_stats_local (void)
 Updates the localized strings used in the stats menu.

Variables

char ** stats_mode_strings

Detailed Description

Exposes functions and enums for working with localization in the map mode.

Definition in file stats_mode_local.h.

Enumeration Type Documentation

◆ stats_mode_index

enum stats_mode_index

Definition at line 8 of file stats_mode_local.h.

8 {
9 //strings that are updated via local
10 PLAYER_MENU_TITLE,
11 STATS_MENU_TITLE,
12 INVENTORY_MENU_TITLE,
13 HEALTH_STR,
14 STAMINA_STR,
15 MANA_STR,
16 STRENGTH_STR,
17 INTELLIGENCE_STR,
18 DEXTERITY_STR,
19 CONSTITUTION_STR,
20 LEVEL_STR,
21 EXP_STR,
22 ARMOR_STR,
23 MAGIC_RESISTANCE_STR,
24 AVAILABLE_SKILL_POINTS_STR,
25 EQUIPPED_ARMOR_STR,
26 EMPTY_ARMOR_SLOT_STR,
27
28 MAX_STATS_STRINGS
29};

Function Documentation

◆ update_stats_local()

void update_stats_local ( void )

Updates the localized strings used in the stats menu.

This function refreshes the strings used to display various statistics or menu titles by retrieving their updated localized values. It first frees any previously allocated strings in the stats_mode_strings array and then populates the array with fresh localized strings retrieved from the get_local_string function.

Note
The function assumes that the stats_mode_strings array has sufficient capacity to hold all the required strings (defined by MAX_STATS_STRINGS). It also assumes that indices into the array correspond to specific keys for localization.

Updates the localized strings used in the stats menu.

Updates all localized strings used in the stats window.

Definition at line 13 of file stats_mode_local.c.

13 {
14 for (int i = 0; i < MAX_STATS_STRINGS; i++) {
15 if (stats_mode_strings[i] != NULL) {
16 free(stats_mode_strings[i]);
17 }
18 }
19
20 stats_mode_strings[PLAYER_MENU_TITLE] = get_local_string("STATS.PLAYER.MENU.TITLE");
21 stats_mode_strings[STATS_MENU_TITLE] = get_local_string("STATS.STATS.MENU.TITLE");
22 stats_mode_strings[INVENTORY_MENU_TITLE] = get_local_string("STATS.INVENTORY.MENU.TITLE");
23 stats_mode_strings[HEALTH_STR] = get_local_string("HEALTH");
24 stats_mode_strings[STAMINA_STR] = get_local_string("STAMINA");
25 stats_mode_strings[MANA_STR] = get_local_string("MANA");
26 stats_mode_strings[STRENGTH_STR] = get_local_string("STRENGTH");
27 stats_mode_strings[INTELLIGENCE_STR] = get_local_string("INTELLIGENCE");
28 stats_mode_strings[DEXTERITY_STR] = get_local_string("DEXTERITY");
29 stats_mode_strings[CONSTITUTION_STR] = get_local_string("CONSTITUTION");
30 stats_mode_strings[LEVEL_STR] = get_local_string("LEVEL");
31 stats_mode_strings[EXP_STR] = get_local_string("EXP_POINTS");
32 stats_mode_strings[ARMOR_STR] = get_local_string("ARMOR");
33 stats_mode_strings[MAGIC_RESISTANCE_STR] = get_local_string("MAGIC_RESISTANCE");
34 stats_mode_strings[AVAILABLE_SKILL_POINTS_STR] = get_local_string("STATS.AV.SKILL_P");
35 stats_mode_strings[EQUIPPED_ARMOR_STR] = get_local_string("STATS.EQUIPPED.ARMOR");
36 stats_mode_strings[EMPTY_ARMOR_SLOT_STR] = get_local_string("STATS.EMPTY.ARMOR.SLOT");
37}
char * get_local_string(const char *key)
Get the localized string for the given key.

Variable Documentation

◆ stats_mode_strings

char** stats_mode_strings
extern

Definition at line 11 of file stats_mode_local.c.