Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Need help with ship resets for SWR 1.0
|
Need help with ship resets for SWR 1.0
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Jason
(109 posts) Bio
|
| Date
| Thu 05 Feb 2004 06:24 AM (UTC) |
| 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;
}
}
| | Top |
|
| Posted by
| Meerclar
USA (733 posts) Bio
|
| Date
| Reply #1 on Thu 05 Feb 2004 08:43 AM (UTC) |
| 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 | | Top |
|
| Posted by
| Greven
Canada (835 posts) Bio
|
| Date
| Reply #2 on Thu 05 Feb 2004 08:58 AM (UTC) |
| 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 | | 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.
14,485 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top