Call command for public ships on SWR

Posted by Jason on Tue 26 Jun 2012 10:21 PM — 2 posts, 12,931 views.

#0
Ok, here's what I got. I'm trying to make a call command to call a public ship to a landing pad.. right now i am in testing phases and i know this code is incomplete as far as checking room flags...

Here is the code.

void do_call( CHAR_DATA *ch, char * argument)
{
    SHIP_DATA *ship;

    for ( ship = first_ship; ship; ship = ship->next )
    {
	if ( !str_cmp( ship->owner , "Public" ) && !IS_SET(ship->flags, SHIP_SIMULATOR ) )
	{
	    if (ship->class > CAPITAL_SHIP)
		continue;
	    if (ship->type == MOB_SHIP)
		continue;
	    transship(ship, ch->in_room->vnum);
	}
    }
}


Now what it is doing is calling all the public ships into the room, I want it to call a random public ship to the room, or call them in order each time the command is issued. I'm not sure if there is a function that will pull one from the list alone. any help will be apprieciated.
USA #1
Either change your for loop check from just 'ship' to something more appropriate, or break from the loop once you a acquire an unused ship.