Angband
Data Structures | Macros | Enumerations | Functions | Variables
obj-properties.h File Reference

definitions and functions for object flags and modifiers More...

#include "z-file.h"
#include "z-bitflag.h"
#include "list-tvals.h"
#include "list-object-flags.h"
#include "list-kind-flags.h"
#include "list-stats.h"
#include "list-object-modifiers.h"

Go to the source code of this file.

Data Structures

struct  obj_property
 

Structures

More...
 

Macros

#define TV(a, b, c)   TV_##a,
 
#define OF(a)   OF_##a,
 
#define KF(a, b)   KF_##a,
 
#define STAT(a)   OBJ_MOD_##a,
 
#define OBJ_MOD(a)   OBJ_MOD_##a,
 
#define OBJ_MOD_MIN_STAT   OBJ_MOD_STR
 
#define OF_SIZE   FLAG_SIZE(OF_MAX)
 
#define of_has(f, flag)   flag_has_dbg(f, OF_SIZE, flag, #f, #flag)
 
#define of_next(f, flag)   flag_next(f, OF_SIZE, flag)
 
#define of_count(f)   flag_count(f, OF_SIZE)
 
#define of_is_empty(f)   flag_is_empty(f, OF_SIZE)
 
#define of_is_full(f)   flag_is_full(f, OF_SIZE)
 
#define of_is_inter(f1, f2)   flag_is_inter(f1, f2, OF_SIZE)
 
#define of_is_subset(f1, f2)   flag_is_subset(f1, f2, OF_SIZE)
 
#define of_is_equal(f1, f2)   flag_is_equal(f1, f2, OF_SIZE)
 
#define of_on(f, flag)   flag_on_dbg(f, OF_SIZE, flag, #f, #flag)
 
#define of_off(f, flag)   flag_off(f, OF_SIZE, flag)
 
#define of_wipe(f)   flag_wipe(f, OF_SIZE)
 
#define of_setall(f)   flag_setall(f, OF_SIZE)
 
#define of_negate(f)   flag_negate(f, OF_SIZE)
 
#define of_copy(f1, f2)   flag_copy(f1, f2, OF_SIZE)
 
#define of_union(f1, f2)   flag_union(f1, f2, OF_SIZE)
 
#define of_inter(f1, f2)   flag_inter(f1, f2, OF_SIZE)
 
#define of_diff(f1, f2)   flag_diff(f1, f2, OF_SIZE)
 
#define KF_SIZE   FLAG_SIZE(KF_MAX)
 
#define kf_has(f, flag)   flag_has_dbg(f, KF_SIZE, flag, #f, #flag)
 
#define kf_next(f, flag)   flag_next(f, KF_SIZE, flag)
 
#define kf_is_empty(f)   flag_is_empty(f, KF_SIZE)
 
#define kf_is_full(f)   flag_is_full(f, KF_SIZE)
 
#define kf_is_inter(f1, f2)   flag_is_inter(f1, f2, KF_SIZE)
 
#define kf_is_subset(f1, f2)   flag_is_subset(f1, f2, KF_SIZE)
 
#define kf_is_equal(f1, f2)   flag_is_equal(f1, f2, KF_SIZE)
 
#define kf_on(f, flag)   flag_on_dbg(f, KF_SIZE, flag, #f, #flag)
 
#define kf_off(f, flag)   flag_off(f, KF_SIZE, flag)
 
#define kf_wipe(f)   flag_wipe(f, KF_SIZE)
 
#define kf_setall(f)   flag_setall(f, KF_SIZE)
 
#define kf_negate(f)   flag_negate(f, KF_SIZE)
 
#define kf_copy(f1, f2)   flag_copy(f1, f2, KF_SIZE)
 
#define kf_union(f1, f2)   flag_union(f1, f2, KF_SIZE)
 
#define kf_inter(f1, f2)   flag_inter(f1, f2, KF_SIZE)
 
#define kf_diff(f1, f2)   flag_diff(f1, f2, KF_SIZE)
 

Enumerations

enum  { TV_MAX }
 

Constants

More...
 
enum  { OF_NONE }
 The object flags. More...
 
enum  
 The object kind flags. More...
 
