[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Need help with ship resets for SWR 1.0

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Need help with ship resets for SWR 1.0

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Jason   (102 posts)  [Biography] bio
Date Thu 05 Feb 2004 06:24 AM (UTC)  quote  ]
Message
Hello again,

I'm needing some help with some ship reset on my swr 1.0. Everytime they reset all my speeders end up in the middle of space the following code is the void resetships and the void do_resetships. Oh and when i reset the ship manually it goes back to where it is supposed to:

void resetship( SHIP_DATA *ship )
{
     ship->shipstate = SHIP_READY;
     ship->docking = SHIP_READY;
     ship->docked = NULL;     
     if ( ship->class <= SHIP_PLATFORM && ship->type != MOB_SHIP )
     {
           extract_ship( ship );
           ship_to_room( ship , ship->shipyard ); 
     
           ship->location = ship->shipyard;
           ship->lastdoc = ship->shipyard; 
           ship->shipstate = SHIP_LANDED;
     }

     if (ship->class == LAND_SPEEDER)
     {
	extract_ship(ship);
	ship_to_room( ship , ship->lastdoc );
	ship->location = ship->lasdoc;
     }
     if (ship->starsystem)
        ship_from_starsystem( ship, ship->starsystem );  
  
     ship->currspeed=0;
     ship->energy=ship->maxenergy;
     ship->chaff=ship->maxchaff;
     ship->hull=ship->maxhull;
     ship->shield=0;
     
     ship->statet1 = LASER_READY; 
     ship->statet2 = LASER_READY; 
     ship->statet0 = LASER_READY; 
     ship->missilestate = LASER_READY;
       
     ship->currjump=NULL;
     ship->target0=NULL;
     ship->target1=NULL;
     ship->target2=NULL;
     
     ship->hatchopen = FALSE;
	if (ship->class == SHIP_PLATFORM)
	  ship->bayopen = TRUE;
	else
     ship->bayopen = FALSE;
     
     ship->missiles = ship->maxmissiles;
     ship->torpedos = ship->maxtorpedos;
     ship->rockets = ship->maxrockets;
     ship->autorecharge = FALSE;
     ship->autotrack = FALSE;
     ship->autospeed = FALSE;
     
     if ( str_cmp("Public",ship->owner) && ship->type != MOB_SHIP )
     {
        CLAN_DATA *clan;
        
        if ( ship->type != MOB_SHIP && (clan = get_clan( ship->owner )) != NULL )
	{
          if ( ship->class <= SHIP_PLATFORM )
             clan->spacecraft--;
          else
             clan->vehicles--;
	}
        
        STRFREE( ship->owner );
        ship->owner = STRALLOC( "" );
        STRFREE( ship->pilot );
        ship->pilot = STRALLOC( "" );
        STRFREE( ship->copilot );
        ship->copilot = STRALLOC( "" );
     }
     
     if ( ship->type == SHIP_REPUBLIC || ( ship->type == MOB_SHIP && !str_cmp(ship->owner, "The Galactic Republic") ) )
     {
         STRFREE( ship->home );
         ship->home = STRALLOC( "coruscant" );
     }
     else if ( ship->type == SHIP_IMPERIAL || ( ship->type == MOB_SHIP && !str_cmp(ship->owner, "The Army of Palpatine") ))

     {
          STRFREE( ship->home );
          ship->home = STRALLOC( "byss" );
     }
     else if ( ship->type == SHIP_CIVILIAN)
     {
          STRFREE( ship->home );
          ship->home = STRALLOC( "corperate" );
     }
     
     save_ship(ship);               
}
void do_resetship( CHAR_DATA *ch, char *argument )
{    
     SHIP_DATA *ship;
     
     ship = get_ship( argument );
     if (ship == NULL)
     {
        send_to_char("&RNo such ship!",ch);
        return;
     } 
     
     resetship( ship ); 
     
     if ( ( ship->class == SHIP_PLATFORM || ship->type == MOB_SHIP || ship->class == CAPITAL_SHIP ) 
          && ship->home )
     {
          ship_to_starsystem(ship, starsystem_from_name(ship->home) );  
          ship->vx = number_range( -5000 , 5000 );
          ship->vy = number_range( -5000 , 5000 );
          ship->vz = number_range( -5000 , 5000 );
          ship->shipstate = SHIP_READY;
          ship->autopilot = TRUE;
          ship->autorecharge = TRUE;
          ship->shield = ship->maxshield;
     }
         
}

[Go to top] top

Posted by Meerclar   USA  (554 posts)  [Biography] bio
Date Reply #1 on Thu 05 Feb 2004 08:43 AM (UTC)  quote  ]
Message
Unless I missed it(entirely possible at 230), you havent actually initialized ship->lastdoc to anything for your speeders. My suspicion is they are going to vnum 0(or is it 1 minimum?) since that would be the logical default value for a room vnum. Granted, I dont work with the SWR codebase but unless its stored as a permanemt value in the ship_data construct, ship->lastdoc is your most likely culprit. Might be a good time to read up on Nick's gdb guide and put in a breakpoint to see whats really going on with that reset function.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
[Go to top] top

Posted by Greven   Canada  (835 posts)  [Biography] bio
Date Reply #2 on Thu 05 Feb 2004 08:58 AM (UTC)  quote  ]
Message
Also, double check that it is set as a speeder for sure, because if not, then it may be sent out to space. I tried to reste a speeder manually, and it didn't go into space, so its likely a setting with the ship it self, or with a code change. Have you done anything to it recently?

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,826 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]