Angband
Macros | Functions | Variables
obj-properties.c File Reference

functions to deal with object flags and modifiers More...

#include "angband.h"
#include "obj-gear.h"
#include "list-stats.h"
#include "list-object-flags.h"
#include "list-object-modifiers.h"

Macros

#define STAT(a, b, c, d, e, f, g, h)   { OF_##c, OFID_NORMAL, OFT_SUST, d, "Your %s glows." },
#define OF(a, b, c, d, e)   { OF_##a, b, c, d, e },
#define STAT(a, b, c, d, e, f, g, h)   #c,
#define OF(a, b, c, d, e)   #a,
#define STAT(a, b, c, d, e, f, g, h)   { OBJ_MOD_##a, b, e, h },
#define OBJ_MOD(a, b, c, d)   { OBJ_MOD_##a, b, c, d },
#define STAT(a, b, c, d, e, f, g, h)   #a,
#define OBJ_MOD(a, b, c, d)   #a,

Functions

void create_mask (bitflag *f, bool id,...)
 Create a "mask" of flags of a specific type or ID threshold.
bool cursed_p (const bitflag *f)
 Determine whether a flagset includes any curse flags.
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.
s32b flag_power (int flag)
 Return the base power rating for a flag.
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.

Variables

static struct object_flag object_flag_table []
 Details of the different object flags in the game.
static const char * flag_names []
 Object flag names.
static struct object_mod object_mod_table []
 Details of the different object modifiers in the game.
static const char * mod_names []
 Object modifier names.

Detailed Description

functions to deal with 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 OBJ_MOD (   a,
  b,
  c,
 
)    { OBJ_MOD_##a, b, c, d },
#define OBJ_MOD (   a,
  b,
  c,
 
)    #a,
#define OF (   a,
  b,
  c,
  d,
 
)    { OF_##a, b, c, d, e },
#define OF (   a,
  b,
  c,
  d,
 
)    #a,
#define STAT (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    { OF_##c, OFID_NORMAL, OFT_SUST, d, "Your %s glows." },
#define STAT (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    #c,
#define STAT (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    { OBJ_MOD_##a, b, e, h },
#define STAT (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    #a,

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

Variable Documentation

const char* flag_names[]
static

Object flag names.

Referenced by flag_name(), and log_flags().

const char* mod_names[]
static
Initial value:
{
#define STAT(a, b, c, d, e, f, g, h)
#define OBJ_MOD(a, b, c, d)
""
}

Object modifier names.

Referenced by mod_name().

struct object_flag object_flag_table[]
static

Details of the different object flags in the game.

See src/obj-properties.h for structure

Note that sustain stat flags are included first, so that the index into the flag table for a sustain is the stat index + 1

struct object_mod object_mod_table[]
static
Initial value:
{
#define STAT(a, b, c, d, e, f, g, h)
#define OBJ_MOD(a, b, c, d)
}

Details of the different object modifiers in the game.

See src/obj-properties.h for structure