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

mount.c

Go to the documentation of this file.
00001 /* Mount.c Written by Tribul of Beyond the Shadows */
00002 
00003 #if defined(macintosh)
00004 #include <types.h>
00005 #else
00006 #include <sys/types.h>
00007 #endif
00008 #include <stdio.h>
00009 #include <string.h>
00010 #include <time.h>
00011 #include "merc.h"
00012 #include "interp.h"
00013 #include "tables.h"
00014 #include "lookup.h"
00015 #include "mount.h"
00016 void do_dismount (CHAR_DATA *ch, char *argument);
00017 int IS_RIDING (CHAR_DATA *ch);
00018 void do_mount (CHAR_DATA *ch, char *argument)
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 }
00069 
00070 void do_dismount (CHAR_DATA *ch, char *argument)
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 }
00094 
00095 int IS_RIDING(CHAR_DATA *ch)
00096 {
00097     if (ch->riding == NULL)
00098         return FALSE;
00099     else
00100         return TRUE;
00101 }
00102 
00103     
00104 
00105 
00106     
00107 
00108 
00109 
00110     
00111 
00112 
00113 

Generated on Thu Jan 13 21:48:12 2005 for Beyond the Shadows by  doxygen 1.4.0