Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Today, 9:00 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, Yandex, DotBot

Members: 0
Guests: 23
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,237
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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 5, 2005, 11:40 pm
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 >>