enum  { OBJ_MOD_MAX }
 The object modifiers. More...
 
enum  object_flag_type {
  OFT_NONE = 0, OFT_SUST, OFT_PROT, OFT_MISC,
  OFT_LIGHT, OFT_MELEE, OFT_BAD, OFT_DIG,
  OFT_MAX
}
 The object flag types. More...
 
enum  object_flag_id { OFID_NONE = 0, OFID_NORMAL, OFID_TIMED, OFID_WIELD }
 How object flags are IDd. More...
 
enum  obj_property_type {
  OBJ_PROPERTY_NONE = 0, OBJ_PROPERTY_STAT, OBJ_PROPERTY_MOD, OBJ_PROPERTY_FLAG,
  OBJ_PROPERTY_IGNORE, OBJ_PROPERTY_RESIST, OBJ_PROPERTY_VULN, OBJ_PROPERTY_IMM,
  OBJ_PROPERTY_MAX
}
 The object property types. More...
 

Functions

struct obj_propertylookup_obj_property (int type, int index)
 

Functions

More...
 
void create_obj_flag_mask (bitflag *f, bool id,...)
 Create a "mask" of object flags of a specific type or ID threshold. More...
 
void flag_message (int flag, char *name)
 Print a message when an object flag is identified by use. More...
 
int sustain_flag (int stat)
 Return the sustain flag of a given stat. More...
 

Variables

struct obj_propertyobj_properties
 

Detailed Description

definitions and functions for object flags and modifiers

Copyright (c) 2014 Chris Carr, Nick McConnell

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 KF (   a,
 
)    KF_##a,
#define kf_copy (   f1,
  f2 
)    flag_copy(f1, f2, KF_SIZE)
#define kf_diff (   f1,
  f2 
)    flag_diff(f1, f2, KF_SIZE)
#define kf_has (   f,
  flag 
)    flag_has_dbg(f, KF_SIZE, flag, #f, #flag)
#define kf_inter (   f1,
  f2 
)    flag_inter(f1, f2, KF_SIZE)
#define kf_is_empty (   f)    flag_is_empty(f, KF_SIZE)
#define kf_is_equal (   f1,
  f2 
)    flag_is_equal(f1, f2, KF_SIZE)
#define kf_is_full (   f)    flag_is_full(f, KF_SIZE)
#define kf_is_inter (   f1,
  f2 
)    flag_is_inter(f1, f2, KF_SIZE)
#define kf_is_subset (   f1,
  f2 
)    flag_is_subset(f1, f2, KF_SIZE)
#define kf_negate (   f)    flag_negate(f, KF_SIZE)
#define kf_next (   f,
  flag 
)    flag_next(f, KF_SIZE, flag)
#define kf_off (   f,
  flag 
)    flag_off(f, KF_SIZE, flag)
#define kf_on (   f,
  flag 
)    flag_on_dbg(f, KF_SIZE, flag, #f, #flag)
#define kf_setall (   f)    flag_setall(f, KF_SIZE)
#define KF_SIZE   FLAG_SIZE(KF_MAX)
#define kf_union (   f1,
  f2 
)    flag_union(f1, f2, KF_SIZE)

Referenced by finish_parse_object().

#define kf_wipe (   f)    flag_wipe(f, KF_SIZE)
#define OBJ_MOD (   a)    OBJ_MOD_##a,
#define OBJ_MOD_MIN_STAT   OBJ_MOD_STR
#define OF (   a)    OF_##a,
#define of_copy (   f1,
  f2 
)    flag_copy(f1, f2, OF_SIZE)
#define of_count (   f)    flag_count(f, OF_SIZE)
#define of_diff (   f1,
  f2 
)    flag_diff(f1, f2, OF_SIZE)
#define of_has (   f,
  flag 
)    flag_has_dbg(f, OF_SIZE, flag, #f, #flag)
#define of_inter (   f1,
  f2 
)    flag_inter(f1, f2, OF_SIZE)
#define of_is_empty (   f)    flag_is_empty(f, OF_SIZE)
#define of_is_equal (   f1,
  f2 
)    flag_is_equal(f1, f2, OF_SIZE)

