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

act_move.c File Reference

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

Include dependency graph for act_move.c:

Go to the source code of this file.

Functions

bool has_key args ((CHAR_DATA *ch, int key))
int find_door args ((CHAR_DATA *ch, char *arg))
void do_close (CHAR_DATA *ch, char *argument)
void do_down (CHAR_DATA *ch, char *argument)
void do_east (CHAR_DATA *ch, char *argument)
void do_hide (CHAR_DATA *ch, char *argument)
void do_land (CHAR_DATA *ch, char *argument)
void do_lock (CHAR_DATA *ch, char *argument)
void do_north (CHAR_DATA *ch, char *argument)
void do_northeast (CHAR_DATA *ch, char *argument)
void do_northwest (CHAR_DATA *ch, char *argument)
void do_open (CHAR_DATA *ch, char *argument)
void do_pick (CHAR_DATA *ch, char *argument)
void do_recall (CHAR_DATA *ch, char *argument)
void do_rest (CHAR_DATA *ch, char *argument)
void do_sit (CHAR_DATA *ch, char *argument)
void do_sleep (CHAR_DATA *ch, char *argument)
void do_sneak (CHAR_DATA *ch, char *argument)
void do_south (CHAR_DATA *ch, char *argument)
void do_southeast (CHAR_DATA *ch, char *argument)
void do_southwest (CHAR_DATA *ch, char *argument)
void do_stand (CHAR_DATA *ch, char *argument)
void do_train (CHAR_DATA *ch, char *argument)
void do_unlock (CHAR_DATA *ch, char *argument)
void do_up (CHAR_DATA *ch, char *argument)
void do_visible (CHAR_DATA *ch, char *argument)
void do_wake (CHAR_DATA *ch, char *argument)
void do_west (CHAR_DATA *ch, char *argument)
int find_door (CHAR_DATA *ch, char *arg)
bool has_key (CHAR_DATA *ch, int key)
void move_char (CHAR_DATA *ch, int door, bool follow)

Variables

char *const dir_name []
const sh_int movement_loss [SECT_MAX]
const sh_int rev_dir []


Function Documentation

bool has_key args (CHAR_DATA *ch, int key)   ) 
 

int find_door args (CHAR_DATA *ch, char *arg)   ) 
 

void do_close CHAR_DATA ch,
char *  argument
 

Definition at line 564 of file act_move.c.

References act, CONT_CLOSEABLE, CONT_CLOSED, EX_CLOSED, EX_ISDOOR, EX_NOCLOSE, room_index_data::exit, exit_data::exit_info, find_door(), get_obj_here(), IS_SET, ITEM_CONTAINER, ITEM_PORTAL, obj_data::item_type, exit_data::keyword, MAX_INPUT_LENGTH, char_data::next_in_room, one_argument(), room_index_data::people, rev_dir, send_to_char(), SET_BIT, TO_CHAR, exit_data::to_room, TO_ROOM, exit_data::u1, and obj_data::value.

Referenced by spec_mayor().

00565 {
00566     char arg[MAX_INPUT_LENGTH];
00567     OBJ_DATA *obj;
00568     int door;
00569 
00570     one_argument (argument, arg);
00571 
00572     if (arg[0] == '\0')
00573     {
00574         send_to_char ("Close what?\n\r", ch);
00575         return;
00576     }
00577 
00578     if ((obj = get_obj_here (ch, arg)) != NULL)
00579     {
00580         /* portal stuff */
00581         if (obj->item_type == ITEM_PORTAL)
00582         {
00583 
00584             if (!IS_SET (obj->value[1], EX_ISDOOR)
00585                 || IS_SET (obj->value[1], EX_NOCLOSE))
00586             {
00587                 send_to_char ("You can't do that.\n\r", ch);
00588                 return;
00589             }
00590 
00591             if (IS_SET (obj->value[1], EX_CLOSED))
00592             {
00593                 send_to_char ("It's already closed.\n\r", ch);
00594                 return;
00595             }
00596 
00597             SET_BIT (obj->value[1], EX_CLOSED);
00598             act ("You close $p.", ch, obj, NULL, TO_CHAR);
00599             act ("$n closes $p.", ch, obj, NULL, TO_ROOM);
00600             return;
00601         }
00602 
00603         /* 'close object' */
00604         if (obj->item_type != ITEM_CONTAINER)
00605         {
00606             send_to_char ("That's not a container.\n\r", ch);
00607             return;
00608         }
00609         if (IS_SET (obj->value[1], CONT_CLOSED))
00610         {
00611             send_to_char ("It's already closed.\n\r", ch);
00612             return;
00613         }
00614         if (!IS_SET (obj->value[1], CONT_CLOSEABLE))
00615         {
00616             send_to_char ("You can't do that.\n\r", ch);
00617             return;
00618         }
00619 
00620         SET_BIT (obj->value[1], CONT_CLOSED);
00621         act ("You close $p.", ch, obj, NULL, TO_CHAR);
00622         act ("$n closes $p.", ch, obj, NULL, TO_ROOM);
00623         return;
00624     }
00625 
00626     if ((door = find_door (ch, arg)) >= 0)
00627     {
00628         /* 'close door' */
00629         ROOM_INDEX_DATA *to_room;
00630         EXIT_DATA *pexit;
00631         EXIT_DATA *pexit_rev;
00632 
00633         pexit = ch->in_room->exit[door];
00634         if (IS_SET (pexit->exit_info, EX_CLOSED))
00635         {
00636             send_to_char ("It's already closed.\n\r", ch);
00637             return;
00638         }
00639 
00640         SET_BIT (pexit->exit_info, EX_CLOSED);
00641         act ("$n closes the $d.", ch, NULL, pexit->keyword, TO_ROOM);
00642         send_to_char ("Ok.\n\r", ch);
00643 
00644         /* close the other side */
00645         if ((to_room = pexit->u1.to_room) != NULL
00646             && (pexit_rev = to_room->exit[rev_dir[door]]) != 0
00647             && pexit_rev->u1.to_room == ch->in_room)
00648         {
00649             CHAR_DATA *rch;
00650 
00651             SET_BIT (pexit_rev->exit_info, EX_CLOSED);
00652             for (rch = to_room->people; rch != NULL; rch = rch->next_in_room)
00653                 act ("The $d closes.", rch, NULL, pexit_rev->keyword,
00654                      TO_CHAR);
00655         }
00656     }
00657 
00658     return;
00659 }

