Angband
Data Structures | Macros | Functions | Variables
obj-ignore.c File Reference

Item ignoring. More...

#include "angband.h"
#include "cmds.h"
#include "init.h"
#include "obj-desc.h"
#include "obj-gear.h"
#include "obj-identify.h"
#include "obj-ignore.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "object.h"
#include "list-ignore-types.h"

Data Structures

struct  quality_ignore_struct

Macros

#define ITYPE(a, b)   { ITYPE_##a, b },

Functions

void init_ignore (void)
 Initialise the ignore package.
void cleanup_ignore (void)
 Clean up the ignore package.
void ignore_birth_init (void)
 Reset the player's ignore choices for a new game.
const char * get_autoinscription (object_kind *kind)
 

Autoinscription stuff


int apply_autoinscription (object_type *o_ptr)
 Put an autoinscription on an object.
int remove_autoinscription (s16b kind)
 Deregister an object kind autoinscription.
int add_autoinscription (s16b kind, const char *inscription)
 Register an object kind autoinscription.
void autoinscribe_ground (void)
 Put an autoinscription on all objects on the floor beneath the player.
void autoinscribe_pack (void)
 Put an autoinscription on all the player's carried objects.
void object_ignore_flavor_of (const object_type *o_ptr)
 

Ignore code


ignore_type_t ignore_type_of (const object_type *o_ptr)
 Find the ignore type of the object, or ITYPE_MAX if none.
bool tval_has_ignore_type (int tval, ignore_type_t itype)
 Find whether an ignore type is valid for a given tval.
static int cmp_object_trait (int bonus, random_value base)
 Small helper function to see how an object trait compares to the one in its base type.
static int is_object_good (const object_type *o_ptr)
 Small helper function to see if an item seems good, bad or average based on to_h, to_d and to_a.
byte ignore_level_of (const object_type *o_ptr)
 Determine the ignore level of an object, which is similar to its pseudo.
void kind_ignore_clear (object_kind *k_ptr)
 Remove any ignoring of a particular flavor.
void ego_ignore (struct object *obj)
void ego_ignore_clear (struct object *obj)
void ego_ignore_toggle (int e_idx, int itype)
bool ego_is_ignored (int e_idx, int itype)
bool kind_is_ignored_aware (const object_kind *k_ptr)
bool kind_is_ignored_unaware (const object_kind *k_ptr)
void kind_ignore_when_aware (object_kind *k_ptr)
void kind_ignore_when_unaware (object_kind *k_ptr)
bool object_is_ignored (const object_type *o_ptr)
 Determines if an object is already ignored.
bool ignore_item_ok (const object_type *o_ptr)
 Determines if an object is eligible for ignoring.
void ignore_drop (void)
 Drop all {ignore}able items.
const char * ignore_name_for_type (ignore_type_t type)
 Return the name of an ignore type.

Variables

static quality_ignore_struct quality_mapping []
 Any entry here with an identifier should appear above the entry with the same tval and no identifier.
quality_name_struct quality_choices []
quality_name_struct quality_values [IGNORE_MAX]
 The names for the various kinds of quality.
byte ignore_level [ITYPE_MAX]
const size_t ignore_size = ITYPE_MAX
bool ** ego_ignore_types
int num_ego_types
struct init_module ignore_module

Detailed Description

Item ignoring.

Copyright (c) 2007 David T. Blackston, Iain McFall, DarkGod, Jeff Greene, David Vestal, Pete Mack, 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.

Macro Definition Documentation

