If you want another layer of flexibility, and don't mind a small performance
hit, consider
something like:
/* race table */
const struct race_type race_table[] = {
/*
{
name, pc_race?,
act bits, 2 aff bytes: {b0, b1}, off bits,
imm, res, vuln,
mats_allergic, mats_affinity,
form, parts
},
*/
{
"fake-elf", TRUE,
0, { 0, 0 }, 0,
0, 0, 0,
"iron steel cobalt", "mithril wood",
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
usage something like in wear_obj or get_obj (or whatever you want):
if (!stristr(obj->material, race_table[ch->race].mats_allergic))
{
ch_printf(ch, "You hiss and recoil after touching %s--it burns you."
" Your race must be allergic to %s.\n\r",
obj->short_descr, obj->material);
return;
}
Much more flexible this way. This is infinitely quicker and easier than
fucking around with
flags and such.
Can change items on-the-fly and race allergies with a simple edit. Your
phrasing may vary, of
course.
race_type now (I use unlimited bits):
struct race_type
{
char * name; /* call name of the race */
bool pc_race; /* can be chosen by pcs */
long act; /* act bits for the race */
FLAG aff[AFF_FLAGS]; /* aff bits for the race */
long off; /* off bits for the race */
long imm; /* imm bits for the race */
long res; /* res bits for the race */
long vuln; /* vuln bits for the race */
char * mats_allergic; /*Materials this race should not touch (depending on
code)*/
char * mats_affinity, /*Materials this race receives bonuses (depending on
code)*/
long form; /* default form flag for the race */
long parts; /* default parts for the race */
};
P.S.
if (!stristr(obj->material, race_table[ch->race].mats_allergic))
may need to be
if (!stristr(obj->material, race_table[ch->race].mats_allergic))
I forgot which arg is string and which is pattern.
-- Jeremy