 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
42 const char *
i18n(
const object *who,
const char *
code) {
62 if (strcmp(
code, language->code) == 0)
118 while ((next = strstr(
line,
"\\n")) != NULL) {
148 while ((file =
readdir(dir)) != NULL) {
149 if (strncmp(file->d_name,
"messages.", 9) != 0)
152 snprintf(filename,
sizeof(filename),
"%s%s", dirname, file->d_name);
167 if (
line[0] !=
'#' &&
line[0] !=
'\0') {
169 token = strtok(
line,
"|");
172 token = strtok(NULL,
"|");
179 language->
messages[scode] = smessage;
186 LOG(
llevError,
"i18n: no language set in %s\n", filename);
194 if (strcmp(language->
code,
"en") == 0)
202 LOG(
llevError,
"i18n: couldn't find default language (en)\n");
213 for (
auto message : language->messages) {
void i18n_free(void)
Clears all i18n-related data.
struct Settings settings
Global settings.
static std::vector< i18n_file * > i18n_files
Defined languages.
@ llevError
Error, serious thing.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void * language_t
Strings that should be manipulated through add_string() and free_string().
const char * datadir
Read only data files.
std::map< sstring, sstring > messages
Available messages for this language.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void bufferreader_destroy(BufferReader *br)
Destroy a BufferReader.
sstring name
Language's name, in its native version.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
void i18n_init(void)
Initializes the i18n subsystem.
struct player * contr
Pointer to the player which control this object.
BufferReader * bufferreader_init_from_file(BufferReader *br, const char *filepath, const char *failureMessage, LogLevel failureLevel)
Initialize or create a BufferReader from a file path.
DIR * opendir(const char *)
sstring add_refcount(sstring str)
This will increase the refcount of the string str.
sstring i18n_get_language_code(language_t language)
Return the code of a specified language.
sstring add_string(const char *str)
This will add 'str' to the hash table.
struct dirent * readdir(DIR *)
sstring find_string(const char *str)
Searches a string in the shared strings.
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your message
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
#define MAX_BUF
Used for all kinds of things.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
#define NDI_UNIQUE
Print immediately, don't buffer.
language_t i18n_get_language_by_code(const char *code)
Find the identifier of a language from its code.
const typedef char * sstring
void i18n_list_languages(object *who)
List all languages for who.
language_t language
The language the player wishes to use.
language_t i18n_find_language_by_code(const char *code)
Attempt to find the identifier of a language from its code.
sstring code
Language code, "message." extension.
Crossfire Architecture the general intention is to enhance the enjoyability and playability of CF In this code
static i18n_file * i18n_default
"English" language.
@ llevDebug
Only for debugging purposes.
const char * i18n(const object *who, const char *code)
Translate a message in the appropriate language.
static void convert_newline(char *line)
Replaces ' ' by a newline char.
char * bufferreader_next_line(BufferReader *br)
Return the next line in the buffer, as separated by a newline.