Online Created Shuttles Snippet

Written by Gavin Mogan ( Gavin ) and Mark Gottselig ( Greven )

Requirements to use this snippet
--------------------------------
First off, we are not responsible for any problems you incur by using any of this code. Please leave any comments left in this code. For further restrictions, please consult the Diku license included with your mud. This code was tested on a stock SWR 1.0 mud. If you have made any modifications to your code, it may conflict with this snippet. For support of this snippet, please use the forum available at www.dementiasystems.com/forum. You can try to reach Greven at darkwarsmud@hotmail.com, but no guarantees.

Overview of Snippet
-------------------
This snippet is intended to replace the stock shuttles of SWR, and allow you to create and edit new ones online. Included in this package are the replacements fore the stock Serin Pluogus, Serin Tocca, Coruscant Shipyard shuttle, and Coruscant Turbocar. You can use the showshuttle command with no argument to show a list of your current OLC shuttles, or with a keyword from a shuttle to show details on that specific shuttle. Makeshuttle is used to initialize a new shuttle, and setshuttle allows you to set various aspects of the shuttle.

There are three types of shuttle: hyperspace(Pluogus), Space(Shipyard), and Turbocar(heh, kinda self explanitory).

Instructions
------------

First, extract all the files in the archive. Place the /shuttle directory in your base directory, along with /area, /src/ system, etc. If you don't want any of the pre-made shuttle files, simply delete them and edit shuttles.lst to remove the appropriate entries. However, the shuttles.lst file must be in the directory, even if its empty.

Next, add the shuttle.c and shuttle.h files to your /src directory.

Edit your makefile, and add shuttle.c to your C_FILES, and shuttle.o to your O_FILES.

mud.h
-----
Search for 

#define LEVEL_AVATAR		   (MAX_LEVEL - 5)

And below that, add:

#include "shuttle.h"

Find:
#define ROOM_SHUTTLE_BUS           32140  /*PLUOGUS*/
#define ROOM_SHUTTLE_BUS_2         32410  /*TOCCA*/

#define ROOM_CORUSCANT_SHUTTLE     199
#define ROOM_SENATE_SHUTTLE      10197
#define ROOM_CORUSCANT_TURBOCAR    226  

And remove these lines

In room_index_data, add the following fields:

    SHUTTLE_DATA *	first_shuttle;
    SHUTTLE_DATA *	last_shuttle;

act_info.c
----------
Search in do_look for

show_ships_to_char( ch->in_room->first_ship, ch );

Below, add
		
show_shuttles_to_char( ch, ch->in_room->first_shuttle );

db.c
----
In boot_db, search for:

        log_string( "Loading governments" );
        load_planets( );

Below that, add:

        log_string ( "Loading shuttles" );
        load_shuttles( );


space.c
-------
Search for:

int bus_pos =0;
int bus_planet =0;
int bus2_planet = 4;
int turbocar_stop =0;
int corus_shuttle =0;
 
#define MAX_STATION    10
#define MAX_BUS_STOP 2

#define STOP_PLANET     202
#define STOP_SHIPYARD   32015

int     const   station_vnum [MAX_STATION] =
{
    215 , 216 , 217 , 218 , 219 , 220 , 221 ,222 , 223 , 224
};

char *  const   station_name [MAX_STATION] =
{
   "Menari Spaceport" , "Skydome Botanical Gardens" , "Grand Towers" , 
   "Grandis Mon Theater" , "Palace Station" , "Great Galactic Museum" , 
   "College Station" , "Holographic Zoo of Extinct Animals" , 
   "Dometown Station " , "Monument Plaza"  
};

int     const   bus_vnum [MAX_BUS_STOP] =
{
    201 ,  32297
};

char *  const   bus_stop [MAX_BUS_STOP+1] =
{
   "Coruscant", 
   "Cloning Facilities", "Coruscant"  /* last should always be same as first */  
};


Delete these functions, you don't need them.

Also search and find the follow functions and their prototype, and remove them as well
(The commands have be moved to shuttle.c):
bool  land_bus( SHIP_DATA *ship, int destination )
void    launch_bus( SHIP_DATA *ship )
void update_traffic( )
void update_bus( )
void do_pluogus( CHAR_DATA *ch, char *argument )
void do_board( CHAR_DATA *ch, char *argument )
void do_leaveship( CHAR_DATA *ch, char *argument )

Remove the following from load_ship_file:

       else if ( ship->cockpit == ROOM_SHUTTLE_BUS || 
                 ship->cockpit == ROOM_SHUTTLE_BUS_2 || 
                 ship->cockpit == ROOM_SENATE_SHUTTLE || 
                 ship->cockpit == ROOM_CORUSCANT_TURBOCAR ||
                 ship->cockpit == ROOM_CORUSCANT_SHUTTLE   )
       {}

udpate.c
--------

Find:

pulse_space    = PULSE_SPACE;

Below, replace:

       update_bus ( );
       update_traffic ( );

with

       update_shuttle( );

tables.c
--------
In case 'm', add:

	if ( !str_cmp( name, "do_makeshuttle" ))		return do_makeshuttle;

In case 's', add:

	if ( !str_cmp( name, "do_showshuttle" ))		return do_showshuttle;
	if ( !str_cmp( name, "do_setshuttle"  ))		return do_setshuttle;

Farther down, search for:

    if ( skill == do_makestarsystem )   return "do_makestarsystem";

Add below that add:

    if ( skill == do_makeshuttle )   return "do_makeshuttle";

Find:

    if ( skill == do_setstarsystem )    return "do_setstarsystem";

And bellow add:

    if ( skill == do_setshuttle )       return "do_setshuttle";
    if ( skill == do_showshuttle )      return "do_showshuttle";

If you are using copyover, you may want to include this:

copyover.c
--------------------

Find the following line:

   sprintf(buf, "\n\rCopy initiated by %s. Please Wait.\n\r", ch->name);

below that, add the following:

{
		SHUTTLE_DATA * tshuttle;
		for ( tshuttle = first_shuttle; tshuttle; tshuttle = tshuttle->next )
			save_shuttle(tshuttle);
}


That should be all you need to do. Make clean, make, and then reboot/copyover. 
From within your mud, create the commands:
cedit setshuttle create
cedit makeshuttle create
cedit showshuttle create

If there are any problems/bugs, report them to darkwarsmud@hotmail.com