Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 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, Yahoo!, Google

Members: 0
Guests: 9
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 » SWR FUSS » No planet reference in area f...
Forum Rules | Mark all | Recent Posts

No planet reference in area file -> possible fix
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Apr 15, 2008, 7:00 am
Go to the top of the page
Go to the bottom of the page

addis
Fledgling
GroupMembers
Posts6
JoinedApr 4, 2008

Hi everyone :)
I've been having a play with the SWR FUSS codebase and noticed that the area data doesnt include the planet that the area is on, this isnt immediately a problem for the stock base but frustrates attempts at using a for loop to go through all the areas on a planet etc. In aset the planet setting works fine and links up, so shouldnt load_area_file and fold_area include this data?

Heres the fix that I put together:

In db.c load_area_file

Under
     
         else if( !str_cmp( word, "SPECIALS" ) )
         load_specials( tarea, fpArea );


add
         else if( !str_cmp( word, "PLANET" ) )
         load_aplanet( tarea, fpArea );

in db.c add under 'local booting procedures'
void load_aplanet args( ( AREA_DATA * tarea, FILE * fp ) );

in db.c add the function
void load_aplanet( AREA_DATA * tarea, FILE * fp )
{ 
      PLANET_DATA *planet;
   if( !tarea )
   {
      bug( "Load_author: no #AREA seen yet." );
      if( fBootDb )
      {
         shutdown_mud( "No #AREA" );
         exit( 1 );
      }
      else
         return;
   }


      planet = get_planet( fread_string( fp ) );
      if( planet )
      {
         if( tarea->planet )
         {
            PLANET_DATA *old_planet;

            old_planet = tarea->planet;
            UNLINK( tarea, old_planet->first_area, old_planet->last_area, next_on_planet, prev_on_planet );
         }
         tarea->planet = planet;
         LINK( tarea, planet->first_area, planet->last_area, next_on_planet, prev_on_planet );
         save_planet( planet );
      }
}


In build.c fold_area

under
   fprintf( fpout, "#ECONOMY %d %d\n\n", tarea->high_economy, tarea->low_economy ); 

add
 
  if(tarea->planet && tarea->planet->name)      
	fprintf( fpout, "#PLANET %s~\n\n", tarea->planet->name );
[/code]

This seems to work for me, hope its useful for someone, if anybody can spot errors or anything id be glad for the help :) still getting used to this stuff.
       
Post is unread #2 Apr 15, 2008, 4:07 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Looks like you've got a good fix there. I'm surprised nobody ever noticed this not working before. You'd think that the planet assignment not sticking would be a big problem :P
       
Post is unread #3 Apr 23, 2008, 6:20 am
Go to the top of the page
Go to the bottom of the page

Caius
Magician
GroupMembers
Posts132
JoinedJan 29, 2006

addis said:

[...]this isnt immediately a problem for the stock base but frustrates attempts at using a for loop to go through all the areas on a planet etc.[...]


How exactly is this a problem? Excerpt from do_planets():

if( IS_IMMORTAL( ch ) )
{
    ch_printf( ch, "&WAreas: &G" );
    for( area = planet->first_area; area; area = area->next_on_planet )
        ch_printf( ch, "%s,  ", area->filename );
    ch_printf( ch, "\r\n" );
}


Isn't this exactly what you're trying to accomplish here?
       
Post is unread #4 Apr 23, 2008, 1:56 pm
Go to the top of the page
Go to the bottom of the page

addis
Fledgling
GroupMembers
Posts6
JoinedApr 4, 2008

Yeah, that works fine, but a few functions in the code seemed to find the planet an area was on a bit inefficiently (or at very least, not very neatly :) )considering there should be an area->planet pointer. I think starsystem_from_vnum in space.c was the prime culprit here, I was modifying it to be a bit more generally useful.

Just seemed a little silly having the planet section in there and being unused when it could make the code a bit neater in some cases :).
       
Pages:<< prev 1 next >>