Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
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

Members: 0
Guests: 11
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Planes not loading
Forum Rules | Mark all | Recent Posts

Planes not loading
< Newer Topic :: Older Topic > read_plane

Pages:<< prev 1 next >>
Post is unread #1 May 24, 2010, 8:59 am   Last edited May 24, 2010, 9:07 am by Xucan
Go to the top of the page
Go to the bottom of the page

Xucan
Fledgling
GroupMembers
Posts5
JoinedMay 6, 2010

I'm setting up a very basic system that will be taking advantage of the plane code included in 1.9. At this point, all I want to do is create planes with only a name and set rooms to be of a certain plane. I've got the code from the planes.h file copied over and the online commands are working and the Prime Material plane gets created. I can create and save a plane and I've added the code to add a plane to a room. Unfortunately, the planes don't seem to load.

According to the log there's an end of file bug. It's occurring at this line in the read_plane function:
KEY( "Name", p->name, fread_string( fp ) );


Here's the entire function:
void read_plane( FILE * fp )
{
   PLANE_DATA *p;
   const char *word;
   bool fMatch;

   CREATE( p, PLANE_DATA, 1 );
   for( ;; )
   {
      word = ( feof( fp ) ? "End" : fread_word( fp ) );
      fMatch = FALSE;
      switch ( UPPER( *word ) )
      {
         case 'E':
            if( !str_cmp( word, "End" ) )
            {
               if( plane_lookup( p->name ) )
               {
                  bug( "read_plane: duplicate plane name!" );
                  STRFREE( p->name );
                  DISPOSE( p );
               }
               else
                  LINK( p, first_plane, last_plane, next, prev );
               return;
            }
            break;
         case 'N':
            KEY( "Name", p->name, fread_string( fp ) );
            break;
      }
      if( !fMatch )
      {
         bug( "read_plane: unknown field '%s'", word );
         fread_to_eol( fp );
      }
   }
   return;
}


I'm not terribly experienced with managing the reading and writing of data so I'm at a bit of a loss here.
Thanks for any help you can give.

As a side note, this is my first post primarily because I've been able to find a lot of useful information already on the forums. So thanks for all that help too :)
       
Post is unread #2 May 24, 2010, 9:12 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

What does the file you're reading look like? It's possible that the code is trying to read a format that the file's not in.
       
Post is unread #3 May 24, 2010, 9:14 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

fread_string requires that the line end in a ~. So it should look like:
Name    Prime Material~

If fread_string doesn't find a ~ it just continues to read continually until it reaches the end of a file.
       
Post is unread #4 May 24, 2010, 9:27 am
Go to the top of the page
Go to the bottom of the page

Xucan
Fledgling
GroupMembers
Posts5
JoinedMay 6, 2010


Kayle said:

fread_string requires that the line end in a ~. So it should look like:
Name    Prime Material~

If fread_string doesn't find a ~ it just continues to read continually until it reaches the end of a file.


Ah, that did it. Should have known it was something staring me in the face :)

Thanks very much for the help!
       
Pages:<< prev 1 next >>