sscanf(argument, "%d'%d", &feet, &inches );
void nanny_get_height( DESCRIPTOR_DATA * d, char *argument )
{
CHAR_DATA *ch;
//char buf[MSL];
int rfeet, feet = -1, rinches, inches = -1, height;
ch = d->character;
if( sscanf( argument, "%d'%d\"", &rfeet, &rinches ) )
{
feet = &rfeet;
inches = &rinches;
if( feet != -1 && inches != -1 )
{
height = ( feet * 12 ) + inches;
if( ch->sex == SEX_MALE )
{
if( height >= ( int )( race_table[ch->race]->maleheight * .888 ) && height <= ( int )( race_table[ch->race]->maleheight * 1.15 ) )
ch->height = height;
}
if( ch->sex == SEX_FEMALE )
{
if( height >= ( int )( race_table[ch->race]->femaleheight * .888 ) && height <= ( int )( race_table[ch->race]->femaleheight * 1.15 ) )
ch->height = height;
}
}
else
{
height = atoi( argument );
if( ch->sex == SEX_MALE )
{
if( height >= ( int )( race_table[ch->race]->maleheight * .888 ) && height <= ( int )( race_table[ch->race]->maleheight * 1.15 ) )
ch->height = height;
}
if( ch->sex == SEX_FEMALE )
{
if( height >= ( int )( race_table[ch->race]->femaleheight * .888 ) && height <= ( int )( race_table[ch->race]->femaleheight * 1.15 ) )
ch->height = height;
}
}
}
}
[Kayle@Malevolum ~/coding/src]$ make
make -s smaug
Compiling o/comm.o….
comm.c: In function `void nanny_get_height(DESCRIPTOR_DATA*, char*)':
comm.c:2544: error: invalid conversion from `int*' to `int'
comm.c:2545: error: invalid conversion from `int*' to `int'
make[1]: *** [o/comm.o] Error 1
make: *** [all] Error 2
[Kayle@Malevolum ~/coding/src]$
feet = &rfeet;
inches = &rinches;
feet = rfeet;
inches = rinches
if( sscanf( argument, "%d'%d\"", &rfeet, &rinches ) )
if(sscanf(argument, "%d'%d\"", &rfeet, &rinches ) == 2 )will mean both rfeet and rinches were assigned values and that it is indeed entered correctly.
const char *show_appearance( CHAR_DATA * ch )
{
static char buf[MSL];
int feet, inches;
feet = ch->height / 12;
inches = ch->height % 12;
if( ch->race == RACE_LIZARDFOLK )
{
snprintf( buf, MSL, "Your %s eyes stand out ferociously against your %s scales.\r\n"
"You stand %d'%d\" tall and weight %d pounds, and your %s build\r\n"
"makes you a worthy adversary for any warm-blood that challenges\r\n"
"you.\r\n", get_eye_color( ch, ch->eyecolor ), scale_color[ch->scalecolor], feet, inches,
ch->weight, build_name[ch->build] );
}
else if( ch->race == RACE_LUPINAL )
{
snprintf( buf, MSL, "", ? );
}
else if( ch->race == RACE_FELINID )
{
snprintf( buf, MSL, "", ? );
}
else if( ch->race == RACE_HALFDEMON || ch->race == RACE_HALFCELESTIAL || ch->race == RACE_IGNAN
|| ch->race == RACE_TERRAN || ch->race == RACE_BOREAN || ch->race == HALF_AQUAN )
{
snprintf( buf, MSL, "", ? );
}
else
{
snprintf( buf, MSL, "", ? );
}
return buf;
}
snprintf( buf, MSL, "Your %s eyes gaze mischievously about, and your %s are the envy of the rest\r\n"
"of the pride. Your %s %s hair is worn %s%s. You stand at %d'%d\" and weigh\r\n"
"%d pounds, with a %s build. You are ready for anything.\r\n",
get_eye_color( ch, ch->eyecolor ), felinid_fur_color[ch->furcolor], hair_length[ch->hlength],
get_hair_color( ch, ch->hcolor ), ch->hstyle == 9 ? "as " : ch->hstyle == 10 ?
"with long bangs framed around your face" : "", ch->hstyle == 10 ? "" : hair_style[ch->hstyle],
feet, inches, ch->weight, build_name[ch->build] );
char *show_appearance( CHAR_DATA * ch )
{
static char buf[MSL];
int feet, inches;
feet = ch->height / 12;
inches = ch->height % 12;
(…)
else
{
if( ch->race == RACE_GOLDDWARF || ch->race == RACE_SHIELDDWARF || ( ch->race == RACE_HUMAN && ch->sex == SEX_MALE )
|| ( ch->race == RACE_HALFELF && ch->sex == SEX_MALE ) || ( ch->race == RACE_HALFORC && ch->sex == SEX_MALE )
|| ( ch->race == RACE_HALFOGRE && ch->sex == SEX_MALE ) || ( ch->race == RACE_ROCKGNOME && ch->sex == SEX_MALE )
|| ( ch->race == RACE_DUERGAR && ch->sex == SEX_MALE ) )
{
snprintf( buf, MSL, "&wYour &W%s&w eyes twinkle with a need for adventure, and contrast with your\r\n"
"&W%s&w skin. Your &W%s %s&w hair is worn &W%s%s&w. You stand at &W%d'%d\"&w and weigh\r\n"
"&W%d&w pounds, with a &W%s&w build. Your &W%s&w%s.&D\r\n",
strlower( get_eye_color( ch, ch->eyecolor ) ), strlower( get_skin_tone( ch, ch->skintone ) ),
strlower( hair_length[ch->hlength] ), strlower( get_hair_color( ch, ch->hcolor ) ),
ch->hstyle == 9 ? "as " : "", strlower( hair_style[ch->hstyle] ), feet, inches,
ch->weight, strlower( build_name[ch->build] ), strlower( facial_hair[ch->facialhair] ),
ch->facialhair == 0 ? " face draws all the attention of the ladies" : ch->facialhair == 5 ?
" are neatly trimmed" : " is neatly trimmed" );
}
else
{
snprintf( buf, MSL, "&wYour &W%s&w eyes twinkle with a need for adventure, and contrast with your\r\n"
"&W%s&w skin. Your&W %s %s&w hair is worn &W%s%s&w. You stand at&W %d'%d\"&w and weigh\r\n"
"&W%d &wpounds, with a &W%s&w build. You are ready for anything.\r\n",
strlower( get_eye_color( ch, ch->eyecolor ) ), strlower( get_skin_tone( ch, ch->skintone ) ),
strlower( hair_length[ch->hlength] ), strlower( get_hair_color( ch, ch->hcolor ) ),
ch->hstyle == 9 ? "as " : "", strlower( hair_style[ch->hstyle] ), feet, inches,
ch->weight, strlower( build_name[ch->build] ) );
}
}
return buf;
}
char *strlower( const char *str )
{
static char strlow[MAX_STRING_LENGTH];
int i;
for( i = 0; str[i] != '\0'; i++ )
strlow[i] = LOWER( str[i] );
strlow[i] = '\0';
return strlow;
}
if( ch->race == RACE_LIZARDFOLK )
{
snprintf( buf, MSL, "&wYour &W%s&w eyes stand out ferociously against your", strlower( get_eye_color( ch, ch->eyecolor ) ) );
snprintf( buf, MSL, "&W%s&w scales. You stand\r\n&W%d'%d\"&w tall and weigh &W%d&w pounds,",
strlower( scale_color[ch->scalecolor] ), feet, inches, ch->weight );
snprintf( buf, MSL, "and your &W%s&w build makes you a worthy\r\n&wadversary for any warm-blood that challenges you.\r\n",
strlower( build_name[ch->build] ) );
feet = ch->height / 12;
inches = ch->height % 12;
eyecolor = strlower( get_eye_color( ch, ch->eyecolor ) );
furcolor = strlower( get_fur_color( ch, ch->furcolor ) );
scalecolor = strlower( scale_color[ch->scalecolor] );
(…)
else if( ch->race == RACE_FELINID )
{
snprintf( buf, MSL, "&wYour &W%s&w eyes twinkle mischievously, and your &W%s&w are the envy of the rest\r\n"
"&wof the pride. Your &W%s %s&w hair is worn &W%s%s&w. You stand at &W%d'%d\"&w and weigh\r\n"
"&W%d&w pounds, with a &W%s&w build. You are ready for anything.\r\n",
eyecolor, furcolor, hairlength,haircolor, ch->hstyle == 9 ? "as " : "", hairstyle,
feet, inches, ch->weight, build );
I'm trying to expand character creation and add in an option to customize your appearance. So with that comes the ability to pick your height within the limits assigned to the class. So I've come to the conclusion, that the players should be able to input their height the easiest way for them, currently the code will do the following to spit out the limits so they can read them:
Kiasyn tried to explain this to me on Ichat, but I think a combination of lack of sleep and attempting to understand RegExp caused me to be utterly unable to do anything. I need the following code to be able to read both straight inches and X'X" format. For instance, a player could use 78 or 6'6" to select their height.
Currently in my stupor, I've only managed to pull off:
Granted, this is probably wrong as well, needless to say I probably shouldn't be coding in my current state, but I can't sleep and coding normally calms me down. I will need to be able to convert any x'x" formats to inches as well. And.. Hmm.. This is a SmaugFUSS 1.8 base.. and Um.. I should probably go sleep. Any help is appreciated, Um.. Thanks in advance.. and.. I sound like a total retard right now. So I'm going to shut up now. :)