Defines | Functions | Variables

role.c File Reference

#include "hack.h"
Include dependency graph for role.c:

Defines

#define BP_ALIGN   0
#define BP_GEND   1
#define BP_RACE   2
#define BP_ROLE   3
#define NUM_BP   4

Functions

STATIC_DCL char * FDECL (promptsep,(char *, int))
STATIC_DCL int FDECL (role_gendercount,(int))
STATIC_DCL int FDECL (race_alignmentcount,(int))
boolean validrole (int rolenum)
int randrole ()
int str2role (char *str)
boolean validrace (int rolenum, int racenum)
int randrace (int rolenum)
int str2race (char *str)
boolean validgend (int rolenum, int racenum, int gendnum)
int randgend (int rolenum, int racenum)
int str2gend (char *str)
boolean validalign (int rolenum, int racenum, int alignnum)
int randalign (int rolenum, int racenum)
int str2align (char *str)
boolean ok_role (int rolenum, int racenum, int gendnum, int alignnum)
int pick_role (int racenum, int gendnum, int alignnum, int pickhow)
boolean ok_race (int rolenum, int racenum, int gendnum, int alignnum)
int pick_race (int rolenum, int gendnum, int alignnum, int pickhow)
boolean ok_gend (int rolenum, int racenum, int gendnum, int alignnum)
int pick_gend (int rolenum, int racenum, int alignnum, int pickhow)
boolean ok_align (int rolenum, int racenum, int gendnum, int alignnum)
int pick_align (int rolenum, int racenum, int gendnum, int pickhow)
void rigid_role_checks ()
STATIC_OVL char * promptsep (char *buf, int num_post_attribs)
STATIC_OVL int role_gendercount (int rolenum)
STATIC_OVL int race_alignmentcount (int racenum)
char * root_plselection_prompt (char *suppliedbuf, int buflen, int rolenum, int racenum, int gendnum, int alignnum)
char * build_plselection_prompt (char *buf, int buflen, int rolenum, int racenum, int gendnum, int alignnum)
void plnamesuffix ()
void role_init ()
const char * Hello (struct monst *mtmp)
const char * Goodbye ()
void violated (int cdt)
boolean successful_cdt (int cdt)
boolean intended_cdt (int cdt)
boolean superfluous_cdt (int cdt)
boolean failed_cdt (int cdt)

Variables

struct Role roles []
struct Role urole
struct Race races []
struct Race urace
struct Gender genders []
struct Align aligns []
struct Conduct conducts []
static char NEARDATA randomstr [] = "random"
STATIC_VAR char pa [NUM_BP]
STATIC_VAR char post_attribs

Define Documentation

#define BP_ALIGN   0
#define BP_GEND   1
#define BP_RACE   2
#define BP_ROLE   3
#define NUM_BP   4

Referenced by root_plselection_prompt().


Function Documentation

char* build_plselection_prompt ( char *  buf,
int  buflen,
int  rolenum,
int  racenum,
int  gendnum,
int  alignnum 
)
boolean failed_cdt ( int  cdt )

References intended_cdt(), and successful_cdt().

Referenced by show_conduct().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_DCL int FDECL ( role_gendercount  ,
(int)   
)
STATIC_DCL char* FDECL ( promptsep  ,
(char *, int)   
)
STATIC_DCL int FDECL ( race_alignmentcount  ,
(int)   
)
const char* Goodbye (  )

References PM_KNIGHT, PM_MONK, PM_SAMURAI, PM_TOURIST, PM_VALKYRIE, and Role_switch.

Referenced by done(), and losexp().

Here is the caller graph for this function:

const char* Hello ( struct monst mtmp )

References MAIL, mons, PM_KNIGHT, PM_MAIL_DAEMON, PM_MONK, PM_SAMURAI, PM_SHOPKEEPER, PM_TOURIST, PM_VALKYRIE, and Role_switch.

Referenced by check_special_room(), shk_chat(), shk_move(), u_entered_shop(), and welcome().

Here is the caller graph for this function:

boolean intended_cdt ( int  cdt )
boolean ok_align ( int  rolenum,
int  racenum,
int  gendnum,
int  alignnum 
)

References Race::allow, Role::allow, Align::allow, FALSE, ROLE_ALIGNMASK, ROLE_ALIGNS, SIZE, and TRUE.

Referenced by pick_align().

Here is the caller graph for this function:

boolean ok_gend ( int  rolenum,
int  racenum,
int  gendnum,
int  alignnum 
)

References Race::allow, Role::allow, Gender::allow, FALSE, ROLE_GENDERS, ROLE_GENDMASK, SIZE, and TRUE.

Referenced by pick_gend().

Here is the caller graph for this function:

boolean ok_race ( int  rolenum,
int  racenum,
int  gendnum,
int  alignnum 
)

References Role::allow, Race::allow, FALSE, ROLE_ALIGNMASK, ROLE_ALIGNS, ROLE_GENDERS, ROLE_GENDMASK, ROLE_RACEMASK, SIZE, and TRUE.