Here is the call graph for this function:

void do_down CHAR_DATA ch,
char *  argument
 

Definition at line 368 of file act_move.c.

References DIR_DOWN, FALSE, and move_char().

00369 {
00370     move_char (ch, DIR_DOWN, FALSE);
00371     return;
00372 }

Here is the call graph for this function:

void do_east CHAR_DATA ch,
char *  argument
 

Definition at line 336 of file act_move.c.

References DIR_EAST, FALSE, and move_char().

00337 {
00338     move_char (ch, DIR_EAST, FALSE);
00339     return;
00340 }

Here is the call graph for this function:

void do_hide CHAR_DATA ch,
char *  argument
 

Definition at line 1664 of file act_move.c.

References AFF_HIDE, check_improve(), FALSE, get_skill(), gsn_hide, IS_AFFECTED, number_percent(), REMOVE_BIT, send_to_char(), SET_BIT, and TRUE.

01665 {
01666     send_to_char ("You attempt to hide.\n\r", ch);
01667 
01668     if (IS_AFFECTED (ch, AFF_HIDE))
01669         REMOVE_BIT (ch->affected_by, AFF_HIDE);
01670 
01671     if (number_percent () < get_skill (ch, gsn_hide))
01672     {
01673         SET_BIT (ch->affected_by, AFF_HIDE);
01674         check_improve (ch, gsn_hide, TRUE, 3);
01675     }
01676     else
01677         check_improve (ch, gsn_hide, FALSE, 3);
01678 
01679     return;
01680 }

Here is the call graph for this function:

void do_land CHAR_DATA ch,
char *  argument
 

Definition at line 947 of file act_move.c.

References AFF_FLYING, affect_strip(), IS_AFFECTED, POS_FLYING, POS_STANDING, send_to_char(), skill_lookup(), and skill_table.

00948 {
00949     int sn;
00950     if(!IS_AFFECTED(ch, AFF_FLYING) && ch->position != POS_FLYING)
00951     {
00952         send_to_char("...You're not flying.\n\r",ch);
00953         return;
00954     }
00955     sn = skill_lookup("fly");
00956     if (!sn)
00957     {
00958         send_to_char("Ooops...\n\r",ch);
00959         return;
00960     }
00961     ch->position = POS_STANDING;
00962     affect_strip (ch, sn);
00963     send_to_char(skill_table[sn].msg_off, ch);
00964     send_to_char("\n\r",ch);
00965 
00966 
00967 
00968     return;
00969 }

Here is the call graph for this function:

void do_lock CHAR_DATA ch,
char *  argument
 

Definition at line 678 of file act_move.c.

References act, CONT_CLOSED, CONT_LOCKED, EX_CLOSED, EX_ISDOOR, EX_LOCKED, EX_NOCLOSE, EX_NOLOCK, room_index_data::exit, exit_data::exit_info, find_door(), get_obj_here(), has_key(), IS_SET, ITEM_CONTAINER, ITEM_PORTAL, obj_data::item_type, exit_data::key, exit_data::keyword, MAX_INPUT_LENGTH, one_argument(), rev_dir, send_to_char(), SET_BIT, TO_CHAR, exit_data::to_room, TO_ROOM, exit_data::u1, and obj_data::value.