Referenced by find_inven(), and object_stackable().

#define of_is_full (   f)    flag_is_full(f, OF_SIZE)
#define of_is_inter (   f1,
  f2 
)    flag_is_inter(f1, f2, OF_SIZE)
#define of_is_subset (   f1,
  f2 
)    flag_is_subset(f1, f2, OF_SIZE)
#define of_negate (   f)    flag_negate(f, OF_SIZE)

Referenced by equip_learn_after_time().

#define of_next (   f,
  flag 
)    flag_next(f, OF_SIZE, flag)
#define of_off (   f,
  flag 
)    flag_off(f, OF_SIZE, flag)
#define of_on (   f,
  flag 
)    flag_on_dbg(f, OF_SIZE, flag, #f, #flag)
#define of_setall (   f)    flag_setall(f, OF_SIZE)
#define OF_SIZE   FLAG_SIZE(OF_MAX)
#define of_union (   f1,
  f2 
)    flag_union(f1, f2, OF_SIZE)
#define of_wipe (   f)    flag_wipe(f, OF_SIZE)
#define STAT (   a)    OBJ_MOD_##a,
#define TV (   a,
  b,
 
)    TV_##a,

Enumeration Type Documentation

anonymous enum


Constants

The values for the "tval" field of various objects.

This value is the primary means by which items are sorted in the player inventory, followed by "sval" and "cost".

Enumerator
TV_MAX 
anonymous enum

The object flags.

Enumerator
OF_NONE 
anonymous enum

The object kind flags.

anonymous enum

The object modifiers.

Enumerator
OBJ_MOD_MAX 

The object property types.

Enumerator
OBJ_PROPERTY_NONE 
OBJ_PROPERTY_STAT 
OBJ_PROPERTY_MOD 
OBJ_PROPERTY_FLAG 
OBJ_PROPERTY_IGNORE 
OBJ_PROPERTY_RESIST 
OBJ_PROPERTY_VULN 
OBJ_PROPERTY_IMM 
OBJ_PROPERTY_MAX 

How object flags are IDd.

Enumerator
OFID_NONE 
OFID_NORMAL 
OFID_TIMED 
OFID_WIELD 

The object flag types.

Enumerator
OFT_NONE 
OFT_SUST 
OFT_PROT 
OFT_MISC 
OFT_LIGHT 
OFT_MELEE 
OFT_BAD 
OFT_DIG 
OFT_MAX 

Function Documentation

void create_obj_flag_mask ( bitflag f,
bool  id,
  ... 
)

Create a "mask" of object flags of a specific type or ID threshold.

Parameters
fis the flag array we're filling
idis whether we're masking by ID level
...is the list of flags or ID types we're looking for

N.B. OFT_MAX must be the last item in the ... list

References args, i, obj_property::id_type, obj_property::index, OBJ_PROPERTY_FLAG, of_on, of_wipe, OFT_MAX, angband_constants::property_max, obj_property::subtype, obj_property::type, and z_info.

Referenced by ego_apply_magic(), equip_learn_after_time(), object_learn_on_wield(), object_power_calculation_ALL_MISC(), object_power_calculation_ALL_PROTECTS(), object_power_calculation_ALL_SUSTAINS(), object_power_calculation_NUM_MISC(), object_power_calculation_NUM_PROTECTS(), and object_power_calculation_NUM_SUSTAINS().

void flag_message ( int  flag,
char *  name 
)

Print a message when an object flag is identified by use.

Parameters
flagis the flag being noticed
nameis the object name

References buf, lookup_obj_property(), msg, obj_property::msg, obj_property::next, OBJ_PROPERTY_FLAG, strnfcat(), and tag.

Referenced by equip_learn_after_time(), equip_learn_flag(), object_curses_find_flags(), and object_learn_on_wield().

struct obj_property* lookup_obj_property ( int  type,
int  index 
)
int sustain_flag ( int  stat)

Return the sustain flag of a given stat.

References STAT_MAX.

Referenced by describe_sustains(), display_player_sust_info(), effect_handler_DRAIN_STAT(), and object_learn_on_wield().

Variable Documentation

struct obj_property* obj_properties