Angband
Functions | Variables
ui-prefs.h File Reference

Pref file handling code. More...

#include "cave.h"
#include "z-file.h"

Go to the source code of this file.

Functions

void dump_monsters (ang_file *fff)
 Dump monsters.
void dump_objects (ang_file *fff)
 Dump objects.
void dump_autoinscriptions (ang_file *f)
 Dump autoinscriptions.
void dump_features (ang_file *fff)
 Dump features.
void dump_flavors (ang_file *fff)
 Dump flavors.
void dump_colors (ang_file *fff)
 Dump colors.
void option_dump (ang_file *fff)
 Write all current options to a user preference file.
bool prefs_save (const char *path, void(*dump)(ang_file *), const char *title)
 Save a set of preferences to file, overwriting any old preferences with the same title.
errr process_pref_file_command (const char *buf)
bool process_pref_file (const char *name, bool quiet, bool user)
 Look for a pref file at its base location (falling back to another path if needed) and then in the user location.
void reset_visuals (bool load_prefs)
 Reset the "visual" lists.
void textui_prefs_init (void)
 Initialise the glyphs for monsters, objects, traps, flavors and terrain.
void textui_prefs_free (void)
 Free the glyph arrays for monsters, objects, traps, flavors and terrain.
void do_cmd_pref (void)
 Ask for a "user pref line" and process it.

Variables

int use_graphics
int arg_graphics
bool arg_graphics_nice
bytemonster_x_attr
wchar_t * monster_x_char
bytekind_x_attr
wchar_t * kind_x_char
bytefeat_x_attr [LIGHTING_MAX]
wchar_t * feat_x_char [LIGHTING_MAX]
bytetrap_x_attr
wchar_t * trap_x_char
byteflavor_x_attr
wchar_t * flavor_x_char

Detailed Description

Pref file handling code.

Copyright (c) 2003 Takeshi Mogami, Robert Ruehlmann Copyright (c) 2007 Pete Mack Copyright (c) 2010 Andi Sidwell

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

void do_cmd_pref ( void  )

Ask for a "user pref line" and process it.

References get_string(), my_strcpy(), process_pref_file_command(), and void().

void dump_autoinscriptions ( ang_file f)
void dump_colors ( ang_file fff)
void dump_features ( ang_file fff)
void dump_flavors ( ang_file fff)
void dump_monsters ( ang_file fff)
void dump_objects ( ang_file fff)
void option_dump ( ang_file fff)

Write all current options to a user preference file.

References angband_term, ANGBAND_TERM_MAX, angband_term_name, file_putf(), i, int, N_ELEMENTS, window_flag, and window_flag_desc.

Referenced by do_dump_options(), and save_game().

bool prefs_save ( const char *  path,
void(*)(ang_file *)  dump,
const char *  title 
)

Save a set of preferences to file, overwriting any old preferences with the same title.

Parameters
pathis the filename to dump to
dumpis a pointer to the function that does the writing to file
titleis the name of this set of preferences
Returns
TRUE on success, FALSE otherwise.

References FALSE, file_close(), file_open(), file_putf(), FTYPE_TEXT, MODE_APPEND, pref_footer(), pref_header(), remove_old_dump(), safe_setuid_drop(), safe_setuid_grab(), and TRUE.

Referenced by dump_pref_file(), and save_game().

bool process_pref_file ( const char *  name,
bool  quiet,
bool  user 
)

Look for a pref file at its base location (falling back to another path if needed) and then in the user location.

This effectively will layer a user pref file on top of a default pref file.

Because of the way this function works, there might be some unexpected effects when a pref file triggers another pref file to be loaded. For example, pref/pref.prf causes message.prf to load. This means that the game will load pref/pref.prf, then pref/message.prf, then user/message.prf, and finally user/pref.prf.

Parameters
nameis the name of the pref file.
quietmeans "don't complain about not finding the file".
usershould be TRUE if the pref file is user-specific and not a game default.
Returns
TRUE if everything worked OK, FALSE otherwise.

References ANGBAND_DIR_PREF, ANGBAND_DIR_USER, FALSE, process_pref_file_layered(), and TRUE.

Referenced by do_cmd_pref_file_hack(), do_cmd_save_screen_html(), parse_prefs_load(), process_character_pref_files(), reset_visuals(), and textui_init().

errr process_pref_file_command ( const char *  buf)
void reset_visuals ( bool  load_prefs)
void textui_prefs_free ( void  )

Free the glyph arrays for monsters, objects, traps, flavors and terrain.

References feat_x_attr, feat_x_char, flavor_x_attr, flavor_x_char, i, kind_x_attr, kind_x_char, LIGHTING_MAX, mem_free(), monster_x_attr, monster_x_char, trap_x_attr, and trap_x_char.

Referenced by teardown_tests(), and textui_cleanup().

void textui_prefs_init ( void  )

Variable Documentation

int arg_graphics
bool arg_graphics_nice
byte* feat_x_attr[LIGHTING_MAX]
wchar_t* feat_x_char[LIGHTING_MAX]
byte* flavor_x_attr
wchar_t* flavor_x_char
byte* kind_x_attr
wchar_t* kind_x_char
byte* monster_x_attr
wchar_t* monster_x_char
byte* trap_x_attr
wchar_t* trap_x_char
int use_graphics