00679 {
00680     char arg[MAX_INPUT_LENGTH];
00681     OBJ_DATA *obj;
00682     int door;
00683 
00684     one_argument (argument, arg);
00685 
00686     if (arg[0] == '\0')
00687     {
00688         send_to_char ("Lock what?\n\r", ch);
00689         return;
00690     }
00691 
00692     if ((obj = get_obj_here (ch, arg)) != NULL)
00693     {
00694         /* portal stuff */
00695         if (obj->item_type == ITEM_PORTAL)
00696         {
00697             if (!IS_SET (obj->value[1], EX_ISDOOR)
00698                 || IS_SET (obj->value[1], EX_NOCLOSE))
00699             {
00700                 send_to_char ("You can't do that.\n\r", ch);
00701                 return;
00702             }
00703             if (!IS_SET (obj->value[1], EX_CLOSED))
00704             {
00705                 send_to_char ("It's not closed.\n\r", ch);
00706                 return;
00707             }
00708 
00709             if (obj->value[4] < 0 || IS_SET (obj->value[1], EX_NOLOCK))
00710             {
00711                 send_to_char ("It can't be locked.\n\r", ch);
00712                 return;
00713             }
00714 
00715             if (!has_key (ch, obj->value[4]))
00716             {
00717                 send_to_char ("You lack the key.\n\r", ch);
00718                 return;
00719             }
00720 
00721             if (IS_SET (obj->value[1], EX_LOCKED))
00722             {
00723                 send_to_char ("It's already locked.\n\r", ch);
00724                 return;
00725             }
00726 
00727             SET_BIT (obj->value[1], EX_LOCKED);
00728             act ("You lock $p.", ch, obj, NULL, TO_CHAR);
00729             act ("$n locks $p.", ch, obj, NULL, TO_ROOM);
00730             return;
00731         }
00732 
00733         /* 'lock object' */
00734         if (obj->item_type != ITEM_CONTAINER)
00735         {
00736             send_to_char ("That's not a container.\n\r", ch);
00737             return;
00738         }
00739         if (!IS_SET (obj->value[1], CONT_CLOSED))
00740         {
00741             send_to_char ("It's not closed.\n\r", ch);
00742             return;
00743         }
00744         if (obj->value[2] < 0)
00745         {
00746             send_to_char ("It can't be locked.\n\r", ch);
00747             return;
00748         }
00749         if (!has_key (ch, obj->value[2]))
00750         {
00751             send_to_char ("You lack the key.\n\r", ch);
00752             return;
00753         }
00754         if (IS_SET (obj->value[1], CONT_LOCKED))
00755         {
00756             send_to_char ("It's already locked.\n\r", ch);
00757             return;
00758         }
00759 
00760         SET_BIT (obj->value[1], CONT_LOCKED);
00761         act ("You lock $p.", ch, obj, NULL, TO_CHAR);
00762         act ("$n locks $p.", ch, obj, NULL, TO_ROOM);
00763         return;
00764     }
00765 
00766     if ((door = find_door (ch, arg)) >= 0)
00767     {
00768         /* 'lock door' */
00769         ROOM_INDEX_DATA *to_room;
00770         EXIT_DATA *pexit;
00771         EXIT_DATA *pexit_rev;
00772 
00773         pexit = ch->in_room->exit[door];
00774         if (!IS_SET (pexit->exit_info, EX_CLOSED))
00775         {
00776             send_to_char ("It's not closed.\n\r", ch);
00777             return;
00778         }
00779         if (pexit->key < 0)
00780         {
00781             send_to_char ("It can't be locked.\n\r", ch);
00782             return;
00783         }
00784         if (!has_key (ch, pexit->key))
00785         {
00786             send_to_char ("You lack the key.\n\r", ch);
00787             return;
00788         }
00789         if (IS_SET (pexit->exit_info, EX_LOCKED))
00790         {
00791             send_to_char ("It's already locked.\n\r", ch);
00792             return;
00793         }
00794 
00795         SET_BIT (pexit->exit_info, EX_LOCKED);
00796         send_to_char ("*Click*\n\r", ch);
00797         act ("$n locks the $d.", ch, NULL, pexit->keyword, TO_ROOM);
00798 
00799         /* lock the other side */
00800         if ((to_room = pexit->u1.to_room) != NULL
00801             && (pexit_rev = to_room->exit[rev_dir[door]]) != 0
00802             && pexit_rev->u1.to_room == ch->in_room)
00803         {
00804             SET_BIT (pexit_rev->exit_info, EX_LOCKED);
00805         }
00806     }
00807 
00808     return;
00809 }

Here is the call graph for this function:

void do_north CHAR_DATA ch,
char *  argument
 

Definition at line 328 of file act_move.c.

References DIR_NORTH, FALSE, and move_char().

00329 {
00330     move_char (ch, DIR_NORTH, FALSE);
00331     return;
00332 }

Here is the call graph for this function:

void do_northeast CHAR_DATA ch,
char *  argument
 

Definition at line 374 of file act_move.c.

References DIR_NORTHEAST, FALSE, and move_char().

00375 {
00376     move_char (ch, DIR_NORTHEAST, FALSE);
00377 return;
00378 }

Here is the call graph for this function:

void do_northwest CHAR_DATA ch,
char *  argument
 

Definition at line 379 of file act_move.c.

References DIR_NORTHWEST, FALSE, and move_char().

00380 {
00381         move_char (ch, DIR_NORTHWEST, FALSE);
00382 return;
00383 }

Here is the call graph for this function:

void do_open CHAR_DATA ch,
char *  argument
 

Definition at line 452 of file act_move.c.

