Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Development
Nov 28, 2018, 10:10 am
By Keirath
First Immortal
Oct 12, 2018, 12:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018, 5:31 pm
By joeyfogas
question on overland code
May 31, 2018, 10:03 am
By joeyfogas
KaVir's Protocol Snip
May 15, 2018, 7:57 pm
By joeyfogas
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Bing

Members: 0
Guests: 21
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,397
638
IgnacioBol
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,644
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 >>