DungeonCrawl
Loading...
Searching...
No Matches
combat_mode_local.c File Reference

Implementation for the localization of the combat mode. More...

#include "combat_mode_local.h"
#include "../../local/local_handler.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

void update_combat_local (void)
 Updates the combat mode strings with localized versions.

Variables

char ** combat_mode_strings = NULL

Detailed Description

Implementation for the localization of the combat mode.

Definition in file combat_mode_local.c.

Function Documentation

◆ update_combat_local()

void update_combat_local ( void )

Updates the combat mode strings with localized versions.

Note
This function should be called after initializing the combat mode.

Definition at line 13 of file combat_mode_local.c.

13 {
14 for (int i = 0; i < MAX_COMBAT_MODE_STRINGS; i++) {
15 if (combat_mode_strings[i] != NULL) {
16 free(combat_mode_strings[i]);
17 }
18 }
19
20 combat_mode_strings[MAIN_MENU_TITLE] = get_local_string("COMBAT.MAIN.MENU.TITLE");
21 combat_mode_strings[ABILITY_MENU_TITLE] = get_local_string("COMBAT.ABILITY.MENU.TITLE");
22 combat_mode_strings[POTION_MENU_TITLE] = get_local_string("COMBAT.POTION.MENU.TITLE");
23 combat_mode_strings[MAIN_MENU_OPTION1] = get_local_string("COMBAT.USE.ABILITY");
24 combat_mode_strings[MAIN_MENU_OPTION2] = get_local_string("COMBAT.USE.POTION");
25
26 combat_mode_strings[ABILITY_FORMAT] = get_local_string("COMBAT.ABILITY.FORMAT");
27 combat_mode_strings[POTION_FORMAT] = get_local_string("POTION.FORMAT");
28 combat_mode_strings[PRESS_C_RETURN] = get_local_string("PRESS.C.RETURN");
29 combat_mode_strings[NO_MORE_POTIONS] = get_local_string("POTION.EMPTY");
30
31 combat_mode_strings[ATTACK_SUCCESS] = get_local_string("COMBAT.ATTACK.SUCCESS");
32 combat_mode_strings[ATTACK_MISS] = get_local_string("COMBAT.ATTACK.MISS");
33 combat_mode_strings[ATTACK_FAIL] = get_local_string("COMBAT.ATTACK.FAIL");
34 combat_mode_strings[POTION_USE] = get_local_string("COMBAT.POTION.USE");
35}
char * get_local_string(const char *key)
Get the localized string for the given key.

Variable Documentation

◆ combat_mode_strings

char** combat_mode_strings = NULL

Definition at line 11 of file combat_mode_local.c.