References act, CONT_CLOSEABLE, CONT_CLOSED, CONT_LOCKED, EX_CLOSED, EX_ISDOOR, EX_LOCKED, room_index_data::exit, exit_data::exit_info, find_door(), get_obj_here(), IS_SET, ITEM_CONTAINER, ITEM_PORTAL, obj_data::item_type, exit_data::keyword, MAX_INPUT_LENGTH, char_data::next_in_room, one_argument(), room_index_data::people, REMOVE_BIT, rev_dir, send_to_char(), TO_CHAR, exit_data::to_room, TO_ROOM, exit_data::u1, and obj_data::value.

Referenced by spec_mayor().

00453 {
00454     char arg[MAX_INPUT_LENGTH];
00455     OBJ_DATA *obj;
00456     int door;
00457 
00458     one_argument (argument, arg);
00459 
00460     if (arg[0] == '\0')
00461     {
00462         send_to_char ("Open what?\n\r", ch);
00463         return;
00464     }
00465 
00466     if ((obj = get_obj_here (ch, arg)) != NULL)
00467     {
00468         /* open portal */
00469         if (obj->item_type == ITEM_PORTAL)
00470         {
00471             if (!IS_SET (obj->value[1], EX_ISDOOR))
00472             {
00473                 send_to_char ("You can't do that.\n\r", ch);
00474                 return;
00475             }
00476 
00477             if (!IS_SET (obj->value[1], EX_CLOSED))
00478             {
00479                 send_to_char ("It's already open.\n\r", ch);
00480                 return;
00481             }
00482 
00483             if (IS_SET (obj->value[1], EX_LOCKED))
00484             {
00485                 send_to_char ("It's locked.\n\r", ch);
00486                 return;
00487             }
00488 
00489             REMOVE_BIT (obj->value[1], EX_CLOSED);
00490             act ("You open $p.", ch, obj, NULL, TO_CHAR);
00491             act ("$n opens $p.", ch, obj, NULL, TO_ROOM);
00492             return;
00493         }
00494 
00495         /* 'open object' */
00496         if (obj->item_type != ITEM_CONTAINER)
00497         {
00498             send_to_char ("That's not a container.\n\r", ch);
00499             return;
00500         }
00501         if (!IS_SET (obj->value[1], CONT_CLOSED))
00502         {
00503             send_to_char ("It's already open.\n\r", ch);
00504             return;
00505         }
00506         if (!IS_SET (obj->value[1], CONT_CLOSEABLE))
00507         {
00508             send_to_char ("You can't do that.\n\r", ch);
00509             return;
00510         }
00511         if (IS_SET (obj->value[1], CONT_LOCKED))
00512         {
00513             send_to_char ("It's locked.\n\r", ch);
00514             return;
00515         }
00516 
00517         REMOVE_BIT (obj->value[1], CONT_CLOSED);
00518         act ("You open $p.", ch, obj, NULL, TO_CHAR);
00519         act ("$n opens $p.", ch, obj, NULL, TO_ROOM);
00520         return;
00521     }
00522 
00523     if ((door = find_door (ch, arg)) >= 0)
00524     {
00525         /* 'open door' */
00526         ROOM_INDEX_DATA *to_room;
00527         EXIT_DATA *pexit;
00528         EXIT_DATA *pexit_rev;
00529 
00530         pexit = ch->in_room->exit[door];
00531         if (!IS_SET (pexit->exit_info, EX_CLOSED))
00532         {
00533             send_to_char ("It's already open.\n\r", ch);
00534             return;
00535         }
00536         if (IS_SET (pexit->exit_info, EX_LOCKED))
00537         {
00538             send_to_char ("It's locked.\n\r", ch);
00539             return;
00540         }
00541 
00542         REMOVE_BIT (pexit->exit_info, EX_CLOSED);
00543         act ("$n opens the $d.", ch, NULL, pexit->keyword, TO_ROOM);
00544         send_to_char ("Ok.\n\r", ch);
00545 
00546         /* open the other side */
00547         if ((to_room = pexit->u1.to_room) != NULL
00548             && (pexit_rev = to_room->exit[rev_dir[door]]) != NULL
00549             && pexit_rev->u1.to_room == ch->in_room)
00550         {
00551             CHAR_DATA *rch;
00552 
00553             REMOVE_BIT (pexit_rev->exit_info, EX_CLOSED);
00554             for (rch = to_room->people; rch != NULL; rch = rch->next_in_room)
00555                 act ("The $d opens.", rch, NULL, pexit_rev->keyword, TO_CHAR);
00556         }
00557     }
00558 
00559     return;
00560 }

Here is the call graph for this function:

void do_pick CHAR_DATA ch,
char *  argument
 

Definition at line 973 of file act_move.c.

References act, check_improve(), CONT_CLOSED, CONT_LOCKED, CONT_PICKPROOF, EX_CLOSED, EX_ISDOOR, EX_LOCKED, EX_PICKPROOF, room_index_data::exit, exit_data::exit_info, FALSE, find_door(), get_obj_here(), get_skill(), gsn_pick_lock, char_data::in_room, IS_AWAKE, IS_IMMORTAL, IS_NPC, IS_SET, ITEM_CONTAINER, ITEM_PORTAL, obj_data::item_type, exit_data::key, exit_data::keyword, MAX_INPUT_LENGTH, char_data::next_in_room, number_percent(), one_argument(), room_index_data::people, REMOVE_BIT, rev_dir, send_to_char(), skill_table, TO_CHAR, exit_data::to_room, TO_ROOM, TRUE, exit_data::u1, obj_data::value, and WAIT_STATE.

