misbehaviuor with wizmode-defined ghosts (doesn't really work anyway) and (hopefully) the highscores.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3507 c06c8d41-db1a-0410-9941-cceddc491573
6O5667Y65C5GTP4V3NBKWUN22IRGCAXEELJ6MCANMYPBOKDUO75QC
JDM5R3HYGXKQKZWY35QZ2KOB24TFZ3FW2PCNXCRCMWG72AZC5ZXQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
TAVHZJPVNJBZR7CUURAOYNDZPNVQ3AGHTXDEP5K4JGYETBLQJDRQC
3C2VE43SHCSBY4LTRTFYFLIPRWFUN6DXU6D34QVWDQTSNRBUFG7AC
J6APXOT4QOGQFONWB7G546VTVF6QG42HVOROMHF7YBDJPR4K26OAC
/* ***********************************************************************
* called from: debug and hiscores
* *********************************************************************** */
int get_species_by_abbrev( const char *abbrev );
int get_species_by_name( const char *name );
int get_class_by_abbrev( const char *abbrev );
int get_class_by_name( const char *name );
}
// needed for debug.cc and hiscores.cc
int get_species_by_abbrev( const char *abbrev )
{
int i;
COMPILE_CHECK(ARRAYSIZE(Species_Abbrev_List) == NUM_SPECIES, c1);
for (i = SP_HUMAN; i < NUM_SPECIES; i++)
{
if (tolower( abbrev[0] ) == tolower( Species_Abbrev_List[i][0] )
&& tolower( abbrev[1] ) == tolower( Species_Abbrev_List[i][1] ))
{
break;
}
}
return ((i < NUM_SPECIES) ? i : -1);
char *ptr;
char lowered_buff[80];
char lowered_class[80];
strncpy( lowered_buff, name, sizeof( lowered_buff ) );
strlwr( lowered_buff );
for (i = 0; i < NUM_JOBS; i++)
{
strncpy( lowered_class, Class_Name_List[i], sizeof( lowered_class ) );
strlwr( lowered_class );
ptr = strstr( lowered_class, lowered_buff );
if (ptr != NULL)
{
cl = i;
if (ptr == lowered_class) // prefix takes preference
break;
}
}
return (cl);
}
char class_str[80];
char input_str[80];
mpr( "Make player ghost which species? ", MSGCH_PROMPT );
get_input_line( input_str, sizeof( input_str ) );
int sp_id = get_species_by_abbrev(input_str);
if (sp_id == -1)
sp_id = str_to_species(input_str);
if (sp_id == -1)
{
mpr("No such species, making it Human.");
sp_id = SP_HUMAN;
}
ghost.species = static_cast<species_type>(sp_id);