Referenced by pick_race(), and root_plselection_prompt().

Here is the caller graph for this function:

boolean ok_role ( int  rolenum,
int  racenum,
int  gendnum,
int  alignnum 
)

References Race::allow, Role::allow, FALSE, ROLE_ALIGNMASK, ROLE_ALIGNS, ROLE_GENDERS, ROLE_GENDMASK, ROLE_RACEMASK, SIZE, and TRUE.

Referenced by pick_role().

Here is the caller graph for this function:

int pick_align ( int  rolenum,
int  racenum,
int  gendnum,
int  pickhow 
)

References ok_align(), PICK_RIGID, rn2(), ROLE_ALIGNS, and ROLE_NONE.

Referenced by rigid_role_checks().

Here is the call graph for this function:

Here is the caller graph for this function:

int pick_gend ( int  rolenum,
int  racenum,
int  alignnum,
int  pickhow 
)

References ok_gend(), PICK_RIGID, rn2(), ROLE_GENDERS, and ROLE_NONE.

Referenced by rigid_role_checks().

Here is the call graph for this function:

Here is the caller graph for this function:

int pick_race ( int  rolenum,
int  gendnum,
int  alignnum,
int  pickhow 
)

References ok_race(), PICK_RIGID, rn2(), ROLE_NONE, and SIZE.

Referenced by rigid_role_checks().

Here is the call graph for this function:

Here is the caller graph for this function:

int pick_role ( int  racenum,
int  gendnum,
int  alignnum,
int  pickhow 
)

References ok_role(), PICK_RIGID, rn2(), ROLE_NONE, and SIZE.

Referenced by rigid_role_checks().

Here is the call graph for this function:

Here is the caller graph for this function:

void plnamesuffix (  )

References askname, flags, index, flag::initalign, flag::initgend, flag::initrace, flag::initrole, plname, ROLE_NONE, str2align(), str2gend(), str2race(), and str2role().

Referenced by parse_config_line(), and role_init().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL char* promptsep ( char *  buf,
int  num_post_attribs 
)

References post_attribs, and Strcat.

Referenced by build_plselection_prompt().

Here is the caller graph for this function:

STATIC_OVL int race_alignmentcount ( int  racenum )

References ROLE_CHAOTIC, ROLE_LAWFUL, ROLE_NEUTRAL, ROLE_NONE, and ROLE_RANDOM.

Referenced by root_plselection_prompt().

Here is the caller graph for this function:

int randalign ( int  rolenum,
int  racenum 
)

References rn2(), ROLE_ALIGNMASK, and ROLE_ALIGNS.

Referenced by role_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int randgend ( int  rolenum,
int  racenum 
)

References rn2(), ROLE_GENDERS, and validgend().

Here is the call graph for this function:

int randrace ( int  rolenum )

References Race::noun, rn2(), SIZE, and validrace().

Referenced by role_init().

Here is the call graph for this function:

Here is the caller graph for this function:

int randrole (  )

References rn2(), and SIZE.

Referenced by rigid_role_checks(), rnd_gname(), and role_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void rigid_role_checks (  )
STATIC_OVL int role_gendercount ( int  rolenum )

References ROLE_FEMALE, ROLE_MALE, ROLE_NEUTER, and validrole().

Referenced by root_plselection_prompt().

Here is the call graph for this function:

Here is the caller graph for this function:

void role_init (  )
char* root_plselection_prompt ( char *  suppliedbuf,
int  buflen,
int  rolenum,
int  racenum,
int  gendnum,
int  alignnum 
)

References Conduct::adj, BP_ALIGN, BP_GEND, BP_RACE, BP_ROLE, BUFSZ, FALSE, name, Conduct::noun, NUM_BP, ok_race(), race_alignmentcount(), role_gendercount(), ROLE_NONE, ROLE_RANDOM, Strcat, Strcpy, TRUE, and validrole().

Referenced by build_plselection_prompt().

Here is the call graph for this function:

Here is the caller graph for this function:

int str2align ( char *  str )

References Conduct::adj, ROLE_ALIGNS, ROLE_NONE, ROLE_RANDOM, strcmpi, and strncmpi().

Referenced by parseoptions(), and plnamesuffix().

Here is the call graph for this function:

Here is the caller graph for this function:

int str2gend ( char *  str )

References Conduct::adj, ROLE_GENDERS, ROLE_NONE, ROLE_RANDOM, strcmpi, and strncmpi().

Referenced by parseoptions(), and plnamesuffix().

Here is the call graph for this function:

Here is the caller graph for this function:

int str2race ( char *  str )

References Conduct::noun, Race::noun, ROLE_NONE, ROLE_RANDOM, strcmpi, and strncmpi().

Referenced by parseoptions(), plnamesuffix(), and score_wanted().

Here is the call graph for this function:

Here is the caller graph for this function:

int str2role ( char *  str )

References RoleName::m, name, Role::name, ROLE_NONE, ROLE_RANDOM, strcmpi, and strncmpi().