00974 {
00975     char arg[MAX_INPUT_LENGTH];
00976     CHAR_DATA *gch;
00977     OBJ_DATA *obj;
00978     int door;
00979 
00980     one_argument (argument, arg);
00981 
00982     if (arg[0] == '\0')
00983     {
00984         send_to_char ("Pick what?\n\r", ch);
00985         return;
00986     }
00987 
00988     WAIT_STATE (ch, skill_table[gsn_pick_lock].beats);
00989 
00990     /* look for guards */
00991     for (gch = ch->in_room->people; gch; gch = gch->next_in_room)
00992     {
00993         if (IS_NPC (gch) && IS_AWAKE (gch) && ch->level + 5 < gch->level)
00994         {
00995             act ("$N is standing too close to the lock.",
00996                  ch, NULL, gch, TO_CHAR);
00997             return;
00998         }
00999     }
01000 
01001     if (!IS_NPC (ch) && number_percent () > get_skill (ch, gsn_pick_lock))
01002     {
01003         send_to_char ("You failed.\n\r", ch);
01004         check_improve (ch, gsn_pick_lock, FALSE, 2);
01005         return;
01006     }
01007 
01008     if ((obj = get_obj_here (ch, arg)) != NULL)
01009     {
01010         /* portal stuff */
01011         if (obj->item_type == ITEM_PORTAL)
01012         {
01013             if (!IS_SET (obj->value[1], EX_ISDOOR))
01014             {
01015                 send_to_char ("You can't do that.\n\r", ch);
01016                 return;
01017             }
01018 
01019             if (!IS_SET (obj->value[1], EX_CLOSED))
01020             {
01021                 send_to_char ("It's not closed.\n\r", ch);
01022                 return;
01023             }
01024 
01025             if (obj->value[4] < 0)
01026             {
01027                 send_to_char ("It can't be unlocked.\n\r", ch);
01028                 return;
01029             }
01030 
01031             if (IS_SET (obj->value[1], EX_PICKPROOF))
01032             {
01033                 send_to_char ("You failed.\n\r", ch);
01034                 return;
01035             }
01036 
01037             REMOVE_BIT (obj->value[1], EX_LOCKED);
01038             act ("You pick the lock on $p.", ch, obj, NULL, TO_CHAR);
01039             act ("$n picks the lock on $p.", ch, obj, NULL, TO_ROOM);
01040             check_improve (ch, gsn_pick_lock, TRUE, 2);
01041             return;
01042         }
01043 
01044 
01045 
01046 
01047 
01048         /* 'pick object' */
01049         if (obj->item_type != ITEM_CONTAINER)
01050         {
01051             send_to_char ("That's not a container.\n\r", ch);
01052             return;
01053         }
01054         if (!IS_SET (obj->value[1], CONT_CLOSED))
01055         {
01056             send_to_char ("It's not closed.\n\r", ch);
01057             return;
01058         }
01059         if (obj->value[2] < 0)
01060         {
01061             send_to_char ("It can't be unlocked.\n\r", ch);
01062             return;
01063         }
01064         if (!IS_SET (obj->value[1], CONT_LOCKED))
01065         {
01066             send_to_char ("It's already unlocked.\n\r", ch);
01067             return;
01068         }
01069         if (IS_SET (obj->value[1], CONT_PICKPROOF))
01070         {
01071             send_to_char ("You failed.\n\r", ch);
01072             return;
01073         }
01074 
01075         REMOVE_BIT (obj->value[1], CONT_LOCKED);
01076         act ("You pick the lock on $p.", ch, obj, NULL, TO_CHAR);
01077         act ("$n picks the lock on $p.", ch, obj, NULL, TO_ROOM);
01078         check_improve (ch, gsn_pick_lock, TRUE, 2);
01079         return;
01080     }
01081 
01082     if ((door = find_door (ch, arg)) >= 0)
01083     {
01084         /* 'pick door' */
01085         ROOM_INDEX_DATA *to_room;
01086         EXIT_DATA *pexit;
01087         EXIT_DATA *pexit_rev;
01088 
01089         pexit = ch->in_room->exit[door];
01090         if (!IS_SET (pexit->exit_info, EX_CLOSED) && !IS_IMMORTAL (ch))
01091         {
01092             send_to_char ("It's not closed.\n\r", ch);
01093             return;
01094         }
01095         if (pexit->key < 0 && !IS_IMMORTAL (ch))
01096         {
01097             send_to_char ("It can't be picked.\n\r", ch);
01098             return;
01099         }
01100         if (!IS_SET (pexit->exit_info, EX_LOCKED))
01101         {
01102             send_to_char ("It's already unlocked.\n\r", ch);
01103             return;
01104         }
01105         if (IS_SET (pexit->exit_info, EX_PICKPROOF) && !IS_IMMORTAL (ch))
01106         {
01107             send_to_char ("You failed.\n\r", ch);
01108             return;
01109         }
01110 
01111         REMOVE_BIT (pexit->exit_info, EX_LOCKED);
01112         send_to_char ("*Click*\n\r", ch);
01113         act ("$n picks the $d.", ch, NULL, pexit->keyword, TO_ROOM);
01114         check_improve (ch, gsn_pick_lock, TRUE, 2);
01115 
01116         /* pick the other side */
01117         if ((to_room = pexit->u1.to_room) != NULL
01118             && (pexit_rev = to_room->exit[rev_dir[door]]) != NULL
01119             && pexit_rev->u1.to_room == ch->in_room)
01120         {
01121             REMOVE_BIT (pexit_rev->exit_info, EX_LOCKED);
01122         }
01123     }
01124 
01125     return;
01126 }

