Data Structures | Functions | Variables
ui-prefs.h File Reference

Pref file handling code. More...

#include "cave.h"
#include "datafile.h"
#include "ui-keymap.h"
#include "ui-term.h"
#include "option.h"
#include "z-file.h"

Go to the source code of this file.

Data Structures

struct  prefs_data
 Private data for pref file parsing. More...


enum parser_error parse_prefs_dummy (struct parser *p)
void dump_monsters (ang_file *fff)
 Dump monsters. More...
void dump_objects (ang_file *fff)
 Dump objects. More...
void dump_autoinscriptions (ang_file *f)
 Dump autoinscriptions. More...
void dump_features (ang_file *fff)
 Dump features. More...
void dump_flavors (ang_file *fff)
 Dump flavors. More...
void dump_colors (ang_file *fff)
 Dump colors. More...
void dump_ui_entry_renderers (ang_file *fff)
 Dump the customizable attributes for renderers used in the character screen. More...
void option_dump (ang_file *fff)
 Write all current options to a user preference file. More...
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. More...
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. More...
void reset_visuals (bool load_prefs)
 Reset the "visual" lists. More...
void textui_prefs_init (void)
 Initialise the glyphs for monsters, objects, traps, flavors and terrain. More...
void textui_prefs_free (void)
 Free the glyph arrays for monsters, objects, traps, flavors and terrain. More...
void do_cmd_pref (void)
 Ask for a "user pref line" and process it. More...


char arg_name [PLAYER_NAME_LEN]
int use_graphics
int arg_graphics
bool arg_graphics_nice
wchar_t * monster_x_char
wchar_t * kind_x_char
bytefeat_x_attr [LIGHTING_MAX]
wchar_t * feat_x_char [LIGHTING_MAX]
bytetrap_x_attr [LIGHTING_MAX]
wchar_t * trap_x_char [LIGHTING_MAX]
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

◆ do_cmd_pref()

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().

◆ dump_autoinscriptions()

void dump_autoinscriptions ( ang_file f)

◆ dump_colors()

void dump_colors ( ang_file fff)

◆ dump_features()

void dump_features ( ang_file fff)

◆ dump_flavors()

void dump_flavors ( ang_file fff)

◆ dump_monsters()

void dump_monsters ( ang_file fff)

◆ dump_objects()

void dump_objects ( ang_file fff)

◆ dump_ui_entry_renderers()

void dump_ui_entry_renderers ( ang_file fff)

◆ option_dump()

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().

◆ parse_prefs_dummy()

enum parser_error parse_prefs_dummy ( struct parser p)

◆ prefs_save()

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.

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
true on success, false otherwise.

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

Referenced by dump_pref_file(), and save_game().

◆ process_pref_file()

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.

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.
true if everything worked OK, false otherwise.

References ANGBAND_DIR_CUSTOMIZE, ANGBAND_DIR_USER, current_graphics_mode, _graphics_mode::path, and process_pref_file_layered().

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

◆ process_pref_file_command()

errr process_pref_file_command ( const char *  buf)

◆ reset_visuals()

void reset_visuals ( bool  load_prefs)

◆ textui_prefs_free()

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().

◆ textui_prefs_init()

void textui_prefs_init ( void  )

Variable Documentation

◆ arg_graphics

int arg_graphics

Referenced by default_layout_win(), and main().

◆ arg_graphics_nice

bool arg_graphics_nice

Referenced by default_layout_win().

◆ arg_name

char arg_name[PLAYER_NAME_LEN]

Referenced by get_name_command(), and main().

◆ feat_x_attr

byte* feat_x_attr[LIGHTING_MAX]

◆ feat_x_char

wchar_t* feat_x_char[LIGHTING_MAX]

◆ flavor_x_attr

byte* flavor_x_attr

◆ flavor_x_char

wchar_t* flavor_x_char

◆ kind_x_attr

byte* kind_x_attr

◆ kind_x_char

wchar_t* kind_x_char

◆ monster_x_attr

byte* monster_x_attr

◆ monster_x_char

wchar_t* monster_x_char

◆ trap_x_attr

byte* trap_x_attr[LIGHTING_MAX]

◆ trap_x_char

wchar_t* trap_x_char[LIGHTING_MAX]

◆ use_graphics

int use_graphics