..hey guys well I'm getting pretty ok at coding..but I'm clueless on porting other code to smaug.
I found a useful snip, would anyone know how to port this over to smaug 1.4a?
* To install, simply add a ROOM_VEHICLE room flag, a field to room_index *
* data called "in_room", and the interpreter declarations for do_drive. *
* Then, for maximum effect, add the following lines of code into the *
* do_look command after showing the rooms description: *
* *
* if ( ch->in_room->in_room != NULL ) *
* { *
* send_to_char("{WThrough the windows, you see:{x\n\r",ch); *
* *
* sprintf( buf, "{y%s{x\n\r{w%s{x", *
* ch->in_room->in_room->name, *
* ch->in_room->in_room->description ); *
* send_to_char( buf, ch ); *
* } *
* *
* Place this file in your /src directory as vehicle.c and add the proper *
* lines to your Makefile to compile this with the other source files. *
* *
***************************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "merc.h"
void do_drive( CHAR_DATA *ch, char *argument )
{
EXIT_DATA *pexit;
ROOM_INDEX_DATA *orig;
ROOM_INDEX_DATA *vroom;
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
int door = 0;
argument = one_argument( argument, arg );
if ( !IS_SET( ch->in_room->room_flags, ROOM_VEHICLE ) )
{
send_to_char("You are not in a vehicle!\n\r",ch);
return;
}
if ( ch->in_room->in_room == NULL )
{
send_to_char("You are not in the controlling area!\n\r",ch);
return;
}
if ( !str_cmp( arg, "n" ) || !str_cmp( arg, "north" ) ) door = 0;
else if ( !str_cmp( arg, "e" ) || !str_cmp( arg, "east" ) ) door = 1;
else if ( !str_cmp( arg, "s" ) || !str_cmp( arg, "south" ) ) door = 2;
else if ( !str_cmp( arg, "w" ) || !str_cmp( arg, "west" ) ) door = 3;
else if ( !str_cmp( arg, "u" ) || !str_cmp( arg, "up" ) ) door = 4;
else if ( !str_cmp( arg, "d" ) || !str_cmp( arg, "down" ) ) door = 5;
if ( arg[0] == '\0' )
{
send_to_char("Usage: drive <direction>\n\r",ch);
return;
}
vroom = ch->in_room->in_room;
if ( ( pexit = vroom->exit[door] ) == NULL )
{
send_to_char("You can't drive THAT way!\n\r",ch);
return;
}
sprintf( buf, "#WYou drive %s %s.#x\n\r",
ch->in_room->name,
dir_name[door]);
send_to_char(buf,ch);
ch->in_room->in_room = pexit->to_room;
orig = ch->in_room;
char_from_room(ch);
char_to_room(ch, vroom);
do_function(ch, &do_look, "");
char_from_room(ch);
char_to_room(ch, orig);
return;
} |