Here is the call graph for this function:

void do_recall CHAR_DATA ch,
char *  argument
 

Definition at line 1701 of file act_move.c.

References act, ACT_PET, AFF_CURSE, char_from_room(), char_to_room(), check_improve(), clan_table, do_function(), do_look(), do_recall(), FALSE, char_data::fighting, gain_exp(), get_room_index(), get_skill(), gsn_recall, clan_type::hall, IS_AFFECTED, IS_NPC, IS_SET, MAX_STRING_LENGTH, number_percent(), ROOM_NO_RECALL, ROOM_VNUM_TEMPLE, send_to_char(), stop_fighting(), TO_ROOM, TRUE, and WAIT_STATE.

Referenced by damage(), and do_recall().

01702 {
01703     char buf[MAX_STRING_LENGTH];
01704     CHAR_DATA *victim;
01705     ROOM_INDEX_DATA *location;
01706 
01707     if (IS_NPC (ch) && !IS_SET (ch->act, ACT_PET))
01708     {
01709         send_to_char ("Only players can recall.\n\r", ch);
01710         return;
01711     }
01712 
01713     act ("$n prays for transportation!", ch, 0, 0, TO_ROOM);
01714 
01715     if (ch->clan != 0)
01716     {
01717        if ((location = get_room_index (clan_table[ch->clan].hall)) == NULL)
01718        {
01719            send_to_char("You are completely lost.\n\r",ch);
01720            return;
01721        }
01722     }
01723     else if ((location = get_room_index (ROOM_VNUM_TEMPLE)) == NULL)
01724     {
01725         send_to_char ("You are completely lost.\n\r", ch);
01726         return;
01727     }
01728 
01729     if (ch->in_room == location)
01730         return;
01731 
01732     if (IS_SET (ch->in_room->room_flags, ROOM_NO_RECALL)
01733         || IS_AFFECTED (ch, AFF_CURSE))
01734     {
01735         send_to_char ("The Gods has forsaken you.\n\r", ch);
01736         return;
01737     }
01738 
01739     if ((victim = ch->fighting) != NULL)
01740     {
01741         int lose, skill;
01742 
01743         skill = get_skill (ch, gsn_recall);
01744 
01745         if (number_percent () < 80 * skill / 100)
01746         {
01747             check_improve (ch, gsn_recall, FALSE, 6);
01748             WAIT_STATE (ch, 4);
01749             sprintf (buf, "You failed!.\n\r");
01750             send_to_char (buf, ch);
01751             return;
01752         }
01753 
01754         lose = (ch->desc != NULL) ? 25 : 50;
01755         gain_exp (ch, 0 - lose);
01756         check_improve (ch, gsn_recall, TRUE, 4);
01757         sprintf (buf, "You recall from combat!  You lose %d exps.\n\r", lose);
01758         send_to_char (buf, ch);
01759         stop_fighting (ch, TRUE);
01760 
01761     }
01762 
01763     ch->move /= 2;
01764     act ("$n disappears.", ch, NULL, NULL, TO_ROOM);
01765     char_from_room (ch);
01766     char_to_room (ch, location);
01767     act ("$n appears in the room.", ch, NULL, NULL, TO_ROOM);
01768     do_function (ch, &do_look, "auto");
01769 
01770     if (ch->pet != NULL)
01771         do_function (ch->pet, &do_recall, "");
01772 
01773     return;
01774 }

Here is the call graph for this function:

void do_rest CHAR_DATA ch,
char *  argument
 

Definition at line 1242 of file act_move.c.

References act, act_new(), AFF_SLEEP, count_users(), get_obj_list(), IS_AFFECTED, IS_SET, ITEM_FURNITURE, obj_data::item_type, obj_data::on, POS_DEAD, POS_FIGHTING, POS_RESTING, POS_SITTING, POS_SLEEPING, POS_STANDING, REST_AT, REST_IN, REST_ON, send_to_char(), TO_CHAR, TO_ROOM, and obj_data::value.

