Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Sogou, Yandex, DotBot, Yahoo!, Bing

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Floating points
Forum Rules | Mark all | Recent Posts

Floating points
< Newer Topic :: Older Topic > Floating point skill adept system

Pages:<< prev 1 next >>
Post is unread #1 Feb 5, 2004, 6:24 am
Go to the top of the page
Go to the bottom of the page

angelus433
New Member
GroupMembers
Posts2
JoinedJan 10, 2004

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" ) )
{
   int sn;
   int value;

   if ( preload )
     word = "End";
   else
   {
     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 );
     else
     {
       ch->pcdata->learned[sn] = value;
       if ( ch->level < LEVEL_IMMORTAL )
         if ( DUAL_SKILL(ch,sn) >= LEVEL_IMMORTAL )
         {
           ch->pcdata->learned[sn] = 0;
           ch->practice++;
         }
     }
     fMatch = TRUE;
     break;
   }
}

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.
       
Post is unread #2 Feb 5, 2004, 9:59 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

You could cheat and take a copy of fread_number and change it to load floats, then name it something like fread_float, and have it return a float value. That's the easy way out :)
       
Pages:<< prev 1 next >>