Alright guys. I know I'm PAINFULLY close here, but I'm just missing something...Here's what I have right now. And for anyone who's been wondering, luck and morale are only showing up for now so I can see if it's working. Anyone's welcome to see the error for themselves. Port 9000 at rom.servegame.org.
in merc.h:
/*
* Connected state for a channel.
*/
#define CON_PLAYING 0
#define CON_GET_NAME 1
#define CON_GET_OLD_PASSWORD 2
#define CON_CONFIRM_NEW_NAME 3
#define CON_GET_NEW_PASSWORD 4
#define CON_CONFIRM_NEW_PASSWORD 5
#define CON_GET_NEW_RACE 6
#define CON_GET_NEW_SEX 7
#define CON_GET_NEW_CLASS 8
#define CON_GET_ALIGNMENT 9
#define CON_CHOOSE_TERM 11
#define CON_DEFAULT_CHOICE 12
#define CON_GEN_GROUPS 13
#define CON_PICK_WEAPON 14
#define CON_READ_IMOTD 15
#define CON_READ_MOTD 16
#define CON_BREAK_CONNECT 17
#define CON_COPYOVER_RECOVER 18
/*Dave Added for Char Generation*/
#define CON_ROLLING_STATS 19
in comm.c:
ch->pcdata->points = pc_race_table[race].points;
ch->size = pc_race_table[race].size;
write_to_buffer(d,"Now rolling for stats...\n\n",0);
d->connected = CON_ROLLING_STATS;
break;
case CON_ROLLING_STATS:
/* initialize stats */
for (i = 0; i < MAX_STATS; i++)
{
ch->perm_stat[i] = rollstats(pc_race_table[ch->race].stats[i],pc_race_table[ch->race].max_stats[i]);
}
sprintf(buf,"Str: %d Int: %d Wis: %d Dex: %d Con: %d Cha: %d Lck: %d Morale: %d",
ch->perm_stat[0],ch->perm_stat[1],ch->perm_stat[2],ch->perm_stat[3],ch->perm_stat[4],
ch->perm_stat[5],ch->perm_stat[6],ch->perm_stat[7]);
send_to_char(buf, ch);
write_to_buffer(d,"Accept these stats? (Y/N)\n",0);
switch ( argument[0] )
{
case 'y': case 'Y':
d->connected = CON_GET_NEW_SEX;
break;
case 'n': case 'N':
for (i = 0; i < MAX_STATS; i++)
{
ch->perm_stat[i] = rollstats(pc_race_table[ch->race].stats[i],pc_race_table[ch->race].max_stats[i]);
}
sprintf(buf,"Str: %d Int: %d Wis: %d Dex: %d Con: %d Cha: %d Lck: %d Morale: %d",
ch->perm_stat[0],ch->perm_stat[1],ch->perm_stat[2],ch->perm_stat[3],ch->perm_stat[4],
ch->perm_stat[5],ch->perm_stat[6],ch->perm_stat[7]);
send_to_char(buf, ch);
write_to_buffer(d,"Accept these stats? (Y/N)\n",0);
break;
default:
write_to_buffer(d,"Accept these stats? (Y/N)\n",0);
break;
}
case CON_GET_NEW_SEX:
write_to_buffer(d,"What is your sex (M/F)? ", 0 );
switch ( argument[0] )
{
case 'm': case 'M': ch->sex = SEX_MALE;
ch->pcdata->true_sex = SEX_MALE;
break;
case 'f': case 'F': ch->sex = SEX_FEMALE;
ch->pcdata->true_sex = SEX_FEMALE;
break;
default:
write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 );
return;
}
strcpy( buf, "Select a class [" );
for ( iClass = 0; iClass < MAX_CLASS; iClass++ )
{
if ( iClass > 0 )
strcat( buf, " " );
strcat( buf, class_table[iClass].name );
}
strcat( buf, "]: " );
write_to_buffer( d, buf, 0 );
d->connected = CON_GET_NEW_CLASS;
break;
and further down:
const int rollstats (const int min, const int max)
{
int num = (max - min);
num = (((double) rand () / ((double) (RAND_MAX) + 1.0) * (double) num) + min);
return num;
}
the prototype is simply:
const int rollstats (const int min, const int max);
So here's what's happening...
By what name do you wish to be known? test
Did I get that right, Test (Y/N)? y
New character.
Give me a password for Test:
Please retype password:
The following races are available:
human elf dwarf halfling
What is your race (help for more information)? elf
Now rolling for stats...
Accept these stats? (Y/N)
What is your sex (M/F)? That's not a sex.
it shows up blank, and if i hit enter it then says 'accept these stat's and goes on, instantly saying 'That's not a sex'. If I hit 'N' right after typing elf, it shows a unique (but correct) roll, then goes straight to this same point...not allowing me to reroll more than once. Any ideas what the heck is going on here? |