Referenced by parse_config_line(), parseoptions(), plnamesuffix(), priestname(), readentry(), role_init(), and score_wanted().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean successful_cdt ( int  cdt )
boolean superfluous_cdt ( int  cdt )

References CONDUCT_FOODLESS, CONDUCT_THIEVERY, CONDUCT_VEGAN, CONDUCT_VEGETARIAN, FALSE, successful_cdt(), TRUE, u, and you::uevent.

Referenced by dosacrifice(), and show_conduct().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean validalign ( int  rolenum,
int  racenum,
int  alignnum 
)

References ROLE_ALIGNMASK, and ROLE_ALIGNS.

Referenced by role_init().

Here is the caller graph for this function:

boolean validgend ( int  rolenum,
int  racenum,
int  gendnum 
)

References ROLE_GENDERS, and ROLE_GENDMASK.

Referenced by randgend(), and role_init().

Here is the caller graph for this function:

boolean validrace ( int  rolenum,
int  racenum 
)

References ROLE_ALIGNMASK, ROLE_GENDMASK, ROLE_RACEMASK, and SIZE.

Referenced by randrace(), and role_init().

Here is the caller graph for this function:

boolean validrole ( int  rolenum )

References SIZE.

Referenced by build_plselection_prompt(), rnd_gname(), role_gendercount(), role_init(), and root_plselection_prompt().

Here is the caller graph for this function:

void violated ( int  cdt )

Variable Documentation

struct Align aligns[]
Initial value:
 {
        {"law",         "lawful",       "Law",  ROLE_LAWFUL,    A_LAWFUL},
        {"balance",     "neutral",      "Neu",  ROLE_NEUTRAL,   A_NEUTRAL},
        {"chaos",       "chaotic",      "Cha",  ROLE_CHAOTIC,   A_CHAOTIC},
        {"evil",        "unaligned",    "Una",  0,              A_NONE}
}

Referenced by done(), get_compopt_value(), hack_artifacts(), newhp(), topten(), and u_init().

struct Conduct conducts[]

Referenced by dosacrifice(), and show_conduct().

struct Gender genders[]
Initial value:
 {
        {"male",        "he",   "him",  "his",  "Mal",  ROLE_MALE},
        {"female",      "she",  "her",  "her",  "Fem",  ROLE_FEMALE},
        {"neuter",      "it",   "it",   "its",  "Ntr",  ROLE_NEUTER}
}

Referenced by done(), get_compopt_value(), minimal_enlightenment(), topten(), and welcome().

STATIC_VAR char pa[NUM_BP]

Referenced by mattackm(), and mdamagem().

STATIC_VAR char post_attribs
struct Race races[]

Referenced by get_compopt_value().

char NEARDATA randomstr[] = "random" [static]
struct Role roles[]
struct Race urace
Initial value:
{       "something", "undefined", "something", "Xxx",
        {0, 0},
        NON_PM, NON_PM, NON_PM, NON_PM,
        0, 0, 0, 0,
        
        {      3,      3,  3,  3,  3,  3 },
        { STR18(100), 18, 18, 18, 18, 18 },
        
        {  2, 0,  0, 2,  1, 0 },        
        {  1, 0,  2, 0,  2, 0 }         
}

Referenced by can_twoweapon(), cpostfx(), do_class_genocide(), do_genocide(), domonnoise(), done(), done_in_by(), dosacrifice(), ini_inv(), init_uasmon(), is_playermon_genocided(), load_qtlist(), lookat(), losexp(), minimal_enlightenment(), newhp(), newman(), pluslvl(), raceptr(), rehumanize(), spec_applies(), topten(), u_init(), and welcome().

struct Role urole
Initial value:
{       {"Undefined", 0}, { {0, 0}, {0, 0}, {0, 0},
        {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} },
        "L", "N", "C", "Xxx", "home", "locate",
        NON_PM, NON_PM, NON_PM, NON_PM, NON_PM, NON_PM,
        0, 0,
        
        {   7,  7,  7,  7,  7,  7 },
        {  20, 15, 15, 20, 20, 10 },
        
        { 10, 0,  0, 8,  1, 0 },        
        {  2, 0,  0, 2,  0, 3 },14,     
        0, 10, 0, 0,  4, A_INT, 0, -3
}

Referenced by align_gname(), align_gtitle(), can_twoweapon(), change_sex(), convert_arg(), do_class_genocide(), do_genocide(), domonnoise(), done(), find_roll_to_hit(), guardname(), hack_artifacts(), homebase(), init_attr(), init_dungeons(), intermed(), is_playermon_genocided(), is_quest_artifact(), ldrname(), load_qtlist(), losexp(), makelevel(), max_rank_sz(), maybe_wail(), minimal_enlightenment(), mplayer_talk(), neminame(), newhp(), newuhs(), percent_success(), pet_type(), pluslvl(), priestname(), quest_info(), rank_of(), set_bonesfile_name(), skill_init(), topten(), u_init(), and welcome().