I'm in the process of converting the skills system to use floating point adepts, eg. Your min and max adepts would range from 0.0 to 100.0, gains would be from 0.1 to 9.9; and for the most part I've got it done. It saves the new format to player and class files just fine, but I am having a lot of trouble getting it to load properly. The standard loading procedure I have is this:
if ( !strcmp( word, "Spell" ) )
if ( preload )
word = "End";
value = fread_number( fp );
sn = bsearch_skill_exact( fread_word( fp ), gsn_first_spell, gsn_first_skill-1 );
if ( sn < 0 )
bug( "Fread_char: unknown spell.", 0 );
ch->pcdata->learned[sn] = value;
if ( ch->level < LEVEL_IMMORTAL )
if ( DUAL_SKILL(ch,sn) >= LEVEL_IMMORTAL )
ch->pcdata->learned[sn] = 0;
fMatch = TRUE;
In order to have a floating point number load properly, I'd have to use something different to read the data in, which is my problem. Near as I can figure, I'd have to change the value variable to a float, and create some kind of function to read in a floating point number, since I don't think fread_number would do the trick right?
Any ideas on how I should go about getting them to load would be greatly appreciated.