Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
AFKMud 2.2.2
Mar 3, 2019 5:35 pm
By Samson
Development
Nov 28, 2018 12:10 pm
By Keirath
First Immortal
Oct 12, 2018 2:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018 7:31 pm
By joeyfogas
question on overland code
May 31, 2018 12:03 pm
By joeyfogas
SmaugFUSS 1.9.3
Author: Various
Submitted by: Samson
AFKMud 2.2.2
Author: AFKMud Team
Submitted by: Samson
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
Users Online
CommonCrawl, Bing

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
483
3,743
19,401
655
RodrickMci
Today's Birthdays
tphegley (37)
Related Links
» SmaugMuds » Codebases » SWR FUSS » fread_planet
Forum Rules | Mark all | Recent Posts

fread_planet
< Newer Topic :: Older Topic > error on boot

Pages:<< prev 1 next >>
Post is unread #1 Mar 6, 2005 1:40 am
Go to the top of the page
Go to the bottom of the page

Greven
Magician
GroupMembers
Posts204
JoinedMar 5, 2005

The planet_data uses uses a float variable the planets population support, however in stock SWR there is no proper fread_float. So, to fix this minor error, we need to add this functions, care of Samson, to db.c
/* * Read a number from a file. */float fread_float(FILE * fp){        float     number;        char      buf[32];        bool      sign;        char      c;        int       count = 0;        do        {                if (feof(fp))                {                        bug("fread_number: EOF encountered on read.
";);                        if (fBootDb)                                exit(1);                        return 0.0f;                }                c = getc(fp);        }        while (isspace(c));        number = 0;        sign = FALSE;        if (c == '+')                c = getc(fp);        else if (c == '-')        {                sign = TRUE;                c = getc(fp);        }        if (!isdigit(c))        {                bug("Fread_number: bad format. (%c)", c);                if (fBootDb)                        abort();                return 0.0f;        }        if (isdigit(c))        {                buf[count] = c;                count++;        }        while (isdigit(c) || c == '.')        {                if (count >= 31)                        break;                if (feof(fp))                {                        bug("fread_number: EOF encountered on read.
";);                        if (fBootDb)                                exit(1);                        return number;                }                c = getc(fp);                if (c != ' ')                        buf[count] = c;                count++;        }        buf[count] = '';        number = atof(buf);        if (sign)                number = 0 - number;        if (c != ' ')                ungetc(c, fp);        return number;}
Then in mud.h added the declaration for the function
float fread_float args( (FILE * fp) );
Then in clans.c change
         case 'P':            KEY( "PopSupport", planet->pop_support, fread_number( fp ) );            break;
to such
         case 'P':            KEY( "PopSupport", planet->pop_support, fread_float( fp ) );            break;
Very minor, but annoying all the still.
       
Pages:<< prev 1 next >>