01243 {
01244     OBJ_DATA *obj = NULL;
01245 
01246     if (ch->position == POS_FIGHTING)
01247     {
01248         send_to_char ("You are already fighting!\n\r", ch);
01249         return;
01250     }
01251 
01252     /* okay, now that we know we can rest, find an object to rest on */
01253     if (argument[0] != '\0')
01254     {
01255         obj = get_obj_list (ch, argument, ch->in_room->contents);
01256         if (obj == NULL)
01257         {
01258             send_to_char ("You don't see that here.\n\r", ch);
01259             return;
01260         }
01261     }
01262     else
01263         obj = ch->on;
01264 
01265     if (obj != NULL)
01266     {
01267         if (obj->item_type != ITEM_FURNITURE
01268             || (!IS_SET (obj->value[2], REST_ON)
01269                 && !IS_SET (obj->value[2], REST_IN)
01270                 && !IS_SET (obj->value[2], REST_AT)))
01271         {
01272             send_to_char ("You can't rest on that.\n\r", ch);
01273             return;
01274         }
01275 
01276         if (obj != NULL && ch->on != obj
01277             && count_users (obj) >= obj->value[0])
01278         {
01279             act_new ("There's no more room on $p.", ch, obj, NULL, TO_CHAR,
01280                      POS_DEAD);
01281             return;
01282         }
01283 
01284         ch->on = obj;
01285     }
01286 
01287     switch (ch->position)
01288     {
01289         case POS_SLEEPING:
01290             if (IS_AFFECTED (ch, AFF_SLEEP))
01291             {
01292                 send_to_char ("You can't wake up!\n\r", ch);
01293                 return;
01294             }
01295 
01296             if (obj == NULL)
01297             {
01298                 send_to_char ("You wake up and start resting.\n\r", ch);
01299                 act ("$n wakes up and starts resting.", ch, NULL, NULL,
01300                      TO_ROOM);
01301             }
01302             else if (IS_SET (obj->value[2], REST_AT))
01303             {
01304                 act_new ("You wake up and rest at $p.",
01305                          ch, obj, NULL, TO_CHAR, POS_SLEEPING);
01306                 act ("$n wakes up and rests at $p.", ch, obj, NULL, TO_ROOM);
01307             }
01308             else if (IS_SET (obj->value[2], REST_ON))
01309             {
01310                 act_new ("You wake up and rest on $p.",
01311                          ch, obj, NULL, TO_CHAR, POS_SLEEPING);
01312                 act ("$n wakes up and rests on $p.", ch, obj, NULL, TO_ROOM);
01313             }
01314             else
01315             {
01316                 act_new ("You wake up and rest in $p.",
01317                          ch, obj, NULL, TO_CHAR, POS_SLEEPING);
01318                 act ("$n wakes up and rests in $p.", ch, obj, NULL, TO_ROOM);
01319             }
01320             ch->position = POS_RESTING;
01321             break;
01322 
01323         case POS_RESTING:
01324             send_to_char ("You are already resting.\n\r", ch);
01325             break;
01326 
01327         case POS_STANDING:
01328             if (obj == NULL)
01329             {
01330                 send_to_char ("You rest.\n\r", ch);
01331                 act ("$n sits down and rests.", ch, NULL, NULL, TO_ROOM);
01332             }
01333             else if (IS_SET (obj->value[2], REST_AT))
01334             {
01335                 act ("You sit down at $p and rest.", ch, obj, NULL, TO_CHAR);
01336                 act ("$n sits down at $p and rests.", ch, obj, NULL, TO_ROOM);
01337             }
01338             else if (IS_SET (obj->value[2], REST_ON))
01339             {
01340                 act ("You sit on $p and rest.", ch, obj, NULL, TO_CHAR);
01341                 act ("$n sits on $p and rests.", ch, obj, NULL, TO_ROOM);
01342             }
01343             else
01344             {
01345                 act ("You rest in $p.", ch, obj, NULL, TO_CHAR);
01346                 act ("$n rests in $p.", ch, obj, NULL, TO_ROOM);
01347             }
01348             ch->position = POS_RESTING;
01349             break;
01350 
01351         case POS_SITTING:
01352             if (obj == NULL)
01353             {
01354                 send_to_char ("You rest.\n\r", ch);
01355                 act ("$n rests.", ch, NULL, NULL, TO_ROOM);
01356             }
01357             else if (IS_SET (obj->value[2], REST_AT))
01358             {
01359                 act ("You rest at $p.", ch, obj, NULL, TO_CHAR);
01360                 act ("$n rests at $p.", ch, obj, NULL, TO_ROOM);
01361             }
01362             else if (IS_SET (obj->value[2], REST_ON))
01363             {
01364                 act ("You rest on $p.", ch, obj, NULL, TO_CHAR);
01365                 act ("$n rests on $p.", ch, obj, NULL, TO_ROOM);
01366             }
01367             else
01368             {
01369                 act ("You rest in $p.", ch, obj, NULL, TO_CHAR);
01370                 act ("$n rests in $p.", ch, obj, NULL, TO_ROOM);
01371             }
01372             ch->position = POS_RESTING;
01373             break;
01374     }
01375 
01376 
01377     return;
01378 }

Here is the call graph for this function:

void do_sit CHAR_DATA ch,
char *  argument
 

Definition at line 1381 of file act_move.c.

