Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

mount.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "tables.h"
#include "lookup.h"
#include "mount.h"

Include dependency graph for mount.c:

Go to the source code of this file.

Functions

void do_dismount (CHAR_DATA *ch, char *argument)
void do_mount (CHAR_DATA *ch, char *argument)
int IS_RIDING (CHAR_DATA *ch)


Function Documentation

void do_dismount CHAR_DATA ch,
char *  argument
 

Definition at line 70 of file mount.c.

References act, char_data::is_riding, POS_STANDING, char_data::position, char_data::riding, send_to_char(), TO_CHAR, and TO_ROOM.

00071 {
00072 //char buf[MSL];
00073 
00074     if (ch->riding == NULL)
00075     {
00076         send_to_char("You are not currently riding anyone!\n\r",ch);
00077         return;
00078     }
00079     if (ch->is_riding != NULL)
00080     {
00081         send_to_char("You cannot dismount someone who is riding you! Try bucking them off!\n\r",ch);
00082         return;
00083     }
00084 
00085     act ("$n dismounts from $N.", ch, 0, ch->riding, TO_ROOM);
00086     act ("You dismount from $N", ch, 0, ch->riding, TO_CHAR);
00087     act ("$N dismounts from you.", ch->riding, 0, ch, TO_CHAR);
00088 
00089     ch->riding->is_riding = NULL;
00090     ch->riding = NULL;
00091     ch->position = POS_STANDING;
00092     return;
00093 }

Here is the call graph for this function:

void do_mount CHAR_DATA ch,
char *  argument
 

Definition at line 18 of file mount.c.

References act, char_data::act, ACT_IS_MOUNT, get_char_world(), char_data::in_room, IS_IMMORTAL, IS_NPC, char_data::is_riding, IS_SET, MAX_STRING_LENGTH, char_data::name, POS_RIDING, char_data::position, char_data::riding, send_to_char(), char_data::short_descr, TO_CHAR, and TO_ROOM.

00019 {
00020     CHAR_DATA *victim;
00021     char buf[MAX_STRING_LENGTH];
00022 
00023     if (argument[0] == '\0')
00024     {
00025         send_to_char("Ride who?\n\r",ch);
00026         return;
00027     }
00028 
00029     if ((victim = get_char_world(ch,argument)) == NULL)
00030     {
00031         send_to_char("Ride who?\n\r",ch);
00032         return;
00033     }
00034     if (victim->in_room != ch->in_room)
00035     {
00036         send_to_char("Ride who?\n\r",ch);
00037         return;
00038     }
00039 
00040     if (victim->is_riding != NULL)
00041     {
00042         sprintf(buf, "%s already has a rider.\n\r", IS_NPC(victim) ? victim->short_descr :
00043                 victim->name);
00044         send_to_char(buf,ch);
00045         return;
00046     }
00047 
00048     if (ch->riding != NULL)
00049     {
00050         send_to_char("You are already riding something.\n\r",ch);
00051         return;
00052     }
00053 
00054     if ((!IS_IMMORTAL(ch)) && (!IS_SET(victim->act, ACT_IS_MOUNT) || !IS_NPC(victim)))
00055     {
00056         send_to_char("That wouldn't be a good idea..\n\r",ch);
00057         return;
00058     }
00059 
00060     victim->is_riding = ch;
00061     ch->riding = victim;
00062 
00063     act ("$n mounts the back of $N.", ch, 0, victim, TO_ROOM);
00064     act ("You mount $N.", ch, 0, victim, TO_CHAR);
00065     act ("$N mounts you.", victim, 0, ch, TO_CHAR);
00066     ch->position = POS_RIDING;
00067     return;
00068 }

Here is the call graph for this function:

int IS_RIDING CHAR_DATA ch  ) 
 

Definition at line 95 of file mount.c.

References FALSE, and TRUE.

Referenced by do_score2(), move_char(), and show_char_to_char_0().

00096 {
00097     if (ch->riding == NULL)
00098         return FALSE;
00099     else
00100         return TRUE;
00101 }


Generated on Thu Jan 13 22:11:32 2005 for Beyond the Shadows by  doxygen 1.4.0