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-ignore.h"
#include "obj-knowledge.h"
#include "obj-pile.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "object.h"
#include "player-calcs.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. More...
 
void cleanup_ignore (void)
 Clean up the ignore package. More...
 
void ignore_birth_init (void)
 Reset the player's ignore choices for a new game. More...
 
static void rune_add_autoinscription (struct object *obj, int i)
 

Autoinscription stuff

More...
 
void rune_autoinscribe (int i)
 Put a rune autoinscription on all available objects. More...
 
static void runes_autoinscribe (struct object *obj)
 Put all appropriate rune autoinscriptions on an object. More...
 
const char * get_autoinscription (struct object_kind *kind, bool aware)
 Return an object kind autoinscription. More...
 
int apply_autoinscription (struct object *obj)
 Put an autoinscription on an object. More...
 
int remove_autoinscription (s16b kind)
 Deregister an object kind autoinscription. More...
 
int add_autoinscription (s16b kind, const char *inscription, bool aware)
 Register an object kind autoinscription. More...
 
void autoinscribe_ground (void)
 Put an autoinscription on all objects on the floor beneath the player. More...
 
void autoinscribe_pack (void)
 Put an autoinscription on all the player's carried objects. More...
 
void object_ignore_flavor_of (const struct object *obj)
 

Ignore code

More...
 
ignore_type_t ignore_type_of (const struct object *obj)
 Find the ignore type of the object, or ITYPE_MAX if none. More...
 
bool ego_has_ignore_type (struct ego_item *ego, ignore_type_t itype)
 Find whether an ignore type is valid for a given ego item. More...
 
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. More...
 
static int is_object_good (const struct object *obj)
 Small helper function to see if an item seems good, bad or average based on to_h, to_d and to_a. More...
 
byte ignore_level_of (const struct object *obj)
 Determine the ignore level of an object. More...
 
void kind_ignore_clear (struct object_kind *kind)
 Remove any ignoring of a particular flavor. More...
 
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 struct object_kind *kind)
 
bool kind_is_ignored_unaware (const struct object_kind *kind)
 
void kind_ignore_when_aware (struct object_kind *kind)
 
void kind_ignore_when_unaware (struct object_kind *kind)
 
bool object_is_ignored (const struct object *obj)
 Determines if an object is already ignored. More...
 
bool ignore_item_ok (const struct object *obj)
 Determines if an object is eligible for ignoring. More...
 
bool ignore_known_item_ok (const struct object *obj)
 Determines if the known version of an object is eligible for ignoring. More...
 
void ignore_drop (void)
 Drop all {ignore}able items. More...
 
const char * ignore_name_for_type (ignore_type_t type)
 Return the name of an ignore type. More...
 

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. More...
 
quality_name_struct quality_choices []
 
quality_name_struct quality_values [IGNORE_MAX]
 The names for the various kinds of quality. More...
 
byte ignore_level [ITYPE_MAX]
 
const size_t ignore_size = ITYPE_MAX
 
bool ** ego_ignore_types
 
static 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,
bool  aware 
)

Register an object kind autoinscription.

References object_kind::note_aware, object_kind::note_unaware, objkind_byid(), quark_add(), and remove_autoinscription().

Referenced by o_xtra_act(), and parse_prefs_inscribe().

int apply_autoinscription ( struct object obj)
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().

Referenced by do_cmd_autoinscribe(), and update_player_object_knowledge().

void autoinscribe_pack ( void  )

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

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

Referenced by do_cmd_autoinscribe(), and update_player_object_knowledge().

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

bool ego_has_ignore_type ( struct ego_item ego,
ignore_type_t  itype 
)
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 ( struct object_kind kind,
bool  aware 
)
void ignore_birth_init ( void  )

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

References angband_constants::e_max, ego_ignore_types, i, 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 struct object obj)
bool ignore_known_item_ok ( const struct object obj)

Determines if the known version of an object is eligible for ignoring.

This function should only be called on known version of items which have a (real or imaginary) listed base item in the current level

References cave, object_is_ignored(), chunk::objects, object::oidx, and player::unignoring.

Referenced by map_info(), object_list_should_ignore_object(), scan_distant_floor(), and target_accept().

byte ignore_level_of ( const struct object obj)

Determine the ignore level of an object.

The main point is when the value is undetermined given current info, return the maximum possible value.

References object::artifact, object::ego, i, IGNORE_ALL, IGNORE_AVERAGE, IGNORE_BAD, IGNORE_GOOD, IGNORE_MAX, is_object_good(), object::known, object::modifiers, object::notice, OBJ_MOD_MAX, OBJ_NOTICE_ASSESSED, object_fully_known(), object::to_a, object::to_d, object::to_h, tval_is_jewelry(), and value.

Referenced by object_is_ignored(), and textui_cmd_ignore_menu().

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 struct object obj)
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 struct object obj)
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 ( struct object_kind kind)

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 ( struct object_kind kind)
void kind_ignore_when_unaware ( struct object_kind kind)
bool kind_is_ignored_aware ( const struct object_kind kind)
bool kind_is_ignored_unaware ( const struct object_kind kind)
void object_ignore_flavor_of ( const struct object obj)


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 struct object obj)
int remove_autoinscription ( s16b  kind)

Deregister an object kind autoinscription.

References object_kind::aware, object_kind::note_aware, object_kind::note_unaware, and objkind_byid().

Referenced by add_autoinscription(), and o_xtra_act().

static void rune_add_autoinscription ( struct object obj,
int  i 
)
static


Autoinscription stuff

Make or extend a rune autoinscription

References my_strcat(), my_strcpy(), object::note, quark_add(), quark_str(), and rune_note().

Referenced by rune_autoinscribe(), and runes_autoinscribe().

void rune_autoinscribe ( int  i)

Put a rune autoinscription on all available objects.

References cave, player::gear, object::next, object_has_rune(), player_knows_rune(), player::px, player::py, rune_add_autoinscription(), and square_object().

Referenced by rune_xtra_act().

static void runes_autoinscribe ( struct object obj)
static

Put all appropriate rune autoinscriptions on an object.

References i, max_runes(), object_has_rune(), player_knows_rune(), rune_add_autoinscription(), and rune_max.

Referenced by apply_autoinscription().

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
}
void cleanup_ignore(void)
Clean up the ignore package.
Definition: obj-ignore.c:131
void init_ignore(void)
Initialise the ignore package.
Definition: obj-ignore.c:117
const size_t ignore_size = ITYPE_MAX

Referenced by rd_ignore(), and wr_ignore().

int num_ego_types
static

Referenced by cleanup_ignore(), and init_ignore().

quality_name_struct quality_choices[]

Referenced by ego_item_name(), and quality_display().

quality_ignore_struct quality_mapping[]
static

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_ALL, "non-artifact" },
}
Definition: obj-ignore.h:57
Definition: obj-ignore.h:56
Definition: obj-ignore.h:59
Definition: obj-ignore.h:55
Definition: obj-ignore.h:58

The names for the various kinds of quality.

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