#define ITYPE (   a,
 
)    { ITYPE_##a, b },

Function Documentation

int add_autoinscription ( s16b  kind,
const char *  inscription 
)

Register an object kind autoinscription.

References object_kind::note, objkind_byid(), quark_add(), and remove_autoinscription().

Referenced by o_xtra_act(), and parse_prefs_inscribe().

int apply_autoinscription ( object_type o_ptr)
void autoinscribe_ground ( void  )

Put an autoinscription on all objects on the floor beneath the player.

References apply_autoinscription(), cave, object::next, player::px, player::py, and square_object().

void autoinscribe_pack ( void  )

Put an autoinscription on all the player's carried objects.

References apply_autoinscription(), player::gear, and object::next.

void cleanup_ignore ( void  )

Clean up the ignore package.

References ego_ignore_types, i, mem_free(), and num_ego_types.

static int cmp_object_trait ( int  bonus,
random_value  base 
)
static

Small helper function to see how an object trait compares to the one in its base type.

If the base type provides a positive bonus, we'll use that. Otherwise, we'll use zero (players don't consider an item with a positive bonus to be bad even if the base kind has a higher positive bonus).

References CMP, MINIMISE, and randcalc().

Referenced by is_object_good().

void ego_ignore ( struct object obj)
void ego_ignore_clear ( struct object obj)
void ego_ignore_toggle ( int  e_idx,
int  itype 
)
bool ego_is_ignored ( int  e_idx,
int  itype 
)
const char* get_autoinscription ( object_kind kind)


Autoinscription stuff

Return an object kind autoinscription

References object_kind::note, and quark_str().

Referenced by apply_autoinscription(), display_object(), dump_autoinscriptions(), and o_xtra_act().

void ignore_birth_init ( void  )

Reset the player's ignore choices for a new game.

References FALSE, i, object::ignore, ignore_level, IGNORE_NONE, ITYPE_MAX, k_info, angband_constants::k_max, and z_info.

Referenced by do_cmd_accept_character().

void ignore_drop ( void  )
bool ignore_item_ok ( const object_type o_ptr)
byte ignore_level_of ( const object_type o_ptr)
const char* ignore_name_for_type ( ignore_type_t  type)

Return the name of an ignore type.

References i, ITYPE_MAX, and quality_name_struct::name.

Referenced by textui_cmd_ignore_menu().

ignore_type_t ignore_type_of ( const object_type o_ptr)

Find the ignore type of the object, or ITYPE_MAX if none.

References i, quality_ignore_struct::ignore_type, ITYPE_MAX, object::kind, N_ELEMENTS, object_kind::name, and object::tval.

Referenced by ego_ignore(), ego_ignore_clear(), object_is_ignored(), and textui_cmd_ignore_menu().

void init_ignore ( void  )

Initialise the ignore package.

References angband_constants::e_max, ego_ignore_types, i, ITYPE_MAX, mem_zalloc(), num_ego_types, and z_info.

static int is_object_good ( const object_type o_ptr)
static

Small helper function to see if an item seems good, bad or average based on to_h, to_d and to_a.

The sign of the return value announces if the object is bad (negative), good (positive) or average (zero).

References cmp_object_trait(), object::kind, object_kind::to_a, object::to_a, object_kind::to_d, object::to_d, object_kind::to_h, and object::to_h.

Referenced by ignore_level_of().

void kind_ignore_clear ( object_kind k_ptr)

Remove any ignoring of a particular flavor.

References object_kind::ignore, player_upkeep::notice, PN_IGNORE, and player::upkeep.

Referenced by o_xtra_act(), and textui_cmd_ignore_menu().

void kind_ignore_when_aware ( object_kind k_ptr)
void kind_ignore_when_unaware ( object_kind k_ptr)
bool kind_is_ignored_aware ( const object_kind k_ptr)
bool kind_is_ignored_unaware ( const object_kind k_ptr)
void object_ignore_flavor_of ( const object_type o_ptr)


Ignore code

Ignore the flavor of an object

References object_kind::ignore, IGNORE_IF_AWARE, IGNORE_IF_UNAWARE, object::kind, and object_flavor_is_aware().

Referenced by textui_cmd_ignore_menu().

bool object_is_ignored ( const object_type o_ptr)
int remove_autoinscription ( s16b  kind)

Deregister an object kind autoinscription.

References object_kind::note, and objkind_byid().

Referenced by add_autoinscription(), and o_xtra_act().

bool tval_has_ignore_type ( int  tval,
ignore_type_t  itype 
)

Find whether an ignore type is valid for a given tval.

References FALSE, i, quality_ignore_struct::ignore_type, N_ELEMENTS, and TRUE.

Referenced by ego_menu().

Variable Documentation

bool** ego_ignore_types
byte ignore_level[ITYPE_MAX]
struct init_module ignore_module
Initial value:
{
.name = "ignore",
.init = init_ignore,
.cleanup = cleanup_ignore
}
const size_t ignore_size = ITYPE_MAX

Referenced by rd_ignore(), and wr_ignore().

int num_ego_types

Referenced by cleanup_ignore(), and init_ignore().

quality_name_struct quality_choices[]
Initial value:
{
#define ITYPE(a, b)
}

Referenced by ego_item_name(), and quality_display().

quality_ignore_struct quality_mapping[]
static
Initial value:
{
{ ITYPE_GREAT, TV_SWORD, "Chaos" },
{ ITYPE_GREAT, TV_POLEARM, "Slicing" },
{ ITYPE_GREAT, TV_HAFTED, "Disruption" },
{ ITYPE_SHARP, TV_SWORD, "" },
{ ITYPE_SHARP, TV_POLEARM, "" },
{ ITYPE_BLUNT, TV_HAFTED, "" },
{ ITYPE_SHOOTER, TV_BOW, "" },
{ ITYPE_SHOT, TV_SHOT, "" },
{ ITYPE_ARROW, TV_ARROW, "" },
{ ITYPE_BOLT, TV_BOLT, "" },
{ ITYPE_ROBE, TV_SOFT_ARMOR, "Robe" },
{ ITYPE_DRAGON_ARMOR, TV_DRAG_ARMOR, "" },
{ ITYPE_BODY_ARMOR, TV_HARD_ARMOR, "" },
{ ITYPE_BODY_ARMOR, TV_SOFT_ARMOR, "" },
{ ITYPE_ELVEN_CLOAK, TV_CLOAK, "Elven" },
{ ITYPE_CLOAK, TV_CLOAK, "" },
{ ITYPE_SHIELD, TV_SHIELD, "" },
{ ITYPE_HEADGEAR, TV_HELM, "" },
{ ITYPE_HEADGEAR, TV_CROWN, "" },
{ ITYPE_HANDGEAR, TV_GLOVES, "" },
{ ITYPE_FEET, TV_BOOTS, "" },
{ ITYPE_DIGGER, TV_DIGGING, "" },
{ ITYPE_RING, TV_RING, "" },
{ ITYPE_AMULET, TV_AMULET, "" },
{ ITYPE_LIGHT, TV_LIGHT, "" },
}

Any entry here with an identifier should appear above the entry with the same tval and no identifier.

Initial value:
{
{ IGNORE_NONE, "no ignore" },
{ IGNORE_BAD, "bad" },
{ IGNORE_AVERAGE, "average" },
{ IGNORE_GOOD, "good" },
{ IGNORE_EXCELLENT_NO_HI, "excellent with no high resists" },
{ IGNORE_EXCELLENT_NO_SPL, "excellent but not splendid" },
{ IGNORE_ALL, "non-artifact" },
}

The names for the various kinds of quality.

Referenced by quality_action(), quality_display(), quality_menu(), quality_subdisplay(), and textui_cmd_ignore_menu().