References act, act_new(), AFF_SLEEP, count_users(), get_obj_list(), IS_AFFECTED, IS_SET, ITEM_FURNITURE, obj_data::item_type, obj_data::on, POS_DEAD, POS_FIGHTING, POS_RESTING, POS_SITTING, POS_SLEEPING, POS_STANDING, send_to_char(), SIT_AT, SIT_IN, SIT_ON, TO_CHAR, TO_ROOM, and obj_data::value.

01382 {
01383     OBJ_DATA *obj = NULL;
01384 
01385     if (ch->position == POS_FIGHTING)
01386     {
01387         send_to_char ("Maybe you should finish this fight first?\n\r", ch);
01388         return;
01389     }
01390 
01391     /* okay, now that we know we can sit, find an object to sit on */
01392     if (argument[0] != '\0')
01393     {
01394         obj = get_obj_list (ch, argument, ch->in_room->contents);
01395         if (obj == NULL)
01396         {
01397             send_to_char ("You don't see that here.\n\r", ch);
01398             return;
01399         }
01400     }
01401     else
01402         obj = ch->on;
01403 
01404     if (obj != NULL)
01405     {
01406         if (obj->item_type != ITEM_FURNITURE
01407             || (!IS_SET (obj->value[2], SIT_ON)
01408                 && !IS_SET (obj->value[2], SIT_IN)
01409                 && !IS_SET (obj->value[2], SIT_AT)))
01410         {
01411             send_to_char ("You can't sit on that.\n\r", ch);
01412             return;
01413         }
01414 
01415         if (obj != NULL && ch->on != obj
01416             && count_users (obj) >= obj->value[0])
01417         {
01418             act_new ("There's no more room on $p.", ch, obj, NULL, TO_CHAR,
01419                      POS_DEAD);
01420             return;
01421         }
01422 
01423         ch->on = obj;
01424     }
01425     switch (ch->position)
01426     {
01427         case POS_SLEEPING:
01428             if (IS_AFFECTED (ch, AFF_SLEEP))
01429             {
01430                 send_to_char ("You can't wake up!\n\r", ch);
01431                 return;
01432             }
01433 
01434             if (obj == NULL)
01435             {
01436                 send_to_char ("You wake and sit up.\n\r", ch);
01437                 act ("$n wakes and sits up.", ch, NULL, NULL, TO_ROOM);
01438             }
01439             else if (IS_SET (obj->value[2], SIT_AT))
01440             {
01441                 act_new ("You wake and sit at $p.", ch, obj, NULL, TO_CHAR,
01442                          POS_DEAD);
01443                 act ("$n wakes and sits at $p.", ch, obj, NULL, TO_ROOM);
01444             }
01445             else if (IS_SET (obj->value[2], SIT_ON))
01446             {
01447                 act_new ("You wake and sit on $p.", ch, obj, NULL, TO_CHAR,
01448                          POS_DEAD);
01449                 act ("$n wakes and sits at $p.", ch, obj, NULL, TO_ROOM);
01450             }
01451             else
01452             {
01453                 act_new ("You wake and sit in $p.", ch, obj, NULL, TO_CHAR,
01454                          POS_DEAD);
01455                 act ("$n wakes and sits in $p.", ch, obj, NULL, TO_ROOM);
01456             }
01457 
01458             ch->position = POS_SITTING;
01459             break;
01460         case POS_RESTING:
01461             if (obj == NULL)
01462                 send_to_char ("You stop resting.\n\r", ch);
01463             else if (IS_SET (obj->value[2], SIT_AT))
01464             {
01465                 act ("You sit at $p.", ch, obj, NULL, TO_CHAR);
01466                 act ("$n sits at $p.", ch, obj, NULL, TO_ROOM);
01467             }
01468 
01469             else if (IS_SET (obj->value[2], SIT_ON))
01470             {
01471                 act ("You sit on $p.", ch, obj, NULL, TO_CHAR);
01472                 act ("$n sits on $p.", ch, obj, NULL, TO_ROOM);
01473             }
01474             ch->position = POS_SITTING;
01475             break;
01476         case POS_SITTING:
01477             send_to_char ("You are already sitting down.\n\r", ch);
01478             break;
01479         case POS_STANDING:
01480             if (obj == NULL)
01481             {
01482                 send_to_char ("You sit down.\n\r", ch);
01483                 act ("$n sits down on the ground.", ch, NULL, NULL, TO_ROOM);
01484             }
01485             else if (IS_SET (obj->value[2], SIT_AT))
01486             {
01487                 act ("You sit down at $p.", ch, obj, NULL, TO_CHAR);
01488                 act ("$n sits down at $p.", ch, obj, NULL, TO_ROOM);
01489             }
01490             else if (IS_SET (obj->value[2], SIT_ON))
01491             {
01492                 act ("You sit on $p.", ch, obj, NULL, TO_CHAR);
01493                 act ("$n sits on $p.", ch, obj, NULL, TO_ROOM);
01494             }
01495             else
01496             {
01497                 act ("You sit down in $p.", ch, obj, NULL, TO_CHAR);
01498                 act ("$n sits down in $p.", ch, obj, NULL, TO_ROOM);
01499             }
01500             ch->position = POS_SITTING;
01501             break;
01502     }
01503     return;
01504 }

Here is the call graph for this function:

void do_sleep CHAR_DATA ch,
char *  argument