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;
}
}
|