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

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

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

Go to the source code of this file.

Data Structures

struct  object_flag
 The object flag structure. More...
struct  object_mod
 The object modifier structure. More...

Macros

#define STAT(a, b, c, d, e, f, g, h)   OF_##c,
#define OF(a, b, c, d, e)   OF_##a,
#define KF(a, b)   KF_##a,
#define STAT(a, b, c, d, e, f, g, h)   OBJ_MOD_##a,
#define OBJ_MOD(a, b, c, d)   OBJ_MOD_##a,
#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_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_comp_union(f1, f2)   flag_comp_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_comp_union(f1, f2)   flag_comp_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  { OF_NONE }
enum  
enum  { OBJ_MOD_MAX }
enum  object_flag_type {
  OFT_NONE = 0, OFT_SUST, OFT_PROT, OFT_MISC,
  OFT_LIGHT, OFT_MELEE, OFT_CURSE, OFT_BAD,
  OFT_MAX
}
enum  object_flag_id { OFID_NONE = 0, OFID_NORMAL, OFID_TIMED, OFID_WIELD }

Functions

bool cursed_p (const bitflag *f)
 Determine whether a flagset includes any curse flags.
void create_mask (bitflag *f, bool id,...)
 Create a "mask" of flags of a specific type or ID threshold.
s32b flag_power (int flag)
 Return the base power rating for a flag.
void log_flags (bitflag *f, ang_file *log_file)
 Log the names of a flagset to a file.
const char * flag_name (int flag)
 Return the name of a flag.
s16b flag_slot_mult (int flag, int slot)
 Get the slot multiplier for a flag's power rating.
int obj_flag_type (int flag)
 Return the OFT_ type of a flag.
void flag_message (int flag, char *name)
 Print a message when an object flag is identified by use.
int sustain_flag (int stat)
 Return the sustain flag of a given stat.
const char * mod_name (int mod)
 Return the name of a flag.
s32b mod_power (int mod)
 Return the base power rating for a mod.
int mod_mult (int mod)
 Return the mod weighting of a flag^H^H^H^Hmod.
s16b mod_slot_mult (int mod, int slot)
 Get the slot multiplier for a mod's power rating.

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_comp_union (   f1,
  f2 
)    flag_comp_union(f1, f2, KF_SIZE)
#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,
  b,
  c,
 
)    OBJ_MOD_##a,
#define OF (   a,
  b,
  c,
  d,
 
)    OF_##a,
#define of_comp_union (   f1,
  f2 
)    flag_comp_union(f1, f2, OF_SIZE)
#define of_copy (   f1,
  f2 
)    flag_copy(f1, f2, 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)

Referenced by object_notice_flags().

#define of_negate (   f)    flag_negate(f, OF_SIZE)
#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,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    OF_##c,
#define STAT (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    OBJ_MOD_##a,

Enumeration Type Documentation

anonymous enum
Enumerator:
OF_NONE 
anonymous enum
anonymous enum
Enumerator:
OBJ_MOD_MAX 
Enumerator:
OFID_NONE 
OFID_NORMAL 
OFID_TIMED 
OFID_WIELD 
Enumerator:
OFT_NONE 
OFT_SUST 
OFT_PROT 
OFT_MISC 
OFT_LIGHT 
OFT_MELEE 
OFT_CURSE 
OFT_BAD 
OFT_MAX 

Function Documentation

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

Create a "mask" of 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 i, object_flag::id, object_flag::index, of_on, of_wipe, OFT_MAX, and object_flag::type.

Referenced by cursed_p(), ego_apply_magic(), equip_notice_after_time(), ignore_level_of(), obj_desc_inscrip(), object_notice_curses(), object_notice_ego(), object_notice_on_wield(), object_pseudo(), uncurse_object(), and wiz_tweak_curse().

bool cursed_p ( const bitflag f)
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 flag, object_flag::message, msg, and streq.

Referenced by equip_notice_after_time(), and equip_notice_flag().

const char* flag_name ( int  flag)

Return the name of a flag.

References flag, and flag_names.

Referenced by add_flag(), and flags_power().

s32b flag_power ( int  flag)

Return the base power rating for a flag.

References flag, and object_flag::power.

Referenced by flags_power().

s16b flag_slot_mult ( int  flag,
int  slot 
)

Get the slot multiplier for a flag's power rating.

Parameters
flagis the flag in question.
slotis the wield_slot it's in.

References flag, OFT_BAD, OFT_CURSE, OFT_LIGHT, OFT_MELEE, OFT_MISC, OFT_PROT, OFT_SUST, and object_flag::type.

Referenced by flags_power().

void log_flags ( bitflag f,
ang_file log_file 
)

Log the names of a flagset to a file.

Parameters
fis the set of flags we are logging.
log_fileis the file to which we are logging the names.

References file_putf(), flag_names, i, and of_has.

Referenced by flags_power().

int mod_mult ( int  mod)

Return the mod weighting of a flag^H^H^H^Hmod.

References object_mod::mod_mult.

Referenced by modifier_power().

const char* mod_name ( int  mod)
s32b mod_power ( int  mod)

Return the base power rating for a mod.

References object_mod::power.

Referenced by modifier_power().

s16b mod_slot_mult ( int  mod,
int  slot 
)

Get the slot multiplier for a mod's power rating.

Parameters
modis the mod in question.
slotis the wield_slot it's in.

Referenced by modifier_power().

int obj_flag_type ( int  flag)

Return the OFT_ type of a flag.

References flag, and object_flag::type.

Referenced by flags_power().

int sustain_flag ( int  stat)

Return the sustain flag of a given stat.

References object_flag::index, and STAT_MAX.

Referenced by display_player_sust_info(), and effect_handler_DRAIN_STAT().