#include "config.h"
#include "copyright.h"
#include "db.h"
#include "mudconf.h"
#include "interface.h"
#include "mmdb.h"
Include dependency graph for externs.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | INLINE |
#define | ToUpper(C) (((C) >= 'a' && (C) <= 'z')? (C) - 'a' + 'A': (C)) |
#define | ToLower(C) (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C)) |
#define | safe_atoi(s) ((s == NULL) ? 0 : atoi(s)) |
#define | notify(p, m) notify_checked(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN) |
#define | notify_quiet(p, m) |
#define | notify_with_cause(p, c, m) |
#define | notify_quiet_with_cause(p, c, m) |
#define | notify_puppet(p, c, m) |
#define | notify_quiet_puppet(p, c, m) |
#define | notify_all(p, c, m) |
#define | notify_all_from_inside(p, c, m) |
#define | notify_all_from_outside(p, c, m) |
#define | ATTRIB_ACCESS 1 |
#define | ATTRIB_RENAME 2 |
#define | ATTRIB_DELETE 4 |
#define | BOOT_QUIET 1 |
#define | BOOT_PORT 2 |
#define | CEMIT_NOHEADER 1 |
#define | CHOWN_ONE 1 |
#define | CHOWN_ALL 2 |
#define | CLIST_FULL 1 |
#define | CSTATUS_FULL 1 |
#define | CLONE_LOCATION 0 |
#define | CLONE_INHERIT 1 |
#define | CLONE_PRESERVE 2 |
#define | CLONE_INVENTORY 4 |
#define | CLONE_SET_COST 8 |
#define | CLONE_SET_LOC 16 |
#define | CLONE_SET_NAME 32 |
#define | CLONE_PARENT 64 |
#define | CRE_INVENTORY 0 |
#define | CRE_LOCATION 1 |
#define | CRE_SET_LOC 2 |
#define | CSET_PUBLIC 0 |
#define | CSET_PRIVATE 1 |
#define | CSET_LOUD 2 |
#define | CSET_QUIET 3 |
#define | CSET_LIST 4 |
#define | CSET_OBJECT 5 |
#define | CSET_STATUS 6 |
#define | CSET_TRANSPARENT 7 |
#define | CSET_OPAQUE 8 |
#define | DBCK_DEFAULT 1 |
#define | DBCK_REPORT 2 |
#define | DBCK_FULL 4 |
#define | DBCK_FLOATING 8 |
#define | DBCK_PURGE 16 |
#define | DBCK_LINKS 32 |
#define | DBCK_WEALTH 64 |
#define | DBCK_OWNER 128 |
#define | DBCK_OWN_EXIT 256 |
#define | DBCK_WIZARD 512 |
#define | DBCK_TYPES 1024 |
#define | DBCK_SPARE 2048 |
#define | DBCK_HOMES 4096 |
#define | DECOMP_DBREF 1 |
#define | DEST_ONE 1 |
#define | DEST_ALL 2 |
#define | DEST_OVERRIDE 4 |
#define | DEST_RECURSIVE 8 |
#define | DIG_TELEPORT 1 |
#define | DOLIST_SPACE 0 |
#define | DOLIST_DELIMIT 1 |
#define | DOING_MESSAGE 0 |
#define | DOING_HEADER 1 |
#define | DOING_POLL 2 |
#define | DROP_QUIET 1 |
#define | DUMP_STRUCT 1 |
#define | DUMP_TEXT 2 |
#define | DUMP_OPTIMIZE 3 |
#define | EXAM_DEFAULT 0 |
#define | EXAM_BRIEF 1 |
#define | EXAM_LONG 2 |
#define | EXAM_DEBUG 4 |
#define | EXAM_PARENT 8 |
#define | FIXDB_OWNER 1 |
#define | FIXDB_LOC 2 |
#define | FIXDB_CON 4 |
#define | FIXDB_EXITS 8 |
#define | FIXDB_NEXT 16 |
#define | FIXDB_PENNIES 32 |
#define | FIXDB_ZONE 64 |
#define | FIXDB_LINK 128 |
#define | FIXDB_PARENT 256 |
#define | FIXDB_DEL_PN 512 |
#define | FIXDB_ADD_PN 1024 |
#define | FIXDB_NAME 2048 |
#define | FRC_PREFIX 0 |
#define | FRC_COMMAND 1 |
#define | GET_QUIET 1 |
#define | GIVE_MONEY 1 |
#define | GIVE_QUOTA 2 |
#define | GIVE_QUIET 64 |
#define | GLOB_ENABLE 1 |
#define | GLOB_DISABLE 2 |
#define | GLOB_LIST 3 |
#define | HALT_ALL 1 |
#define | HELP_HELP 1 |
#define | HELP_NEWS 2 |
#define | HELP_WIZHELP 3 |
#define | HELP_PLUSHELP 4 |
#define | HELP_WIZNEWS 5 |
#define | KILL_KILL 1 |
#define | KILL_SLAY 2 |
#define | LOOK_LOOK 1 |
#define | LOOK_EXAM 2 |
#define | LOOK_DEXAM 3 |
#define | LOOK_INVENTORY 4 |
#define | LOOK_SCORE 5 |
#define | LOOK_OUTSIDE 8 |
#define | MAIL_STATS 1 |
#define | MAIL_DSTATS 2 |
#define | MAIL_FSTATS 3 |
#define | MAIL_DEBUG 4 |
#define | MAIL_NUKE 5 |
#define | MAIL_FOLDER 6 |
#define | MAIL_LIST 7 |
#define | MAIL_READ 8 |
#define | MAIL_CLEAR 9 |
#define | MAIL_UNCLEAR 10 |
#define | MAIL_PURGE 11 |
#define | MAIL_FILE 12 |
#define | MAIL_TAG 13 |
#define | MAIL_UNTAG 14 |
#define | MAIL_FORWARD 15 |
#define | MAIL_SEND 16 |
#define | MAIL_EDIT 17 |
#define | MAIL_URGENT 18 |
#define | MAIL_ALIAS 19 |
#define | MAIL_ALIST 20 |
#define | MAIL_PROOF 21 |
#define | MAIL_ABORT 22 |
#define | MAIL_QUICK 23 |
#define | MAIL_REVIEW 24 |
#define | MAIL_RETRACT 25 |
#define | MAIL_CC 26 |
#define | MAIL_SAFE 27 |
#define | MALIAS_DESC 1 |
#define | MALIAS_CHOWN 2 |
#define | MALIAS_ADD 3 |
#define | MALIAS_REMOVE 4 |
#define | MALIAS_DELETE 5 |
#define | MALIAS_RENAME 6 |
#define | MALIAS_LIST 8 |
#define | MALIAS_STATUS 9 |
#define | MOTD_ALL 0 |
#define | MOTD_WIZ 1 |
#define | MOTD_DOWN 2 |
#define | MOTD_FULL 4 |
#define | MOTD_LIST 8 |
#define | MOTD_BRIEF 16 |
#define | MOVE_QUIET 1 |
#define | NFY_NFY 0 |
#define | NFY_NFYALL 1 |
#define | NFY_DRAIN 2 |
#define | OPEN_LOCATION 0 |
#define | OPEN_INVENTORY 1 |
#define | PASS_ANY 1 |
#define | PASS_MINE 2 |
#define | PCRE_PLAYER 1 |
#define | PCRE_ROBOT 2 |
#define | PEMIT_PEMIT 1 |
#define | PEMIT_OEMIT 2 |
#define | PEMIT_WHISPER 3 |
#define | PEMIT_FSAY 4 |
#define | PEMIT_FEMIT 5 |
#define | PEMIT_FPOSE 6 |
#define | PEMIT_FPOSE_NS 7 |
#define | PEMIT_CONTENTS 8 |
#define | PEMIT_HERE 16 |
#define | PEMIT_ROOM 32 |
#define | PEMIT_LIST 64 |
#define | PS_BRIEF 0 |
#define | PS_LONG 1 |
#define | PS_SUMM 2 |
#define | PS_ALL 4 |
#define | QUEUE_KICK 1 |
#define | QUEUE_WARP 2 |
#define | QUOTA_SET 1 |
#define | QUOTA_FIX 2 |
#define | QUOTA_TOT 4 |
#define | QUOTA_REM 8 |
#define | QUOTA_ALL 16 |
#define | SAY_SAY 1 |
#define | SAY_NOSPACE 1 |
#define | SAY_POSE 2 |
#define | SAY_POSE_NOSPC 3 |
#define | SAY_PREFIX 4 |
#define | SAY_EMIT 5 |
#define | SAY_SHOUT 8 |
#define | SAY_WALLPOSE 9 |
#define | SAY_WALLEMIT 10 |
#define | SAY_WIZSHOUT 12 |
#define | SAY_WIZPOSE 13 |
#define | SAY_WIZEMIT 14 |
#define | SAY_ADMINSHOUT 15 |
#define | SAY_GRIPE 16 |
#define | SAY_NOTE 17 |
#define | SAY_NOTAG 32 |
#define | SAY_HERE 64 |
#define | SAY_ROOM 128 |
#define | SET_QUIET 1 |
#define | SHUTDN_NORMAL 0 |
#define | SHUTDN_PANIC 1 |
#define | SHUTDN_EXIT 2 |
#define | SHUTDN_COREDUMP 4 |
#define | SRCH_SEARCH 1 |
#define | SRCH_MARK 2 |
#define | SRCH_UNMARK 3 |
#define | STAT_PLAYER 0 |
#define | STAT_ALL 1 |
#define | STAT_ME 2 |
#define | SWITCH_DEFAULT 0 |
#define | SWITCH_ANY 1 |
#define | SWITCH_ONE 2 |
#define | SWEEP_ME 1 |
#define | SWEEP_HERE 2 |
#define | SWEEP_COMMANDS 4 |
#define | SWEEP_LISTEN 8 |
#define | SWEEP_PLAYER 16 |
#define | SWEEP_CONNECT 32 |
#define | SWEEP_EXITS 64 |
#define | SWEEP_SCAN 128 |
#define | SWEEP_VERBOSE 256 |
#define | TELEPORT_DEFAULT 1 |
#define | TELEPORT_QUIET 2 |
#define | TOAD_NO_CHOWN 1 |
#define | TRIG_QUIET 1 |
#define | TWARP_QUEUE 1 |
#define | TWARP_DUMP 2 |
#define | TWARP_CLEAN 4 |
#define | TWARP_IDLE 8 |
#define | TWARP_EVENTS 32 |
#define | HUSH_ENTER 1 |
#define | HUSH_LEAVE 2 |
#define | HUSH_EXIT 4 |
#define | EV_FMASK 0x00000300 |
#define | EV_FIGNORE 0x00000000 |
#define | EV_FMAND 0x00000100 |
#define | EV_FCHECK 0x00000200 |
#define | EV_STRIP 0x00000400 |
#define | EV_EVAL 0x00000800 |
#define | EV_STRIP_TS 0x00001000 |
#define | EV_STRIP_LS 0x00002000 |
#define | EV_STRIP_ESC 0x00004000 |
#define | EV_STRIP_AROUND 0x00008000 |
#define | EV_TOP 0x00010000 |
#define | EV_NOTRACE 0x00020000 |
#define | EV_NO_COMPRESS 0x00040000 |
#define | EV_NO_LOCATION 0x00080000 |
#define | EV_NOFCHECK 0x00100000 |
#define | PT_NOTHING 0x00000000 |
#define | PT_BRACE 0x00000001 |
#define | PT_BRACKET 0x00000002 |
#define | PT_PAREN 0x00000004 |
#define | PT_COMMA 0x00000008 |
#define | PT_SEMI 0x00000010 |
#define | PT_EQUALS 0x00000020 |
#define | PT_SPACE 0x00000040 |
#define | MSG_PUP_ALWAYS 1 |
#define | MSG_INV 2 |
#define | MSG_INV_L 4 |
#define | MSG_INV_EXITS 8 |
#define | MSG_NBR 16 |
#define | MSG_NBR_A 32 |
#define | MSG_NBR_EXITS 64 |
#define | MSG_NBR_EXITS_A 128 |
#define | MSG_LOC 256 |
#define | MSG_LOC_A 512 |
#define | MSG_FWDLIST 1024 |
#define | MSG_ME 2048 |
#define | MSG_S_INSIDE 4096 |
#define | MSG_S_OUTSIDE 8192 |
#define | MSG_COLORIZE 16384 |
#define | MSG_NO_SLAVE 65536 |
#define | MSG_ME_ALL (MSG_ME|MSG_INV_EXITS|MSG_FWDLIST) |
#define | MSG_F_CONTENTS (MSG_INV) |
#define | MSG_F_UP (MSG_NBR_A|MSG_LOC_A) |
#define | MSG_F_DOWN (MSG_INV_L) |
#define | LK_IDESC 0x0001 |
#define | LK_OBEYTERSE 0x0002 |
#define | LK_SHOWATTR 0x0004 |
#define | LK_SHOWEXIT 0x0008 |
#define | VE_LOC_XAM 0x01 |
#define | VE_LOC_DARK 0x02 |
#define | VE_LOC_LIGHT 0x04 |
#define | VE_BASE_XAM 0x08 |
#define | VE_BASE_DARK 0x10 |
#define | VE_BASE_LIGHT 0x20 |
#define | SA_EXIT 1 |
#define | SA_DFLT 2 |
#define | STARTLOG(key, p, s) if ((((key) & mudconf.log_options) != 0) && start_log(p, s)) |
#define | ENDLOG end_log() |
#define | LOG_SIMPLE(key, p, s, m) |
#define | test_top() ((mudstate.qfirst != NULL) ? 1 : 0) |
#define | controls(p, x) Controls(p,x) |
Functions | |
int | cf_modify_bits (int *, char *, long, dbref, char *) |
int | load_mail (FILE *) |
int | dump_mail (FILE *) |
void | mail_init (void) |
mail * | mail_fetch (dbref, int) |
int | dddb_close (void) |
int | dddb_setfile (char *) |
int | dddb_init (void) |
void | choke_player (dbref) |
void | release_player (dbref) |
void | make_ulist (dbref, char *, char **) |
int | fetch_idle (dbref) |
int | fetch_connect (dbref) |
void | raw_broadcast (int, char *,...) |
int | desc_cmp (void *, void *, void *) |
void | run_command (DESC *d, char *) |
int | do_unauth_command (DESC *d, char *) |
int | nfy_que (dbref, int, int, int) |
int | halt_que (dbref, dbref) |
void | wait_que (dbref, dbref, int, dbref, int, char *, char *[], int, char *[]) |
int | que_next (void) |
int | do_top (int ncmds) |
void | recover_queue_deposits (void) |
void | cque_dump_restart (struct mmdb_t *) |
void | cque_load_restart (struct mmdb_t *) |
void | tcache_init (void) |
char * | parse_to (char **, char, int) |
char * | parse_arglist (dbref, dbref, char *, char, int, char *[], int, char *[], int) |
int | get_gender (dbref) |
void | exec (char *, char **, int, dbref, dbref, int, char **, char *[], int) |
void | do_shutdown (dbref, dbref, int, char *) |
void | notify_except (dbref, dbref, dbref, const char *) |
void | notify_except2 (dbref, dbref, dbref, dbref, const char *) |
void | notify_printf (dbref, const char *,...) |
int | check_filter (dbref, dbref, int, const char *) |
void | notify_checked (dbref, dbref, const char *, int) |
int | Hearer (dbref) |
void | report (void) |
int | atr_match (dbref, dbref, char, char *, int) |
int | list_check (dbref, dbref, char, char *, int) |
int | dnschild_init () |
void * | dnschild_request (DESC *d) |
void | dnschild_destruct () |
void | dnschild_kill (void *) |
void | shutdown_services () |
void | flush_sockets () |
int | eradicate_broken_fd (int) |
void | mux_release_socket () |
void | bind_descriptor (DESC *) |
void | release_descriptor (DESC *) |
void | bind_signals () |
void | unbind_signals () |
int | helpindex_read (HASHTAB *, char *) |
void | helpindex_load (dbref) |
void | helpindex_init (void) |
int | cf_ntab_access (int *, char *, long, dbref, char *) |
char * | strip_ansi_r (char *, const char *, size_t) |
char * | normal_to_white_r (char *, const char *, size_t) |
int | start_log (const char *, const char *) |
void | end_log (void) |
void | log_perror (const char *, const char *, const char *, const char *) |
void | log_printf (char *,...) |
void | log_error (int, char *, char *, char *,...) |
void | log_text (char *) |
void | log_number (int) |
void | log_name (dbref) |
void | log_name_and_loc (dbref) |
char * | OBJTYP (dbref) |
void | log_type_and_name (dbref) |
void | log_type_and_num (dbref) |
void | look_in (dbref, dbref, int) |
void | move_object (dbref, dbref) |
void | move_via_generic (dbref, dbref, dbref, int) |
void | move_via_exit (dbref, dbref, dbref, dbref, int) |
int | move_via_teleport (dbref, dbref, dbref, int) |
void | move_exit (dbref, dbref, int, const char *, int) |
void | do_enter_internal (dbref, dbref, int) |
void | destroy_player (dbref) |
dbref | start_home (void) |
dbref | default_home (void) |
int | can_set_home (dbref, dbref, dbref) |
dbref | new_home (dbref) |
dbref | clone_home (dbref, dbref) |
void | divest_object (dbref) |
dbref | create_obj (dbref, int, char *, int) |
void | destroy_obj (dbref, dbref) |
void | empty_obj (dbref) |
void | record_login (dbref, int, char *, char *, char *) |
int | check_pass (dbref, const char *) |
dbref | connect_player (char *, char *, char *, char *) |
dbref | create_player (char *, char *, dbref, int, int) |
int | add_player_name (dbref, char *) |
int | delete_player_name (dbref, char *) |
dbref | lookup_player (dbref, char *, int) |
void | load_player_names (void) |
void | badname_add (char *) |
void | badname_remove (char *) |
int | badname_check (char *) |
void | badname_list (dbref, const char *) |
char * | tprintf (const char *,...) |
void | safe_tprintf_str (char *, char **, const char *,...) |
dbref | insert_first (dbref, dbref) |
dbref | remove_first (dbref, dbref) |
dbref | reverse_list (dbref) |
int | member (dbref, dbref) |
int | is_integer (char *) |
int | is_number (char *) |
int | could_doit (dbref, dbref, int) |
int | can_see (dbref, dbref, int) |
void | add_quota (dbref, int) |
int | canpayfees (dbref, dbref, int, int) |
void | giveto (dbref, int) |
int | payfor (dbref, int) |
int | ok_name (const char *) |
int | ok_player_name (const char *) |
int | ok_attr_name (const char *) |
int | ok_password (const char *) |
void | handle_ears (dbref, int, int) |
void | handle_xcode (dbref, dbref, int, int) |
int | HandledCommand (dbref, dbref, char *) |
dbref | match_possessed (dbref, dbref, char *, dbref, int) |
void | parse_range (char **, dbref *, dbref *) |
int | parse_thing_slash (dbref, char *, char **, dbref *) |
int | get_obj_and_lock (dbref, char *, dbref *, ATTR **, char *, char **) |
dbref | where_is (dbref) |
dbref | where_room (dbref) |
int | locatable (dbref, dbref, dbref) |
int | nearby (dbref, dbref) |
int | exit_visible (dbref, dbref, int) |
int | exit_displayable (dbref, dbref, int) |
void | did_it (dbref, dbref, int, const char *, int, const char *, int, char *[], int) |
void | list_bufstats (dbref) |
void | list_buftrace (dbref) |
void | do_restart (dbref player, dbref cause, int key) |
int | parse_attrib (dbref, char *, dbref *, int *) |
int | parse_attrib_wild (dbref, char *, dbref *, int, int, int) |
void | edit_string (char *, char **, char *, char *) |
dbref | match_controlled (dbref, char *) |
dbref | match_affected (dbref, char *) |
dbref | match_examinable (dbref, char *) |
char * | munge_space (char *) |
char * | trim_spaces (char *) |
char * | grabto (char **, char) |
int | string_compare (const char *, const char *) |
int | string_prefix (const char *, const char *) |
const char * | string_match (const char *, const char *) |
char * | dollar_to_space (const char *) |
char * | replace_string (const char *, const char *, const char *) |
char * | replace_string_inplace (const char *, const char *, char *) |
char * | skip_space (const char *) |
char * | seek_char (const char *, char) |
int | prefix_match (const char *, const char *) |
int | minmatch (char *, char *, int) |
char * | strsave (const char *) |
int | safe_copy_str (char *, char *, char **, int) |
int | safe_copy_chr (char, char *, char **, int) |
int | matches_exit_from_list (char *, char *) |
char * | translate_string (const char *, int) |
int | eval_boolexp (dbref, dbref, dbref, BOOLEXP *) |
BOOLEXP * | parse_boolexp (dbref, const char *, int) |
int | eval_boolexp_atr (dbref, dbref, dbref, char *) |
int | xlate (char *) |
char * | unparse_boolexp (dbref, BOOLEXP *) |
char * | unparse_boolexp_quiet (dbref, BOOLEXP *) |
char * | unparse_boolexp_decompile (dbref, BOOLEXP *) |
char * | unparse_boolexp_function (dbref, BOOLEXP *) |
int | chown_all (dbref, dbref) |
void | olist_push (void) |
void | olist_pop (void) |
void | olist_add (dbref) |
dbref | olist_first (void) |
dbref | olist_next (void) |
int | wild (char *, char *, char *[], int) |
int | wild_match (char *, char *) |
int | quick_wild (char *, char *) |
const char * | uncompress (const char *, int) |
const char * | compress (const char *, int) |
char * | uncompress_str (char *, const char *, int) |
int | check_access (dbref, int) |
void | set_prefix_cmds (void) |
int | Commer (dbref) |
void | s_Pass (dbref, const char *) |
void | s_Name (dbref, char *) |
char * | Name (dbref) |
char * | PureName (dbref) |
int | fwdlist_load (FWDLIST *, dbref, char *) |
void | fwdlist_set (dbref, FWDLIST *) |
void | fwdlist_clr (dbref) |
int | fwdlist_rewrite (FWDLIST *, char *) |
FWDLIST * | fwdlist_get (dbref) |
void | clone_object (dbref, dbref) |
void | init_min_db (void) |
void | atr_push (void) |
void | atr_pop (void) |
int | atr_head (dbref, char **) |
int | atr_next (char **) |
int | init_gdbm_db (char *) |
void | atr_cpy (dbref, dbref, dbref) |
void | atr_chown (dbref) |
void | atr_clr (dbref, int) |
void | atr_add_raw (dbref, int, char *) |
void | atr_add (dbref, int, char *, dbref, int) |
void | atr_set_owner (dbref, int, dbref) |
void | atr_set_flags (dbref, int, int) |
char * | atr_get_raw (dbref, int) |
char * | atr_get (dbref, int, dbref *, int *) |
char * | atr_pget (dbref, int, dbref *, int *) |
char * | atr_get_str (char *, dbref, int, dbref *, int *) |
char * | atr_pget_str (char *, dbref, int, dbref *, int *) |
int | atr_get_info (dbref, int, dbref *, int *) |
int | atr_pget_info (dbref, int, dbref *, int *) |
void | atr_free (dbref) |
int | check_zone (dbref, dbref) |
int | check_zone_for_player (dbref, dbref) |
void | toast_player (dbref) |
void | dump_restart_db (void) |
void | DisposeSpecialObject (dbref, dbref) |
void | UpdateSpecialObjects (void) |
void | LoadSpecialObjects (void) |
void | ResetSpecialObjects (void) |
void | SaveSpecialObjects (int) |
void | helpindex_faction_load (dbref) |
void | list_fhashstats (dbref) |
void | list_chashstats (dbref) |
#define ATTRIB_ACCESS 1 |
#define ATTRIB_DELETE 4 |
#define ATTRIB_RENAME 2 |
#define CEMIT_NOHEADER 1 |
#define CLIST_FULL 1 |
#define CLONE_INHERIT 1 |
#define CLONE_INVENTORY 4 |
#define CLONE_PARENT 64 |
#define CLONE_PRESERVE 2 |
#define CLONE_SET_COST 8 |
Definition at line 657 of file externs.h.
Referenced by do_chown(), do_destroy(), do_enter_internal(), do_find(), do_get(), do_kill(), do_link(), do_lock(), do_notify(), do_trigger(), do_unlink(), do_verb(), do_wait(), fun_setlock(), fwdlist_load(), give_thing(), link_exit(), open_exit(), and sp_ok().
#define CSET_LIST 4 |
#define CSET_LOUD 2 |
#define CSET_OBJECT 5 |
#define CSET_OPAQUE 8 |
#define CSET_PRIVATE 1 |
#define CSET_QUIET 3 |
#define CSET_STATUS 6 |
#define CSET_TRANSPARENT 7 |
#define CSTATUS_FULL 1 |
#define DBCK_FULL 4 |
Definition at line 374 of file externs.h.
Referenced by check_dead_refs(), check_loc_contents(), and check_loc_exits().
#define DECOMP_DBREF 1 |
#define DEST_OVERRIDE 4 |
#define DOING_HEADER 1 |
#define DOING_MESSAGE 0 |
#define DOLIST_DELIMIT 1 |
#define DUMP_STRUCT 1 |
#define ENDLOG end_log() |
Definition at line 649 of file externs.h.
Referenced by check_connect(), do_boot(), do_fixdb(), do_help(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_say(), do_shutdown(), do_toad(), dump_database(), eval_boolexp(), failconn(), helpindex_read(), init_version(), load_game(), Log_header_err(), Log_pointer_err(), Log_simple_err(), main(), process_command(), and report().
#define EV_EVAL 0x00000800 |
Definition at line 580 of file externs.h.
Referenced by add_mail_message(), add_prefix(), check_filter(), delim_check(), did_it(), do_mail_proof(), do_mail_review(), do_switch(), do_think(), eval_boolexp(), exec(), fun_case(), fun_columns(), fun_default(), fun_edefault(), fun_eval(), fun_filter(), fun_fold(), fun_foreach(), fun_get_eval(), fun_ifelse(), fun_iter(), fun_list(), fun_map(), fun_mix(), fun_munge(), fun_objeval(), fun_parse(), fun_s(), fun_switch(), fun_udefault(), fun_zfun(), page_return(), parse_arglist(), process_cmdent(), search_perform(), and u_comp().
#define EV_FCHECK 0x00000200 |
Definition at line 578 of file externs.h.
Referenced by add_mail_message(), delim_check(), do_mail_proof(), do_mail_review(), do_switch(), do_think(), exec(), fun_case(), fun_columns(), fun_default(), fun_edefault(), fun_filter(), fun_fold(), fun_foreach(), fun_ifelse(), fun_iter(), fun_list(), fun_map(), fun_mix(), fun_munge(), fun_objeval(), fun_parse(), fun_switch(), fun_udefault(), fun_zfun(), page_return(), parse_arglist(), process_cmdent(), process_command(), search_perform(), and u_comp().
#define EV_FIGNORE 0x00000000 |
Definition at line 576 of file externs.h.
Referenced by add_prefix(), check_filter(), did_it(), eval_boolexp(), fun_edefault(), fun_eval(), fun_get_eval(), fun_s(), fun_subeval(), fun_v(), and get_statustemplate_attr().
#define EV_NO_COMPRESS 0x00040000 |
Definition at line 587 of file externs.h.
Referenced by add_mail_message(), do_mail_review(), exec(), fun_subeval(), get_statustemplate_attr(), parse_to(), and parse_to_cleanup().
#define EV_NO_LOCATION 0x00080000 |
Definition at line 588 of file externs.h.
Referenced by exec(), fun_subeval(), get_statustemplate_attr(), and page_return().
#define EV_NOFCHECK 0x00100000 |
Definition at line 589 of file externs.h.
Referenced by exec(), fun_subeval(), and get_statustemplate_attr().
#define EV_NOTRACE 0x00020000 |
Definition at line 586 of file externs.h.
Referenced by exec(), get_statustemplate_attr(), and search_perform().
#define EV_STRIP 0x00000400 |
Definition at line 579 of file externs.h.
Referenced by add_mail_message(), check_filter(), do_dolist(), exec(), fun_case(), fun_columns(), fun_default(), fun_edefault(), fun_filter(), fun_fold(), fun_foreach(), fun_ifelse(), fun_iter(), fun_list(), fun_map(), fun_mix(), fun_munge(), fun_objeval(), fun_parse(), fun_switch(), fun_udefault(), fun_zfun(), parse_to(), process_cmdent(), process_command(), and u_comp().
#define EV_STRIP_AROUND 0x00008000 |
Definition at line 584 of file externs.h.
Referenced by get_statustemplate_attr(), parse_to_cleanup(), and process_cmdent().
#define EV_STRIP_ESC 0x00004000 |
#define EV_STRIP_LS 0x00002000 |
Definition at line 582 of file externs.h.
Referenced by do_verb(), parse_to(), parse_to_cleanup(), and process_cmdent().
#define EV_STRIP_TS 0x00001000 |
Definition at line 581 of file externs.h.
Referenced by do_verb(), parse_range(), parse_to_cleanup(), process_cmdent(), and search_setup().
#define EV_TOP 0x00010000 |
Definition at line 585 of file externs.h.
Referenced by add_prefix(), check_filter(), did_it(), do_switch(), do_think(), eval_boolexp(), page_return(), process_cmdent(), and process_command().
#define EXAM_BRIEF 1 |
#define EXAM_DEBUG 4 |
#define EXAM_DEFAULT 0 |
#define EXAM_PARENT 8 |
#define FIXDB_CON 4 |
#define FIXDB_EXITS 8 |
#define FIXDB_LOC 2 |
#define FIXDB_NAME 2048 |
#define FIXDB_NEXT 16 |
#define FIXDB_OWNER 1 |
#define FIXDB_PENNIES 32 |
#define GIVE_QUIET 64 |
#define GLOB_DISABLE 2 |
#define GLOB_ENABLE 1 |
#define HUSH_ENTER 1 |
Definition at line 569 of file externs.h.
Referenced by do_teleport(), move_via_teleport(), and process_enter_loc().
#define HUSH_EXIT 4 |
Definition at line 571 of file externs.h.
Referenced by do_move(), move_exit(), and move_via_exit().
#define HUSH_LEAVE 2 |
Definition at line 570 of file externs.h.
Referenced by do_leave(), do_teleport(), move_via_teleport(), and process_leave_loc().
#define LK_IDESC 0x0001 |
#define LK_OBEYTERSE 0x0002 |
Definition at line 629 of file externs.h.
Referenced by announce_connect(), do_look(), look_in(), move_object(), and show_desc().
#define LK_SHOWATTR 0x0004 |
#define LK_SHOWEXIT 0x0008 |
Definition at line 631 of file externs.h.
Referenced by announce_connect(), do_look(), look_in(), and move_object().
#define LOG_SIMPLE | ( | key, | |||
p, | |||||
s, | |||||
m | ) |
#define MOVE_QUIET 1 |
#define MSG_COLORIZE 16384 |
Definition at line 618 of file externs.h.
Referenced by mecha_notify_except(), and notify_checked().
#define MSG_F_CONTENTS (MSG_INV) |
#define MSG_F_DOWN (MSG_INV_L) |
Definition at line 624 of file externs.h.
Referenced by mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
#define MSG_F_UP (MSG_NBR_A|MSG_LOC_A) |
Definition at line 623 of file externs.h.
Referenced by mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
#define MSG_FWDLIST 1024 |
Definition at line 614 of file externs.h.
Referenced by announce_connect(), announce_disconnect(), and notify_checked().
#define MSG_INV 2 |
Definition at line 605 of file externs.h.
Referenced by announce_connect(), announce_disconnect(), handle_ears(), and notify_checked().
#define MSG_INV_EXITS 8 |
#define MSG_INV_L 4 |
#define MSG_LOC 256 |
Definition at line 612 of file externs.h.
Referenced by announce_connect(), announce_disconnect(), handle_ears(), and notify_checked().
#define MSG_LOC_A 512 |
#define MSG_ME 2048 |
Definition at line 615 of file externs.h.
Referenced by handle_ears(), mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
#define MSG_ME_ALL (MSG_ME|MSG_INV_EXITS|MSG_FWDLIST) |
Definition at line 621 of file externs.h.
Referenced by mecha_notify_except(), notify_except(), and notify_except2().
#define MSG_NBR 16 |
Definition at line 608 of file externs.h.
Referenced by announce_connect(), announce_disconnect(), handle_ears(), and notify_checked().
#define MSG_NBR_A 32 |
#define MSG_NBR_EXITS 64 |
Definition at line 610 of file externs.h.
Referenced by announce_connect(), announce_disconnect(), and notify_checked().
#define MSG_NBR_EXITS_A 128 |
Definition at line 611 of file externs.h.
Referenced by mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
#define MSG_NO_SLAVE 65536 |
#define MSG_PUP_ALWAYS 1 |
#define MSG_S_INSIDE 4096 |
Definition at line 616 of file externs.h.
Referenced by mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
#define MSG_S_OUTSIDE 8192 |
Definition at line 617 of file externs.h.
Referenced by mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
#define NFY_DRAIN 2 |
#define notify | ( | p, | |||
m | ) | notify_checked(p,p,m, MSG_PUP_ALWAYS|MSG_ME_ALL|MSG_F_DOWN) |
Definition at line 76 of file externs.h.
Referenced by add_mail_message(), aero_checklz(), aero_land(), aero_takeoff(), auto_addcommand(), auto_delcommand(), auto_disengage(), auto_engage(), auto_eventstats(), auto_jump(), autoeject(), badname_list(), canpayfees(), cf_log_notfound(), cf_set(), cf_status_from_succfail(), cf_string(), char_disembark(), char_eject(), check_mail(), CheckData(), common_checks(), create_obj(), CreateNewSpecialObject(), debug_EventTypes(), debug_examine(), debug_loaddb(), debug_savedb(), debug_xptop(), destroy_obj(), did_it(), display_flagtab(), display_powertab(), DisplayTarget(), DisposeSpecialObject(), do_add_macro(), do_addcommand(), do_admin(), do_attribute(), do_boot(), do_charstatus(), do_chmod_macro(), do_chown_macro(), do_chzone(), do_clear_macro(), do_comprintf(), do_comsend(), do_create_macro(), do_dbck(), do_dbclean(), do_def_macro(), do_del_macro(), do_delcommand(), do_desc_macro(), do_destroy(), do_doing(), do_dolist(), do_drop(), do_dump(), do_edit_macro(), do_edit_msg(), do_enter(), do_enter_internal(), do_ex_macro(), do_examine(), do_expmail_abort(), do_expmail_start(), do_expmail_stop(), do_find(), do_fixdb(), do_get(), do_gex_macro(), do_give(), do_halt(), do_inventory(), do_kill(), do_last(), do_leave(), do_list_macro(), do_macro(), do_mail(), do_mail_cc(), do_mail_change_folder(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_fwd(), do_mail_list(), do_mail_nuke(), do_mail_proof(), do_mail_purge(), do_mail_quick(), do_mail_read(), do_mail_retract(), do_mail_review(), do_mail_stats(), do_mail_stub(), do_malias(), do_malias_add(), do_malias_adminlist(), do_malias_chown(), do_malias_create(), do_malias_delete(), do_malias_desc(), do_malias_list(), do_malias_list_all(), do_malias_remove(), do_malias_rename(), do_malias_send(), do_malias_status(), do_move(), do_notify(), do_page(), do_password(), do_pemit(), do_pemit_list(), do_postpend(), do_prepend(), do_prog(), do_ps(), do_queue(), do_quitprog(), do_restart(), do_search(), do_show(), do_show_com(), do_show_stat(), do_stats(), do_status_macro(), do_sweep(), do_teleport(), do_think(), do_undef_macro(), do_verb(), do_version(), do_wait(), Dump_Mech(), DumpMaps(), er_mark_disabled(), eval_boolexp(), exam_wildattrs(), fcache_load(), fh_going_bit(), fh_wiz_bit(), FindBSuitTarget(), FireSpot(), flag_set(), fun_bttechtime(), fun_list(), get_stats(), give_money(), give_thing(), heat_cutoff(), ice_growth(), ice_melt(), initiate_ood(), invalid_section(), list_charvaluestuff(), list_mapobjs(), list_sites(), list_xcodevalues(), ListForms(), loading_bay_whine(), logcache_list(), look_contents(), look_exits(), look_in(), look_simple(), make_numlist(), map_addfire(), map_addhex(), map_addsmoke(), map_delobj(), map_listmechs(), map_loadmap(), map_mapemit(), map_setconditions(), map_setmapsize(), map_view(), match_status(), mech_bearing(), mech_charge(), mech_contacts(), mech_embark(), mech_enterbay(), mech_eta(), mech_land(), mech_list_freqs(), mech_list_maker(), mech_losemit(), mech_lrsmap(), mech_mechprefs(), mech_navigate(), mech_notify(), mech_printf(), mech_range(), mech_rotatetorso(), mech_Rresetstuff(), mech_Rsetmapindex(), mech_Rsetteam(), mech_scan(), mech_sendchannel(), mech_settarget(), Mech_ShowFlags(), mech_sight(), mech_speed(), mech_stand(), mech_status(), mech_tacmap(), mech_target(), mech_toggle_mode_sub_func(), mech_turnmode(), mech_udisembark(), mech_vector(), mech_vertical(), mech_view(), mech_weaponstatus(), mech_weight_sub(), mechrep_Raddinftech(), mechrep_Raddspecial(), mechrep_Raddtech(), mechrep_Rdelinftech(), mechrep_Rdeltech(), mechrep_Rfiremode(), mechrep_Rloadnew(), mechrep_Rreload(), mechrep_Rrepair(), mechrep_Rresetcrits(), mechrep_Rrestore(), mechrep_Rsavetemp(), mechrep_Rsavetemp2(), mechrep_Rsetarmor(), mechrep_Rsetmove(), mechrep_Rsetradio(), mechrep_Rsettarget(), mechrep_Rsettype(), mechrep_Rshowtech(), move_exit(), page_check(), parse_msglist(), parse_tacargs(), power_set(), PrintArmorStatus(), PrintEnemyStatus(), PrintEnemyWeaponStatus(), PrintGenericStatus(), PrintHeatBar(), PrintInfoStatus(), PrintReport(), PrintShortInfo(), PrintWeaponStatus(), process_cmdent(), process_command(), record_login(), search_setup(), send_mail(), sensor_mode(), set_colorscheme(), setup_que(), show_lrs_map(), show_narc_pods(), showNetworkData(), showNetworkTargets(), ShowText(), ShowTurretFacing(), showWeaponDamageAndInfo(), sp_ok(), tech_status(), TECHCOMMANDH(), TFUNC_LOCPOS(), and TFUNC_LOCPOS_VAL().
#define notify_all | ( | p, | |||
c, | |||||
m | ) |
#define notify_all_from_inside | ( | p, | |||
c, | |||||
m | ) |
#define notify_all_from_outside | ( | p, | |||
c, | |||||
m | ) |
Value:
#define notify_puppet | ( | p, | |||
c, | |||||
m | ) |
#define notify_quiet | ( | p, | |||
m | ) |
Value:
notify_checked(p,p,m, \ MSG_PUP_ALWAYS|MSG_ME)
Definition at line 77 of file externs.h.
Referenced by can_destroy_exit(), can_destroy_player(), destroy_player(), do_alias(), do_boot(), do_chown(), do_clone(), do_create(), do_cut(), do_destroy(), do_dig(), do_edit(), do_examine(), do_find(), do_function(), do_global(), do_link(), do_lock(), do_look(), do_motd(), do_mvattr(), do_name(), do_newpassword(), do_notify(), do_parent(), do_pcreate(), do_power(), do_quota(), do_set(), do_setvattr(), do_sweep(), do_teleport(), do_toad(), do_trigger(), do_unlink(), do_unlock(), do_use(), do_verb(), do_wait(), do_wipe(), exam_wildattrs(), fun_regmatch(), link_exit(), match_affected(), match_controlled(), match_examinable(), move_via_teleport(), open_exit(), parse_linkable_room(), set_attr_internal(), and show_quota().
#define notify_quiet_puppet | ( | p, | |||
c, | |||||
m | ) |
#define notify_quiet_with_cause | ( | p, | |||
c, | |||||
m | ) |
#define notify_with_cause | ( | p, | |||
c, | |||||
m | ) |
Value:
Definition at line 79 of file externs.h.
Referenced by do_kill(), do_page(), do_pemit(), do_pemit_list(), give_money(), give_thing(), page_return(), and whisper_pose().
#define PCRE_ROBOT 2 |
#define PEMIT_CONTENTS 8 |
#define PEMIT_FEMIT 5 |
#define PEMIT_FPOSE 6 |
#define PEMIT_FPOSE_NS 7 |
#define PEMIT_FSAY 4 |
#define PEMIT_HERE 16 |
#define PEMIT_LIST 64 |
#define PEMIT_OEMIT 2 |
#define PEMIT_PEMIT 1 |
#define PEMIT_ROOM 32 |
#define PEMIT_WHISPER 3 |
#define PS_ALL 4 |
#define PS_LONG 1 |
#define PS_SUMM 2 |
#define QUEUE_KICK 1 |
#define QUEUE_WARP 2 |
#define QUOTA_ALL 16 |
#define QUOTA_FIX 2 |
#define QUOTA_REM 8 |
#define QUOTA_SET 1 |
#define QUOTA_TOT 4 |
#define SA_EXIT 1 |
#define safe_atoi | ( | s | ) | ((s == NULL) ? 0 : atoi(s)) |
#define SAY_NOTAG 32 |
#define SET_QUIET 1 |
Definition at line 532 of file externs.h.
Referenced by bt_set_attr(), do_set(), flag_set(), power_set(), and set_attr_internal().
#define SHUTDN_EXIT 2 |
#define SHUTDN_PANIC 1 |
#define STARTLOG | ( | key, | |||
p, | |||||
s | ) | if ((((key) & mudconf.log_options) != 0) && start_log(p, s)) |
Definition at line 647 of file externs.h.
Referenced by check_connect(), do_boot(), do_fixdb(), do_help(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_say(), do_shutdown(), do_toad(), dump_database(), eval_boolexp(), failconn(), helpindex_read(), init_version(), load_game(), Log_header_err(), Log_pointer_err(), Log_simple_err(), main(), process_command(), and report().
#define STAT_ALL 1 |
#define STAT_ME 2 |
#define STAT_PLAYER 0 |
#define SWEEP_COMMANDS 4 |
#define SWEEP_CONNECT 32 |
#define SWEEP_EXITS 64 |
#define SWEEP_HERE 2 |
#define SWEEP_LISTEN 8 |
#define SWEEP_ME 1 |
#define SWEEP_PLAYER 16 |
#define SWEEP_VERBOSE 256 |
#define SWITCH_ANY 1 |
#define SWITCH_DEFAULT 0 |
#define SWITCH_ONE 2 |
#define TELEPORT_QUIET 2 |
#define ToLower | ( | C | ) | (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C)) |
Definition at line 28 of file externs.h.
Referenced by add_player_name(), ccode(), cf_acmd_access(), cf_alias(), char_getvaluecode(), delete_player_name(), do_function(), exec(), find_flag(), find_matching_short_part(), find_matching_vlong_part(), find_power(), fun_lcstr(), fun_trim(), get_list_type(), HandledCommand_sub(), help_write(), helpindex_read(), init_btechstats(), init_cmdtab(), init_flagtab(), init_functab(), init_powertab(), InitSpecialHash(), lookup_player(), matches_exit_from_list(), minmatch(), prefix_match(), process_command(), string_compare(), and string_prefix().
#define ToUpper | ( | C | ) | (((C) >= 'a' && (C) <= 'z')? (C) - 'a' + 'A': (C)) |
Definition at line 27 of file externs.h.
Referenced by atr_str(), cf_alias(), do_attribute(), exec(), fixcase(), fun_capstr(), fun_ucstr(), init_attrtab(), and upcasestr().
#define TRIG_QUIET 1 |
#define TWARP_CLEAN 4 |
#define TWARP_DUMP 2 |
#define TWARP_EVENTS 32 |
#define TWARP_IDLE 8 |
#define TWARP_QUEUE 1 |
#define VE_BASE_DARK 0x10 |
Definition at line 639 of file externs.h.
Referenced by exit_displayable(), exit_visible(), fun_lexits(), look_exits(), and match_exit_internal().
#define VE_LOC_DARK 0x02 |
Definition at line 636 of file externs.h.
Referenced by exit_displayable(), exit_visible(), fun_exit(), fun_lexits(), fun_next(), look_exits(), and match_exit_internal().
#define VE_LOC_XAM 0x01 |
Definition at line 635 of file externs.h.
Referenced by exit_visible(), fun_exit(), fun_lexits(), fun_next(), and match_exit_internal().
int add_player_name | ( | dbref | , | |
char * | ||||
) |
Definition at line 389 of file player.c.
References alloc_lbuf, AMBIGUOUS, free_lbuf, hashfind(), mudstate, statedata::player_htab, safe_str, and ToLower.
Referenced by create_obj(), do_alias(), do_fixdb(), do_name(), and load_player_names().
00390 { 00391 int stat; 00392 dbref *p; 00393 char *temp, *tp; 00394 00395 /* 00396 * Convert to all lowercase 00397 */ 00398 00399 tp = temp = alloc_lbuf("add_player_name"); 00400 safe_str(name, temp, &tp); 00401 *tp = '\0'; 00402 for(tp = temp; *tp; tp++) 00403 *tp = ToLower(*tp); 00404 00405 p = (int *) hashfind(temp, &mudstate.player_htab); 00406 if(p) { 00407 00408 /* 00409 * Entry found in the hashtable. If a player, succeed if the 00410 * * * numbers match (already correctly in the hash table), 00411 * fail * * if they don't. Fail if the name is a disallowed 00412 * name * * (value AMBIGUOUS). 00413 */ 00414 00415 if(*p == AMBIGUOUS) { 00416 free_lbuf(temp); 00417 return 0; 00418 } 00419 if(Good_obj(*p) && (Typeof(*p) == TYPE_PLAYER)) { 00420 free_lbuf(temp); 00421 if(*p == player) { 00422 return 1; 00423 } else { 00424 return 0; 00425 } 00426 } 00427 /* 00428 * It's an alias (or an incorrect entry). Clobber it 00429 */ 00430 free(p); 00431 p = (dbref *) malloc(sizeof(int)); 00432 00433 *p = player; 00434 stat = hashrepl(temp, p, &mudstate.player_htab); 00435 free_lbuf(temp); 00436 } else { 00437 p = (dbref *) malloc(sizeof(int)); 00438 00439 *p = player; 00440 stat = hashadd(temp, p, &mudstate.player_htab); 00441 free_lbuf(temp); 00442 stat = (stat < 0) ? 0 : 1; 00443 } 00444 return stat; 00445 }
void add_quota | ( | dbref | , | |
int | ||||
) |
Definition at line 368 of file predicates.c.
References A_RQUOTA, atr_add_raw(), atr_get(), and free_lbuf.
Referenced by chown_all(), destroy_obj(), do_chown(), and link_exit().
00369 { 00370 dbref aowner; 00371 int aflags; 00372 char buf[20], *quota; 00373 00374 quota = atr_get(who, A_RQUOTA, &aowner, &aflags); 00375 sprintf(buf, "%d", atoi(quota) + payment); 00376 free_lbuf(quota); 00377 atr_add_raw(who, A_RQUOTA, buf); 00378 }
Definition at line 1280 of file db.c.
References atr_add_raw(), atr_clr(), atr_encode(), and LBUF_SIZE.
Referenced by add_folder_name(), atr_chown(), atr_cpy(), atr_set_flags(), atr_set_owner(), check_dead_refs(), do_alias(), do_edit(), do_edit_msg(), do_mvattr(), do_page(), set_attr_internal(), and set_player_folder().
01281 { 01282 char *tbuff; 01283 char buffer[LBUF_SIZE]; 01284 01285 if(!buff || !*buff) { 01286 atr_clr(thing, atr); 01287 } else { 01288 tbuff = atr_encode(buff, thing, owner, flags, atr, buffer); 01289 atr_add_raw(thing, atr, tbuff); 01290 } 01291 }
void atr_add_raw | ( | dbref | , | |
int | , | |||
char * | ||||
) |
Definition at line 1172 of file db.c.
References A_DAILY, A_FORWARDLIST, A_HOURLY, A_LISTEN, A_QUEUEMAX, A_STARTUP, A_TIMEOUT, atr_clr(), atrlist::data, flatfiledb::db, desc_reload(), Flags, Flags2, HAS_DAILY, HAS_FWDLIST, HAS_HOURLY, HAS_LISTEN, HAS_STARTUP, LBUF_SIZE, number, atrlist::number, pcache_reload(), s_Flags, s_Flags2, atrlist::size, and StringCopy.
Referenced by add_quota(), add_to(), atr_add(), connect_player(), create_obj(), db_read(), destroy_guest(), did_it(), do_destroy(), do_expmail_start(), do_lock(), do_mail_cc(), do_mail_fwd(), do_password(), do_postpend(), do_prepend(), do_prog(), fun_setlock(), get_list(), mmdb_db_read(), mung_quotas(), pay_quota(), pcache_save(), record_login(), s_Name(), s_Pass(), s_Pennies(), set_lastsite(), and silly_atr_set().
01173 { 01174 ATRLIST *list; 01175 char *text; 01176 int found = 0; 01177 int hi, lo, mid; 01178 01179 if(!buff || !*buff) { 01180 atr_clr(thing, atr); 01181 return; 01182 } 01183 if(strlen(buff) >= LBUF_SIZE) { 01184 buff[LBUF_SIZE - 1] = '\0'; 01185 } 01186 if((text = (char *) malloc(strlen(buff) + 1)) == NULL) { 01187 return; 01188 } 01189 StringCopy(text, buff); 01190 01191 if(!db[thing].ahead) { 01192 if((list = (ATRLIST *) malloc(sizeof(ATRLIST))) == NULL) { 01193 free(text); 01194 return; 01195 } 01196 db[thing].ahead = list; 01197 db[thing].at_count = 1; 01198 list[0].number = atr; 01199 list[0].data = text; 01200 list[0].size = strlen(text) + 1; 01201 found = 1; 01202 } else { 01203 01204 /* 01205 * Binary search for the attribute 01206 */ 01207 lo = 0; 01208 hi = db[thing].at_count - 1; 01209 01210 list = db[thing].ahead; 01211 while (lo <= hi) { 01212 mid = ((hi - lo) >> 1) + lo; 01213 if(list[mid].number == atr) { 01214 free(list[mid].data); 01215 list[mid].data = text; 01216 list[mid].size = strlen(text) + 1; 01217 found = 1; 01218 break; 01219 } else if(list[mid].number > atr) { 01220 hi = mid - 1; 01221 } else { 01222 lo = mid + 1; 01223 } 01224 } 01225 01226 if(!found) { 01227 /* 01228 * If we got here, we didn't find it, so lo = hi + 1, 01229 * and the attribute should be inserted between them. 01230 */ 01231 01232 list = 01233 (ATRLIST *) realloc(db[thing].ahead, 01234 (db[thing].at_count + 01235 1) * sizeof(ATRLIST)); 01236 01237 if(!list) 01238 return; 01239 01240 /* 01241 * Move the stuff upwards one slot 01242 */ 01243 if(lo < db[thing].at_count) 01244 bcopy((char *) (list + lo), (char *) (list + lo + 1), 01245 (db[thing].at_count - lo) * sizeof(ATRLIST)); 01246 01247 list[lo].data = text; 01248 list[lo].number = atr; 01249 list[lo].size = strlen(text) + 1; 01250 db[thing].at_count++; 01251 db[thing].ahead = list; 01252 } 01253 } 01254 01255 switch (atr) { 01256 case A_STARTUP: 01257 s_Flags(thing, Flags(thing) | HAS_STARTUP); 01258 break; 01259 case A_DAILY: 01260 s_Flags2(thing, Flags2(thing) | HAS_DAILY); 01261 break; 01262 case A_HOURLY: 01263 s_Flags2(thing, Flags2(thing) | HAS_HOURLY); 01264 break; 01265 case A_FORWARDLIST: 01266 s_Flags2(thing, Flags2(thing) | HAS_FWDLIST); 01267 break; 01268 case A_LISTEN: 01269 s_Flags2(thing, Flags2(thing) | HAS_LISTEN); 01270 break; 01271 case A_TIMEOUT: 01272 desc_reload(thing); 01273 break; 01274 case A_QUEUEMAX: 01275 pcache_reload(thing); 01276 break; 01277 } 01278 }
void atr_chown | ( | dbref | ) |
Definition at line 1519 of file db.c.
References AF_LOCK, atr_add(), atr_get(), atr_head(), atr_next(), attr, free_lbuf, and Owner.
Referenced by do_chown().
01520 { 01521 int attr, aflags; 01522 dbref owner, aowner; 01523 char *as, *buf; 01524 01525 owner = Owner(obj); 01526 for(attr = atr_head(obj, &as); attr; attr = atr_next(&as)) { 01527 buf = atr_get(obj, attr, &aowner, &aflags); 01528 if((aowner != owner) && !(aflags & AF_LOCK)) 01529 atr_add(obj, attr, buf, owner, aflags); 01530 free_lbuf(buf); 01531 } 01532 }
void atr_clr | ( | dbref | , | |
int | ||||
) |
Definition at line 1109 of file db.c.
References A_DAILY, A_FORWARDLIST, A_HOURLY, A_LISTEN, A_QUEUEMAX, A_STARTUP, A_TIMEOUT, flatfiledb::db, desc_reload(), Flags, Flags2, HAS_DAILY, HAS_FWDLIST, HAS_HOURLY, HAS_LISTEN, HAS_STARTUP, number, pcache_reload(), s_Flags, and s_Flags2.
Referenced by atr_add(), atr_add_raw(), do_alias(), do_expmail_start(), do_mvattr(), do_quitprog(), do_unlock(), do_wipe(), fun_setlock(), handle_prog(), and nfy_que().
01110 { 01111 ATRLIST *list; 01112 int hi, lo, mid; 01113 01114 if(!db[thing].at_count || !db[thing].ahead) 01115 return; 01116 01117 if(db[thing].at_count < 0) 01118 abort(); 01119 01120 /* 01121 * Binary search for the attribute. 01122 */ 01123 lo = 0; 01124 hi = db[thing].at_count - 1; 01125 list = db[thing].ahead; 01126 while (lo <= hi) { 01127 mid = ((hi - lo) >> 1) + lo; 01128 if(list[mid].number == atr) { 01129 free(list[mid].data); 01130 db[thing].at_count -= 1; 01131 if(mid != db[thing].at_count) 01132 bcopy((char *) (list + mid + 1), (char *) (list + mid), 01133 (db[thing].at_count - mid) * sizeof(ATRLIST)); 01134 break; 01135 } else if(list[mid].number > atr) { 01136 hi = mid - 1; 01137 } else { 01138 lo = mid + 1; 01139 } 01140 } 01141 01142 switch (atr) { 01143 case A_STARTUP: 01144 s_Flags(thing, Flags(thing) & ~HAS_STARTUP); 01145 break; 01146 case A_DAILY: 01147 s_Flags2(thing, Flags2(thing) & ~HAS_DAILY); 01148 break; 01149 case A_HOURLY: 01150 s_Flags2(thing, Flags2(thing) & ~HAS_HOURLY); 01151 break; 01152 case A_FORWARDLIST: 01153 s_Flags2(thing, Flags2(thing) & ~HAS_FWDLIST); 01154 break; 01155 case A_LISTEN: 01156 s_Flags2(thing, Flags2(thing) & ~HAS_LISTEN); 01157 break; 01158 case A_TIMEOUT: 01159 desc_reload(thing); 01160 break; 01161 case A_QUEUEMAX: 01162 pcache_reload(thing); 01163 break; 01164 } 01165 }
Definition at line 1487 of file db.c.
References AF_LOCK, atr_add(), atr_get(), atr_head(), atr_next(), atr_num(), attr, free_lbuf, Owner, and Write_attr.
Referenced by create_guest(), and do_clone().
01488 { 01489 int attr, aflags; 01490 dbref owner, aowner; 01491 char *as, *buf; 01492 ATTR *at; 01493 01494 owner = Owner(dest); 01495 for(attr = atr_head(source, &as); attr; attr = atr_next(&as)) { 01496 buf = atr_get(source, attr, &aowner, &aflags); 01497 if(!(aflags & AF_LOCK)) 01498 aowner = owner; /* 01499 * chg owner 01500 */ 01501 at = atr_num(attr); 01502 if(attr && at) { 01503 if(Write_attr(owner, dest, at, aflags)) 01504 /* 01505 * Only set attrs that owner has perm to set 01506 */ 01507 atr_add(dest, attr, buf, aowner, aflags); 01508 } 01509 free_lbuf(buf); 01510 } 01511 }
void atr_free | ( | dbref | ) |
Definition at line 1464 of file db.c.
References flatfiledb::db.
Referenced by create_obj(), destroy_obj(), and do_clone().
Definition at line 1377 of file db.c.
References alloc_lbuf, and atr_get_str().
Referenced by add_folder_name(), add_mail_message(), add_quota(), add_to(), announce_connect(), atr_chown(), atr_cpy(), atr_set_flags(), atr_set_owner(), check_connect(), check_pass(), Commer(), connect_player(), could_doit(), db_write_object(), debug_examine(), do_decomp(), do_edit_msg(), do_examine(), do_expmail_stop(), do_last(), do_mail_proof(), do_password(), do_postpend(), do_prepend(), eval_boolexp(), exam_wildattrs(), exec(), fun_colorpairs(), fun_elock(), fun_eval(), fun_get(), fun_get_eval(), fun_hasattr(), fun_lock(), fun_pairs(), fun_xget(), get_folder_name(), get_folder_number(), grep_util(), handle_prog(), look_atrs1(), mung_quotas(), Name(), nfy_que(), notify_checked(), pay_quota(), process_cmdent(), PureName(), record_login(), show_quota(), xml_db_write_mux(), and xml_db_write_object().
01378 { 01379 char *buff; 01380 01381 buff = alloc_lbuf("atr_get"); 01382 return atr_get_str(buff, thing, atr, owner, flags); 01383 }
Definition at line 1385 of file db.c.
References atr_decode(), atr_get_raw(), and Owner.
Referenced by check_dead_refs(), debug_examine(), do_chown(), do_lock(), do_mvattr(), do_prog(), do_set(), do_unlock(), do_verb(), find_wild_attrs(), fun_hasattr(), fun_set(), and fun_setlock().
01386 { 01387 char *buff; 01388 01389 buff = atr_get_raw(thing, atr); 01390 if(!buff) { 01391 *owner = Owner(thing); 01392 *flags = 0; 01393 return 0; 01394 } 01395 atr_decode(buff, NULL, thing, owner, flags, atr); 01396 return 1; 01397 }
char* atr_get_raw | ( | dbref | , | |
int | ||||
) |
Definition at line 1331 of file db.c.
References atrlist::data, flatfiledb::db, and number.
Referenced by atr_get_info(), atr_get_str(), atr_pget_info(), atr_pget_str(), check_zone(), check_zone_for_player(), db_write_object(), destroy_player(), do_dbclean(), do_mail_cc(), do_mail_fwd(), do_mail_proof(), do_postpend(), do_prepend(), do_prog(), mem_usage(), pcache_reload1(), Pennies(), and show_a_desc().
01332 { 01333 int lo, mid, hi; 01334 ATRLIST *list; 01335 01336 if(thing < 0) 01337 return NULL; 01338 01339 /* 01340 * Binary search for the attribute 01341 */ 01342 lo = 0; 01343 hi = db[thing].at_count - 1; 01344 list = db[thing].ahead; 01345 if(!list) 01346 return NULL; 01347 01348 while (lo <= hi) { 01349 mid = ((hi - lo) >> 1) + lo; 01350 if(list[mid].number == atr) { 01351 01352 return list[mid].data; 01353 } else if(list[mid].number > atr) { 01354 hi = mid - 1; 01355 } else { 01356 lo = mid + 1; 01357 } 01358 } 01359 return NULL; 01360 }
Definition at line 1362 of file db.c.
References atr_decode(), atr_get_raw(), and Owner.
Referenced by atr_get(), atr_match1(), bt_get_attr(), do_edit(), do_examine(), do_mvattr(), do_page(), do_wipe(), Hearer(), mech_embark(), Name(), process_preload(), PureName(), set_lastsite(), silly_atr_get(), and sweep_check().
01363 { 01364 char *buff; 01365 01366 buff = atr_get_raw(thing, atr); 01367 if(!buff) { 01368 *owner = Owner(thing); 01369 *flags = 0; 01370 *s = '\0'; 01371 } else { 01372 atr_decode(buff, s, thing, owner, flags, atr); 01373 } 01374 return s; 01375 }
int atr_head | ( | dbref | , | |
char ** | ||||
) |
Definition at line 1561 of file db.c.
References atrcount::count, flatfiledb::db, and atrcount::thing.
Referenced by atr_chown(), atr_cpy(), atr_match1(), Commer(), db_write_object(), debug_examine(), find_wild_attrs(), Hearer(), look_atrs1(), mem_usage(), sweep_check(), xml_db_write_mux(), and xml_db_write_object().
01562 { 01563 ATRCOUNT *atr; 01564 01565 if(db[thing].at_count) { 01566 atr = (ATRCOUNT *) malloc(sizeof(ATRCOUNT)); 01567 atr->thing = thing; 01568 atr->count = 2; 01569 *attrp = (char *) atr; 01570 return db[thing].ahead[0].number; 01571 } 01572 return 0; 01573 }
Definition at line 281 of file game.c.
References atr_match1(), Good_obj, Halted, ITER_PARENTS, mudstate, nhashflush(), Parent, and statedata::parent_htab.
Referenced by list_check(), notify_checked(), and process_command().
00283 { 00284 int match, lev, result, exclude, insert; 00285 dbref parent; 00286 00287 /* 00288 * If thing is halted, don't check anything 00289 */ 00290 00291 if(Halted(thing)) 00292 return 0; 00293 00294 /* 00295 * If not checking parents, just check the thing 00296 */ 00297 00298 match = 0; 00299 if(!check_parents) 00300 return atr_match1(thing, thing, player, type, str, 0, 0); 00301 00302 /* 00303 * Check parents, ignoring halted objects 00304 */ 00305 00306 exclude = 0; 00307 insert = 1; 00308 nhashflush(&mudstate.parent_htab, 0); 00309 ITER_PARENTS(thing, parent, lev) { 00310 if(!Good_obj(Parent(parent))) 00311 insert = 0; 00312 result = 00313 atr_match1(thing, parent, player, type, str, exclude, insert); 00314 if(result > 0) { 00315 match = 1; 00316 } else if(result < 0) { 00317 return match; 00318 } 00319 exclude = 1; 00320 } 00321 00322 return match; 00323 }
int atr_next | ( | char ** | ) |
Definition at line 1539 of file db.c.
References atrcount::count, flatfiledb::db, and atrcount::thing.
Referenced by atr_chown(), atr_cpy(), atr_match1(), Commer(), db_write_object(), debug_examine(), find_wild_attrs(), Hearer(), look_atrs1(), mem_usage(), sweep_check(), xml_db_write_mux(), and xml_db_write_object().
01540 { 01541 ATRCOUNT *atr; 01542 01543 if(!attrp || !*attrp) { 01544 return 0; 01545 } else { 01546 atr = (ATRCOUNT *) * attrp; 01547 if(atr->count > db[atr->thing].at_count) { 01548 free(atr); 01549 return 0; 01550 } 01551 atr->count++; 01552 return db[atr->thing].ahead[atr->count - 2].number; 01553 } 01554 }
Definition at line 1426 of file db.c.
References alloc_lbuf, and atr_pget_str().
Referenced by add_prefix(), announce_connect(), announce_disconnect(), check_attr(), check_filter(), connect_player(), desc_reload(), destroy_player(), did_it(), do_alias(), do_chanlist(), do_chanstatus(), do_toad(), do_ufun(), eval_boolexp(), exam_wildattrs(), exec(), fun_colorpairs(), fun_default(), fun_edefault(), fun_eval(), fun_filter(), fun_fold(), fun_foreach(), fun_get(), fun_get_eval(), fun_hasattrp(), fun_map(), fun_mix(), fun_munge(), fun_pairs(), fun_sortby(), fun_udefault(), fun_v(), fun_xget(), fun_zfun(), get_gender(), give_money(), page_return(), player_folder(), process_command(), show_desc(), and silly_atr_get().
01427 { 01428 char *buff; 01429 01430 buff = alloc_lbuf("atr_pget"); 01431 return atr_pget_str(buff, thing, atr, owner, flags); 01432 }
Definition at line 1434 of file db.c.
References AF_PRIVATE, atr_decode(), atr_get_raw(), atr_num(), attr::flags, Good_obj, ITER_PARENTS, Owner, and Parent.
Referenced by do_alias(), do_notify(), do_wait(), fun_hasattrp(), fun_owner(), fun_v(), fun_visible(), parse_attrib(), and set_attr_internal().
01435 { 01436 char *buff; 01437 dbref parent; 01438 int lev; 01439 ATTR *ap; 01440 01441 ITER_PARENTS(thing, parent, lev) { 01442 buff = atr_get_raw(parent, atr); 01443 if(buff && *buff) { 01444 atr_decode(buff, NULL, thing, owner, flags, atr); 01445 if((lev == 0) || !(*flags & AF_PRIVATE)) 01446 return 1; 01447 } 01448 if((lev == 0) && Good_obj(Parent(parent))) { 01449 ap = atr_num(atr); 01450 if(!ap || ap->flags & AF_PRIVATE) 01451 break; 01452 } 01453 } 01454 *owner = Owner(thing); 01455 *flags = 0; 01456 return 0; 01457 }
Definition at line 1399 of file db.c.
References AF_PRIVATE, atr_decode(), atr_get_raw(), atr_num(), attr::flags, Good_obj, ITER_PARENTS, Owner, and Parent.
Referenced by atr_pget(), do_set(), do_use(), fun_set(), and load_player_names().
01400 { 01401 char *buff; 01402 dbref parent; 01403 int lev; 01404 01405 ATTR *ap; 01406 01407 ITER_PARENTS(thing, parent, lev) { 01408 buff = atr_get_raw(parent, atr); 01409 if(buff && *buff) { 01410 atr_decode(buff, s, thing, owner, flags, atr); 01411 if((lev == 0) || !(*flags & AF_PRIVATE)) 01412 return s; 01413 } 01414 if((lev == 0) && Good_obj(Parent(parent))) { 01415 ap = atr_num(atr); 01416 if(!ap || ap->flags & AF_PRIVATE) 01417 break; 01418 } 01419 } 01420 *owner = Owner(thing); 01421 *flags = 0; 01422 *s = '\0'; 01423 return s; 01424 }
void atr_pop | ( | void | ) |
void atr_push | ( | void | ) |
void atr_set_flags | ( | dbref | , | |
int | , | |||
int | ||||
) |
Definition at line 1304 of file db.c.
References atr_add(), atr_get(), and free_lbuf.
Referenced by do_lock(), do_set(), do_unlock(), fun_set(), and fun_setlock().
01305 { 01306 dbref aowner; 01307 int aflags; 01308 char *buff; 01309 01310 buff = atr_get(thing, atr, &aowner, &aflags); 01311 atr_add(thing, atr, buff, aowner, flags); 01312 free_lbuf(buff); 01313 }
Definition at line 1293 of file db.c.
References atr_add(), atr_get(), and free_lbuf.
Referenced by do_chown().
01294 { 01295 dbref aowner; 01296 int aflags; 01297 char *buff; 01298 01299 buff = atr_get(thing, atr, &aowner, &aflags); 01300 atr_add(thing, atr, buff, owner, aflags); 01301 free_lbuf(buff); 01302 }
void badname_add | ( | char * | bad_name | ) |
badname_add, badname_check, badname_list: Add/look for/display bad names.
Definition at line 537 of file player.c.
References statedata::badname_head, mudstate, badname_struc::name, badname_struc::next, StringCopy, and XMALLOC.
Referenced by cf_badname().
00538 { 00539 BADNAME *bp; 00540 00541 /* 00542 * Make a new node and link it in at the top 00543 */ 00544 00545 bp = (BADNAME *) XMALLOC(sizeof(BADNAME), "badname.struc"); 00546 bp->name = XMALLOC(strlen(bad_name) + 1, "badname.name"); 00547 bp->next = mudstate.badname_head; 00548 mudstate.badname_head = bp; 00549 StringCopy(bp->name, bad_name); 00550 }
int badname_check | ( | char * | ) |
Definition at line 574 of file player.c.
References statedata::badname_head, mudstate, badname_struc::name, badname_struc::next, and quick_wild().
Referenced by create_obj(), do_alias(), and do_name().
00575 { 00576 BADNAME *bp; 00577 00578 /* 00579 * Walk the badname list, doing wildcard matching. If we get a hit * 00580 * 00581 * * * * * * then return false. If no matches in the list, return 00582 * true. 00583 */ 00584 00585 for(bp = mudstate.badname_head; bp; bp = bp->next) { 00586 if(quick_wild(bp->name, bad_name)) 00587 return 0; 00588 } 00589 return 1; 00590 }
void badname_list | ( | dbref | , | |
const char * | ||||
) |
Definition at line 592 of file player.c.
References alloc_lbuf, statedata::badname_head, free_lbuf, mudstate, badname_struc::name, badname_struc::next, notify, safe_chr, and safe_str.
Referenced by do_list().
00593 { 00594 BADNAME *bp; 00595 char *buff, *bufp; 00596 00597 /* 00598 * Construct an lbuf with all the names separated by spaces 00599 */ 00600 00601 buff = bufp = alloc_lbuf("badname_list"); 00602 safe_str((char *) prefix, buff, &bufp); 00603 for(bp = mudstate.badname_head; bp; bp = bp->next) { 00604 safe_chr(' ', buff, &bufp); 00605 safe_str(bp->name, buff, &bufp); 00606 } 00607 *bufp = '\0'; 00608 00609 /* 00610 * Now display it 00611 */ 00612 00613 notify(player, buff); 00614 free_lbuf(buff); 00615 }
void badname_remove | ( | char * | ) |
Definition at line 552 of file player.c.
References statedata::badname_head, mudstate, badname_struc::name, badname_struc::next, string_compare(), and XFREE.
Referenced by cf_badname().
00553 { 00554 BADNAME *bp, *backp; 00555 00556 /* 00557 * Look for an exact match on the bad name and remove if found 00558 */ 00559 00560 backp = NULL; 00561 for(bp = mudstate.badname_head; bp; backp = bp, bp = bp->next) { 00562 if(!string_compare(bad_name, bp->name)) { 00563 if(backp) 00564 backp->next = bp->next; 00565 else 00566 mudstate.badname_head = bp->next; 00567 XFREE(bp->name, "badname.name"); 00568 XFREE(bp, "badname.struc"); 00569 return; 00570 } 00571 } 00572 }
void bind_descriptor | ( | DESC * | ) |
Definition at line 131 of file bsd.c.
References descriptor_data::refcount.
Referenced by accept_client_input(), desc_addhash(), initializesock(), and process_input().
00131 { 00132 d->refcount++; 00133 //dprintk("bound desciptor %p, refcount now %d", d, d->refcount); 00134 }
void bind_signals | ( | ) |
Definition at line 54 of file signal.c.
References ALT_STACK_ALIGN, ALT_STACK_SIZE, dperror, dprintk, log_error(), LOG_PROBLEMS, posix_memalign(), regular_stack, saBUS, saSEGV, saTERM, saUSR1, and sighandler_stack.
Referenced by main().
00055 { 00056 int error_code; 00057 dprintk("creating alternate signal stack."); 00058 #ifdef HAVE_POSIX_MEMALIGN 00059 error_code = posix_memalign(&sighandler_stack.ss_sp, ALT_STACK_ALIGN, 00060 ALT_STACK_SIZE); 00061 #else 00062 sighandler_stack.ss_sp = malloc(ALT_STACK_SIZE); 00063 if(sighandler_stack.ss_sp != 0) error_code = 0; 00064 #endif 00065 if(error_code == 0) { 00066 sighandler_stack.ss_size = ALT_STACK_SIZE; 00067 sighandler_stack.ss_flags = 0; 00068 memset(sighandler_stack.ss_sp, 0, ALT_STACK_SIZE); 00069 dperror(sigaltstack(&sighandler_stack, ®ular_stack) <0); 00070 dprintk("Current stack at 0x%x with length 0x%x and flags 0x%x", 00071 (unsigned int)regular_stack.ss_sp, regular_stack.ss_size, regular_stack.ss_flags); 00072 dprintk("Signal stack at 0x%x with length 0x%x and flags 0x%x", 00073 (unsigned int)sighandler_stack.ss_sp, sighandler_stack.ss_size, sighandler_stack.ss_flags); 00074 saSEGV.sa_flags |= SA_ONSTACK; 00075 saBUS.sa_flags |= SA_ONSTACK; 00076 } else { 00077 dprintk("posix_memalign failed with %s", strerror(error_code)); 00078 log_error(LOG_PROBLEMS, "SIG", "ERR", 00079 "posix_memalign() failed with error %s, alternate stack not used.", 00080 strerror(error_code)); 00081 log_error(LOG_PROBLEMS, "SIG", "ERR", 00082 "running signal_handlers without sigaltstack() will corrupt your coredumps!"); 00083 sighandler_stack.ss_sp = NULL; 00084 } 00085 dprintk("binding signals."); 00086 dperror(sigaction(SIGTERM, &saTERM, NULL) <0); 00087 // sigaction(SIGPIPE, &saPIPE, NULL); 00088 sigaction(SIGUSR1, &saUSR1, NULL); 00089 sigaction(SIGSEGV, &saSEGV, NULL); 00090 sigaction(SIGBUS, &saBUS, NULL); 00091 signal(SIGCHLD, SIG_IGN); 00092 signal(SIGPIPE, SIG_IGN); 00093 dprintk("done."); 00094 }
Definition at line 248 of file predicates.c.
References Connected, Dark, confdata::dark_sleepers, isExit, isPlayer, Light, mudconf, MyopicExam, Puppet, and confdata::see_own_dark.
Referenced by look_contents().
00249 { 00250 /* 00251 * Don't show if all the following apply: * Sleeping players should * 00252 * 00253 * * * * not be seen. * The thing is a disconnected player. * The 00254 * player * is * * * not a puppet. 00255 */ 00256 00257 if(mudconf.dark_sleepers && isPlayer(thing) && !Connected(thing) && 00258 !Puppet(thing)) { 00259 return 0; 00260 } 00261 /* 00262 * You don't see yourself or exits 00263 */ 00264 00265 if((player == thing) || isExit(thing)) { 00266 return 0; 00267 } 00268 /* 00269 * If loc is not dark, you see it if it's not dark or you control it. 00270 * * * * * If loc is dark, you see it if you control it. Seeing your 00271 * * own * * * dark objects is controlled by mudconf.see_own_dark. * 00272 * In * dark * * locations, you also see things that are LIGHT and 00273 * !DARK. 00274 */ 00275 00276 if(can_see_loc) { 00277 return (!Dark(thing) || (mudconf.see_own_dark && 00278 MyopicExam(player, thing))); 00279 } else { 00280 return ((Light(thing) && !Dark(thing)) || (mudconf.see_own_dark && 00281 MyopicExam(player, 00282 thing))); 00283 } 00284 }
Definition at line 108 of file object.c.
References Abode, Controls, Going, Good_obj, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
Referenced by clone_home(), do_link(), and new_home().
00109 { 00110 if(!Good_obj(player) || !Good_obj(home) || (thing == home)) 00111 return 0; 00112 00113 switch (Typeof(home)) { 00114 case TYPE_PLAYER: 00115 case TYPE_ROOM: 00116 case TYPE_THING: 00117 if(Going(home)) 00118 return 0; 00119 if(Controls(player, home) || Abode(home)) 00120 return 1; 00121 } 00122 return 0; 00123 }
Definition at line 323 of file predicates.c.
References Free_Money, confdata::many_coins, mudconf, notify, notify_printf(), Owner, pay_quota(), payfor(), Pennies(), confdata::quotas, and Wizard.
Referenced by create_obj(), do_chown(), and link_exit().
00324 { 00325 if(!Wizard(who) && !Wizard(Owner(who)) && !Free_Money(who) && 00326 !Free_Money(Owner(who)) && (Pennies(Owner(who)) < pennies)) { 00327 if(player == who) { 00328 notify_printf(player, "Sorry, you don't have enough %s.", 00329 mudconf.many_coins); 00330 } else { 00331 notify_printf(player, 00332 "Sorry, that player doesn't have enough %s.", 00333 mudconf.many_coins); 00334 } 00335 return 0; 00336 } 00337 if(mudconf.quotas) { 00338 if(!pay_quota(who, quota)) { 00339 if(player == who) { 00340 notify(player, "Sorry, your building contract has run out."); 00341 } else { 00342 notify(player, 00343 "Sorry, that player's building contract has run out."); 00344 } 00345 return 0; 00346 } 00347 } 00348 payfor(who, pennies); 00349 return 1; 00350 }
int cf_modify_bits | ( | int * | , | |
char * | , | |||
long | , | |||
dbref | , | |||
char * | ||||
) |
Definition at line 681 of file conf.c.
References cf_log_notfound(), cf_status_from_succfail(), GOD, search_nametab(), and strtok().
Referenced by cf_access(), cf_acmd_access(), cf_attr_access(), cf_cf_access(), cf_func_access(), and cf_ntab_access().
00682 { 00683 char *sp; 00684 int f, negate, success, failure; 00685 00686 /* 00687 * Walk through the tokens 00688 */ 00689 00690 success = failure = 0; 00691 sp = strtok(str, " \t"); 00692 while (sp != NULL) { 00693 00694 /* 00695 * Check for negation 00696 */ 00697 00698 negate = 0; 00699 if(*sp == '!') { 00700 negate = 1; 00701 sp++; 00702 } 00703 /* 00704 * Set or clear the appropriate bit 00705 */ 00706 00707 f = search_nametab(GOD, (NAMETAB *) extra, sp); 00708 if(f > 0) { 00709 if(negate) 00710 *vp &= ~f; 00711 else 00712 *vp |= f; 00713 success++; 00714 } else { 00715 cf_log_notfound(player, cmd, "Entry", sp); 00716 failure++; 00717 } 00718 00719 /* 00720 * Get the next token 00721 */ 00722 00723 sp = strtok(NULL, " \t"); 00724 } 00725 return cf_status_from_succfail(player, cmd, success, failure); 00726 }
int cf_ntab_access | ( | int * | , | |
char * | , | |||
long | , | |||
dbref | , | |||
char * | ||||
) |
Definition at line 158 of file nametab.c.
References cf_modify_bits(), name_table::minlen, minmatch(), name_table::name, and name_table::perm.
Referenced by cf_access().
00159 { 00160 NAMETAB *np; 00161 char *ap; 00162 00163 for(ap = str; *ap && !isspace(*ap); ap++); 00164 if(*ap) 00165 *ap++ = '\0'; 00166 while (*ap && isspace(*ap)) 00167 ap++; 00168 for(np = (NAMETAB *) vp; np->name; np++) { 00169 if(minmatch(str, np->name, np->minlen)) { 00170 return cf_modify_bits(&(np->perm), ap, extra, player, cmd); 00171 } 00172 } 00173 cf_log_notfound(player, cmd, "Entry", str); 00174 return -1; 00175 }
int check_access | ( | dbref | , | |
int | ||||
) |
Definition at line 805 of file command.c.
References Announce, confdata::btech_ooc_comsys, Builder, CA_ADMIN, CA_ANNOUNCE, CA_BUILDER, CA_DISABLED, CA_GOD, CA_IMMORTAL, CA_NO_GUEST, CA_NO_HAVEN, CA_NO_IC, CA_NO_ROBOT, CA_NO_SLAVE, CA_NO_SUSPECT, CA_ROBOT, CA_WIZARD, Gagged, God, Guest, Immortal, In_IC_Loc(), statedata::initializing, mudconf, mudstate, Player_haven, Robot, Slave, Suspect, Wizard, and WizRoy.
Referenced by cf_set(), check_command(), decompile_powers(), display_nametab(), do_decomp(), exec(), find_nametab_ent(), interp_nametab(), list_cf_access(), list_cmdaccess(), list_cmdswitches(), list_cmdtable(), list_functable(), listset_nametab(), process_cmdent(), process_command(), and search_nametab().
00808 { 00809 int succ, fail; 00810 00811 if(mask & CA_DISABLED) 00812 return 0; 00813 if(God(player) || mudstate.initializing) 00814 return 1; 00815 00816 succ = fail = 0; 00817 if(mask & CA_GOD) 00818 fail++; 00819 if(mask & CA_WIZARD) { 00820 if(Wizard(player)) 00821 succ++; 00822 else 00823 fail++; 00824 } 00825 if((succ == 0) && (mask & CA_ADMIN)) { 00826 if(WizRoy(player)) 00827 succ++; 00828 else 00829 fail++; 00830 } 00831 if((succ == 0) && (mask & CA_ANNOUNCE)) { 00832 if(Announce(player)) 00833 succ++; 00834 else 00835 fail++; 00836 } 00837 if((succ == 0) && (mask & CA_IMMORTAL)) { 00838 if(Immortal(player)) 00839 succ++; 00840 else 00841 fail++; 00842 } 00843 if((succ == 0) && (mask & CA_BUILDER)) { 00844 if(Builder(player)) 00845 succ++; 00846 else 00847 fail++; 00848 } 00849 if((succ == 0) && (mask & CA_ROBOT)) { 00850 if(Robot(player)) 00851 succ++; 00852 else 00853 fail++; 00854 } 00855 if(succ > 0) 00856 fail = 0; 00857 if(fail > 0) 00858 return 0; 00859 00860 /* 00861 * Check for forbidden flags. 00862 */ 00863 00864 if(!Wizard(player) && (((mask & CA_NO_HAVEN) && Player_haven(player)) 00865 || ((mask & CA_NO_ROBOT) && Robot(player)) || 00866 ((mask & CA_NO_SLAVE) && Slave(player)) || 00867 ((mask & CA_NO_SUSPECT) && Suspect(player)) || 00868 ((mask & CA_NO_GUEST) && Guest(player)) || 00869 (!mudconf.btech_ooc_comsys && (mask & CA_NO_IC) 00870 && In_IC_Loc(player)) || ((mask & CA_NO_IC) 00871 && Gagged(player)) 00872 )) 00873 return 0; 00874 return 1; 00875 }
Notifies the object target of the message msg, and optionally notify the contents, neighbors, and location also.
Definition at line 329 of file game.c.
References alloc_lbuf, atr_pget(), EV_EVAL, EV_FIGNORE, EV_STRIP, EV_TOP, exec(), free_lbuf, parse_to(), and quick_wild().
Referenced by notify_checked().
00330 { 00331 int aflags; 00332 dbref aowner; 00333 char *buf, *nbuf, *cp, *dp, *str; 00334 00335 buf = atr_pget(object, filter, &aowner, &aflags); 00336 if(!*buf) { 00337 free_lbuf(buf); 00338 return (1); 00339 } 00340 nbuf = dp = alloc_lbuf("check_filter"); 00341 str = buf; 00342 exec(nbuf, &dp, 0, object, player, EV_FIGNORE | EV_EVAL | EV_TOP, &str, 00343 (char **) NULL, 0); 00344 *dp = '\0'; 00345 dp = nbuf; 00346 free_lbuf(buf); 00347 do { 00348 cp = parse_to(&dp, ',', EV_STRIP); 00349 if(quick_wild(cp, (char *) msg)) { 00350 free_lbuf(nbuf); 00351 return (0); 00352 } 00353 } while (dp != NULL); 00354 free_lbuf(nbuf); 00355 return (1); 00356 }
int check_pass | ( | dbref | player, | |
const char * | password | |||
) |
Test a password to see if it is correct.
Definition at line 198 of file player.c.
References A_PASS, atr_get(), crypt(), and free_lbuf.
Referenced by connect_player(), and do_password().
00199 { 00200 dbref aowner; 00201 int aflags; 00202 char *target; 00203 char *hashed; 00204 00205 target = atr_get(player, A_PASS, &aowner, &aflags); 00206 hashed = crypt(password, "XX"); 00207 if(*target && strcmp(target, password) && strcmp(hashed, target)) { 00208 free_lbuf(target); 00209 return 0; 00210 } 00211 free_lbuf(target); 00212 00213 /* 00214 * This is needed to prevent entering the raw encrypted password from 00215 * working. Do it better if you like, but it's needed. 00216 * 00217 * Not really, you should just not really allow unencrypted passwords. 00218 * -Hag 00219 */ 00220 00221 if((strlen(password) == 13) && (password[0] == 'X') && 00222 (password[1] == 'X')) 00223 return 0; 00224 00225 return 1; 00226 }
Definition at line 2019 of file db.c.
References A_LENTER, atr_get_raw(), check_zone(), could_doit(), confdata::have_zones, isPlayer, mudconf, mudstate, NOTHING, Zone, confdata::zone_nest_lim, and statedata::zone_nest_num.
Referenced by check_zone(), and check_zone_for_player().
02020 { 02021 mudstate.zone_nest_num++; 02022 02023 if(!mudconf.have_zones || (Zone(thing) == NOTHING) || 02024 (mudstate.zone_nest_num == mudconf.zone_nest_lim) || 02025 (isPlayer(thing))) { 02026 mudstate.zone_nest_num = 0; 02027 return 0; 02028 } 02029 02030 /* 02031 * If the zone doesn't have an enterlock, DON'T allow control. 02032 */ 02033 02034 if(atr_get_raw(Zone(thing), A_LENTER) && 02035 could_doit(player, Zone(thing), A_LENTER)) { 02036 mudstate.zone_nest_num = 0; 02037 return 1; 02038 } else { 02039 return check_zone(player, Zone(thing)); 02040 } 02041 02042 }
Definition at line 2044 of file db.c.
References A_LENTER, atr_get_raw(), check_zone(), could_doit(), confdata::have_zones, isPlayer, mudconf, mudstate, NOTHING, Zone, confdata::zone_nest_lim, and statedata::zone_nest_num.
Referenced by do_chzone().
02045 { 02046 mudstate.zone_nest_num++; 02047 02048 if(!mudconf.have_zones || (Zone(thing) == NOTHING) || 02049 (mudstate.zone_nest_num == mudconf.zone_nest_lim) || 02050 !(isPlayer(thing))) { 02051 mudstate.zone_nest_num = 0; 02052 return 0; 02053 } 02054 02055 if(atr_get_raw(Zone(thing), A_LENTER) && 02056 could_doit(player, Zone(thing), A_LENTER)) { 02057 mudstate.zone_nest_num = 0; 02058 return 1; 02059 } else { 02060 return check_zone(player, Zone(thing)); 02061 } 02062 02063 }
void choke_player | ( | dbref | ) |
Transfers ownership of all a player's objects to another player.
Definition at line 233 of file walkdb.c.
References add_quota(), CHOWN_OK, DO_WHOLE_DB, confdata::exit_quota, Flags, HALT, INHERIT, mudconf, Owner, confdata::player_quota, confdata::room_quota, s_Flags, s_Owner, confdata::thing_quota, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
Referenced by destroy_player(), do_chownall(), and do_toad().
00234 { 00235 int i, count, quota_out, quota_in; 00236 00237 if(Typeof(from_player) != TYPE_PLAYER) 00238 from_player = Owner(from_player); 00239 if(Typeof(to_player) != TYPE_PLAYER) 00240 to_player = Owner(to_player); 00241 count = 0; 00242 quota_out = 0; 00243 quota_in = 0; 00244 DO_WHOLE_DB(i) { 00245 if((Owner(i) == from_player) && (Owner(i) != i)) { 00246 switch (Typeof(i)) { 00247 case TYPE_PLAYER: 00248 s_Owner(i, i); 00249 quota_out += mudconf.player_quota; 00250 break; 00251 case TYPE_THING: 00252 s_Owner(i, to_player); 00253 quota_out += mudconf.thing_quota; 00254 quota_in -= mudconf.thing_quota; 00255 break; 00256 case TYPE_ROOM: 00257 s_Owner(i, to_player); 00258 quota_out += mudconf.room_quota; 00259 quota_in -= mudconf.room_quota; 00260 break; 00261 case TYPE_EXIT: 00262 s_Owner(i, to_player); 00263 quota_out += mudconf.exit_quota; 00264 quota_in -= mudconf.exit_quota; 00265 break; 00266 default: 00267 s_Owner(i, to_player); 00268 } 00269 s_Flags(i, (Flags(i) & ~(CHOWN_OK | INHERIT)) | HALT); 00270 count++; 00271 } 00272 } 00273 add_quota(from_player, quota_out); 00274 add_quota(to_player, quota_in); 00275 return count; 00276 }
Definition at line 138 of file object.c.
References can_set_home(), Home, loc, new_home(), and Owner.
Referenced by do_clone().
00139 { 00140 dbref loc; 00141 00142 loc = Home(thing); 00143 if(can_set_home(Owner(player), player, loc)) 00144 return loc; 00145 return new_home(player); 00146 }
int Commer | ( | dbref | ) |
Definition at line 954 of file db.c.
References AF_NOPROG, atr_get(), atr_head(), atr_next(), atr_num(), attr, c, attr::flags, and free_lbuf.
Referenced by check_loc_contents(), and sweep_check().
00955 { 00956 char *s, *as, c; 00957 int attr, aflags; 00958 dbref aowner; 00959 ATTR *ap; 00960 00961 for(attr = atr_head(thing, &as); attr; attr = atr_next(&as)) { 00962 ap = atr_num(attr); 00963 if(!ap || (ap->flags & AF_NOPROG)) 00964 continue; 00965 00966 s = atr_get(thing, attr, &aowner, &aflags); 00967 c = *s; 00968 free_lbuf(s); 00969 if((c == '$') && !(aflags & AF_NOPROG)) { 00970 return 1; 00971 } 00972 } 00973 return 0; 00974 }
const char* compress | ( | const char * | , | |
int | ||||
) |
dbref connect_player | ( | char * | name, | |
char * | password, | |||
char * | host, | |||
char * | username | |||
) |
Try to connect to an existing player.
Definition at line 231 of file player.c.
References A_ALLOWANCE, A_LAST, atr_add_raw(), atr_get(), atr_pget(), check_pass(), free_lbuf, giveto(), lookup_player(), mudconf, NOTHING, confdata::paycheck, record_login(), and time().
Referenced by check_connect().
00232 { 00233 dbref player, aowner; 00234 int aflags; 00235 time_t tt; 00236 char *time_str, *player_last, *allowance; 00237 00238 time(&tt); 00239 time_str = ctime(&tt); 00240 time_str[strlen(time_str) - 1] = '\0'; 00241 00242 if((player = lookup_player(NOTHING, name, 0)) == NOTHING) 00243 return NOTHING; 00244 if(!check_pass(player, password)) { 00245 record_login(player, 0, time_str, host, username); 00246 return NOTHING; 00247 } 00248 time(&tt); 00249 time_str = ctime(&tt); 00250 time_str[strlen(time_str) - 1] = '\0'; 00251 00252 /* 00253 * compare to last connect see if player gets salary 00254 */ 00255 player_last = atr_get(player, A_LAST, &aowner, &aflags); 00256 if(strncmp(player_last, time_str, 10) != 0) { 00257 allowance = atr_pget(player, A_ALLOWANCE, &aowner, &aflags); 00258 if(*allowance == '\0') 00259 giveto(player, mudconf.paycheck); 00260 else 00261 giveto(player, atoi(allowance)); 00262 free_lbuf(allowance); 00263 } 00264 atr_add_raw(player, A_LAST, time_str); 00265 free_lbuf(player_last); 00266 return player; 00267 }
Definition at line 226 of file predicates.c.
References atr_get(), eval_boolexp_atr(), free_lbuf, isPlayer, Key, and Pass_Locks.
Referenced by atr_match1(), check_zone(), check_zone_for_player(), do_drop(), do_enter_internal(), do_get(), do_leave(), do_link(), do_teleport(), do_test_access(), do_use(), fwdlist_load(), give_money(), give_thing(), link_exit(), look_in(), move_exit(), move_via_teleport(), notify_checked(), open_exit(), page_check(), promote_match(), and sp_ok().
00227 { 00228 char *key; 00229 dbref aowner; 00230 int aflags, doit; 00231 00232 /* 00233 * no if nonplayer trys to get key 00234 */ 00235 00236 if(!isPlayer(player) && Key(thing)) { 00237 return 0; 00238 } 00239 if(Pass_Locks(player)) 00240 return 1; 00241 00242 key = atr_get(thing, locknum, &aowner, &aflags); 00243 doit = eval_boolexp_atr(player, thing, thing, key); 00244 free_lbuf(key); 00245 return doit; 00246 }
void cque_dump_restart | ( | struct mmdb_t * | ) |
Definition at line 220 of file cque.c.
References cque_init(), dump_bqe(), dump_objqe(), mmdb_write_uint32(), mudstate, obq, statedata::qsemfirst, statedata::qwait, rb_size(), rb_walk(), and WALK_INORDER.
Referenced by dump_restart_db_xdr().
00220 { 00221 if(obq == NULL) { 00222 cque_init(); 00223 } 00224 mmdb_write_uint32(mmdb, rb_size(obq)); 00225 if(rb_size(obq) > 0) { 00226 rb_walk(obq, WALK_INORDER, dump_objqe, mmdb); 00227 } 00228 dump_bqe(mmdb, mudstate.qwait); 00229 dump_bqe(mmdb, mudstate.qsemfirst); 00230 }
void cque_load_restart | ( | struct mmdb_t * | ) |
Definition at line 283 of file cque.c.
References load_bqe(), load_objqe(), and mmdb_read_uint32().
Referenced by load_restart_db_xdr().
00283 { 00284 int count; 00285 count = mmdb_read_uint32(mmdb); 00286 for(int i = 0; i < count; i++) { 00287 load_objqe(mmdb); 00288 } 00289 load_bqe(mmdb); // wait q 00290 load_bqe(mmdb); // sem q 00291 }
Create an object of the indicated type IF the player can afford it.
Definition at line 169 of file object.c.
References A_LAST, A_QUOTA, A_RQUOTA, add_player_name(), alloc_sbuf, atr_add_raw(), atr_free(), badname_check(), canpayfees(), confdata::createmax, confdata::createmin, db_grow(), statedata::db_top, confdata::digcost, confdata::exit_flags, confdata::exit_parent, confdata::exit_quota, free_lbuf, free_sbuf, statedata::freelist, Good_obj, Inherits, IS_CLEAN, Link, LOG_BUGS, LOG_PROBLEMS, LOG_SIMPLE, lookup_player(), make_freelist(), mudconf, mudstate, munge_space(), Name(), NOTHING, notify, notify_printf(), OBJECT_ENDOWMENT, ok_name(), ok_player_name(), confdata::opencost, Owner, confdata::paystart, confdata::player_flags, confdata::player_quota, confdata::robot_flags, confdata::robotcost, confdata::room_flags, confdata::room_parent, confdata::room_quota, s_Contents, s_Exits, s_Flags, s_Flags2, s_Flags3, s_Link, s_Location, s_Name(), s_Next, s_Owner, s_Parent, s_Pennies(), s_Zone, confdata::start_quota, confdata::thing_flags, confdata::thing_quota, time(), tprintf(), TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Unmark, flagset::word1, flagset::word2, flagset::word3, and Zone.
Referenced by create_player(), do_clone(), do_create(), do_dig(), fun_create(), and open_exit().
00170 { 00171 dbref obj, owner; 00172 int quota, okname = 0, value, self_owned, require_inherit; 00173 FLAG f1, f2, f3; 00174 time_t tt; 00175 char *buff; 00176 const char *tname; 00177 00178 value = 0; 00179 quota = 0; 00180 self_owned = 0; 00181 require_inherit = 0; 00182 00183 switch (objtype) { 00184 case TYPE_ROOM: 00185 cost = mudconf.digcost; 00186 quota = mudconf.room_quota; 00187 f1 = mudconf.room_flags.word1; 00188 f2 = mudconf.room_flags.word2; 00189 f3 = mudconf.room_flags.word3; 00190 okname = ok_name(name); 00191 tname = "a room"; 00192 break; 00193 case TYPE_THING: 00194 if(cost < mudconf.createmin) 00195 cost = mudconf.createmin; 00196 if(cost > mudconf.createmax) 00197 cost = mudconf.createmax; 00198 quota = mudconf.thing_quota; 00199 f1 = mudconf.thing_flags.word1; 00200 f2 = mudconf.thing_flags.word2; 00201 f3 = mudconf.thing_flags.word3; 00202 value = OBJECT_ENDOWMENT(cost); 00203 okname = ok_name(name); 00204 tname = "a thing"; 00205 break; 00206 case TYPE_EXIT: 00207 cost = mudconf.opencost; 00208 quota = mudconf.exit_quota; 00209 f1 = mudconf.exit_flags.word1; 00210 f2 = mudconf.exit_flags.word2; 00211 f3 = mudconf.exit_flags.word3; 00212 okname = ok_name(name); 00213 tname = "an exit"; 00214 break; 00215 case TYPE_PLAYER: 00216 if(cost) { 00217 cost = mudconf.robotcost; 00218 quota = mudconf.player_quota; 00219 f1 = mudconf.robot_flags.word1; 00220 f2 = mudconf.robot_flags.word2; 00221 f3 = mudconf.robot_flags.word3; 00222 value = 0; 00223 tname = "a robot"; 00224 require_inherit = 1; 00225 } else { 00226 cost = 0; 00227 quota = 0; 00228 f1 = mudconf.player_flags.word1; 00229 f2 = mudconf.player_flags.word2; 00230 f3 = mudconf.player_flags.word3; 00231 value = mudconf.paystart; 00232 quota = mudconf.start_quota; 00233 self_owned = 1; 00234 tname = "a player"; 00235 } 00236 buff = munge_space(name); 00237 if(!badname_check(buff)) { 00238 notify(player, "That name is not allowed."); 00239 free_lbuf(buff); 00240 return NOTHING; 00241 } 00242 if(*buff) { 00243 okname = ok_player_name(buff); 00244 if(!okname) { 00245 notify(player, "That's a silly name for a player."); 00246 free_lbuf(buff); 00247 return NOTHING; 00248 } 00249 } 00250 if(okname) { 00251 okname = (lookup_player(NOTHING, buff, 0) == NOTHING); 00252 if(!okname) { 00253 notify_printf(player, "The name %s is already taken.", name); 00254 free_lbuf(buff); 00255 return NOTHING; 00256 } 00257 } 00258 free_lbuf(buff); 00259 break; 00260 default: 00261 LOG_SIMPLE(LOG_BUGS, "BUG", "OTYPE", 00262 tprintf("Bad object type in create_obj: %d.", objtype)); 00263 return NOTHING; 00264 } 00265 00266 if(!self_owned) { 00267 if(!Good_obj(player)) 00268 return NOTHING; 00269 owner = Owner(player); 00270 if(!Good_obj(owner)) 00271 return NOTHING; 00272 } else { 00273 owner = NOTHING; 00274 } 00275 00276 if(require_inherit) { 00277 if(!Inherits(player)) { 00278 notify(player, "Permission denied."); 00279 return NOTHING; 00280 } 00281 } 00282 /* 00283 * Make sure the creator can pay for the object. 00284 */ 00285 00286 if((player != NOTHING) && !canpayfees(player, player, cost, quota)) 00287 return NOTHING; 00288 00289 /* 00290 * Get the first object from the freelist. If the object is not 00291 * clean, discard the remainder of the freelist and go get a 00292 * completely new object. 00293 */ 00294 00295 obj = NOTHING; 00296 if(mudstate.freelist != NOTHING) { 00297 obj = mudstate.freelist; 00298 if(Good_obj(obj) && IS_CLEAN(obj)) { 00299 mudstate.freelist = Link(obj); 00300 } else { 00301 LOG_SIMPLE(LOG_PROBLEMS, "FRL", "DAMAG", 00302 tprintf("Freelist damaged, bad object #%d.", obj)); 00303 obj = NOTHING; 00304 mudstate.freelist = NOTHING; 00305 } 00306 } 00307 if(obj == NOTHING) { 00308 obj = mudstate.db_top; 00309 db_grow(mudstate.db_top + 1); 00310 } 00311 atr_free(obj); // Just in case... 00312 00313 /* 00314 * Set things up according to the object type 00315 */ 00316 00317 s_Location(obj, NOTHING); 00318 s_Contents(obj, NOTHING); 00319 s_Exits(obj, NOTHING); 00320 s_Next(obj, NOTHING); 00321 s_Link(obj, NOTHING); 00322 00323 if(objtype == TYPE_ROOM && mudconf.room_parent > 0) 00324 s_Parent(obj, mudconf.room_parent); 00325 else if(objtype == TYPE_EXIT && mudconf.exit_parent > 0) 00326 s_Parent(obj, mudconf.exit_parent); 00327 else 00328 s_Parent(obj, NOTHING); 00329 00330 s_Zone(obj, Zone(player)); 00331 s_Flags(obj, objtype | f1); 00332 s_Flags2(obj, f2); 00333 s_Flags3(obj, f3); 00334 s_Owner(obj, (self_owned ? obj : owner)); 00335 s_Pennies(obj, value); 00336 Unmark(obj); 00337 buff = munge_space((char *) name); 00338 s_Name(obj, buff); 00339 free_lbuf(buff); 00340 00341 if(objtype == TYPE_PLAYER) { 00342 time(&tt); 00343 buff = (char *) ctime(&tt); 00344 buff[strlen(buff) - 1] = '\0'; 00345 atr_add_raw(obj, A_LAST, buff); 00346 00347 buff = alloc_sbuf("create_obj.quota"); 00348 sprintf(buff, "%d", quota); 00349 atr_add_raw(obj, A_QUOTA, buff); 00350 atr_add_raw(obj, A_RQUOTA, buff); 00351 add_player_name(obj, Name(obj)); 00352 free_sbuf(buff); 00353 s_Zone(obj, NOTHING); 00354 } 00355 make_freelist(); 00356 return obj; 00357 }
Create a new player.
Definition at line 272 of file player.c.
References create_obj(), crypt(), do_addcom(), free_lbuf, confdata::guests_channel, mudconf, NOTHING, ok_password(), confdata::public_channel, s_Fixed, s_Home, s_Pass(), start_home(), trim_spaces(), and TYPE_PLAYER.
Referenced by check_connect(), create_guest(), db_make_minimal(), and do_pcreate().
00274 { 00275 dbref player; 00276 char *pbuf; 00277 00278 /* 00279 * Make sure the password is OK. Name is checked in create_obj 00280 */ 00281 00282 pbuf = trim_spaces(password); 00283 if(!ok_password(pbuf)) { 00284 free_lbuf(pbuf); 00285 return NOTHING; 00286 } 00287 /* 00288 * If so, go create him 00289 */ 00290 00291 player = create_obj(creator, TYPE_PLAYER, name, isrobot); 00292 if(player == NOTHING) { 00293 free_lbuf(pbuf); 00294 return NOTHING; 00295 } 00296 /* 00297 * initialize everything 00298 */ 00299 if(isguest) { 00300 if(*mudconf.guests_channel) 00301 do_addcom(player, player, 0, "g", mudconf.guests_channel); 00302 } else { 00303 if(*mudconf.public_channel) 00304 do_addcom(player, player, 0, "pub", mudconf.public_channel); 00305 } 00306 00307 s_Pass(player, crypt(pbuf, "XX")); 00308 s_Home(player, start_home()); 00309 s_Fixed(player); 00310 free_lbuf(pbuf); 00311 return player; 00312 }
int dddb_close | ( | void | ) |
int dddb_init | ( | void | ) |
int dddb_setfile | ( | char * | ) |
dbref default_home | ( | void | ) |
Definition at line 99 of file object.c.
References confdata::default_home, mudconf, NOTHING, confdata::start_home, and confdata::start_room.
Referenced by new_home().
00100 { 00101 if(mudconf.default_home != NOTHING) 00102 return mudconf.default_home; 00103 if(mudconf.start_home != NOTHING) 00104 return mudconf.start_home; 00105 return mudconf.start_room; 00106 }
int delete_player_name | ( | dbref | , | |
char * | ||||
) |
Definition at line 447 of file player.c.
References alloc_lbuf, free_lbuf, hashfind(), mudstate, NOTHING, statedata::player_htab, safe_str, and ToLower.
Referenced by destroy_player(), do_alias(), do_fixdb(), do_name(), and do_toad().
00448 { 00449 dbref *p; 00450 char *temp, *tp; 00451 00452 tp = temp = alloc_lbuf("delete_player_name"); 00453 safe_str(name, temp, &tp); 00454 *tp = '\0'; 00455 for(tp = temp; *tp; tp++) 00456 *tp = ToLower(*tp); 00457 00458 p = (int *) hashfind(temp, &mudstate.player_htab); 00459 if(!p || (*p == NOTHING) || ((player != NOTHING) && (*p != player))) { 00460 free_lbuf(temp); 00461 return 0; 00462 } 00463 free(p); 00464 hashdelete(temp, &mudstate.player_htab); 00465 free_lbuf(temp); 00466 return 1; 00467 }
int desc_cmp | ( | void * | , | |
void * | , | |||
void * | ||||
) |
Destroy an object. Assumes it has already been removed from all lists and has no contents or exits.
Definition at line 364 of file object.c.
References add_quota(), alloc_sbuf, atr_free(), stack::data, confdata::digcost, confdata::exit_quota, free_lbuf, free_sbuf, giveto(), GOD, GOING, Good_obj, Good_owner, halt_que(), confdata::have_comsys, make_freelist(), mudconf, Name(), stack::next, NFY_DRAIN, nfy_que(), NOTHING, notify, notify_printf(), OBJECT_DEPOSIT, confdata::one_coin, confdata::opencost, Owner, Pennies(), confdata::player_quota, Quiet, confdata::quotas, Robot, confdata::robotcost, confdata::room_quota, s_Contents, s_Exits, s_Flags, s_Flags2, s_Flags3, s_Link, s_Location, s_Name(), s_Next, s_Owner, s_Parent, s_Pennies(), s_Powers, s_Powers2, s_Stack, s_Zone, Stack, StringCopy, confdata::thing_quota, toast_player(), TYPE_EXIT, TYPE_GARBAGE, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
Referenced by check_dead_refs(), check_exit_chains(), check_loc_contents(), check_loc_exits(), destroy_exit(), destroy_guest(), destroy_player(), destroy_thing(), do_destroy(), empty_obj(), and purge_going().
00365 { 00366 dbref owner; 00367 int good_owner, val, quota; 00368 STACK *sp, *next; 00369 char *tname; 00370 00371 if(!Good_obj(obj)) 00372 return; 00373 00374 /* 00375 * Validate the owner 00376 */ 00377 00378 owner = Owner(obj); 00379 good_owner = Good_owner(owner); 00380 00381 /* 00382 * Halt any pending commands (waiting or semaphore) 00383 */ 00384 if(halt_que(NOTHING, obj) > 0) { 00385 if(good_owner && !Quiet(obj) && !Quiet(owner)) { 00386 notify(owner, "Halted."); 00387 } 00388 } 00389 nfy_que(obj, 0, NFY_DRAIN, 0); 00390 00391 /* 00392 * Compensate the owner for the object 00393 */ 00394 00395 val = 1; 00396 quota = 1; 00397 if(good_owner && (owner != obj)) { 00398 switch (Typeof(obj)) { 00399 case TYPE_ROOM: 00400 val = mudconf.digcost; 00401 quota = mudconf.room_quota; 00402 break; 00403 case TYPE_THING: 00404 val = OBJECT_DEPOSIT(Pennies(obj)); 00405 quota = mudconf.thing_quota; 00406 break; 00407 case TYPE_EXIT: 00408 val = mudconf.opencost; 00409 quota = mudconf.exit_quota; 00410 break; 00411 case TYPE_PLAYER: 00412 if(Robot(obj)) 00413 val = mudconf.robotcost; 00414 else 00415 val = 0; 00416 quota = mudconf.player_quota; 00417 } 00418 giveto(owner, val); 00419 if(mudconf.quotas) 00420 add_quota(owner, quota); 00421 00422 if(!Quiet(owner) && !Quiet(obj)) 00423 notify_printf(owner, 00424 "You get back your %d %s deposit for %s(#%d).", 00425 val, mudconf.one_coin, Name(obj), obj); 00426 } 00427 00428 if((player != NOTHING) && !Quiet(player)) { 00429 if(good_owner && Owner(player) != owner) { 00430 if(owner == obj) { 00431 notify_printf(player, "Destroyed. %s(#%d)", Name(obj), obj); 00432 } else { 00433 tname = alloc_sbuf("destroy_obj"); 00434 StringCopy(tname, Name(owner)); 00435 notify_printf(player, "Destroyed. %s's %s(#%d)", tname, 00436 Name(obj), obj); 00437 free_sbuf(tname); 00438 } 00439 } else if(!Quiet(obj)) { 00440 notify(player, "Destroyed."); 00441 } 00442 } 00443 00444 atr_free(obj); 00445 s_Name(obj, "Garbage"); 00446 s_Flags(obj, (TYPE_GARBAGE | GOING)); 00447 s_Flags2(obj, 0); 00448 s_Flags3(obj, 0); 00449 s_Powers(obj, 0); 00450 s_Powers2(obj, 0); 00451 s_Location(obj, NOTHING); 00452 s_Contents(obj, NOTHING); 00453 s_Exits(obj, NOTHING); 00454 s_Next(obj, NOTHING); 00455 s_Link(obj, NOTHING); 00456 s_Owner(obj, GOD); 00457 s_Pennies(obj, 0); 00458 s_Parent(obj, NOTHING); 00459 s_Zone(obj, NOTHING); 00460 00461 /* 00462 * Clear the stack 00463 */ 00464 for(sp = Stack(obj); sp != NULL; sp = next) { 00465 next = sp->next; 00466 free_lbuf(sp->data); 00467 free(sp); 00468 } 00469 00470 s_Stack(obj, NULL); 00471 00472 if(mudconf.have_comsys) 00473 toast_player(obj); 00474 00475 make_freelist(); 00476 return; 00477 }
void destroy_player | ( | dbref | victim | ) |
Destroys a player.
Definition at line 567 of file object.c.
Referenced by destroy_guest(), do_destroy(), and purge_going().
00568 { 00569 dbref aowner, player; 00570 int count, aflags; 00571 char *buf; 00572 00573 /* 00574 * Bye bye... 00575 */ 00576 player = (dbref) atoi(atr_get_raw(victim, A_DESTROYER)); 00577 toast_player(victim); 00578 boot_off(victim, (char *) "You have been destroyed!"); 00579 halt_que(victim, NOTHING); 00580 count = chown_all(victim, player); 00581 00582 /* 00583 * Remove the name from the name hash table 00584 */ 00585 00586 delete_player_name(victim, Name(victim)); 00587 buf = atr_pget(victim, A_ALIAS, &aowner, &aflags); 00588 delete_player_name(victim, buf); 00589 free_lbuf(buf); 00590 00591 move_via_generic(victim, NOTHING, player, 0); 00592 do_mail_clear(victim, NULL); 00593 do_mail_purge(victim); 00594 destroy_obj(NOTHING, victim); 00595 notify_quiet(player, tprintf("(%d objects @chowned to you)", count)); 00596 }
void did_it | ( | dbref | player, | |
dbref | thing, | |||
int | what, | |||
const char * | def, | |||
int | owhat, | |||
const char * | odef, | |||
int | awhat, | |||
char * | args[], | |||
int | nargs | |||
) |
Have player do something to/with thing
Definition at line 1479 of file predicates.c.
References A_CHARGES, A_RUNOUT, alloc_lbuf, alloc_sbuf, atr_add_raw(), atr_pget(), EV_EVAL, EV_FIGNORE, EV_TOP, exec(), free_lbuf, free_sbuf, statedata::global_regs, Good_obj, Has_location, loc, Location, mudstate, Name(), NOTHING, notify, notify_except2(), tprintf(), and wait_que().
Referenced by ChannelEmitKill(), check_events(), do_clone(), do_delcomchannel(), do_drop(), do_enter_internal(), do_get(), do_joinchannel(), do_kill(), do_leave(), do_leavechannel(), do_teleport(), do_trigger(), do_use(), do_verb(), give_money(), give_thing(), look_in(), look_simple(), make_mine_explode(), mech_embark(), mech_enterbase(), move_exit(), move_via_exit(), move_via_generic(), move_via_teleport(), notify_checked(), process_enter_loc(), process_leave_loc(), process_preload(), send_mail(), show_a_desc(), and show_desc().
01481 { 01482 char *d, *buff, *act, *charges, *bp, *str; 01483 dbref loc, aowner; 01484 int num, aflags; 01485 01486 /* 01487 * message to player 01488 */ 01489 01490 if(what > 0) { 01491 d = atr_pget(thing, what, &aowner, &aflags); 01492 if(*d) { 01493 buff = bp = alloc_lbuf("did_it.1"); 01494 str = d; 01495 exec(buff, &bp, 0, thing, player, 01496 EV_EVAL | EV_FIGNORE | EV_TOP, &str, args, nargs); 01497 *bp = '\0'; 01498 notify(player, buff); 01499 free_lbuf(buff); 01500 } else if(def) { 01501 notify(player, def); 01502 } 01503 free_lbuf(d); 01504 } else if((what < 0) && def) { 01505 notify(player, def); 01506 } 01507 /* 01508 * message to neighbors 01509 */ 01510 01511 if((owhat > 0) && Has_location(player) && 01512 Good_obj(loc = Location(player))) { 01513 d = atr_pget(thing, owhat, &aowner, &aflags); 01514 if(*d) { 01515 buff = bp = alloc_lbuf("did_it.2"); 01516 str = d; 01517 exec(buff, &bp, 0, thing, player, 01518 EV_EVAL | EV_FIGNORE | EV_TOP, &str, args, nargs); 01519 *bp = '\0'; 01520 if(*buff) 01521 notify_except2(loc, player, player, thing, tprintf("%s %s", 01522 Name 01523 (player), 01524 buff)); 01525 free_lbuf(buff); 01526 } else if(odef) { 01527 notify_except2(loc, player, player, thing, tprintf("%s %s", 01528 Name(player), 01529 odef)); 01530 } 01531 free_lbuf(d); 01532 } else if((owhat < 0) && odef && Has_location(player) && 01533 Good_obj(loc = Location(player))) { 01534 notify_except2(loc, player, player, thing, tprintf("%s %s", 01535 Name(player), 01536 odef)); 01537 } 01538 /* 01539 * do the action attribute 01540 */ 01541 01542 if(awhat > 0) { 01543 if(*(act = atr_pget(thing, awhat, &aowner, &aflags))) { 01544 charges = atr_pget(thing, A_CHARGES, &aowner, &aflags); 01545 if(*charges) { 01546 num = atoi(charges); 01547 if(num > 0) { 01548 buff = alloc_sbuf("did_it.charges"); 01549 sprintf(buff, "%d", num - 1); 01550 atr_add_raw(thing, A_CHARGES, buff); 01551 free_sbuf(buff); 01552 } else if(*(buff = 01553 atr_pget(thing, A_RUNOUT, &aowner, &aflags))) { 01554 free_lbuf(act); 01555 act = buff; 01556 } else { 01557 free_lbuf(act); 01558 free_lbuf(buff); 01559 free_lbuf(charges); 01560 return; 01561 } 01562 } 01563 free_lbuf(charges); 01564 wait_que(thing, player, 0, NOTHING, 0, act, args, nargs, 01565 mudstate.global_regs); 01566 } 01567 free_lbuf(act); 01568 } 01569 }
Definition at line 895 of file glue.c.
References SpecialObjectStruct::allocfreefunc, SpecialObjectStruct::datasize, DeleteEntry(), FindNode(), muxevent_remove_data(), NodeData, notify, SPECIAL_FREE, SpecialObjects, WhichSpecial(), WhichSpecialS(), and xcode_tree.
Referenced by do_destroy(), and handle_xcode().
00896 { 00897 Node *tmp; 00898 int i; 00899 struct SpecialObjectStruct *typeOfObject; 00900 00901 tmp = FindNode(xcode_tree, key); 00902 00903 i = WhichSpecialS(key); 00904 if(i < 0) { 00905 notify(player, 00906 "CRITICAL: Unable to free data, inconsistency somewhere. Please"); 00907 notify(player, "contact a wizard about this _NOW_!"); 00908 return; 00909 } 00910 typeOfObject = &SpecialObjects[i]; 00911 00912 if(typeOfObject->datasize > 0 && WhichSpecial(key) != i) { 00913 notify(player, 00914 "Semi-critical error has occured. For some reason the object's data differs\nfrom the data on the object. Please contact a wizard about this."); 00915 i = WhichSpecial(key); 00916 } 00917 if(tmp) { 00918 void *t = NodeData(tmp); 00919 00920 if(typeOfObject->allocfreefunc) 00921 typeOfObject->allocfreefunc(key, &NodeData(tmp), SPECIAL_FREE); 00922 NodeData(tmp) = NULL; 00923 DeleteEntry(&xcode_tree, key); 00924 muxevent_remove_data(t); 00925 free(t); 00926 } else if(typeOfObject->datasize > 0) { 00927 notify(player, "This object is not in the special object DBASE."); 00928 notify(player, "Please contact a wizard about this bug. "); 00929 } 00930 }
void divest_object | ( | dbref | thing | ) |
Get rid of KEY contents of object.
Definition at line 482 of file object.c.
References Contents, Controls, Has_location, HOME, Key, move_via_generic(), NOTHING, and SAFE_DOLIST.
Referenced by do_kill(), do_move(), empty_obj(), give_thing(), move_exit(), move_via_teleport(), process_dropped_dropto(), and send_dropto().
00483 { 00484 dbref curr, temp; 00485 00486 SAFE_DOLIST(curr, temp, Contents(thing)) { 00487 if(!Controls(thing, curr) && Has_location(curr) && Key(curr)) { 00488 move_via_generic(curr, HOME, NOTHING, 0); 00489 } 00490 } 00491 }
void dnschild_destruct | ( | ) |
Definition at line 102 of file dnschild.c.
References descriptor_data::addr, dns_query_state_t::desc, dnschild_state, dprintk, dns_query_state_t::ev, dns_query_state_t::fd, dns_query_state_t::next, descriptor_data::outstanding_dnschild_query, and running.
Referenced by shutdown_services().
00103 { 00104 struct dns_query_state_t *dqst; 00105 dprintk("dnschild expiring queries and shutting down."); 00106 dnschild_state = 0; 00107 while (running) { 00108 dqst = running; 00109 dprintk("dnschild query for %s aborting early.", dqst->desc->addr); 00110 if(event_pending(&dqst->ev, EV_READ, NULL)) 00111 event_del(&dqst->ev); 00112 close(dqst->fd); 00113 dqst->desc->outstanding_dnschild_query = NULL; 00114 running = running->next; 00115 free(dqst); 00116 } 00117 }
int dnschild_init | ( | ) |
Definition at line 41 of file dnschild.c.
References dnschild_state, and dprintk.
Referenced by main().
00042 { 00043 dprintk("dnschild initialized."); 00044 dnschild_state = 1; 00045 return 1; 00046 }
void dnschild_kill | ( | void * | ) |
Definition at line 119 of file dnschild.c.
References descriptor_data::addr, dns_query_state_t::desc, dprintk, dns_query_state_t::ev, dns_query_state_t::fd, dns_query_state_t::next, descriptor_data::outstanding_dnschild_query, and running.
Referenced by close_sockets(), and shutdownsock().
00120 { 00121 struct dns_query_state_t *dqst = (struct dns_query_state_t *) arg, *iter; 00122 00123 dprintk("dnschild query for %s aborting early.", dqst->desc->addr); 00124 00125 iter = running; 00126 if(running == dqst) { 00127 running = dqst->next; 00128 } else { 00129 while (iter) { 00130 if(iter->next == dqst) { 00131 iter->next = dqst->next; 00132 break; 00133 } 00134 iter = iter->next; 00135 } 00136 } 00137 00138 if(event_pending(&dqst->ev, EV_READ, NULL)) 00139 event_del(&dqst->ev); 00140 dqst->desc->outstanding_dnschild_query = NULL; 00141 close(dqst->fd); 00142 free(dqst); 00143 }
void* dnschild_request | ( | DESC * | d | ) |
Definition at line 48 of file dnschild.c.
References dns_query_state_t::desc, dnschild_finish(), dnschild_state, dprintk, dns_query_state_t::ev, dns_query_state_t::fd, log_perror(), dns_query_state_t::next, dns_query_state_t::pid, query_timeout, running, running_queries, descriptor_data::saddr, descriptor_data::saddr_len, and unbind_signals().
Referenced by initializesock(), load_restart_db(), and load_restart_db_xdr().
00049 { 00050 int fds[2]; 00051 struct dns_query_state_t *dqst; 00052 char address[1024]; 00053 char outbuffer[255]; 00054 int length; 00055 int result; 00056 00057 if(!dnschild_state) { 00058 dprintk("bailing query, dnschild is shut down."); 00059 return 0; 00060 } 00061 00062 dqst = malloc(sizeof(struct dns_query_state_t)); 00063 memset(dqst, 0, sizeof(struct dns_query_state_t)); 00064 00065 dqst->desc = d; 00066 00067 if(pipe(fds) < 0) { 00068 log_perror("DNS", "ERR", NULL, "pipe"); 00069 } 00070 00071 event_set(&dqst->ev, fds[0], EV_TIMEOUT | EV_READ, dnschild_finish, dqst); 00072 event_add(&dqst->ev, &query_timeout); 00073 00074 dqst->pid = fork(); 00075 if(dqst->pid == 0) { 00076 close(fds[0]); 00077 /* begin child section */ 00078 unbind_signals(); 00079 memset(address, 0, 1023); 00080 if((result=getnameinfo((struct sockaddr *) &d->saddr, d->saddr_len, 00081 address, 1023, NULL, 0, NI_NAMEREQD))) { 00082 length = snprintf(outbuffer, 255, "0%s/%s", gai_strerror(result), strerror(errno)); 00083 outbuffer[length++] = '\0'; 00084 write(fds[1], outbuffer, length); 00085 } else { 00086 length = snprintf(outbuffer, 255, "1%s", address); 00087 outbuffer[length++] = '\0'; 00088 write(fds[1], outbuffer, length); 00089 } 00090 close(fds[1]); 00091 exit(0); 00092 /* end child section */ 00093 } 00094 dqst->fd = fds[0]; 00095 close(fds[1]); 00096 dqst->next = running; 00097 running = dqst; 00098 running_queries++; 00099 return (void *) dqst; 00100 }
Definition at line 728 of file move.c.
References A_AEFAIL, A_EFAIL, A_LENTER, A_LLEAVE, A_OEFAIL, controls, could_doit(), did_it(), Enter_ok, loc, Location, and notify.
Referenced by do_enter(), and process_command().
00729 { 00730 dbref loc = Location(player); 00731 int oattr, aattr; 00732 00733 if(!Enter_ok(thing) && !controls(player, thing)) { 00734 oattr = quiet ? 0 : A_OEFAIL; 00735 aattr = quiet ? 0 : A_AEFAIL; 00736 did_it(player, thing, A_EFAIL, "Permission denied.", oattr, NULL, 00737 aattr, (char **) NULL, 0); 00738 } else if(player == thing) { 00739 notify(player, "You can't enter yourself!"); 00740 #ifdef ENTER_REQUIRES_LEAVESUCC 00741 } else if(could_doit(player, thing, A_LENTER) && 00742 could_doit(player, loc, A_LLEAVE)) 00743 #else 00744 } else if(could_doit(player, thing, A_LENTER)) 00745 #endif 00746 { 00747 oattr = quiet ? HUSH_ENTER : 0; 00748 move_via_generic(player, thing, NOTHING, oattr); 00749 divest_object(player); 00750 process_sticky_dropto(loc, player); 00751 } else { 00752 oattr = quiet ? 0 : A_OEFAIL; 00753 aattr = quiet ? 0 : A_AEFAIL; 00754 did_it(player, thing, A_EFAIL, "You can't enter that.", oattr, 00755 NULL, aattr, (char **) NULL, 0); 00756 } 00757 }
Restarts the game.
Definition at line 1018 of file predicates.c.
References confdata::config_file, dump_database_internal(), DUMP_RESTART, dump_restart_db(), dump_restart_db_xdr(), statedata::dumping, ENDLOG, statedata::executable_path, LOG_ALWAYS, log_name(), log_text(), mudconf, mudstate, Name(), notify, Owner, raw_broadcast(), ResetSpecialObjects(), shutdown_services(), and STARTLOG.
Referenced by signal_USR1().
01019 { 01020 if(key && mudstate.dumping) { 01021 notify(player, "Dumping. Please try again later."); 01022 return; 01023 } 01024 01025 ResetSpecialObjects(); 01026 raw_broadcast(0, "Game: Restart by %s, please wait.", 01027 Name(Owner(player))); 01028 shutdown_services(); 01029 01030 STARTLOG(LOG_ALWAYS, "WIZ", "RSTRT") { 01031 log_text((char *) "Restart by "); 01032 log_name(player); 01033 ENDLOG; 01034 } dump_database_internal(DUMP_RESTART); 01035 01036 dump_restart_db(); 01037 dump_restart_db_xdr(); 01038 execl(mudstate.executable_path, mudstate.executable_path, 01039 mudconf.config_file, NULL); 01040 }
Definition at line 788 of file game.c.
References confdata::crashdb, DUMP_CRASHED, dump_database_internal(), emergency_shutdown(), ENDLOG, LOG_ALWAYS, log_name(), log_text(), mudconf, mudstate, Name(), NOTHING, Owner, pcache_sync(), raw_broadcast(), ResetSpecialObjects(), SHUTDN_PANIC, statedata::shutdown_flag, STARTLOG, and confdata::status_file.
Referenced by signal_TERM().
00789 { 00790 FILE *fs; 00791 00792 ResetSpecialObjects(); 00793 if(player != NOTHING) { 00794 raw_broadcast(0, "Game: Shutdown by %s", Name(Owner(player))); 00795 STARTLOG(LOG_ALWAYS, "WIZ", "SHTDN") { 00796 log_text((char *) "Shutdown by "); 00797 log_name(player); 00798 ENDLOG; 00799 } 00800 } else { 00801 raw_broadcast(0, "Game: Fatal Error: %s", message); 00802 STARTLOG(LOG_ALWAYS, "WIZ", "SHTDN") { 00803 log_text((char *) "Fatal error: "); 00804 log_text(message); 00805 ENDLOG; 00806 } 00807 } 00808 STARTLOG(LOG_ALWAYS, "WIZ", "SHTDN") { 00809 log_text((char *) "Shutdown status: "); 00810 log_text(message); 00811 ENDLOG; 00812 } 00813 00814 fs = fopen(mudconf.status_file, "w"); 00815 fprintf(fs, "%s\n", message); 00816 fclose(fs); 00817 00818 /* 00819 * Do we perform a normal or an emergency shutdown? Normal shutdown 00820 * * * * * is handled by exiting the main loop in shovechars, 00821 * emergency * * * * shutdown is done here. 00822 */ 00823 00824 if(key & SHUTDN_PANIC) { 00825 00826 /* 00827 * Close down the network interface 00828 */ 00829 00830 emergency_shutdown(); 00831 00832 /* 00833 * Close the attribute text db and dump the header db 00834 */ 00835 00836 pcache_sync(); 00837 STARTLOG(LOG_ALWAYS, "DMP", "PANIC") { 00838 log_text((char *) "Panic dump: "); 00839 log_text(mudconf.crashdb); 00840 ENDLOG; 00841 } dump_database_internal(DUMP_CRASHED); 00842 00843 STARTLOG(LOG_ALWAYS, "DMP", "DONE") { 00844 log_text((char *) "Panic dump complete: "); 00845 log_text(mudconf.crashdb); 00846 ENDLOG; 00847 } 00848 } 00849 /* 00850 * Set up for normal shutdown 00851 */ 00852 00853 mudstate.shutdown_flag = 1; 00854 event_loopexit(NULL); 00855 return; 00856 }
int do_top | ( | int | ncmds | ) |
Definition at line 922 of file cque.c.
References a_Queue(), alloc_lbuf, bque::cause, CF_DEQUEUE, choke_player(), bque::comm, Connected, confdata::control_flags, objqe::cque, cque_deque(), statedata::curr_enactor, statedata::curr_player, dassert, statedata::debug_cmd, bque::env, free_lbuf, free_qentry, giveto(), statedata::global_regs, Going, Halted, statedata::inpipe, isPlayer, MAX_GLOBAL_REGS, mudconf, mudstate, bque::nargs, objqe::next, objqe::obj, Owner, parse_to(), statedata::pout, statedata::poutbufc, statedata::poutnew, statedata::poutobj, process_command(), statedata::qhead, statedata::qtail, objqe::queued, release_player(), bque::scr, StringCopy, bque::text, and confdata::waitcost.
Referenced by do_queue(), process_preload(), and runqueues().
00923 { 00924 BQUE *tmp, *walk; 00925 OBJQE *current_object; 00926 dbref object, player, last_player; 00927 int count, i; 00928 char *command, *cp, *cmdsave; 00929 00930 if((mudconf.control_flags & CF_DEQUEUE) == 0) 00931 return 0; 00932 00933 cmdsave = mudstate.debug_cmd; 00934 mudstate.debug_cmd = (char *) "< do_top >"; 00935 00936 if(!mudstate.qhead) 00937 return 0; 00938 00939 current_object = mudstate.qhead; 00940 count = 0; 00941 00942 while (count < ncmds && mudstate.qhead) { 00943 if(!mudstate.qhead) 00944 break; 00945 00946 object = mudstate.qhead->obj; 00947 tmp = cque_deque(object); 00948 00949 if(!mudstate.qhead->cque) { 00950 mudstate.qhead->queued = 0; 00951 mudstate.qhead = mudstate.qhead->next; 00952 if(mudstate.qhead == NULL) 00953 mudstate.qtail = NULL; 00954 } else { 00955 mudstate.qtail->next = mudstate.qhead; 00956 mudstate.qtail = mudstate.qtail->next; 00957 mudstate.qhead = mudstate.qhead->next; 00958 mudstate.qtail->next = NULL; 00959 } 00960 if(!tmp) 00961 continue; 00962 00963 dassert(tmp); 00964 count++; 00965 if((object >= 0) && !Going(object)) { 00966 giveto(object, mudconf.waitcost); 00967 mudstate.curr_enactor = tmp->cause; 00968 mudstate.curr_player = object; 00969 a_Queue(Owner(object), -1); 00970 if(!Halted(object)) { 00971 for(i = 0; i < MAX_GLOBAL_REGS; i++) { 00972 if(tmp->scr[i]) { 00973 StringCopy(mudstate.global_regs[i], tmp->scr[i]); 00974 } else { 00975 *mudstate.global_regs[i] = '\0'; 00976 } 00977 } 00978 00979 command = tmp->comm; 00980 00981 if(command) { 00982 if(isPlayer(object) && Connected(object)) 00983 choke_player(object); 00984 while (command) { 00985 cp = parse_to(&command, ';', 0); 00986 if(cp && *cp) { 00987 while (command && (*command == '|')) { 00988 command++; 00989 mudstate.inpipe = 1; 00990 mudstate.poutnew = 00991 alloc_lbuf("process_command.pipe"); 00992 mudstate.poutbufc = mudstate.poutnew; 00993 mudstate.poutobj = object; 00994 process_command(object, tmp->cause, 0, cp, 00995 tmp->env, tmp->nargs); 00996 if(mudstate.pout) { 00997 free_lbuf(mudstate.pout); 00998 mudstate.pout = NULL; 00999 } 01000 01001 *mudstate.poutbufc = '\0'; 01002 mudstate.pout = mudstate.poutnew; 01003 cp = parse_to(&command, ';', 0); 01004 } 01005 mudstate.inpipe = 0; 01006 process_command(object, tmp->cause, 0, 01007 cp, tmp->env, tmp->nargs); 01008 if(mudstate.pout) { 01009 free_lbuf(mudstate.pout); 01010 mudstate.pout = NULL; 01011 } 01012 } 01013 } 01014 if(isPlayer(object) && Connected(object)) 01015 release_player(object); 01016 } 01017 } 01018 } 01019 free(tmp->text); 01020 free_qentry(tmp); 01021 } 01022 01023 for(i = 0; i < MAX_GLOBAL_REGS; i++) 01024 *mudstate.global_regs[i] = '\0'; 01025 mudstate.debug_cmd = cmdsave; 01026 return count; 01027 }
int do_unauth_command | ( | DESC * | d, | |
char * | ||||
) |
Definition at line 1440 of file netcommon.c.
References confdata::allow_unloggedwho, check_connect(), CMD_DOING, CMD_MASK, CMD_NOxFIX, CMD_PREFIX, CMD_QUIT, CMD_SUFFIX, CMD_WHO, dassert, DS_CONNECTED, DS_DEAD, dump_users(), name_table::flag, descriptor_data::flags, hashfind(), descriptor_data::last_time, LOG_BUGS, log_error(), statedata::logout_cmd_htab, mudconf, mudstate, statedata::now, queue_string(), R_QUIT, set_userstring(), and shutdownsock().
Referenced by process_input().
01440 { 01441 char *arg; 01442 NAMETAB *cp; 01443 01444 d->last_time = mudstate.now; 01445 arg = command; 01446 01447 dassert(!(d->flags & DS_CONNECTED)); 01448 if(d->flags & DS_DEAD) return 0; 01449 01450 while(*arg && !isspace(*arg)) arg++; 01451 01452 if(*arg) 01453 *arg++ = '\0'; 01454 01455 cp = (NAMETAB *) hashfind(command, &mudstate.logout_cmd_htab); 01456 if(*arg) 01457 *--arg = ' '; 01458 01459 if(!cp) 01460 return check_connect(d, command); 01461 01462 d->command_count++; 01463 if(!(cp->flag & CMD_NOxFIX)) { 01464 if(d->output_prefix) { 01465 queue_string(d, d->output_prefix); 01466 } 01467 } 01468 01469 switch (cp->flag & CMD_MASK) { 01470 case CMD_QUIT: 01471 shutdownsock(d, R_QUIT); 01472 return 0; 01473 case CMD_WHO: 01474 if(d->player || mudconf.allow_unloggedwho) { 01475 dump_users(d, arg, CMD_WHO); 01476 } else { 01477 queue_string(d, "This MUX does not allow WHO at the login screen.\r\n"); 01478 queue_string(d, "Please login or create a character first.\r\n"); 01479 } 01480 break; 01481 case CMD_DOING: 01482 if(d->player || mudconf.allow_unloggedwho) { 01483 dump_users(d, arg, CMD_DOING); 01484 } else { 01485 queue_string(d, "This MUX does not allow DOING at the login screen.\r\n"); 01486 queue_string(d, "Please login or create a character first.\r\n"); 01487 } 01488 break; 01489 case CMD_SESSION: 01490 if(d->player || mudconf.allow_unloggedwho) { 01491 dump_users(d, arg, CMD_SESSION); 01492 } else { 01493 queue_string(d, "This MUX does not allow SESSION at the login screen.\r\n"); 01494 queue_string(d, "Please login or create a character first.\r\n"); 01495 } 01496 break; 01497 case CMD_PREFIX: 01498 set_userstring(&d->output_prefix, arg); 01499 break; 01500 case CMD_SUFFIX: 01501 set_userstring(&d->output_suffix, arg); 01502 break; 01503 default: 01504 log_error(LOG_BUGS, "BUG", "PARSE", "Prefix command with no handler: '%s'", command); 01505 } 01506 01507 if(!(cp->flag & CMD_NOxFIX)) { 01508 if(d->output_suffix) { 01509 queue_string(d, d->output_suffix); 01510 } 01511 } 01512 return 1; 01513 }
char* dollar_to_space | ( | const char * | ) |
int dump_mail | ( | FILE * | ) |
Definition at line 1425 of file mail.c.
References mail_entry::count, DO_WHOLE_DB, mail::from, get_mail_message(), isPlayer, statedata::mail_db_top, statedata::mail_htab, statedata::mail_list, mudstate, mail::next, nhashfind(), mail::number, putref(), putstring(), mail::read, mail::subject, mail::time, mail::to, and mail::tolist.
Referenced by dump_database_internal().
01426 { 01427 struct mail *mp, *mptr; 01428 dbref thing; 01429 int count = 0, i; 01430 01431 /* 01432 * Write out version number 01433 */ 01434 fprintf(fp, "+V5\n"); 01435 putref(fp, mudstate.mail_db_top); 01436 DO_WHOLE_DB(thing) { 01437 if(isPlayer(thing)) { 01438 mptr = 01439 (struct mail *) nhashfind((int) thing, &mudstate.mail_htab); 01440 if(mptr != NULL) 01441 for(mp = mptr; mp; mp = mp->next) { 01442 putref(fp, mp->to); 01443 putref(fp, mp->from); 01444 putref(fp, mp->number); 01445 putstring(fp, mp->tolist); 01446 putstring(fp, mp->time); 01447 putstring(fp, mp->subject); 01448 putref(fp, mp->read); 01449 count++; 01450 } 01451 } 01452 } 01453 01454 fprintf(fp, "*** END OF DUMP ***\n"); 01455 01456 /* 01457 * Add the db of mail messages 01458 */ 01459 for(i = 0; i < mudstate.mail_db_top; i++) { 01460 if(mudstate.mail_list[i].count > 0) { 01461 putref(fp, i); 01462 putstring(fp, get_mail_message(i)); 01463 } 01464 } 01465 fprintf(fp, "+++ END OF DUMP +++\n"); 01466 01467 save_malias(fp); 01468 fflush(fp); 01469 01470 return (count); 01471 }
void dump_restart_db | ( | void | ) |
Definition at line 2079 of file db.c.
02080 { 02081 FILE *f; 02082 DESC *d; 02083 OBJQE *obq; 02084 int version = 0; 02085 02086 /* We maintain a version number for the restart database, 02087 so we can restart even if the format of the restart db 02088 has been changed in the new executable. */ 02089 02090 version |= RS_RECORD_PLAYERS; 02091 version |= RS_NEW_STRINGS; 02092 version |= RS_HUDKEY; 02093 02094 f = fopen("restart.db", "w"); 02095 fprintf(f, "+V%d\n", version); 02096 putref(f, mudstate.start_time); 02097 putstring(f, mudstate.doing_hdr); 02098 putref(f, mudstate.record_players); 02099 for (d = descriptor_list ; d && d->next ; d = d->next); 02100 for(; d != NULL ; d = d->prev) { 02101 dprintk("d: %p dnext: %p dprev: %p", d, d->next, d->prev); 02102 putref(f, d->descriptor); 02103 putref(f, d->flags); 02104 putref(f, d->connected_at); 02105 putref(f, d->command_count); 02106 putref(f, d->timeout); 02107 putref(f, d->host_info); 02108 putref(f, d->player); 02109 putref(f, d->last_time); 02110 putstring(f, d->output_prefix); 02111 putstring(f, d->output_suffix); 02112 putstring(f, d->addr); 02113 putstring(f, d->doing); 02114 putstring(f, d->username); 02115 putstring(f, d->hudkey); 02116 } 02117 putref(f, 0); 02118 fclose(f); 02119 }
void edit_string | ( | char * | , | |
char ** | , | |||
char * | , | |||
char * | ||||
) |
Definition at line 1199 of file set.c.
References alloc_lbuf, replace_string(), and safe_str.
Referenced by fun_edit().
01200 { 01201 char *cp; 01202 01203 /* 01204 * Do the substitution. Idea for prefix/suffix from R'nice@TinyTIM 01205 */ 01206 01207 if(!strcmp(from, "^")) { 01208 /* 01209 * Prepend 'to' to string 01210 */ 01211 01212 *dst = alloc_lbuf("edit_string.^"); 01213 cp = *dst; 01214 safe_str(to, *dst, &cp); 01215 safe_str(src, *dst, &cp); 01216 *cp = '\0'; 01217 } else if(!strcmp(from, "$")) { 01218 /* 01219 * Append 'to' to string 01220 */ 01221 01222 *dst = alloc_lbuf("edit_string.$"); 01223 cp = *dst; 01224 safe_str(src, *dst, &cp); 01225 safe_str(to, *dst, &cp); 01226 *cp = '\0'; 01227 } else { 01228 /* 01229 * replace all occurances of 'from' with 'to'. Handle the * 01230 * * * * special cases of from = \$ and \^. 01231 */ 01232 01233 if(((from[0] == '\\') || (from[0] == '%')) && ((from[1] == '$') || 01234 (from[1] == '^')) 01235 && (from[2] == '\0')) 01236 from++; 01237 *dst = replace_string(from, to, src); 01238 } 01239 }
void empty_obj | ( | dbref | obj | ) |
Empties the contents of a GOING object.
Definition at line 496 of file object.c.
References Contents, destroy_obj(), divest_object(), Exits, Has_location, Home, HOME, isExit, Location, Log_header_err(), Log_simple_err(), move_via_generic(), new_home(), NOTHING, s_Home, SAFE_DOLIST, and ZAP_LOC.
Referenced by destroy_thing(), do_destroy(), and purge_going().
00497 { 00498 dbref targ, next; 00499 00500 /* 00501 * Send the contents home 00502 */ 00503 00504 SAFE_DOLIST(targ, next, Contents(obj)) { 00505 if(!Has_location(targ)) { 00506 Log_simple_err(targ, obj, 00507 "Funny object type in contents list of GOING location. Flush terminated."); 00508 break; 00509 } else if(Location(targ) != obj) { 00510 Log_header_err(targ, obj, Location(targ), 1, "Location", 00511 "indicates object really in another location during cleanup of GOING location. Flush terminated."); 00512 break; 00513 } else { 00514 ZAP_LOC(targ); 00515 if(Home(targ) == obj) { 00516 s_Home(targ, new_home(targ)); 00517 } 00518 move_via_generic(targ, HOME, NOTHING, 0); 00519 divest_object(targ); 00520 } 00521 } 00522 00523 /* 00524 * Destroy the exits 00525 */ 00526 00527 SAFE_DOLIST(targ, next, Exits(obj)) { 00528 if(!isExit(targ)) { 00529 Log_simple_err(targ, obj, 00530 "Funny object type in exit list of GOING location. Flush terminated."); 00531 break; 00532 } else if(Exits(targ) != obj) { 00533 Log_header_err(targ, obj, Exits(targ), 1, "Location", 00534 "indicates exit really in another location during cleanup of GOING location. Flush terminated."); 00535 break; 00536 } else { 00537 destroy_obj(NOTHING, targ); 00538 } 00539 } 00540 }
void end_log | ( | void | ) |
int eradicate_broken_fd | ( | int | ) |
Definition at line 261 of file bsd.c.
References DESC_SAFEITER_ALL, log_error(), LOG_PROBLEMS, mux_bound_socket, R_SOCKDIED, and shutdownsock().
Referenced by signal_PIPE().
00262 { 00263 struct stat statbuf; 00264 DESC *d, *dtemp; 00265 00266 DESC_SAFEITER_ALL(d, dtemp) { 00267 if((fd && d->descriptor == fd) || 00268 (!fd && fstat(d->descriptor, &statbuf) < 0)) { 00269 /* An invalid player connection... eject, eject, eject. */ 00270 log_error(LOG_PROBLEMS, "ERR", "EBADF", 00271 "Broken descriptor %d for player #%d", d->descriptor, 00272 d->player); 00273 close(d->descriptor); 00274 shutdownsock(d, R_SOCKDIED); 00275 } 00276 } 00277 if(mux_bound_socket != -1 && fstat(mux_bound_socket, &statbuf) < 0) { 00278 log_error(LOG_PROBLEMS, "ERR", "EBADF", 00279 "Broken descriptor on our main port."); 00280 mux_bound_socket = -1; 00281 return -1; 00282 } 00283 #ifdef IPV6_SUPPORT 00284 if(mux_bound_socket6 != -1 && fstat(mux_bound_socket6, &statbuf) < 0) { 00285 log_error(LOG_PROBLEMS, "ERR", "EBADF", 00286 "Broken descriptor for our ipv6 port."); 00287 mux_bound_socket6 = -1; 00288 return -1; 00289 } 00290 #endif 00291 return 0; 00292 }
Definition at line 48 of file boolexp.c.
References A_LENTER, A_LOCK, A_NAME, alloc_lbuf, alloc_mbuf, atr_get(), atr_num(), atr_pget(), BOOLEXP_AND, BOOLEXP_ATR, BOOLEXP_CARRY, BOOLEXP_CONST, BOOLEXP_EVAL, BOOLEXP_INDIR, BOOLEXP_IS, BOOLEXP_NOT, BOOLEXP_OR, BOOLEXP_OWNER, c, check_attr(), Contents, DOLIST, ENDLOG, EV_EVAL, EV_FIGNORE, EV_TOP, eval_boolexp(), eval_boolexp_atr(), exec(), free_lbuf, free_mbuf, INDIR_TOKEN, statedata::lock_nest_lev, confdata::lock_nest_lim, LOG_BUGS, log_name_and_loc(), log_text(), member(), mudconf, mudstate, notify, attr::number, Owner, Read_attr, STARTLOG, string_compare(), boolexp::sub1, boolexp::sub2, boolexp::thing, TRUE_BOOLEXP, and boolexp::type.
Referenced by eval_boolexp(), eval_boolexp_atr(), and fun_elock().
00049 { 00050 dbref aowner, obj, source; 00051 int aflags, c, checkit; 00052 char *key, *buff, *buff2, *bp, *str; 00053 ATTR *a; 00054 00055 if(b == TRUE_BOOLEXP) 00056 return 1; 00057 00058 switch (b->type) { 00059 case BOOLEXP_AND: 00060 return (eval_boolexp(player, thing, from, b->sub1) && 00061 eval_boolexp(player, thing, from, b->sub2)); 00062 case BOOLEXP_OR: 00063 return (eval_boolexp(player, thing, from, b->sub1) || 00064 eval_boolexp(player, thing, from, b->sub2)); 00065 case BOOLEXP_NOT: 00066 return !eval_boolexp(player, thing, from, b->sub1); 00067 case BOOLEXP_INDIR: 00068 /* 00069 * BOOLEXP_INDIR (i.e. @) is a unary operation which is replaced at 00070 * evaluation time by the lock of the object whose number is the 00071 * argument of the operation. 00072 */ 00073 00074 mudstate.lock_nest_lev++; 00075 if(mudstate.lock_nest_lev >= mudconf.lock_nest_lim) { 00076 // log_error(LOG_BUGS, "BUG", "LOCK", " 00077 STARTLOG(LOG_BUGS, "BUG", "LOCK") { 00078 log_name_and_loc(player); 00079 log_text((char *) ": Lock exceeded recursion limit."); 00080 ENDLOG; 00081 } notify(player, "Sorry, broken lock!"); 00082 mudstate.lock_nest_lev--; 00083 return (0); 00084 } 00085 if((b->sub1->type != BOOLEXP_CONST) || (b->sub1->thing < 0)) { 00086 STARTLOG(LOG_BUGS, "BUG", "LOCK") { 00087 log_name_and_loc(player); 00088 buff = alloc_mbuf("eval_boolexp.LOG.indir"); 00089 sprintf(buff, ": Lock had bad indirection (%c, type %d)", 00090 INDIR_TOKEN, b->sub1->type); 00091 log_text(buff); 00092 free_mbuf(buff); 00093 ENDLOG; 00094 } 00095 notify(player, "Sorry, broken lock!"); 00096 mudstate.lock_nest_lev--; 00097 return (0); 00098 } 00099 key = atr_get(b->sub1->thing, A_LOCK, &aowner, &aflags); 00100 c = eval_boolexp_atr(player, b->sub1->thing, from, key); 00101 free_lbuf(key); 00102 mudstate.lock_nest_lev--; 00103 return (c); 00104 case BOOLEXP_CONST: 00105 return (b->thing == player || member(b->thing, Contents(player))); 00106 case BOOLEXP_ATR: 00107 a = atr_num(b->thing); 00108 if(!a) 00109 return 0; /* 00110 * no such attribute 00111 */ 00112 00113 /* 00114 * First check the object itself, then its contents 00115 */ 00116 00117 if(check_attr(player, from, a, (char *) b->sub1)) 00118 return 1; 00119 DOLIST(obj, Contents(player)) { 00120 if(check_attr(obj, from, a, (char *) b->sub1)) 00121 return 1; 00122 } 00123 return 0; 00124 case BOOLEXP_EVAL: 00125 a = atr_num(b->thing); 00126 if(!a) 00127 return 0; /* 00128 * no such attribute 00129 */ 00130 source = from; 00131 buff = atr_pget(from, a->number, &aowner, &aflags); 00132 if(!buff || !*buff) { 00133 free_lbuf(buff); 00134 buff = atr_pget(thing, a->number, &aowner, &aflags); 00135 source = thing; 00136 } 00137 checkit = 0; 00138 00139 if((a->number == A_NAME) || (a->number == A_LENTER)) { 00140 checkit = 1; 00141 } else if(Read_attr(source, source, a, aowner, aflags)) { 00142 checkit = 1; 00143 } 00144 if(checkit) { 00145 buff2 = bp = alloc_lbuf("eval_boolexp"); 00146 str = buff; 00147 exec(buff2, &bp, 0, source, player, 00148 EV_FIGNORE | EV_EVAL | EV_TOP, &str, (char **) NULL, 0); 00149 *bp = '\0'; 00150 checkit = !string_compare(buff2, (char *) b->sub1); 00151 free_lbuf(buff2); 00152 } 00153 free_lbuf(buff); 00154 return checkit; 00155 case BOOLEXP_IS: 00156 00157 /* 00158 * If an object check, do that 00159 */ 00160 00161 if(b->sub1->type == BOOLEXP_CONST) 00162 return (b->sub1->thing == player); 00163 00164 /* 00165 * Nope, do an attribute check 00166 */ 00167 00168 a = atr_num(b->sub1->thing); 00169 if(!a) 00170 return 0; 00171 return (check_attr(player, from, a, (char *) (b->sub1)->sub1)); 00172 case BOOLEXP_CARRY: 00173 00174 /* 00175 * If an object check, do that 00176 */ 00177 00178 if(b->sub1->type == BOOLEXP_CONST) 00179 return (member(b->sub1->thing, Contents(player))); 00180 00181 /* 00182 * Nope, do an attribute check 00183 */ 00184 00185 a = atr_num(b->sub1->thing); 00186 if(!a) 00187 return 0; 00188 DOLIST(obj, Contents(player)) { 00189 if(check_attr(obj, from, a, (char *) (b->sub1)->sub1)) 00190 return 1; 00191 } 00192 return 0; 00193 case BOOLEXP_OWNER: 00194 return (Owner(b->sub1->thing) == Owner(player)); 00195 default: 00196 abort(); /* 00197 * bad type 00198 */ 00199 return 0; 00200 } 00201 } /* end eval_boolexp() */
Definition at line 203 of file boolexp.c.
References eval_boolexp(), free_boolexp(), and parse_boolexp().
Referenced by could_doit(), and eval_boolexp().
00204 { 00205 BOOLEXP *b; 00206 int ret_value; 00207 00208 b = parse_boolexp(player, key, 1); 00209 if(b == NULL) { 00210 ret_value = 1; 00211 } else { 00212 ret_value = eval_boolexp(player, thing, from, b); 00213 free_boolexp(b); 00214 } 00215 return (ret_value); 00216 } /* end eval_boolexp_atr() */
Definition at line 344 of file eval.c.
References alloc_lbuf, alloc_sbuf, ANSI_BBLACK, ANSI_BBLUE, ANSI_BCYAN, ANSI_BGREEN, ANSI_BLACK, ANSI_BLINK, ANSI_BLUE, ANSI_BMAGENTA, ANSI_BRED, ANSI_BWHITE, ANSI_BYELLOW, ANSI_CYAN, ANSI_GREEN, ANSI_HILITE, ANSI_INVERSE, ANSI_MAGENTA, ANSI_NORMAL, ANSI_RED, ANSI_UNDER, ANSI_WHITE, ANSI_YELLOW, ufun::atr, atr_get(), atr_pget(), check_access(), EV_EVAL, EV_FCHECK, EV_FMAND, EV_NO_COMPRESS, EV_NO_LOCATION, EV_NOFCHECK, EV_NOTRACE, EV_STRIP, EV_STRIP_ESC, exec(), ufun::flags, fun::flags, FN_NO_EVAL, FN_PRES, FN_PRIV, free_lbuf, free_sbuf, statedata::func_htab, statedata::func_nest_lev, get_gender(), statedata::global_regs, hashfind(), LBUF_SIZE, MAX_GLOBAL_REGS, mudconf, mudstate, Name(), fun::nargs, NFARGS, ufun::obj, parse_arglist(), parse_to(), ufun::perms, statedata::pout, safe_chr, safe_sb_str, safe_str, SBUF_SIZE, confdata::space_compress, StringCopy, tcache_empty(), ToLower, ToUpper, Trace, statedata::ufunc_htab, and where_is().
Referenced by add_mail_message(), add_prefix(), check_filter(), delim_check(), did_it(), do_mail_proof(), do_mail_review(), do_switch(), do_think(), eval_boolexp(), exec(), fun_case(), fun_columns(), fun_default(), fun_edefault(), fun_eval(), fun_filter(), fun_fold(), fun_foreach(), fun_get_eval(), fun_ifelse(), fun_iter(), fun_list(), fun_map(), fun_mix(), fun_munge(), fun_objeval(), fun_parse(), fun_s(), fun_subeval(), fun_switch(), fun_udefault(), fun_v(), fun_zfun(), get_statustemplate_attr(), page_return(), parse_arglist(), process_cmdent(), process_command(), process_sex(), search_perform(), and u_comp().
00346 { 00347 #define NFARGS 30 00348 char *fargs[NFARGS]; 00349 char *preserve[MAX_GLOBAL_REGS]; 00350 char *tstr, *tbuf, *tbufc, *savepos, *atr_gotten, *start, *oldp, *savestr; 00351 char savec, ch, *str; 00352 char *realbuff = NULL, *realbp = NULL; 00353 dbref aowner; 00354 int at_space, nfargs, gender, i, j, alldone, aflags, feval; 00355 int is_trace, is_top, save_count; 00356 int ansi; 00357 FUN *fp; 00358 UFUN *ufp; 00359 00360 static const char *subj[5] = { "", "it", "she", "he", "they" }; 00361 static const char *poss[5] = { "", "its", "her", "his", "their" }; 00362 static const char *obj[5] = { "", "it", "her", "him", "them" }; 00363 static const char *absp[5] = { "", "its", "hers", "his", "theirs" }; 00364 00365 if(*dstr == NULL) 00366 return; 00367 00368 // dprintk("%d/%s", player, *dstr); 00369 00370 at_space = 1; 00371 gender = -1; 00372 alldone = 0; 00373 ansi = 0; 00374 00375 is_trace = Trace(player) && !(eval & EV_NOTRACE); 00376 is_top = 0; 00377 00378 /* Extend the buffer if we need to. */ 00379 00380 if(((*bufc) - buff) > (LBUF_SIZE - SBUF_SIZE)) { 00381 realbuff = buff; 00382 realbp = *bufc; 00383 buff = (char *) malloc(LBUF_SIZE); 00384 *bufc = buff; 00385 } 00386 00387 oldp = start = *bufc; 00388 00389 /* 00390 * If we are tracing, save a copy of the starting buffer 00391 */ 00392 00393 savestr = NULL; 00394 if(is_trace) { 00395 is_top = tcache_empty(); 00396 savestr = alloc_lbuf("exec.save"); 00397 StringCopy(savestr, *dstr); 00398 } 00399 while (**dstr && !alldone) { 00400 switch (**dstr) { 00401 case ' ': 00402 /* 00403 * A space. Add a space if not compressing or if * * 00404 * 00405 * * * * previous char was not a space 00406 */ 00407 00408 if(!(mudconf.space_compress && at_space) || 00409 (eval & EV_NO_COMPRESS)) { 00410 safe_chr(' ', buff, bufc); 00411 at_space = 1; 00412 } 00413 break; 00414 case '\\': 00415 /* 00416 * General escape. Add the following char without * 00417 * * * * special processing 00418 */ 00419 00420 at_space = 0; 00421 (*dstr)++; 00422 if(**dstr) 00423 safe_chr(**dstr, buff, bufc); 00424 else 00425 (*dstr)--; 00426 break; 00427 case '[': 00428 /* 00429 * Function start. Evaluate the contents of the * * 00430 * * * square brackets as a function. If no closing 00431 * * * * * bracket, insert the [ and continue. 00432 */ 00433 00434 at_space = 0; 00435 tstr = (*dstr)++; 00436 if(eval & EV_NOFCHECK) { 00437 safe_chr('[', buff, bufc); 00438 *dstr = tstr; 00439 break; 00440 } 00441 tbuf = parse_to(dstr, ']', 0); 00442 if(*dstr == NULL) { 00443 safe_chr('[', buff, bufc); 00444 *dstr = tstr; 00445 } else { 00446 str = tbuf; 00447 exec(buff, bufc, 0, player, cause, 00448 (eval | EV_FCHECK | EV_FMAND), &str, cargs, ncargs); 00449 (*dstr)--; 00450 } 00451 break; 00452 case '{': 00453 /* 00454 * Literal start. Insert everything up to the * * * 00455 * * terminating } without parsing. If no closing * 00456 * * * * brace, insert the { and continue. 00457 */ 00458 00459 at_space = 0; 00460 tstr = (*dstr)++; 00461 tbuf = parse_to(dstr, '}', 0); 00462 if(*dstr == NULL) { 00463 safe_chr('{', buff, bufc); 00464 *dstr = tstr; 00465 } else { 00466 if(!(eval & EV_STRIP)) { 00467 safe_chr('{', buff, bufc); 00468 } 00469 /* 00470 * Preserve leading spaces (Felan) 00471 */ 00472 00473 if(*tbuf == ' ') { 00474 safe_chr(' ', buff, bufc); 00475 tbuf++; 00476 } 00477 str = tbuf; 00478 exec(buff, bufc, 0, player, cause, 00479 (eval & ~(EV_STRIP | EV_FCHECK)), &str, cargs, ncargs); 00480 if(!(eval & EV_STRIP)) { 00481 safe_chr('}', buff, bufc); 00482 } 00483 (*dstr)--; 00484 } 00485 break; 00486 case '%': 00487 /* 00488 * Percent-replace start. Evaluate the chars * * * 00489 * following * and perform the appropriate * * * 00490 * substitution. 00491 */ 00492 00493 at_space = 0; 00494 (*dstr)++; 00495 savec = **dstr; 00496 savepos = *bufc; 00497 switch (savec) { 00498 case '\0': /* 00499 * Null - all done 00500 */ 00501 (*dstr)--; 00502 break; 00503 case '|': /* piped command output */ 00504 safe_str(mudstate.pout, buff, bufc); 00505 break; 00506 case '%': /* 00507 * Percent - a literal % 00508 */ 00509 safe_chr('%', buff, bufc); 00510 break; 00511 case 'c': 00512 case 'C': 00513 (*dstr)++; 00514 if(!**dstr) 00515 (*dstr)--; 00516 ansi = 1; 00517 switch (**dstr) { 00518 case 'h': /* 00519 * hilite 00520 */ 00521 safe_str(ANSI_HILITE, buff, bufc); 00522 break; 00523 case 'i': /* 00524 * inverse 00525 */ 00526 safe_str(ANSI_INVERSE, buff, bufc); 00527 break; 00528 case 'f': /* 00529 * flash 00530 */ 00531 safe_str(ANSI_BLINK, buff, bufc); 00532 break; 00533 case 'u': /* underline */ 00534 safe_str(ANSI_UNDER, buff, bufc); 00535 break; 00536 case 'n': /* 00537 * normal 00538 */ 00539 safe_str(ANSI_NORMAL, buff, bufc); 00540 ansi = 0; 00541 break; 00542 case 'x': /* 00543 * black fg 00544 */ 00545 safe_str(ANSI_BLACK, buff, bufc); 00546 break; 00547 case 'r': /* 00548 * red fg 00549 */ 00550 safe_str(ANSI_RED, buff, bufc); 00551 break; 00552 case 'g': /* 00553 * green fg 00554 */ 00555 safe_str(ANSI_GREEN, buff, bufc); 00556 break; 00557 case 'y': /* 00558 * yellow fg 00559 */ 00560 safe_str(ANSI_YELLOW, buff, bufc); 00561 break; 00562 case 'b': /* 00563 * blue fg 00564 */ 00565 safe_str(ANSI_BLUE, buff, bufc); 00566 break; 00567 case 'm': /* 00568 * magenta fg 00569 */ 00570 safe_str(ANSI_MAGENTA, buff, bufc); 00571 break; 00572 case 'c': /* 00573 * cyan fg 00574 */ 00575 safe_str(ANSI_CYAN, buff, bufc); 00576 break; 00577 case 'w': /* 00578 * white fg 00579 */ 00580 safe_str(ANSI_WHITE, buff, bufc); 00581 break; 00582 case 'X': /* 00583 * black bg 00584 */ 00585 safe_str(ANSI_BBLACK, buff, bufc); 00586 break; 00587 case 'R': /* 00588 * red bg 00589 */ 00590 safe_str(ANSI_BRED, buff, bufc); 00591 break; 00592 case 'G': /* 00593 * green bg 00594 */ 00595 safe_str(ANSI_BGREEN, buff, bufc); 00596 break; 00597 case 'Y': /* 00598 * yellow bg 00599 */ 00600 safe_str(ANSI_BYELLOW, buff, bufc); 00601 break; 00602 case 'B': /* 00603 * blue bg 00604 */ 00605 safe_str(ANSI_BBLUE, buff, bufc); 00606 break; 00607 case 'M': /* 00608 * magenta bg 00609 */ 00610 safe_str(ANSI_BMAGENTA, buff, bufc); 00611 break; 00612 case 'C': /* 00613 * cyan bg 00614 */ 00615 safe_str(ANSI_BCYAN, buff, bufc); 00616 break; 00617 case 'W': /* 00618 * white bg 00619 */ 00620 safe_str(ANSI_BWHITE, buff, bufc); 00621 break; 00622 default: 00623 safe_chr(**dstr, buff, bufc); 00624 } 00625 break; 00626 case 'r': /* 00627 * Carriage return 00628 */ 00629 case 'R': 00630 safe_str((char *) "\r\n", buff, bufc); 00631 break; 00632 case 't': /* 00633 * Tab 00634 */ 00635 case 'T': 00636 safe_chr('\t', buff, bufc); 00637 break; 00638 case 'B': /* 00639 * Blank 00640 */ 00641 case 'b': 00642 safe_chr(' ', buff, bufc); 00643 break; 00644 case '0': /* 00645 * Command argument number N 00646 */ 00647 case '1': 00648 case '2': 00649 case '3': 00650 case '4': 00651 case '5': 00652 case '6': 00653 case '7': 00654 case '8': 00655 case '9': 00656 i = (**dstr - '0'); 00657 if((i < ncargs) && (cargs[i] != NULL)) 00658 safe_str(cargs[i], buff, bufc); 00659 break; 00660 case 'V': /* 00661 * Variable attribute 00662 */ 00663 case 'v': 00664 (*dstr)++; 00665 ch = ToUpper(**dstr); 00666 if(!**dstr) 00667 (*dstr)--; 00668 if((ch < 'A') || (ch > 'Z')) 00669 break; 00670 i = 100 + ch - 'A'; 00671 atr_gotten = atr_pget(player, i, &aowner, &aflags); 00672 safe_str(atr_gotten, buff, bufc); 00673 free_lbuf(atr_gotten); 00674 break; 00675 case 'Q': 00676 case 'q': 00677 (*dstr)++; 00678 i = (**dstr - '0'); 00679 if((i >= 0) && (i <= 9) && mudstate.global_regs[i]) { 00680 safe_str(mudstate.global_regs[i], buff, bufc); 00681 } 00682 if(!**dstr) 00683 (*dstr)--; 00684 break; 00685 case 'O': /* 00686 * Objective pronoun 00687 */ 00688 case 'o': 00689 if(gender < 0) 00690 gender = get_gender(cause); 00691 if(!gender) 00692 tbuf = Name(cause); 00693 else 00694 tbuf = (char *) obj[gender]; 00695 safe_str(tbuf, buff, bufc); 00696 break; 00697 case 'P': /* 00698 * Personal pronoun 00699 */ 00700 case 'p': 00701 if(gender < 0) 00702 gender = get_gender(cause); 00703 if(!gender) { 00704 safe_str(Name(cause), buff, bufc); 00705 safe_chr('s', buff, bufc); 00706 } else { 00707 safe_str((char *) poss[gender], buff, bufc); 00708 } 00709 break; 00710 case 'S': /* 00711 * Subjective pronoun 00712 */ 00713 case 's': 00714 if(gender < 0) 00715 gender = get_gender(cause); 00716 if(!gender) 00717 tbuf = Name(cause); 00718 else 00719 tbuf = (char *) subj[gender]; 00720 safe_str(tbuf, buff, bufc); 00721 break; 00722 case 'A': /* 00723 * Absolute posessive 00724 */ 00725 case 'a': /* 00726 * idea from Empedocles 00727 */ 00728 if(gender < 0) 00729 gender = get_gender(cause); 00730 if(!gender) { 00731 safe_str(Name(cause), buff, bufc); 00732 safe_chr('s', buff, bufc); 00733 } else { 00734 safe_str((char *) absp[gender], buff, bufc); 00735 } 00736 break; 00737 case '#': /* 00738 * Invoker DB number 00739 */ 00740 tbuf = alloc_sbuf("exec.invoker"); 00741 sprintf(tbuf, "#%d", cause); 00742 safe_str(tbuf, buff, bufc); 00743 free_sbuf(tbuf); 00744 break; 00745 case '!': /* 00746 * Executor DB number 00747 */ 00748 tbuf = alloc_sbuf("exec.executor"); 00749 sprintf(tbuf, "#%d", player); 00750 safe_str(tbuf, buff, bufc); 00751 free_sbuf(tbuf); 00752 break; 00753 case 'N': /* 00754 * Invoker name 00755 */ 00756 case 'n': 00757 safe_str(Name(cause), buff, bufc); 00758 break; 00759 case 'L': /* 00760 * Invoker location db# 00761 */ 00762 case 'l': 00763 if(!(eval & EV_NO_LOCATION)) { 00764 tbuf = alloc_sbuf("exec.exloc"); 00765 sprintf(tbuf, "#%d", where_is(cause)); 00766 safe_str(tbuf, buff, bufc); 00767 free_sbuf(tbuf); 00768 } 00769 00770 break; 00771 default: /* 00772 * Just copy 00773 */ 00774 safe_chr(**dstr, buff, bufc); 00775 } 00776 if(isupper(savec)) 00777 *savepos = ToUpper(*savepos); 00778 break; 00779 case '(': 00780 /* 00781 * Arglist start. See if what precedes is a function. If so, 00782 * execute it if we should. 00783 */ 00784 00785 at_space = 0; 00786 if(!(eval & EV_FCHECK)) { 00787 safe_chr('(', buff, bufc); 00788 break; 00789 } 00790 /* 00791 * Load an sbuf with an uppercase version of the func name, and 00792 * see if the func exists. Trim trailing spaces from the name 00793 * if configured. 00794 */ 00795 00796 **bufc = '\0'; 00797 tbufc = tbuf = alloc_sbuf("exec.tbuf"); 00798 safe_sb_str(oldp, tbuf, &tbufc); 00799 *tbufc = '\0'; 00800 if(mudconf.space_compress) { 00801 while ((--tbufc >= tbuf) && isspace(*tbufc)); 00802 tbufc++; 00803 *tbufc = '\0'; 00804 } 00805 for(tbufc = tbuf; *tbufc; tbufc++) 00806 *tbufc = ToLower(*tbufc); 00807 fp = (FUN *) hashfind(tbuf, &mudstate.func_htab); 00808 00809 /* 00810 * If not a builtin func, check for global func 00811 */ 00812 00813 ufp = NULL; 00814 if(fp == NULL) { 00815 ufp = (UFUN *) hashfind(tbuf, &mudstate.ufunc_htab); 00816 } 00817 /* 00818 * Do the right thing if it doesn't exist 00819 */ 00820 00821 if(!fp && !ufp) { 00822 if(eval & EV_FMAND) { 00823 *bufc = oldp; 00824 safe_str((char *) "#-1 FUNCTION (", buff, bufc); 00825 safe_str(tbuf, buff, bufc); 00826 safe_str((char *) ") NOT FOUND", buff, bufc); 00827 alldone = 1; 00828 } else { 00829 safe_chr('(', buff, bufc); 00830 } 00831 free_sbuf(tbuf); 00832 eval &= ~EV_FCHECK; 00833 break; 00834 } 00835 free_sbuf(tbuf); 00836 00837 /* 00838 * Get the arglist and count the number of args * Neg 00839 * 00840 * * * * * * # of args means catenate subsequent 00841 * args 00842 */ 00843 00844 if(ufp) 00845 nfargs = NFARGS; 00846 else if(fp->nargs < 0) 00847 nfargs = -fp->nargs; 00848 else 00849 nfargs = NFARGS; 00850 tstr = *dstr; 00851 if(fp && (fp->flags & FN_NO_EVAL)) 00852 feval = (eval & ~EV_EVAL) | EV_STRIP_ESC; 00853 else 00854 feval = eval; 00855 *dstr = 00856 parse_arglist(player, cause, *dstr + 1, ')', feval, fargs, 00857 nfargs, cargs, ncargs); 00858 00859 /* 00860 * If no closing delim, just insert the '(' and * * * 00861 * 00862 * * continue normally 00863 */ 00864 00865 if(!*dstr) { 00866 *dstr = tstr; 00867 safe_chr(**dstr, buff, bufc); 00868 for(i = 0; i < nfargs; i++) 00869 if(fargs[i] != NULL) 00870 free_lbuf(fargs[i]); 00871 eval &= ~EV_FCHECK; 00872 break; 00873 } 00874 /* 00875 * Count number of args returned 00876 */ 00877 00878 (*dstr)--; 00879 j = 0; 00880 for(i = 0; i < nfargs; i++) 00881 if(fargs[i] != NULL) 00882 j = i + 1; 00883 nfargs = j; 00884 00885 /* 00886 * If it's a user-defined function, perform it now. 00887 */ 00888 00889 if(ufp) { 00890 mudstate.func_nest_lev++; 00891 if(!check_access(player, ufp->perms)) { 00892 safe_str("#-1 PERMISSION DENIED", buff, &oldp); 00893 *bufc = oldp; 00894 } else { 00895 tstr = atr_get(ufp->obj, ufp->atr, &aowner, &aflags); 00896 if(ufp->flags & FN_PRIV) 00897 i = ufp->obj; 00898 else 00899 i = player; 00900 str = tstr; 00901 00902 if(ufp->flags & FN_PRES) { 00903 for(j = 0; j < MAX_GLOBAL_REGS; j++) { 00904 if(!mudstate.global_regs[j]) 00905 preserve[j] = NULL; 00906 else { 00907 preserve[j] = alloc_lbuf("eval_regs"); 00908 StringCopy(preserve[j], 00909 mudstate.global_regs[j]); 00910 } 00911 } 00912 } 00913 00914 exec(buff, &oldp, 0, i, cause, feval, &str, fargs, 00915 nfargs); 00916 *bufc = oldp; 00917 00918 if(ufp->flags & FN_PRES) { 00919 for(j = 0; j < MAX_GLOBAL_REGS; j++) { 00920 if(preserve[j]) { 00921 if(!mudstate.global_regs[j]) 00922 mudstate.global_regs[j] = 00923 alloc_lbuf("eval_regs"); 00924 StringCopy(mudstate.global_regs[j], 00925 preserve[j]); 00926 free_lbuf(preserve[j]); 00927 } else { 00928 if(mudstate.global_regs[j]) 00929 *(mudstate.global_regs[i]) = '\0'; 00930 } 00931 } 00932 } 00933 00934 free_lbuf(tstr); 00935 } 00936 00937 /* 00938 * Return the space allocated for the args 00939 */ 00940 00941 mudstate.func_nest_lev--; 00942 for(i = 0; i < nfargs; i++) 00943 if(fargs[i] != NULL) 00944 free_lbuf(fargs[i]); 00945 eval &= ~EV_FCHECK; 00946 break; 00947 } 00948 /* 00949 * If the number of args is right, perform the func. 00950 * Otherwise return an error message. Note 00951 * that parse_arglist returns zero args as one 00952 * null arg, so we have to handle that case 00953 * specially. 00954 */ 00955 00956 if((fp->nargs == 0) && (nfargs == 1)) { 00957 if(!*fargs[0]) { 00958 free_lbuf(fargs[0]); 00959 fargs[0] = NULL; 00960 nfargs = 0; 00961 } 00962 } 00963 if((nfargs == fp->nargs) || (nfargs == -fp->nargs) || 00964 (fp->flags & FN_VARARGS)) { 00965 00966 /* 00967 * Check recursion limit 00968 */ 00969 00970 mudstate.func_nest_lev++; 00971 mudstate.func_invk_ctr++; 00972 if(mudstate.func_nest_lev >= mudconf.func_nest_lim) { 00973 safe_str("#-1 FUNCTION RECURSION LIMIT EXCEEDED", buff, 00974 bufc); 00975 } else if(mudstate.func_invk_ctr == mudconf.func_invk_lim) { 00976 safe_str("#-1 FUNCTION INVOCATION LIMIT EXCEEDED", 00977 buff, bufc); 00978 } else if(!check_access(player, fp->perms)) { 00979 safe_str("#-1 PERMISSION DENIED", buff, &oldp); 00980 *bufc = oldp; 00981 } else if(mudstate.func_invk_ctr < mudconf.func_invk_lim) { 00982 fp->fun(buff, &oldp, player, cause, fargs, nfargs, 00983 cargs, ncargs); 00984 *bufc = oldp; 00985 } else { 00986 **bufc = '\0'; 00987 } 00988 mudstate.func_nest_lev--; 00989 } else { 00990 *bufc = oldp; 00991 tstr = alloc_sbuf("exec.funcargs"); 00992 sprintf(tstr, "%d", fp->nargs); 00993 safe_str((char *) "#-1 FUNCTION (", buff, bufc); 00994 safe_str((char *) fp->name, buff, bufc); 00995 safe_str((char *) ") EXPECTS ", buff, bufc); 00996 safe_str(tstr, buff, bufc); 00997 safe_str((char *) " ARGUMENTS", buff, bufc); 00998 free_sbuf(tstr); 00999 } 01000 01001 /* 01002 * Return the space allocated for the arguments 01003 */ 01004 01005 for(i = 0; i < nfargs; i++) 01006 if(fargs[i] != NULL) 01007 free_lbuf(fargs[i]); 01008 eval &= ~EV_FCHECK; 01009 break; 01010 default: 01011 /* 01012 * A mundane character. Just copy it 01013 */ 01014 01015 at_space = 0; 01016 safe_chr(**dstr, buff, bufc); 01017 } 01018 (*dstr)++; 01019 } 01020 01021 /* 01022 * If we're eating spaces, and the last thing was a space, eat it 01023 * up. Complicated by the fact that at_space is initially 01024 * true. So check to see if we actually put something in the 01025 * buffer, too. 01026 */ 01027 01028 if(mudconf.space_compress && at_space && !(eval & EV_NO_COMPRESS) 01029 && (start != *bufc)) 01030 (*bufc)--; 01031 01032 /* 01033 * The ansi() function knows how to take care of itself. However, 01034 * if the player used a %c sub in the string, and hasn't yet 01035 * terminated the color with a %cn yet, we'll have to do it for 01036 * them. 01037 */ 01038 01039 if(ansi == 1) 01040 safe_str(ANSI_NORMAL, buff, bufc); 01041 01042 **bufc = '\0'; 01043 01044 /* 01045 * Report trace information 01046 */ 01047 01048 if(realbuff) { 01049 **bufc = '\0'; 01050 *bufc = realbp; 01051 safe_str(buff, realbuff, bufc); 01052 free(buff); 01053 buff = realbuff; 01054 } 01055 01056 if(is_trace) { 01057 tcache_add(savestr, start); 01058 save_count = tcache_count - mudconf.trace_limit;; 01059 if(is_top || !mudconf.trace_topdown) 01060 tcache_finish(player); 01061 if(is_top && (save_count > 0)) { 01062 tbuf = alloc_mbuf("exec.trace_diag"); 01063 sprintf(tbuf, "%d lines of trace output discarded.", save_count); 01064 notify(player, tbuf); 01065 free_mbuf(tbuf); 01066 } 01067 } 01068 }
Checks to see if the exit is visible to look.
Definition at line 1448 of file predicates.c.
References Dark, Light, VE_BASE_DARK, and VE_LOC_DARK.
Referenced by look_exits().
01449 { 01450 if(Dark(exit)) // Dark exit 01451 return 0; 01452 if(Light(exit)) // Light exit 01453 return 1; 01454 if(key & (VE_LOC_DARK | VE_BASE_DARK)) 01455 return 0; // Dark loc or base 01456 return 1; // Default 01457 }
Checks to see if the exit is visible. Used in lexits().
Definition at line 1430 of file predicates.c.
References Dark, Examinable, Light, VE_BASE_DARK, VE_LOC_DARK, and VE_LOC_XAM.
Referenced by fun_exit(), fun_lexits(), fun_next(), and match_exit_internal().
01431 { 01432 if(key & VE_LOC_XAM) // Exam exit's loc 01433 return 1; 01434 if(Examinable(player, exit)) // Exam exit 01435 return 1; 01436 if(Light(exit)) // Exit is light 01437 return 1; 01438 if(key & (VE_LOC_DARK | VE_BASE_DARK)) 01439 return 0; // Dark loc or base 01440 if(Dark(exit)) // Dark exit 01441 return 0; 01442 return 1; // Default 01443 }
int fetch_connect | ( | dbref | ) |
Definition at line 877 of file netcommon.c.
Referenced by fun_conn().
00878 { 00879 DESC *d; 00880 int result, conntime; 00881 00882 result = -1; 00883 DESC_ITER_PLAYER(target, d) { 00884 conntime = (mudstate.now - d->connected_at); 00885 if(conntime > result) 00886 result = conntime; 00887 } 00888 return result; 00889 }
int fetch_idle | ( | dbref | ) |
Definition at line 863 of file netcommon.c.
Referenced by do_comwho(), and fun_idle().
00864 { 00865 DESC *d; 00866 int result, idletime; 00867 00868 result = -1; 00869 DESC_ITER_PLAYER(target, d) { 00870 idletime = (mudstate.now - d->last_time); 00871 if((result == -1) || (idletime < result)) 00872 result = idletime; 00873 } 00874 return result; 00875 }
void flush_sockets | ( | ) |
Definition at line 692 of file bsd.c.
References descriptor_data::chokes, DESC_SAFEITER_ALL, descriptor_data::descriptor, and descriptor_data::sock_buff.
Referenced by raw_broadcast(), and shutdown_services().
00693 { 00694 int null = 0; 00695 DESC *d, *dnext; 00696 DESC_SAFEITER_ALL(d, dnext) { 00697 if(d->chokes) { 00698 #if TCP_CORK 00699 setsockopt(d->descriptor, IPPROTO_TCP, TCP_CORK, &null, 00700 sizeof(null)); 00701 #else 00702 #ifdef TCP_NOPUSH 00703 setsockopt(d->descriptor, IPPROTO_TCP, TCP_NOPUSH, &null, 00704 sizeof(null)); 00705 #endif 00706 #endif 00707 d->chokes = 0; 00708 } 00709 if(d->sock_buff && EVBUFFER_LENGTH(d->sock_buff->output)) { 00710 evbuffer_write(d->sock_buff->output, d->descriptor); 00711 } 00712 fsync(d->descriptor); 00713 } 00714 }
void fwdlist_clr | ( | dbref | ) |
Definition at line 332 of file db.c.
References fwdlist_get(), statedata::fwdlist_htab, mudstate, nhashdelete(), and XFREE.
Referenced by fwdlist_set().
00333 { 00334 FWDLIST *xfp; 00335 00336 /* 00337 * If a forwardlist exists, delete it 00338 */ 00339 00340 xfp = fwdlist_get(thing); 00341 if(xfp) { 00342 XFREE(xfp, "fwdlist_clr"); 00343 nhashdelete(thing, &mudstate.fwdlist_htab); 00344 } 00345 }
Definition at line 453 of file db.c.
References statedata::fwdlist_htab, mudstate, and nhashfind().
Referenced by check_dead_refs(), do_entrances(), fwdlist_clr(), fwdlist_set(), and notify_checked().
00454 { 00455 FWDLIST *fp; 00456 00457 fp = ((FWDLIST *) nhashfind(thing, &mudstate.fwdlist_htab)); 00458 00459 return fp; 00460 }
Definition at line 351 of file db.c.
References A_LLINK, alloc_lbuf, controls, could_doit(), forward_list::count, forward_list::data, free_lbuf, God, Good_obj, Link_ok, notify_printf(), and StringCopy.
Referenced by fwdlist_ck(), and process_preload().
00352 { 00353 dbref target; 00354 char *tp, *bp, *dp; 00355 int count, errors, fail; 00356 00357 count = 0; 00358 errors = 0; 00359 bp = tp = alloc_lbuf("fwdlist_load.str"); 00360 StringCopy(tp, atext); 00361 00362 do { 00363 for(; *bp && isspace(*bp); bp++); /* 00364 * skip spaces 00365 */ 00366 for(dp = bp; *bp && !isspace(*bp); bp++); /* 00367 * remember string 00368 */ 00369 if(*bp) 00370 *bp++ = '\0'; /* 00371 * terminate string 00372 */ 00373 if((*dp++ == '#') && isdigit(*dp)) { 00374 target = atoi(dp); 00375 fail = (!Good_obj(target) || (!God(player) && 00376 !controls(player, target) && (!Link_ok(target) || !could_doit(player, target, 00377 A_LLINK)))); 00378 if(fail) { 00379 notify_printf(player, 00380 "Cannot forward to #%d: Permission denied.", target); 00381 errors++; 00382 } else { 00383 fp->data[count++] = target; 00384 } 00385 } 00386 } while (*bp); 00387 00388 free_lbuf(tp); 00389 fp->count = count; 00390 return errors; 00391 }
int fwdlist_rewrite | ( | FWDLIST * | , | |
char * | ||||
) |
Definition at line 397 of file db.c.
References alloc_sbuf, forward_list::count, forward_list::data, free_sbuf, Good_obj, and safe_str.
Referenced by check_dead_refs(), and fwdlist_ck().
00398 { 00399 char *tp, *bp; 00400 int i, count; 00401 00402 if(fp && fp->count) { 00403 count = fp->count; 00404 tp = alloc_sbuf("fwdlist_rewrite.errors"); 00405 bp = atext; 00406 for(i = 0; i < fp->count; i++) { 00407 if(Good_obj(fp->data[i])) { 00408 sprintf(tp, "#%d ", fp->data[i]); 00409 safe_str(tp, atext, &bp); 00410 } else { 00411 count--; 00412 } 00413 } 00414 *bp = '\0'; 00415 free_sbuf(tp); 00416 } else { 00417 count = 0; 00418 *atext = '\0'; 00419 } 00420 return count; 00421 }
Definition at line 295 of file db.c.
References forward_list::count, forward_list::data, fwdlist_clr(), fwdlist_get(), statedata::fwdlist_htab, mudstate, nhashadd(), nhashrepl(), XFREE, and XMALLOC.
Referenced by fwdlist_ck(), and process_preload().
00296 { 00297 FWDLIST *fp, *xfp; 00298 int i; 00299 00300 /* 00301 * If fwdlist is null, clear 00302 */ 00303 00304 if(!ifp || (ifp->count <= 0)) { 00305 fwdlist_clr(thing); 00306 return; 00307 } 00308 /* 00309 * Copy input forwardlist to a correctly-sized buffer 00310 */ 00311 00312 fp = (FWDLIST *) XMALLOC(sizeof(int) * ((ifp->count) + 1), "fwdlist_set"); 00313 00314 for(i = 0; i < ifp->count; i++) { 00315 fp->data[i] = ifp->data[i]; 00316 } 00317 fp->count = ifp->count; 00318 00319 /* 00320 * Replace an existing forwardlist, or add a new one 00321 */ 00322 00323 xfp = fwdlist_get(thing); 00324 if(xfp) { 00325 XFREE(xfp, "fwdlist_set"); 00326 nhashrepl(thing, (int *) fp, &mudstate.fwdlist_htab); 00327 } else { 00328 nhashadd(thing, (int *) fp, &mudstate.fwdlist_htab); 00329 } 00330 }
int get_gender | ( | dbref | ) |
Definition at line 248 of file eval.c.
References A_SEX, atr_pget(), and free_lbuf.
Referenced by exec(), and handle_ears().
00249 { 00250 char first, *atr_gotten; 00251 dbref aowner; 00252 int aflags; 00253 00254 atr_gotten = atr_pget(player, A_SEX, &aowner, &aflags); 00255 first = *atr_gotten; 00256 free_lbuf(atr_gotten); 00257 switch (first) { 00258 case 'P': 00259 case 'p': 00260 return 4; 00261 case 'M': 00262 case 'm': 00263 return 3; 00264 case 'F': 00265 case 'f': 00266 case 'W': 00267 case 'w': 00268 return 2; 00269 default: 00270 return 1; 00271 } 00272 }
Definition at line 1264 of file predicates.c.
References A_LOCK, alloc_lbuf, atr_num(), attr, free_lbuf, Good_obj, lock_sw, match_thing(), parse_thing_slash(), safe_str, search_nametab(), and StringCopy.
Referenced by fun_elock(), and fun_lock().
01266 { 01267 char *str, *tbuf; 01268 int anum; 01269 01270 tbuf = alloc_lbuf("get_obj_and_lock"); 01271 StringCopy(tbuf, what); 01272 if(parse_thing_slash(player, tbuf, &str, it)) { 01273 01274 /* 01275 * <obj>/<lock> syntax, use the named lock 01276 */ 01277 01278 anum = search_nametab(player, lock_sw, str); 01279 if(anum < 0) { 01280 free_lbuf(tbuf); 01281 safe_str("#-1 LOCK NOT FOUND", errmsg, bufc); 01282 return 0; 01283 } 01284 } else { 01285 01286 /* 01287 * Not <obj>/<lock>, do a normal get of the default lock 01288 */ 01289 01290 *it = match_thing(player, what); 01291 if(!Good_obj(*it)) { 01292 free_lbuf(tbuf); 01293 safe_str("#-1 NOT FOUND", errmsg, bufc); 01294 return 0; 01295 } 01296 anum = A_LOCK; 01297 } 01298 01299 /* 01300 * Get the attribute definition, fail if not found 01301 */ 01302 01303 free_lbuf(tbuf); 01304 *attr = atr_num(anum); 01305 if(!(*attr)) { 01306 safe_str("#-1 LOCK NOT FOUND", errmsg, bufc); 01307 return 0; 01308 } 01309 return 1; 01310 }
void giveto | ( | dbref | who, | |
int | pennies | |||
) |
Give moner to a player.
Definition at line 383 of file predicates.c.
References Free_Money, Immortal, Owner, Pennies(), s_Pennies(), and Wizard.
Referenced by connect_player(), destroy_obj(), do_chown(), do_kill(), do_processcom(), do_top(), give_money(), halt_que(), link_exit(), move_object(), and nfy_que().
00384 { 00385 if(Wizard(who) || Wizard(Owner(who)) || Free_Money(who) || 00386 Free_Money(Owner(who)) || Immortal(who) || Immortal(Owner(who))) { 00387 return; 00388 } 00389 who = Owner(who); 00390 s_Pennies(who, Pennies(who) + pennies); 00391 }
char* grabto | ( | char ** | str, | |
char | targ | |||
) |
Return portion of a string up to the indicated character. Also returns a modified pointer to the string ready for another call.
Definition at line 291 of file stringutil.c.
Referenced by decrypt_logindata().
00292 { 00293 char *savec, *cp; 00294 00295 if(!str || !*str || !**str) 00296 return NULL; 00297 00298 savec = cp = *str; 00299 while (*cp && *cp != targ) 00300 cp++; 00301 if(*cp) 00302 *cp++ = '\0'; 00303 *str = cp; 00304 return savec; 00305 }
Definition at line 354 of file cque.c.
References a_Queue(), add_to(), objqe::cque, cque_deque(), cque_find(), free_qentry, giveto(), mudconf, mudstate, bque::next, NOTHING, Owner, statedata::qsemfirst, statedata::qsemlast, que_want(), statedata::qwait, s_Queue(), bque::text, and confdata::waitcost.
Referenced by check_dead_refs(), destroy_obj(), destroy_player(), do_chown(), do_halt(), do_kill(), and setup_que().
00355 { 00356 BQUE *trail, *point, *next; 00357 OBJQE *pque; 00358 00359 int numhalted; 00360 00361 numhalted = 0; 00362 00363 /* Player's que */ 00364 // XXX: nuke queu 00365 00366 pque = cque_find(player); 00367 if(pque && pque->cque) { 00368 while ((point = cque_deque(player)) != NULL) { 00369 free(point->text); 00370 point->text = NULL; 00371 free_qentry(point); 00372 point = NULL; 00373 numhalted++; 00374 } 00375 } 00376 pque = cque_find(object); 00377 if(pque && pque->cque) { 00378 while ((point = cque_deque(object)) != NULL) { 00379 free(point->text); 00380 point->text = NULL; 00381 free_qentry(point); 00382 point = NULL; 00383 numhalted++; 00384 } 00385 } 00386 00387 /* 00388 * Wait queue 00389 */ 00390 00391 for(point = mudstate.qwait, trail = NULL; point; point = next) 00392 if(que_want(point, player, object)) { 00393 numhalted++; 00394 if(trail) 00395 trail->next = next = point->next; 00396 else 00397 mudstate.qwait = next = point->next; 00398 if(evtimer_pending(&point->ev, NULL)) 00399 evtimer_del(&point->ev); 00400 free(point->text); 00401 free_qentry(point); 00402 } else 00403 next = (trail = point)->next; 00404 00405 /* 00406 * Semaphore queue 00407 */ 00408 00409 for(point = mudstate.qsemfirst, trail = NULL; point; point = next) 00410 if(que_want(point, player, object)) { 00411 numhalted++; 00412 if(trail) 00413 trail->next = next = point->next; 00414 else 00415 mudstate.qsemfirst = next = point->next; 00416 if(point == mudstate.qsemlast) 00417 mudstate.qsemlast = trail; 00418 add_to(point->sem, -1, point->attr); 00419 free(point->text); 00420 free_qentry(point); 00421 } else 00422 next = (trail = point)->next; 00423 00424 if(player == NOTHING) 00425 player = Owner(object); 00426 giveto(player, (mudconf.waitcost * numhalted)); 00427 if(object == NOTHING) 00428 s_Queue(player, 0); 00429 else 00430 a_Queue(player, -numhalted); 00431 return numhalted; 00432 }
void handle_ears | ( | dbref | thing, | |
int | could_hear, | |||
int | can_hear | |||
) |
Generate the 'grows ears' and 'loses ears' messages.
Definition at line 512 of file predicates.c.
References alloc_lbuf, free_lbuf, get_gender(), isExit, MSG_INV, MSG_LOC, MSG_ME, MSG_NBR, Name(), notify_checked(), StringCopy, and tprintf().
Referenced by do_set(), fh_hear_bit(), and set_attr_internal().
00513 { 00514 char *buff, *bp; 00515 int gender; 00516 static const char *poss[5] = { "", "its", "her", "his", "their" }; 00517 00518 if(!could_hear && can_hear) { 00519 buff = alloc_lbuf("handle_ears.grow"); 00520 StringCopy(buff, Name(thing)); 00521 if(isExit(thing)) { 00522 for(bp = buff; *bp && (*bp != ';'); bp++); 00523 *bp = '\0'; 00524 } 00525 gender = get_gender(thing); 00526 notify_checked(thing, thing, 00527 tprintf("%s grow%s ears and can now hear.", buff, 00528 (gender == 4) ? "" : "s"), 00529 (MSG_ME | MSG_NBR | MSG_LOC | MSG_INV)); 00530 free_lbuf(buff); 00531 } else if(could_hear && !can_hear) { 00532 buff = alloc_lbuf("handle_ears.lose"); 00533 StringCopy(buff, Name(thing)); 00534 if(isExit(thing)) { 00535 for(bp = buff; *bp && (*bp != ';'); bp++); 00536 *bp = '\0'; 00537 } 00538 gender = get_gender(thing); 00539 notify_checked(thing, thing, 00540 tprintf("%s lose%s %s ears and become%s deaf.", buff, 00541 (gender == 4) ? "" : "s", poss[gender], 00542 (gender == 4) ? "" : "s"), 00543 (MSG_ME | MSG_NBR | MSG_LOC | MSG_INV)); 00544 free_lbuf(buff); 00545 } 00546 }
Definition at line 1346 of file glue.c.
Referenced by autoeject(), char_disembark(), char_eject(), do_set(), fh_xcode_bit(), mech_discard_event(), and set_attr_internal().
01347 { 01348 if(from == to) 01349 return; 01350 if(!to) { 01351 s_Hardcode(obj); 01352 DisposeSpecialObject(player, obj); 01353 c_Hardcode(obj); 01354 } else 01355 CreateNewSpecialObject(player, obj); 01356 }
Definition at line 183 of file glue.c.
References Contents, HandledCommand_sub(), Has_contents, LBUF_SIZE, MBUF_SIZE, OkayHcode, SAFE_DOLIST, and Slave.
Referenced by process_command().
00184 { 00185 dbref curr, temp; 00186 00187 if(Slave(player)) 00188 return 0; 00189 if(strlen(command) > (LBUF_SIZE - MBUF_SIZE)) 00190 return 0; 00191 if(OkayHcode(player) && HandledCommand_sub(player, player, command)) 00192 return 1; 00193 if(OkayHcode(loc) && HandledCommand_sub(player, loc, command)) 00194 return 1; 00195 SAFE_DOLIST(curr, temp, Contents(player)) { 00196 if(OkayHcode(curr)) 00197 if(HandledCommand_sub(player, curr, command)) 00198 return 1; 00199 #if 0 /* Recursion is evil ; let's not do that, this time */ 00200 if(Has_contents(curr)) 00201 if(HandledCommand_contents(player, curr, command)) 00202 return 1; 00203 #endif 00204 } 00205 return 0; 00206 }
int Hearer | ( | dbref | ) |
Definition at line 1130 of file game.c.
References A_LISTEN, AF_NOPROG, alloc_lbuf, AMATCH_LISTEN, atr_get_str(), atr_head(), atr_next(), atr_num(), Connected, attr::flags, free_lbuf, statedata::inpipe, Monitor, mudstate, statedata::poutobj, and Puppet.
Referenced by do_examine(), do_set(), fh_hear_bit(), fun_set(), look_in(), look_simple(), move_via_exit(), move_via_generic(), move_via_teleport(), and set_attr_internal().
01131 { 01132 char *as, *buff, *s; 01133 dbref aowner; 01134 int attr, aflags; 01135 ATTR *ap; 01136 01137 if(mudstate.inpipe && (thing == mudstate.poutobj)) 01138 return 1; 01139 01140 if(Connected(thing) || Puppet(thing)) 01141 return 1; 01142 01143 if(Monitor(thing)) 01144 buff = alloc_lbuf("Hearer"); 01145 else 01146 buff = NULL; 01147 for(attr = atr_head(thing, &as); attr; attr = atr_next(&as)) { 01148 if(attr == A_LISTEN) { 01149 if(buff) 01150 free_lbuf(buff); 01151 return 1; 01152 } 01153 if(Monitor(thing)) { 01154 ap = atr_num(attr); 01155 if(!ap || (ap->flags & AF_NOPROG)) 01156 continue; 01157 01158 atr_get_str(buff, thing, attr, &aowner, &aflags); 01159 01160 /* 01161 * Make sure we can execute it 01162 */ 01163 01164 if((buff[0] != AMATCH_LISTEN) || (aflags & AF_NOPROG)) 01165 continue; 01166 01167 /* 01168 * Make sure there's a : in it 01169 */ 01170 01171 for(s = buff + 1; *s && (*s != ':'); s++); 01172 if(s) { 01173 free_lbuf(buff); 01174 return 1; 01175 } 01176 } 01177 } 01178 if(buff) 01179 free_lbuf(buff); 01180 return 0; 01181 }
void helpindex_faction_load | ( | dbref | ) |
void helpindex_init | ( | void | ) |
Definition at line 128 of file help.c.
References HASH_FACTOR, hashinit(), statedata::help_htab, helpindex_load(), mudstate, statedata::news_htab, NOTHING, statedata::plushelp_htab, statedata::wizhelp_htab, and statedata::wiznews_htab.
Referenced by main().
00129 { 00130 hashinit(&mudstate.news_htab, 30 * HASH_FACTOR); 00131 hashinit(&mudstate.help_htab, 400 * HASH_FACTOR); 00132 hashinit(&mudstate.wizhelp_htab, 400 * HASH_FACTOR); 00133 hashinit(&mudstate.plushelp_htab, 400 * HASH_FACTOR); 00134 hashinit(&mudstate.wiznews_htab, 400 * HASH_FACTOR); 00135 00136 helpindex_load(NOTHING); 00137 }
void helpindex_load | ( | dbref | ) |
Definition at line 112 of file help.c.
References statedata::help_htab, confdata::help_indx, helpindex_read(), mudconf, mudstate, statedata::news_htab, confdata::news_indx, NOTHING, notify_printf(), statedata::plushelp_htab, confdata::plushelp_indx, Quiet, confdata::whelp_indx, statedata::wizhelp_htab, statedata::wiznews_htab, and confdata::wiznews_indx.
Referenced by do_readcache(), and helpindex_init().
00113 { 00114 int news, help, whelp; 00115 int phelp, wnhelp; 00116 00117 phelp = helpindex_read(&mudstate.plushelp_htab, mudconf.plushelp_indx); 00118 wnhelp = helpindex_read(&mudstate.wiznews_htab, mudconf.wiznews_indx); 00119 news = helpindex_read(&mudstate.news_htab, mudconf.news_indx); 00120 help = helpindex_read(&mudstate.help_htab, mudconf.help_indx); 00121 whelp = helpindex_read(&mudstate.wizhelp_htab, mudconf.whelp_indx); 00122 if((player != NOTHING) && !Quiet(player)) 00123 notify_printf(player, 00124 "Index entries: News...%d Help...%d Wizhelp...%d +Help...%d Wiznews...%d", 00125 news, help, whelp, phelp, wnhelp); 00126 }
int helpindex_read | ( | HASHTAB * | , | |
char * | ||||
) |
Definition at line 35 of file help.c.
Referenced by helpindex_load().
00036 { 00037 help_indx entry; 00038 char *p; 00039 int count; 00040 FILE *fp; 00041 struct help_entry *htab_entry; 00042 00043 /* 00044 * Let's clean out our hash table, before we throw it away. 00045 */ 00046 for(htab_entry = (struct help_entry *) hash_firstentry(htab); 00047 htab_entry; htab_entry = (struct help_entry *) hash_nextentry(htab)) { 00048 free(htab_entry->key); 00049 free(htab_entry); 00050 } 00051 00052 hashflush(htab, 0); 00053 if((fp = fopen(filename, "r")) == NULL) { 00054 STARTLOG(LOG_PROBLEMS, "HLP", "RINDX") { 00055 p = alloc_lbuf("helpindex_read.LOG"); 00056 sprintf(p, "Can't open %s for reading.", filename); 00057 log_text(p); 00058 free_lbuf(p); 00059 ENDLOG; 00060 } 00061 return -1; 00062 } 00063 count = 0; 00064 while ((fread((char *) &entry, sizeof(help_indx), 1, fp)) == 1) { 00065 00066 /* 00067 * Lowercase the entry and add all leftmost substrings. * * * 00068 * 00069 * * Substrings already added will be rejected by hashadd. 00070 */ 00071 for(p = entry.topic; *p; p++) 00072 *p = ToLower(*p); 00073 00074 htab_entry = (struct help_entry *) malloc(sizeof(struct help_entry)); 00075 00076 htab_entry->pos = entry.pos; 00077 htab_entry->original = 1; /* 00078 * First is the longest 00079 */ 00080 htab_entry->key = (char *) malloc(strlen(entry.topic) + 1); 00081 StringCopy(htab_entry->key, entry.topic); 00082 while (p > entry.topic) { 00083 p--; 00084 if(!isspace(*p)) { 00085 if((hashadd(entry.topic, (int *) htab_entry, htab)) == 0) 00086 count++; 00087 else { 00088 free(htab_entry->key); 00089 free(htab_entry); 00090 } 00091 } else { 00092 free(htab_entry->key); 00093 free(htab_entry); 00094 } 00095 *p = '\0'; 00096 htab_entry = 00097 (struct help_entry *) malloc(sizeof(struct help_entry)); 00098 00099 htab_entry->pos = entry.pos; 00100 htab_entry->original = 0; 00101 htab_entry->key = (char *) malloc(strlen(entry.topic) + 1); 00102 StringCopy(htab_entry->key, entry.topic); 00103 } 00104 free(htab_entry->key); 00105 free(htab_entry); 00106 } 00107 fclose(fp); 00108 hashreset(htab); 00109 return count; 00110 }
int init_gdbm_db | ( | char * | ) |
void init_min_db | ( | void | ) |
Puts an object at the head of a list
Definition at line 91 of file predicates.c.
References s_Next.
Referenced by do_clone(), do_drop(), do_get(), do_teleport(), and move_object().
00092 { 00093 s_Next(thing, head); 00094 return thing; 00095 }
int is_integer | ( | char * | str | ) |
Checks for the presence of an integer
Definition at line 148 of file predicates.c.
Referenced by autodetect_list(), fun_space(), and xlate().
00149 { 00150 while (*str && isspace(*str)) 00151 str++; /* 00152 * Leading spaces 00153 */ 00154 if(*str == '-') { /* 00155 * Leading minus 00156 */ 00157 str++; 00158 if(!*str) 00159 return 0; /* 00160 * but not if just a minus 00161 */ 00162 } 00163 if(!isdigit(*str)) /* 00164 * Need at least 1 integer 00165 */ 00166 return 0; 00167 while (*str && isdigit(*str)) 00168 str++; /* 00169 * The number (int) 00170 */ 00171 while (*str && isspace(*str)) 00172 str++; /* 00173 * Trailing spaces 00174 */ 00175 return (*str ? 0 : 1); 00176 }
int is_number | ( | char * | str | ) |
Checks for the presence of a number
Definition at line 181 of file predicates.c.
Referenced by autodetect_list(), do_boot(), do_del_macro(), do_edit_macro(), do_ex_macro(), do_gex_macro(), do_give(), do_poor(), do_wait(), fun_dec(), fun_doing(), fun_inc(), fun_isnum(), fun_mail(), fun_shl(), fun_shr(), and lookup_player().
00182 { 00183 int got_one; 00184 00185 while (*str && isspace(*str)) 00186 str++; /* 00187 * Leading spaces 00188 */ 00189 if(*str == '-') { /* 00190 * Leading minus 00191 */ 00192 str++; 00193 if(!*str) 00194 return 0; /* 00195 * but not if just a minus 00196 */ 00197 } 00198 got_one = 0; 00199 if(isdigit(*str)) 00200 got_one = 1; /* 00201 * Need at least one digit 00202 */ 00203 while (*str && isdigit(*str)) 00204 str++; /* 00205 * The number (int) 00206 */ 00207 if(*str == '.') 00208 str++; /* 00209 * decimal point 00210 */ 00211 if(isdigit(*str)) 00212 got_one = 1; /* 00213 * Need at least one digit 00214 */ 00215 while (*str && isdigit(*str)) 00216 str++; /* 00217 * The number (fract) 00218 */ 00219 while (*str && isspace(*str)) 00220 str++; /* 00221 * Trailing spaces 00222 */ 00223 return ((*str || !got_one) ? 0 : 1); 00224 }
void list_bufstats | ( | dbref | ) |
void list_buftrace | ( | dbref | ) |
void list_chashstats | ( | dbref | ) |
match a list of things, using the no_command flag
Definition at line 1111 of file game.c.
References atr_match(), statedata::db_top, mudstate, Next, No_Command, and NOTHING.
Referenced by process_command().
01113 { 01114 int match, limit; 01115 01116 match = 0; 01117 limit = mudstate.db_top; 01118 while (thing != NOTHING) { 01119 if((thing != player) && (!(No_Command(thing)))) { 01120 if(atr_match(thing, player, type, str, check_parent) > 0) 01121 match = 1; 01122 } 01123 thing = Next(thing); 01124 if(--limit < 0) 01125 return match; 01126 } 01127 return match; 01128 }
void list_fhashstats | ( | dbref | ) |
int load_mail | ( | FILE * | ) |
Definition at line 1473 of file mail.c.
References add_count(), add_mail_message_nosig(), mail::from, getref(), getstring_noalloc(), load_malias(), mail_db_grow(), statedata::mail_htab, mudstate, new_mail_message(), mail::next, nhashadd(), nhashfind(), number, mail::number, mail::prev, mail::read, mail::subject, mail::time, mail::to, mail::tolist, and tprintf().
Referenced by load_game().
01474 { 01475 char nbuf1[8]; 01476 int mail_top = 0; 01477 int new = 0; 01478 int pennsub = 0; 01479 int read_tolist = 0; 01480 int read_newdb = 0; 01481 int read_new_strings = 0; 01482 int number = 0; 01483 01484 struct mail *mp, *mptr; 01485 01486 /* 01487 * Read the version number 01488 */ 01489 fgets(nbuf1, sizeof(nbuf1), fp); 01490 01491 if(!strncmp(nbuf1, "+V2", 3)) { 01492 new = 1; 01493 } else if(!strncmp(nbuf1, "+V3", 3)) { 01494 new = 1; 01495 read_tolist = 1; 01496 } else if(!strncmp(nbuf1, "+V4", 3)) { 01497 new = 1; 01498 read_tolist = 1; 01499 read_newdb = 1; 01500 } else if(!strncmp(nbuf1, "+V5", 3)) { 01501 new = 1; 01502 read_tolist = 1; 01503 read_newdb = 1; 01504 read_new_strings = 1; 01505 } else if(!strncmp(nbuf1, "+1", 2)) { 01506 pennsub = 1; 01507 } 01508 if(pennsub) 01509 fgets(nbuf1, sizeof(nbuf1), fp); /* 01510 * Toss away the * * 01511 * * number of 01512 * messages * * * 01513 */ 01514 if(read_newdb) { 01515 mail_top = getref(fp); 01516 mail_db_grow(mail_top + 1); 01517 } else { 01518 mail_db_grow(1); 01519 } 01520 01521 fgets(nbuf1, sizeof(nbuf1), fp); 01522 01523 while (strncmp(nbuf1, "***", 3)) { 01524 mp = (struct mail *) malloc(sizeof(struct mail)); 01525 01526 mp->to = atoi(nbuf1); 01527 01528 if(!nhashfind((int) mp->to, &mudstate.mail_htab)) { 01529 nhashadd((int) mp->to, (int *) mp, &mudstate.mail_htab); 01530 mp->prev = NULL; 01531 mp->next = NULL; 01532 } else { 01533 for(mptr = 01534 (struct mail *) nhashfind((int) mp->to, 01535 &mudstate.mail_htab); 01536 mptr->next != NULL; mptr = mptr->next); 01537 mptr->next = mp; 01538 mp->prev = mptr; 01539 mp->next = NULL; 01540 } 01541 01542 mp->from = getref(fp); 01543 01544 if(read_newdb) { 01545 mp->number = getref(fp); 01546 add_count(mp->number); 01547 } 01548 if(read_tolist) 01549 mp->tolist = 01550 (char *) strdup(getstring_noalloc(fp, read_new_strings)); 01551 else 01552 mp->tolist = (char *) strdup(tprintf("%d", mp->to)); 01553 01554 mp->time = (char *) strdup(getstring_noalloc(fp, read_new_strings)); 01555 if(pennsub) 01556 mp->subject = 01557 (char *) strdup(getstring_noalloc(fp, read_new_strings)); 01558 else if(!new) 01559 mp->subject = (char *) strdup("No subject"); 01560 01561 if(!read_newdb) { 01562 number = 01563 add_mail_message_nosig(getstring_noalloc(fp, 01564 read_new_strings)); 01565 add_count(number); 01566 mp->number = number; 01567 } 01568 if(new) 01569 mp->subject = 01570 (char *) strdup(getstring_noalloc(fp, read_new_strings)); 01571 else if(!pennsub) 01572 mp->subject = (char *) strdup("No subject"); 01573 mp->read = getref(fp); 01574 fgets(nbuf1, sizeof(nbuf1), fp); 01575 } 01576 01577 if(read_newdb) { 01578 fgets(nbuf1, sizeof(nbuf1), fp); 01579 01580 while (strncmp(nbuf1, "+++", 3)) { 01581 number = atoi(nbuf1); 01582 new_mail_message(getstring_noalloc(fp, read_new_strings), number); 01583 fgets(nbuf1, sizeof(nbuf1), fp); 01584 } 01585 } 01586 load_malias(fp); 01587 return (1); 01588 }
void load_player_names | ( | void | ) |
Definition at line 510 of file player.c.
References A_ALIAS, add_player_name(), alloc_lbuf, atr_pget_str(), DO_WHOLE_DB, free_lbuf, Name(), TYPE_PLAYER, and Typeof.
Referenced by db_make_minimal(), db_read(), and mmdb_db_read().
00511 { 00512 dbref i, j, aowner; 00513 int aflags; 00514 char *alias; 00515 00516 j = 0; 00517 DO_WHOLE_DB(i) { 00518 if(Typeof(i) == TYPE_PLAYER) { 00519 add_player_name(i, Name(i)); 00520 } 00521 } 00522 alias = alloc_lbuf("load_player_names"); 00523 j = 0; 00524 DO_WHOLE_DB(i) { 00525 if(Typeof(i) == TYPE_PLAYER) { 00526 alias = atr_pget_str(alias, i, A_ALIAS, &aowner, &aflags); 00527 if(*alias) 00528 add_player_name(i, alias); 00529 } 00530 } 00531 free_lbuf(alias); 00532 }
void LoadSpecialObjects | ( | void | ) |
Definition at line 567 of file glue.c.
Referenced by debug_loaddb(), and load_game().
00568 { 00569 dbref i; 00570 int id, brand; 00571 int type; 00572 void *tmpdat; 00573 00574 muxevent_initialize(); 00575 muxevent_count_initialize(); 00576 init_stat(); 00577 initialize_partname_tables(); 00578 for(i = 0; MissileHitTable[i].key != -1; i++) { 00579 if(find_matching_vlong_part(MissileHitTable[i].name, NULL, &id, 00580 &brand)) 00581 MissileHitTable[i].key = Weapon2I(id); 00582 else 00583 MissileHitTable[i].key = -2; 00584 } 00585 /* Loop through the entire database, and if it has the special */ 00586 /* object flag, add it to our linked list. */ 00587 for(i = 0; i < mudstate.db_top; i++) 00588 if(Hardcode(i) && !Going(i) && !Halted(i)) { 00589 type = WhichSpecialS(i); 00590 if(type >= 0) { 00591 if(SpecialObjects[type].datasize > 0) 00592 tmpdat = NewSpecialObject(i, type); 00593 else 00594 tmpdat = NULL; 00595 } else 00596 c_Hardcode(i); /* Reset the flag */ 00597 } 00598 for(i = 0; i < NUM_SPECIAL_OBJECTS; i++) { 00599 InitSpecialHash(i); 00600 if(!SpecialObjects[i].updatefunc) 00601 SpecialObjects[i].updateTime = 0; 00602 } 00603 init_btechstats(); 00604 load_xcode(); 00605 zap_unneccessary_hcode(); 00606 }
Definition at line 1358 of file predicates.c.
References Examinable, Find_Unfindable, Findable, Good_obj, Hideout, NOTHING, where_is(), where_room(), and Wizard.
Referenced by fun_findable(), fun_loc(), fun_rloc(), fun_room(), and fun_where().
01359 { 01360 dbref loc_it, room_it; 01361 int findable_room; 01362 01363 /* 01364 * No sense if trying to locate a bad object 01365 */ 01366 01367 if(!Good_obj(it)) 01368 return 0; 01369 01370 loc_it = where_is(it); 01371 01372 /* 01373 * Succeed if we can examine the target, if we are the target, * if * 01374 * 01375 * * * * we can examine the location, if a wizard caused the lookup, 01376 * * or * * * if the target caused the lookup. 01377 */ 01378 01379 if(Examinable(player, it) || Find_Unfindable(player) || 01380 (loc_it == player) || ((loc_it != NOTHING) && 01381 (Examinable(player, loc_it) 01382 || loc_it == where_is(player))) 01383 || Wizard(cause) || (it == cause)) 01384 return 1; 01385 01386 room_it = where_room(it); 01387 if(Good_obj(room_it)) 01388 findable_room = !Hideout(room_it); 01389 else 01390 findable_room = 1; 01391 01392 /* 01393 * Succeed if we control the containing room or if the target is * * 01394 * * * findable and the containing room is not unfindable. 01395 */ 01396 01397 if(((room_it != NOTHING) && Examinable(player, room_it)) || 01398 Find_Unfindable(player) || (Findable(it) && findable_room)) 01399 return 1; 01400 01401 /* 01402 * We can't do it. 01403 */ 01404 01405 return 0; 01406 }
void log_error | ( | int | , | |
char * | , | |||
char * | , | |||
char * | , | |||
... | ||||
) |
Definition at line 191 of file log.c.
References statedata::buffer, LBUF_SIZE, confdata::log_info, confdata::log_options, LOGOPT_TIMESTAMP, confdata::mud_name, mudconf, mudstate, strip_ansi_r(), and time().
Referenced by accept_new_connection(), bind_signals(), cf_log_notfound(), cf_log_syntax(), cf_set(), cf_status_from_succfail(), cf_string(), do_command(), do_link(), do_unauth_command(), eradicate_broken_fd(), fcache_read(), fork_and_dump(), process_command(), and shutdownsock().
00192 { 00193 char buffer[LBUF_SIZE]; 00194 char stripped_buffer[LBUF_SIZE]; 00195 va_list ap; 00196 00197 if(!(key & mudconf.log_options)) 00198 return; 00199 00200 if(mudconf.log_info & LOGOPT_TIMESTAMP) { 00201 time_t now; 00202 struct tm tm; 00203 time(&now); 00204 localtime_r(&now, &tm); 00205 fprintf(stderr, "%d%02d%02d.%02d%02d%02d ", 00206 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 00207 tm.tm_hour, tm.tm_min, tm.tm_sec); 00208 } 00209 00210 if(secondary && &secondary) { 00211 fprintf(stderr, "%s%s %3s/%-5s: ", mudstate.buffer, 00212 mudconf.mud_name, primary, secondary); 00213 } else { 00214 fprintf(stderr, "%s%s %-9s: ", mudstate.buffer, 00215 mudconf.mud_name, primary); 00216 } 00217 00218 va_start(ap, format); 00219 vsnprintf(buffer, LBUF_SIZE, format, ap); 00220 va_end(ap); 00221 00222 strip_ansi_r(stripped_buffer, buffer, LBUF_SIZE); 00223 fprintf(stderr, "%s\n", stripped_buffer); 00224 }
void log_name | ( | dbref | target | ) |
Writes the name, db number, and flags of an object to the log. If the object does not own itself, append the name, db number, and flags of the owner.
Definition at line 253 of file log.c.
References free_lbuf, GOD, LBUF_SIZE, confdata::log_info, LOGOPT_FLAGS, LOGOPT_OWNER, mudconf, Owner, strip_ansi_r(), unparse_object(), and unparse_object_numonly().
Referenced by check_connect(), do_boot(), do_fixdb(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_say(), do_shutdown(), do_toad(), failconn(), and log_name_and_loc().
00254 { 00255 char *tp; 00256 char new[LBUF_SIZE]; 00257 00258 if((mudconf.log_info & LOGOPT_FLAGS) != 0) 00259 tp = unparse_object((dbref) GOD, target, 0); 00260 else 00261 tp = unparse_object_numonly(target); 00262 strncpy(new, tp, LBUF_SIZE-1); 00263 fprintf(stderr, "%s", strip_ansi_r(new,tp,strlen(tp))); 00264 free_lbuf(tp); 00265 if(((mudconf.log_info & LOGOPT_OWNER) != 0) && (target != Owner(target))) { 00266 if((mudconf.log_info & LOGOPT_FLAGS) != 0) 00267 tp = unparse_object((dbref) GOD, Owner(target), 0); 00268 else 00269 tp = unparse_object_numonly(Owner(target)); 00270 strncpy(new, tp, LBUF_SIZE-1); 00271 fprintf(stderr, "[%s]", strip_ansi_r(new,tp,strlen(tp))); 00272 free_lbuf(tp); 00273 } 00274 return; 00275 }
void log_name_and_loc | ( | dbref | player | ) |
Log both the name and location of an object
Definition at line 280 of file log.c.
References Has_location, Location, confdata::log_info, log_name(), log_text(), LOGOPT_LOC, and mudconf.
Referenced by check_connect(), do_boot(), do_toad(), eval_boolexp(), process_command(), and report().
00281 { 00282 log_name(player); 00283 if((mudconf.log_info & LOGOPT_LOC) && Has_location(player)) { 00284 log_text((char *) " in "); 00285 log_name(Location(player)); 00286 } 00287 return; 00288 }
void log_number | ( | int | ) |
void log_perror | ( | const char * | primary, | |
const char * | secondary, | |||
const char * | extra, | |||
const char * | failing_object | |||
) |
Write perror message to the log
Definition at line 167 of file log.c.
References log_text(), statedata::logging, mudstate, and start_log().
Referenced by bind_mux_socket(), close_sockets(), dnschild_finish(), dnschild_request(), dump_database_internal(), init_rlimit(), logcache_open(), make_blocking(), make_nonblocking(), network_bind_port(), network_make_blocking(), network_make_nonblocking(), and SaveSpecialObjects().
00169 { 00170 start_log(primary, secondary); 00171 if(extra && *extra) { 00172 log_text((char *) "("); 00173 log_text((char *) extra); 00174 log_text((char *) ") "); 00175 } 00176 perror((char *) failing_object); 00177 fflush(stderr); 00178 mudstate.logging--; 00179 }
void log_printf | ( | char * | , | |
... | ||||
) |
Definition at line 226 of file log.c.
References LBUF_SIZE, and strip_ansi_r().
Referenced by network_accept_client(), network_init(), and network_initialize_socket().
00227 { 00228 char buffer[LBUF_SIZE]; 00229 char stripped_buffer[LBUF_SIZE]; 00230 va_list ap; 00231 00232 va_start(ap, format); 00233 vsnprintf(buffer, LBUF_SIZE, format, ap); 00234 va_end(ap); 00235 00236 strip_ansi_r(stripped_buffer, buffer, LBUF_SIZE); 00237 fprintf(stderr, "%s\n", stripped_buffer); 00238 }
void log_text | ( | char * | text | ) |
Write text to log file.
Definition at line 184 of file log.c.
References LBUF_SIZE, and strip_ansi_r().
Referenced by announce_connect(), announce_disconnect(), check_connect(), create_guest(), desc_delhash(), do_boot(), do_fixdb(), do_help(), do_mail_nuke(), do_name(), do_newpassword(), do_pcreate(), do_quota(), do_restart(), do_say(), do_shutdown(), do_toad(), dump_database(), eval_boolexp(), failconn(), helpindex_read(), init_version(), load_game(), Log_header_err(), log_name_and_loc(), log_perror(), Log_pointer_err(), Log_simple_err(), log_type_and_name(), log_type_and_num(), mail_match(), main(), process_command(), and report().
00185 { 00186 char new[LBUF_SIZE]; 00187 strncpy(new, text, LBUF_SIZE-1); 00188 fprintf(stderr, "%s", strip_ansi_r(new,text,strlen(text))); 00189 }
void log_type_and_name | ( | dbref | ) |
Definition at line 314 of file log.c.
References Good_obj, log_text(), Name(), and OBJTYP().
Referenced by Log_header_err(), Log_pointer_err(), and Log_simple_err().
00315 { 00316 char nbuf[16]; 00317 00318 log_text(OBJTYP(thing)); 00319 sprintf(nbuf, " #%d(", thing); 00320 log_text(nbuf); 00321 if(Good_obj(thing)) 00322 log_text(Name(thing)); 00323 log_text((char *) ")"); 00324 return; 00325 }
void log_type_and_num | ( | dbref | ) |
Definition at line 353 of file look.c.
References A_AFAIL, A_ASUCC, A_FAIL, A_LOCK, A_OFAIL, A_OSUCC, A_SUCC, CONTENTS_LOCAL, could_doit(), did_it(), free_lbuf, Good_obj, Hearer(), LK_IDESC, LK_OBEYTERSE, LK_SHOWATTR, LK_SHOWEXIT, Location, look_atrs(), look_contents(), look_exits(), mudconf, notify, confdata::quiet_look, show_desc(), Terse, confdata::terse_contents, confdata::terse_exits, TYPE_ROOM, Typeof, and unparse_object().
Referenced by announce_connect(), do_look(), and move_object().
00354 { 00355 int pattr, oattr, aattr, is_terse, showkey; 00356 char *buff; 00357 00358 is_terse = (key & LK_OBEYTERSE) ? Terse(player) : 0; 00359 00360 /* 00361 * Only makes sense for things that can hear 00362 */ 00363 00364 if(!Hearer(player)) 00365 return; 00366 00367 /* 00368 * tell him the name, and the number if he can link to it 00369 */ 00370 00371 buff = unparse_object(player, loc, 1); 00372 notify(player, buff); 00373 free_lbuf(buff); 00374 00375 if(!Good_obj(loc)) 00376 return; /* 00377 * If we went to NOTHING et al, skip the * * 00378 * 00379 * * rest 00380 */ 00381 00382 /* 00383 * tell him the description 00384 */ 00385 00386 showkey = 0; 00387 if(loc == Location(player)) 00388 showkey |= LK_IDESC; 00389 if(key & LK_OBEYTERSE) 00390 showkey |= LK_OBEYTERSE; 00391 show_desc(player, loc, showkey); 00392 00393 /* 00394 * tell him the appropriate messages if he has the key 00395 */ 00396 00397 if(Typeof(loc) == TYPE_ROOM) { 00398 if(could_doit(player, loc, A_LOCK)) { 00399 pattr = A_SUCC; 00400 oattr = A_OSUCC; 00401 aattr = A_ASUCC; 00402 } else { 00403 pattr = A_FAIL; 00404 oattr = A_OFAIL; 00405 aattr = A_AFAIL; 00406 } 00407 if(is_terse) 00408 pattr = 0; 00409 did_it(player, loc, pattr, NULL, oattr, NULL, aattr, 00410 (char **) NULL, 0); 00411 } 00412 /* 00413 * tell him the attributes, contents and exits 00414 */ 00415 00416 if((key & LK_SHOWATTR) && !mudconf.quiet_look && !is_terse) 00417 look_atrs(player, loc, 0); 00418 if(!is_terse || mudconf.terse_contents) 00419 look_contents(player, loc, "Contents:", CONTENTS_LOCAL); 00420 if((key & LK_SHOWEXIT) && (!is_terse || mudconf.terse_exits)) 00421 look_exits(player, loc, "Obvious exits:"); 00422 }
Definition at line 469 of file player.c.
References alloc_lbuf, Dark, find_connected_name(), free_lbuf, God, Good_obj, hashfind(), is_number(), mudstate, NOTHING, NUMBER_TOKEN, statedata::player_htab, safe_str, string_compare(), ToLower, TYPE_PLAYER, and Typeof.
Referenced by char_lookupplayer(), connect_player(), create_obj(), dbrefs_to_names(), do_alias(), do_chown(), do_editchannel(), do_fixdb(), do_last(), do_mail_debug(), do_mail_retract(), do_mail_review(), do_mail_stats(), do_malias_add(), do_malias_chown(), do_malias_create(), do_malias_remove(), do_name(), do_newpassword(), do_page(), do_quota(), do_stats(), fun_conn(), fun_doing(), fun_idle(), fun_mail(), fun_mailfrom(), fun_pmatch(), fun_ports(), fun_stats(), make_guest(), make_numlist(), match_player(), parse_msglist(), and search_setup().
00470 { 00471 dbref *p, thing; 00472 char *temp, *tp; 00473 00474 if(!string_compare(name, "me")) 00475 return doer; 00476 00477 if(*name == NUMBER_TOKEN) { 00478 name++; 00479 if(!is_number(name)) 00480 return NOTHING; 00481 thing = atoi(name); 00482 if(!Good_obj(thing)) 00483 return NOTHING; 00484 if(!((Typeof(thing) == TYPE_PLAYER) || God(doer))) 00485 thing = NOTHING; 00486 return thing; 00487 } 00488 tp = temp = alloc_lbuf("lookup_player"); 00489 safe_str(name, temp, &tp); 00490 *tp = '\0'; 00491 for(tp = temp; *tp; tp++) 00492 *tp = ToLower(*tp); 00493 p = (int *) hashfind(temp, &mudstate.player_htab); 00494 free_lbuf(temp); 00495 if(!p) { 00496 if(check_who) { 00497 thing = find_connected_name(doer, name); 00498 if(Dark(thing)) 00499 thing = NOTHING; 00500 } else 00501 thing = NOTHING; 00502 } else if(!Good_obj(*p)) { 00503 thing = NOTHING; 00504 } else 00505 thing = *p; 00506 00507 return thing; 00508 }
Definition at line 863 of file mail.c.
References Folder, statedata::mail_htab, mudstate, mail::next, nhashfind(), and player_folder().
Referenced by do_mail_fwd(), fun_mail(), fun_mailfrom(), and make_numlist().
00864 { 00865 struct mail *mp; 00866 int i = 0; 00867 00868 for(mp = (struct mail *) nhashfind((int) player, &mudstate.mail_htab); 00869 mp; mp = mp->next) { 00870 if(Folder(mp) == player_folder(player)) { 00871 i++; 00872 if(i == num) 00873 return mp; 00874 } 00875 } 00876 return NULL; 00877 }
void mail_init | ( | void | ) |
void make_ulist | ( | dbref | , | |
char * | , | |||
char ** | ||||
) |
Definition at line 1715 of file netcommon.c.
Referenced by fun_lwho().
01716 { 01717 DESC *d; 01718 char *cp; 01719 01720 cp = *bufc; 01721 DESC_ITER_CONN(d) { 01722 if(!WizRoy(player) && Hidden(d->player)) 01723 continue; 01724 if(cp != *bufc) 01725 safe_chr(' ', buff, bufc); 01726 safe_chr('#', buff, bufc); 01727 safe_str(tprintf("%d", d->player), buff, bufc); 01728 } 01729 }
Definition at line 55 of file set.c.
References Affects, init_match(), MAT_EXIT_PARENTS, match_everything(), noisy_match_result(), NOTHING, notify_quiet, and NOTYPE.
00056 { 00057 dbref mat; 00058 00059 init_match(player, name, NOTYPE); 00060 match_everything(MAT_EXIT_PARENTS); 00061 mat = noisy_match_result(); 00062 if(mat != NOTHING && !Affects(player, mat)) { 00063 notify_quiet(player, "Permission denied."); 00064 return NOTHING; 00065 } else { 00066 return (mat); 00067 } 00068 }
Definition at line 26 of file set.c.
References Controls, Good_obj, init_match(), MAT_EXIT_PARENTS, match_everything(), noisy_match_result(), NOTHING, notify_quiet, and NOTYPE.
Referenced by do_alias(), do_cut(), do_force(), do_halt(), do_mvattr(), do_name(), do_pemit(), do_power(), do_ps(), do_set(), do_sweep(), do_unlock(), fun_locate(), fun_set(), and search_setup().
00027 { 00028 dbref mat; 00029 00030 init_match(player, name, NOTYPE); 00031 match_everything(MAT_EXIT_PARENTS); 00032 mat = noisy_match_result(); 00033 if(Good_obj(mat) && !Controls(player, mat)) { 00034 notify_quiet(player, "Permission denied."); 00035 return NOTHING; 00036 } else { 00037 return (mat); 00038 } 00039 }
Definition at line 70 of file set.c.
References Examinable, init_match(), MAT_EXIT_PARENTS, match_everything(), noisy_match_result(), NOTHING, notify_quiet, and NOTYPE.
00071 { 00072 dbref mat; 00073 00074 init_match(player, name, NOTYPE); 00075 match_everything(MAT_EXIT_PARENTS); 00076 mat = noisy_match_result(); 00077 if(mat != NOTHING && !Examinable(player, mat)) { 00078 notify_quiet(player, "Permission denied."); 00079 return NOTHING; 00080 } else { 00081 return (mat); 00082 } 00083 }
Definition at line 1067 of file predicates.c.
References alloc_lbuf, Controls, Dark, Enter_ok, free_lbuf, Good_obj, init_match(), match_neighbor(), match_possessed(), match_possession(), match_result(), NOPERM, NOTHING, NOTYPE, Opaque, and promote_dflt().
Referenced by do_get(), do_look(), and match_possessed().
01069 { 01070 dbref result, result1; 01071 int control; 01072 char *buff, *start, *place, *s1, *d1, *temp; 01073 01074 /* 01075 * First, check normally 01076 */ 01077 01078 if(Good_obj(dflt)) 01079 return dflt; 01080 01081 /* 01082 * Didn't find it directly. Recursively do a contents check 01083 */ 01084 01085 start = target; 01086 while (*target) { 01087 01088 /* 01089 * Fail if no ' characters 01090 */ 01091 01092 place = target; 01093 target = (char *) index(place, '\''); 01094 if((target == NULL) || !*target) 01095 return dflt; 01096 01097 /* 01098 * If string started with a ', skip past it 01099 */ 01100 01101 if(place == target) { 01102 target++; 01103 continue; 01104 } 01105 /* 01106 * If next character is not an s or a space, skip past 01107 */ 01108 01109 temp = target++; 01110 if(!*target) 01111 return dflt; 01112 if((*target != 's') && (*target != 'S') && (*target != ' ')) 01113 continue; 01114 01115 /* 01116 * If character was not a space make sure the following * * * 01117 * 01118 * * character is a space. 01119 */ 01120 01121 if(*target != ' ') { 01122 target++; 01123 if(!*target) 01124 return dflt; 01125 if(*target != ' ') 01126 continue; 01127 } 01128 /* 01129 * Copy the container name to a new buffer so we can * * * * 01130 * terminate it. 01131 */ 01132 01133 buff = alloc_lbuf("is_posess"); 01134 for(s1 = start, d1 = buff; *s1 && (s1 < temp); *d1++ = (*s1++)); 01135 *d1 = '\0'; 01136 01137 /* 01138 * Look for the container here and in our inventory. Skip * 01139 * * * * past if we can't find it. 01140 */ 01141 01142 init_match(thing, buff, NOTYPE); 01143 if(player == thing) { 01144 match_neighbor(); 01145 match_possession(); 01146 } else { 01147 match_possession(); 01148 } 01149 result1 = match_result(); 01150 01151 free_lbuf(buff); 01152 if(!Good_obj(result1)) { 01153 dflt = promote_dflt(dflt, result1); 01154 continue; 01155 } 01156 /* 01157 * If we don't control it and it is either dark or opaque, * 01158 * * * * skip past. 01159 */ 01160 01161 control = Controls(player, result1); 01162 if((Dark(result1) || Opaque(result1)) && !control) { 01163 dflt = promote_dflt(dflt, NOTHING); 01164 continue; 01165 } 01166 /* 01167 * Validate object has the ENTER bit set, if requested 01168 */ 01169 01170 if((check_enter) && !Enter_ok(result1) && !control) { 01171 dflt = promote_dflt(dflt, NOPERM); 01172 continue; 01173 } 01174 /* 01175 * Look for the object in the container 01176 */ 01177 01178 init_match(result1, target, NOTYPE); 01179 match_possession(); 01180 result = match_result(); 01181 result = 01182 match_possessed(player, result1, target, result, check_enter); 01183 if(Good_obj(result)) 01184 return result; 01185 dflt = promote_dflt(dflt, result); 01186 } 01187 return dflt; 01188 }
int matches_exit_from_list | ( | char * | , | |
char * | ||||
) |
Definition at line 540 of file stringutil.c.
References EXIT_DELIMITER, and ToLower.
Referenced by match_exit_internal(), and process_command().
00541 { 00542 char *s; 00543 00544 while (*pattern) { 00545 for(s = str; /* 00546 * check out this one 00547 */ 00548 (*s && (ToLower(*s) == ToLower(*pattern)) && *pattern && 00549 (*pattern != EXIT_DELIMITER)); s++, pattern++); 00550 00551 /* 00552 * Did we match it all? 00553 */ 00554 00555 if(*s == '\0') { 00556 00557 /* 00558 * Make sure nothing afterwards 00559 */ 00560 00561 while (*pattern && isspace(*pattern)) 00562 pattern++; 00563 00564 /* 00565 * Did we get it? 00566 */ 00567 00568 if(!*pattern || (*pattern == EXIT_DELIMITER)) 00569 return 1; 00570 } 00571 /* 00572 * We didn't get it, find next string to test 00573 */ 00574 00575 while (*pattern && *pattern++ != EXIT_DELIMITER); 00576 while (isspace(*pattern)) 00577 pattern++; 00578 } 00579 return 0; 00580 }
Indicate if thing is in list
Definition at line 136 of file predicates.c.
References DOLIST.
Referenced by eval_boolexp().
00137 { 00138 DOLIST(list, list) { 00139 if(list == thing) 00140 return 1; 00141 } 00142 return 0; 00143 }
int minmatch | ( | char * | , | |
char * | , | |||
int | ||||
) |
Definition at line 481 of file stringutil.c.
References ToLower.
Referenced by cf_ntab_access(), find_nametab_ent(), and search_nametab().
00482 { 00483 while (*str && *target && (ToLower(*str) == ToLower(*target))) { 00484 str++; 00485 target++; 00486 min--; 00487 } 00488 if(*str) 00489 return 0; 00490 if(!*target) 00491 return 1; 00492 return ((min <= 0) ? 1 : 0); 00493 }
Definition at line 393 of file move.c.
References A_AFAIL, A_FAIL, A_LOCK, A_OFAIL, could_doit(), Dark, did_it(), divest_object(), Going, Good_obj, HOME, Home, HUSH_EXIT, loc, Location, move_via_exit(), NOTHING, notify, TYPE_EXIT, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, and Wizard.
Referenced by do_move(), do_teleport(), and process_command().
00395 { 00396 dbref loc; 00397 int oattr, aattr; 00398 00399 loc = Location(exit); 00400 if(loc == HOME) 00401 loc = Home(player); 00402 if(Good_obj(loc) && could_doit(player, exit, A_LOCK)) { 00403 switch (Typeof(loc)) { 00404 case TYPE_ROOM: 00405 move_via_exit(player, loc, NOTHING, exit, hush); 00406 if(divest) 00407 divest_object(player); 00408 break; 00409 case TYPE_PLAYER: 00410 case TYPE_THING: 00411 if(Going(loc)) { 00412 notify(player, "You can't go that way."); 00413 return; 00414 } 00415 move_via_exit(player, loc, NOTHING, exit, hush); 00416 divest_object(player); 00417 break; 00418 case TYPE_EXIT: 00419 notify(player, "You can't go that way."); 00420 return; 00421 } 00422 } else { 00423 if((Wizard(player) && Dark(player)) || (hush & HUSH_EXIT)) { 00424 oattr = 0; 00425 aattr = 0; 00426 } else { 00427 oattr = A_OFAIL; 00428 aattr = A_AFAIL; 00429 } 00430 did_it(player, exit, A_FAIL, failmsg, oattr, NULL, aattr, 00431 (char **) NULL, 0); 00432 } 00433 }
Definition at line 139 of file move.c.
References Contents, Controls, giveto(), HOME, Home, insert_first(), isPlayer, LK_OBEYTERSE, LK_SHOWEXIT, Location, look_in(), mudconf, NOTHING, notify_printf(), confdata::one_coin, confdata::payfind, confdata::paylimit, Pennies(), random, remove_first(), s_Contents, s_Location, and s_Next.
Referenced by check_connect(), check_dead_refs(), create_guest(), do_pcreate(), move_via_exit(), move_via_generic(), and move_via_teleport().
00140 { 00141 dbref src; 00142 00143 /* 00144 * Remove from the source location 00145 */ 00146 00147 src = Location(thing); 00148 if(src != NOTHING) 00149 s_Contents(src, remove_first(Contents(src), thing)); 00150 00151 /* 00152 * Special check for HOME 00153 */ 00154 00155 if(dest == HOME) 00156 dest = Home(thing); 00157 00158 /* 00159 * Add to destination location 00160 */ 00161 00162 if(dest != NOTHING) 00163 s_Contents(dest, insert_first(Contents(dest), thing)); 00164 else 00165 s_Next(thing, NOTHING); 00166 s_Location(thing, dest); 00167 00168 /* 00169 * Look around and do the penny check 00170 */ 00171 00172 look_in(thing, dest, (LK_SHOWEXIT | LK_OBEYTERSE)); 00173 if(isPlayer(thing) && (mudconf.payfind > 0) && 00174 (Pennies(thing) < mudconf.paylimit) && (!Controls(thing, dest)) && 00175 ((random() % mudconf.payfind) == 0)) { 00176 giveto(thing, 1); 00177 notify_printf(thing, "You found a %s!", mudconf.one_coin); 00178 } 00179 }
Definition at line 297 of file move.c.
References A_ADROP, A_AMOVE, A_ASUCC, A_DROP, A_MOVE, A_ODROP, A_OMOVE, A_OSUCC, A_SUCC, Dark, did_it(), Hearer(), HOME, Home, HUSH_EXIT, Location, move_object(), mudconf, process_enter_loc(), process_leave_loc(), process_sticky_dropto(), Terse, confdata::terse_movemsg, and Wizard.
Referenced by move_exit().
00298 { 00299 dbref src; 00300 int canhear, darkwiz, quiet, pattr, oattr, aattr; 00301 00302 if(dest == HOME) 00303 dest = Home(thing); 00304 src = Location(thing); 00305 canhear = Hearer(thing); 00306 00307 /* 00308 * Dark wizards don't trigger OSUCC/ASUCC 00309 */ 00310 00311 darkwiz = (Wizard(thing) && Dark(thing)); 00312 quiet = darkwiz || (hush & HUSH_EXIT); 00313 00314 oattr = quiet ? 0 : A_OSUCC; 00315 aattr = quiet ? 0 : A_ASUCC; 00316 pattr = (!mudconf.terse_movemsg && Terse(thing)) ? 0 : A_SUCC; 00317 did_it(thing, exit, pattr, NULL, oattr, NULL, aattr, (char **) NULL, 0); 00318 process_leave_loc(thing, dest, cause, canhear, hush); 00319 move_object(thing, dest); 00320 00321 /* 00322 * Dark wizards don't trigger ODROP/ADROP 00323 */ 00324 00325 oattr = quiet ? 0 : A_ODROP; 00326 aattr = quiet ? 0 : A_ADROP; 00327 pattr = (!mudconf.terse_movemsg && Terse(thing)) ? 0 : A_DROP; 00328 did_it(thing, exit, pattr, NULL, oattr, NULL, aattr, (char **) NULL, 0); 00329 00330 did_it(thing, thing, A_MOVE, NULL, A_OMOVE, NULL, A_AMOVE, 00331 (char **) NULL, 0); 00332 process_enter_loc(thing, src, cause, canhear, hush); 00333 process_sticky_dropto(src, thing); 00334 }
Definition at line 276 of file move.c.
References A_AMOVE, A_MOVE, A_OMOVE, did_it(), Hearer(), HOME, Home, Location, move_object(), process_enter_loc(), and process_leave_loc().
Referenced by check_contents_chains(), destroy_player(), destroy_thing(), divest_object(), do_clone(), do_create(), do_drop(), do_get(), do_kill(), do_leave(), do_move(), empty_obj(), fun_create(), give_thing(), process_dropped_dropto(), and send_dropto().
00277 { 00278 dbref src; 00279 int canhear; 00280 00281 if(dest == HOME) 00282 dest = Home(thing); 00283 src = Location(thing); 00284 canhear = Hearer(thing); 00285 process_leave_loc(thing, dest, cause, canhear, hush); 00286 move_object(thing, dest); 00287 did_it(thing, thing, A_MOVE, NULL, A_OMOVE, NULL, A_AMOVE, 00288 (char **) NULL, 0); 00289 process_enter_loc(thing, src, cause, canhear, hush); 00290 }
Definition at line 342 of file move.c.
References A_AMOVE, A_ATOFAIL, A_ATPORT, A_LTELOUT, A_MOVE, A_OMOVE, A_OTOFAIL, A_OTPORT, A_OXTPORT, A_TOFAIL, A_TPORT, could_doit(), did_it(), divest_object(), Good_obj, Hearer(), HOME, Home, HUSH_ENTER, HUSH_LEAVE, isRoom, Location, move_object(), mudconf, NOTHING, notify_quiet, confdata::ntfy_nest_lim, process_enter_loc(), process_leave_loc(), and process_sticky_dropto().
Referenced by do_dig(), and do_teleport().
00343 { 00344 dbref src, curr; 00345 int canhear, count; 00346 char *failmsg; 00347 00348 src = Location(thing); 00349 if((dest != HOME) && Good_obj(src)) { 00350 curr = src; 00351 for(count = mudconf.ntfy_nest_lim; count > 0; count--) { 00352 if(!could_doit(thing, curr, A_LTELOUT)) { 00353 if((thing == cause) || (cause == NOTHING)) 00354 failmsg = (char *) 00355 "You can't teleport out!"; 00356 else { 00357 failmsg = (char *) 00358 "You can't be teleported out!"; 00359 notify_quiet(cause, "You can't teleport that out!"); 00360 } 00361 did_it(thing, src, A_TOFAIL, failmsg, A_OTOFAIL, NULL, 00362 A_ATOFAIL, (char **) NULL, 0); 00363 return 0; 00364 } 00365 if(isRoom(curr)) 00366 break; 00367 curr = Location(curr); 00368 } 00369 } 00370 if(dest == HOME) 00371 dest = Home(thing); 00372 canhear = Hearer(thing); 00373 if(!(hush & HUSH_LEAVE)) 00374 did_it(thing, thing, 0, NULL, A_OXTPORT, NULL, 0, (char **) NULL, 0); 00375 process_leave_loc(thing, dest, NOTHING, canhear, hush); 00376 move_object(thing, dest); 00377 if(!(hush & HUSH_ENTER)) 00378 did_it(thing, thing, A_TPORT, NULL, A_OTPORT, NULL, A_ATPORT, 00379 (char **) NULL, 0); 00380 did_it(thing, thing, A_MOVE, NULL, A_OMOVE, NULL, A_AMOVE, 00381 (char **) NULL, 0); 00382 process_enter_loc(thing, src, NOTHING, canhear, hush); 00383 divest_object(thing); 00384 process_sticky_dropto(src, thing); 00385 return 1; 00386 }
char* munge_space | ( | char * | string | ) |
Compress multiple spaces to one space, also remove leading and trailing spaces.
Definition at line 227 of file stringutil.c.
References alloc_lbuf.
Referenced by create_obj().
00228 { 00229 char *buffer, *p, *q; 00230 00231 buffer = alloc_lbuf("munge_space"); 00232 p = string; 00233 q = buffer; 00234 while (p && *p && isspace(*p)) 00235 p++; /* 00236 * remove inital spaces 00237 */ 00238 while (p && *p) { 00239 while (*p && !isspace(*p)) 00240 *q++ = *p++; 00241 while (*p && isspace(*++p)); 00242 if(*p) 00243 *q++ = ' '; 00244 } 00245 *q = '\0'; /* 00246 * remove terminal spaces and terminate * * * 00247 * 00248 * * string 00249 */ 00250 return (buffer); 00251 }
void mux_release_socket | ( | ) |
char* Name | ( | dbref | ) |
Definition at line 490 of file db.c.
References A_NAME, atr_get(), atr_get_str(), confdata::cache_names, statedata::db_top, free_lbuf, MBUF_SIZE, mudconf, mudstate, purenames, set_string(), and strip_ansi_r().
Referenced by AccumulateArtyXP(), AccumulateCommXP(), AccumulateComputerXP(), AccumulateGunXPold(), AccumulatePilXP(), AccumulateSpotXP(), AccumulateTechWeaponsXP(), AccumulateTechXP(), aero_land(), announce_connect(), announce_disconnect(), auto_listcommands(), autoeject(), cf_set(), char_disembark(), char_eject(), check_dead_refs(), check_floating(), create_obj(), db_write_object(), dbrefs_to_names(), debug_examine(), debug_xptop(), destroy_obj(), destroy_player(), dflt_from_msg(), did_it(), do_boot(), do_chanlist(), do_chanstatus(), do_chboot(), do_clone(), do_comconnect(), do_comconnectraw_notify(), do_comdisconnect(), do_comdisconnectraw_notify(), do_create(), do_decomp(), do_delcomchannel(), do_destroy(), do_drop(), do_entrances(), do_examine(), do_fixdb(), do_get(), do_inventory(), do_joinchannel(), do_kill(), do_leavechannel(), do_mail_debug(), do_mail_fwd(), do_mail_list(), do_mail_nuke(), do_mail_proof(), do_mail_read(), do_mail_review(), do_mail_stats(), do_malias_adminlist(), do_malias_list(), do_malias_list_all(), do_move(), do_mvattr(), do_name(), do_newpassword(), do_page(), do_pemit(), do_processcom(), do_restart(), do_say(), do_set(), do_shutdown(), do_toad(), do_use(), do_wipe(), dump_users(), engine_weight(), exec(), find_connected_name(), flag_set(), fun_btsetcharvalue(), fun_fullname(), fun_name(), give_money(), give_thing(), handle_ears(), initialize_pc(), list_xcodestuff(), load_player_names(), log_type_and_name(), look_exits(), MadePerceptionRoll(), make_namelist(), mech_sendchannel(), mem_usage(), mmdb_write_object(), notify_checked(), page_check(), page_return(), power_set(), PrintGenericStatus(), process_command(), process_enter_loc(), process_input(), process_leave_loc(), save_template(), say_shout(), send_mail(), set_attr_internal(), show_charstatus(), show_quota(), shutdownsock(), structure_name(), sweep_check(), tcache_finish(), trimmed_name(), turret_deinitialize(), turret_initialize(), unparse_boolexp1(), unparse_object(), unparse_object_numonly(), whisper_pose(), xml_db_write_mux(), and xml_db_write_object().
00491 { 00492 dbref aowner; 00493 int aflags; 00494 char *buff; 00495 static char *tbuff[MBUF_SIZE]; 00496 char buffer[MBUF_SIZE]; 00497 00498 if(mudconf.cache_names) { 00499 if(thing > mudstate.db_top || thing < 0) { 00500 return "#-1 INVALID DBREF"; 00501 } 00502 if(!purenames[thing]) { 00503 buff = atr_get(thing, A_NAME, &aowner, &aflags); 00504 strip_ansi_r(buffer, buff, MBUF_SIZE); 00505 set_string(&purenames[thing], buffer); 00506 free_lbuf(buff); 00507 } 00508 } 00509 00510 atr_get_str((char *) tbuff, thing, A_NAME, &aowner, &aflags); 00511 return ((char *) tbuff); 00512 }
Check if thing is nearby player (in inventory, in same room, or IS the room.
Definition at line 1412 of file predicates.c.
References Good_obj, and where_is().
Referenced by check_read_perms(), do_examine(), do_pemit(), do_pemit_list(), do_verb(), exam_wildattrs(), find_wild_attrs(), fun_nearby(), and nearby_or_control().
01413 { 01414 int thing_loc, player_loc; 01415 01416 if(!Good_obj(player) || !Good_obj(thing)) 01417 return 0; 01418 thing_loc = where_is(thing); 01419 if(thing_loc == player) 01420 return 1; 01421 player_loc = where_is(player); 01422 if((thing_loc == player_loc) || (thing == player_loc)) 01423 return 1; 01424 return 0; 01425 }
Definition at line 125 of file object.c.
References can_set_home(), default_home(), Home, loc, Location, and Owner.
Referenced by check_dead_refs(), clone_home(), do_create(), empty_obj(), and fun_create().
00126 { 00127 dbref loc; 00128 00129 loc = Location(player); 00130 if(can_set_home(Owner(player), player, loc)) 00131 return loc; 00132 loc = Home(Owner(player)); 00133 if(can_set_home(Owner(player), player, loc)) 00134 return loc; 00135 return default_home(); 00136 }
int nfy_que | ( | dbref | , | |
int | , | |||
int | , | |||
int | ||||
) |
Definition at line 495 of file cque.c.
References a_Queue(), add_to(), atr_clr(), atr_get(), bque::attr, cque_enqueue(), free_lbuf, free_qentry, giveto(), mudconf, mudstate, bque::next, NFY_DRAIN, NFY_NFY, NOTHING, Owner, bque::player, statedata::qsemfirst, statedata::qsemlast, bque::sem, bque::text, confdata::waitcost, and bque::waittime.
Referenced by destroy_obj(), and do_notify().
00496 { 00497 BQUE *point, *trail, *next; 00498 int num, aflags; 00499 dbref aowner; 00500 char *str; 00501 00502 if(attr) { 00503 str = atr_get(sem, attr, &aowner, &aflags); 00504 num = atoi(str); 00505 free_lbuf(str); 00506 } else { 00507 num = 1; 00508 } 00509 00510 if(num > 0) { 00511 num = 0; 00512 for(point = mudstate.qsemfirst, trail = NULL; point; point = next) { 00513 if((point->sem == sem) && ((point->attr == attr) || !attr)) { 00514 num++; 00515 if(trail) 00516 trail->next = next = point->next; 00517 else 00518 mudstate.qsemfirst = next = point->next; 00519 if(point == mudstate.qsemlast) 00520 mudstate.qsemlast = trail; 00521 00522 /* 00523 * Either run or discard the command 00524 */ 00525 00526 if(key != NFY_DRAIN) { 00527 point->sem = NOTHING; 00528 point->waittime = 0; 00529 cque_enqueue(point->player, point); 00530 } else { 00531 giveto(point->player, mudconf.waitcost); 00532 a_Queue(Owner(point->player), -1); 00533 free(point->text); 00534 free_qentry(point); 00535 } 00536 } else { 00537 next = (trail = point)->next; 00538 } 00539 00540 /* 00541 * If we've notified enough, exit 00542 */ 00543 00544 if((key == NFY_NFY) && (num >= count)) 00545 next = NULL; 00546 } 00547 } else { 00548 num = 0; 00549 } 00550 00551 /* 00552 * Update the sem waiters count 00553 */ 00554 00555 if(key == NFY_NFY) 00556 add_to(sem, -count, attr); 00557 else 00558 atr_clr(sem, attr); 00559 00560 return num; 00561 }
char* normal_to_white_r | ( | char * | , | |
const char * | , | |||
size_t | ||||
) |
Definition at line 74 of file log.c.
References ESC_CHAR.
00074 { 00075 char *p = (char *) raw; 00076 char *q = dest; 00077 00078 while (p && *p && ((q - dest) < n)) { 00079 if(*p == ESC_CHAR) { 00080 /* 00081 * Start of ANSI code. 00082 */ 00083 *q++ = *p++; /* 00084 * ESC CHAR 00085 */ 00086 *q++ = *p++; /* 00087 * [ character. 00088 */ 00089 if(*p == '0') { 00090 if((q - dest + 7) < n) { 00091 memcpy(q, "0m\x1b[37m", 7); 00092 q += 7; 00093 } 00094 p += 2; 00095 } 00096 } else 00097 *q++ = *p++; 00098 } 00099 *q = '\0'; 00100 return dest; 00101 }
Definition at line 403 of file game.c.
References A_AAHEAR, A_AHEAR, A_AMHEAR, A_FILTER, A_INFILTER, A_INPREFIX, A_LISTEN, A_LUSE, A_PREFIX, add_prefix(), alloc_lbuf, alloc_sbuf, AMATCH_LISTEN, args, atr_get(), atr_match(), Audible, check_filter(), colorize(), Connected, Contents, could_doit(), forward_list::count, statedata::curr_enactor, statedata::curr_player, forward_list::data, dflt_from_msg(), did_it(), DOLIST, Exits, free_lbuf, free_sbuf, fwdlist_get(), GOD, Good_obj, H_Listen, Halted, Has_location, statedata::inpipe, isPlayer, Location, Monitor, MSG_COLORIZE, MSG_F_CONTENTS, MSG_F_DOWN, MSG_F_UP, MSG_FWDLIST, MSG_INV, MSG_INV_EXITS, MSG_INV_L, MSG_LOC, MSG_LOC_A, MSG_ME, MSG_NBR, MSG_NBR_A, MSG_NBR_EXITS, MSG_NBR_EXITS_A, MSG_NO_SLAVE, MSG_PUP_ALWAYS, MSG_S_INSIDE, MSG_S_OUTSIDE, mudconf, mudstate, Name(), Nospoof, notify_checked(), statedata::ntfy_nest_lev, confdata::ntfy_nest_lim, ufun::obj, Owner, confdata::player_listen, Puppet, raw_notify(), safe_chr, safe_str, Slave, Staff, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, Typeof, where_is(), and wild().
Referenced by announce_connect(), announce_disconnect(), handle_ears(), mecha_notify_except(), notify_checked(), notify_except(), and notify_except2().
00404 { 00405 char *msg_ns, *mp, *tbuff, *tp, *buff, *colbuf = NULL; 00406 char *args[10]; 00407 dbref aowner, targetloc, recip, obj; 00408 int i, nargs, aflags, has_neighbors, pass_listen; 00409 int check_listens, pass_uselock, is_audible; 00410 FWDLIST *fp; 00411 00412 /* 00413 * If speaker is invalid or message is empty, just exit 00414 */ 00415 00416 if(!Good_obj(target) || !msg || !*msg) 00417 return; 00418 00419 /* 00420 * Enforce a recursion limit 00421 */ 00422 00423 mudstate.ntfy_nest_lev++; 00424 if(mudstate.ntfy_nest_lev >= mudconf.ntfy_nest_lim) { 00425 mudstate.ntfy_nest_lev--; 00426 return; 00427 } 00428 /* 00429 * If we want NOSPOOF output, generate it. It is only needed if 00430 * we are sending the message to the target object 00431 */ 00432 00433 if(key & MSG_ME) { 00434 mp = msg_ns = alloc_lbuf("notify_checked"); 00435 if(Nospoof(target) && (target != sender) && 00436 (target != mudstate.curr_enactor) && 00437 (target != mudstate.curr_player && Good_obj(sender))) { 00438 00439 /* 00440 * I'd really like to use tprintf here but I can't 00441 * because the caller may have. 00442 * notify(target, tprintf(...)) is quite common 00443 * in the code. 00444 */ 00445 00446 tbuff = alloc_sbuf("notify_checked.nospoof"); 00447 safe_chr('[', msg_ns, &mp); 00448 safe_str(Name(sender), msg_ns, &mp); 00449 sprintf(tbuff, "(#%d)", sender); 00450 safe_str(tbuff, msg_ns, &mp); 00451 00452 if(sender != Owner(sender)) { 00453 safe_chr('{', msg_ns, &mp); 00454 safe_str(Name(Owner(sender)), msg_ns, &mp); 00455 safe_chr('}', msg_ns, &mp); 00456 } 00457 if(sender != mudstate.curr_enactor) { 00458 sprintf(tbuff, "<-(#%d)", mudstate.curr_enactor); 00459 safe_str(tbuff, msg_ns, &mp); 00460 } 00461 safe_str((char *) "] ", msg_ns, &mp); 00462 free_sbuf(tbuff); 00463 } 00464 safe_str((char *) msg, msg_ns, &mp); 00465 *mp = '\0'; 00466 } else { 00467 msg_ns = NULL; 00468 } 00469 00470 /* 00471 * msg contains the raw message, msg_ns contains the NOSPOOFed msg 00472 */ 00473 00474 check_listens = Halted(target) ? 0 : 1; 00475 switch (Typeof(target)) { 00476 case TYPE_PLAYER: 00477 if(key & MSG_ME) { 00478 if(key & MSG_COLORIZE) 00479 colbuf = colorize(target, msg_ns); 00480 raw_notify(target, colbuf ? colbuf : msg_ns); 00481 00482 00483 } 00484 00485 if(colbuf) 00486 free_lbuf(colbuf); 00487 if(!mudconf.player_listen) 00488 check_listens = 0; 00489 case TYPE_THING: 00490 case TYPE_ROOM: 00491 00492 /* If we're in a pipe, objects can receive raw_notify 00493 * if they're not a player and connected (if we didn't 00494 * do this, they'd be notified twice! */ 00495 00496 if(mudstate.inpipe && (!isPlayer(target) || (isPlayer(target) && 00497 !Connected(target)))) { 00498 raw_notify(target, msg_ns); 00499 } 00500 00501 /* 00502 * Forward puppet message if it is for me 00503 */ 00504 00505 has_neighbors = Has_location(target); 00506 targetloc = where_is(target); 00507 is_audible = Audible(target); 00508 00509 if((key & MSG_ME) && Puppet(target) && (target != Owner(target)) 00510 && ((key & MSG_PUP_ALWAYS) || 00511 ((targetloc != Location(Owner(target))) && 00512 (targetloc != Owner(target))))) { 00513 tp = tbuff = alloc_lbuf("notify_checked.puppet"); 00514 safe_str(Name(target), tbuff, &tp); 00515 safe_str((char *) "> ", tbuff, &tp); 00516 if(key & MSG_COLORIZE) 00517 colbuf = colorize(Owner(target), msg_ns); 00518 safe_str(colbuf ? colbuf : msg_ns, tbuff, &tp); 00519 *tp = '\0'; 00520 raw_notify(Owner(target), tbuff); 00521 if(colbuf) 00522 free_lbuf(colbuf); 00523 free_lbuf(tbuff); 00524 } 00525 /* 00526 * Check for @Listen match if it will be useful 00527 */ 00528 00529 pass_listen = 0; 00530 nargs = 0; 00531 if(check_listens && (key & (MSG_ME | MSG_INV_L)) && H_Listen(target)) { 00532 tp = atr_get(target, A_LISTEN, &aowner, &aflags); 00533 if(*tp && wild(tp, (char *) msg, args, 10)) { 00534 for(nargs = 10; 00535 nargs && (!args[nargs - 1] || !(*args[nargs - 1])); 00536 nargs--); 00537 pass_listen = 1; 00538 } 00539 free_lbuf(tp); 00540 } 00541 /* 00542 * If we matched the @listen or are monitoring, check the * * 00543 * USE lock 00544 */ 00545 00546 if(sender < 0) 00547 sender = GOD; 00548 pass_uselock = 0; 00549 if((key & MSG_ME) && check_listens && (pass_listen || 00550 Monitor(target))) 00551 pass_uselock = could_doit(sender, target, A_LUSE); 00552 00553 /* 00554 * Process AxHEAR if we pass LISTEN, USElock and it's for me 00555 */ 00556 00557 if((key & MSG_ME) && pass_listen && pass_uselock) { 00558 if(sender != target) 00559 did_it(sender, target, 0, NULL, 0, NULL, A_AHEAR, args, 00560 nargs); 00561 else 00562 did_it(sender, target, 0, NULL, 0, NULL, A_AMHEAR, args, 00563 nargs); 00564 did_it(sender, target, 0, NULL, 0, NULL, A_AAHEAR, args, nargs); 00565 } 00566 /* 00567 * Get rid of match arguments. We don't need them anymore 00568 */ 00569 00570 if(pass_listen) { 00571 for(i = 0; i < 10; i++) 00572 if(args[i] != NULL) 00573 free_lbuf(args[i]); 00574 } 00575 /* 00576 * Process ^-listens if for me, MONITOR, and we pass USElock 00577 */ 00578 /* 00579 * \todo Eventually come up with a cleaner method for making sure 00580 * the sender isn't the same as the target. 00581 */ 00582 if((key & MSG_ME) && (sender != target || Staff(target)) 00583 && pass_uselock && Monitor(target)) { 00584 (void) atr_match(target, sender, AMATCH_LISTEN, (char *) msg, 0); 00585 } 00586 /* 00587 * Deliver message to forwardlist members 00588 */ 00589 00590 if((key & MSG_FWDLIST) && Audible(target) && 00591 check_filter(target, sender, A_FILTER, msg)) { 00592 tbuff = dflt_from_msg(sender, target); 00593 buff = add_prefix(target, sender, A_PREFIX, msg, tbuff); 00594 free_lbuf(tbuff); 00595 00596 fp = fwdlist_get(target); 00597 if(fp) { 00598 for(i = 0; i < fp->count; i++) { 00599 recip = fp->data[i]; 00600 if(!Good_obj(recip) || (recip == target)) 00601 continue; 00602 notify_checked(recip, sender, buff, 00603 (MSG_ME | MSG_F_UP | MSG_F_CONTENTS | 00604 MSG_S_INSIDE)); 00605 } 00606 } 00607 free_lbuf(buff); 00608 } 00609 /* 00610 * Deliver message through audible exits 00611 */ 00612 00613 if(key & MSG_INV_EXITS) { 00614 DOLIST(obj, Exits(target)) { 00615 recip = Location(obj); 00616 if(Audible(obj) && ((recip != target) && 00617 check_filter(obj, sender, A_FILTER, 00618 msg))) { 00619 buff = 00620 add_prefix(obj, target, A_PREFIX, msg, 00621 "From a distance,"); 00622 notify_checked(recip, sender, buff, 00623 MSG_ME | MSG_F_UP | MSG_F_CONTENTS | 00624 MSG_S_INSIDE); 00625 free_lbuf(buff); 00626 } 00627 } 00628 } 00629 /* 00630 * Deliver message through neighboring audible exits 00631 */ 00632 00633 if(has_neighbors && ((key & MSG_NBR_EXITS) || 00634 ((key & MSG_NBR_EXITS_A) && is_audible))) { 00635 00636 /* 00637 * If from inside, we have to add the prefix string * 00638 * 00639 * * * * of * the container. 00640 */ 00641 00642 if(key & MSG_S_INSIDE) { 00643 tbuff = dflt_from_msg(sender, target); 00644 buff = add_prefix(target, sender, A_PREFIX, msg, tbuff); 00645 free_lbuf(tbuff); 00646 } else { 00647 buff = (char *) msg; 00648 } 00649 00650 DOLIST(obj, Exits(Location(target))) { 00651 recip = Location(obj); 00652 if(Good_obj(recip) && Audible(obj) && (recip != targetloc) 00653 && (recip != target) && 00654 check_filter(obj, sender, A_FILTER, msg)) { 00655 tbuff = 00656 add_prefix(obj, target, A_PREFIX, buff, 00657 "From a distance,"); 00658 notify_checked(recip, sender, tbuff, 00659 MSG_ME | MSG_F_UP | MSG_F_CONTENTS | 00660 MSG_S_INSIDE); 00661 free_lbuf(tbuff); 00662 } 00663 } 00664 if(key & MSG_S_INSIDE) { 00665 free_lbuf(buff); 00666 } 00667 } 00668 /* 00669 * Deliver message to contents 00670 */ 00671 00672 if(((key & MSG_INV) || ((key & MSG_INV_L) && pass_listen)) && 00673 (check_filter(target, sender, A_INFILTER, msg))) { 00674 00675 /* 00676 * Don't prefix the message if we were given the * * 00677 * * * MSG_NOPREFIX key. 00678 */ 00679 00680 if(key & MSG_S_OUTSIDE) { 00681 buff = add_prefix(target, sender, A_INPREFIX, msg, ""); 00682 } else { 00683 buff = (char *) msg; 00684 } 00685 DOLIST(obj, Contents(target)) { 00686 if(Slave(obj) && (key & MSG_NO_SLAVE)) 00687 continue; 00688 if(obj != target) { 00689 notify_checked(obj, sender, buff, 00690 MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE ); 00691 } 00692 } 00693 if(key & MSG_S_OUTSIDE) 00694 free_lbuf(buff); 00695 } 00696 /* 00697 * Deliver message to neighbors 00698 */ 00699 00700 if(has_neighbors && ((key & MSG_NBR) || ((key & MSG_NBR_A) && 00701 is_audible && 00702 check_filter(target, sender, 00703 A_FILTER, 00704 msg)))) { 00705 if(key & MSG_S_INSIDE) { 00706 tbuff = dflt_from_msg(sender, target); 00707 buff = add_prefix(target, sender, A_PREFIX, msg, ""); 00708 free_lbuf(tbuff); 00709 } else { 00710 buff = (char *) msg; 00711 } 00712 DOLIST(obj, Contents(targetloc)) { 00713 if((obj != target) && (obj != targetloc)) { 00714 notify_checked(obj, sender, buff, 00715 MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE | (key 00716 & 00717 MSG_COLORIZE)); 00718 } 00719 } 00720 if(key & MSG_S_INSIDE) { 00721 free_lbuf(buff); 00722 } 00723 } 00724 /* 00725 * Deliver message to container 00726 */ 00727 00728 if(has_neighbors && ((key & MSG_LOC) || ((key & MSG_LOC_A) && 00729 is_audible && 00730 check_filter(target, sender, 00731 A_FILTER, 00732 msg)))) { 00733 if(key & MSG_S_INSIDE) { 00734 tbuff = dflt_from_msg(sender, target); 00735 buff = add_prefix(target, sender, A_PREFIX, msg, tbuff); 00736 free_lbuf(tbuff); 00737 } else { 00738 buff = (char *) msg; 00739 } 00740 notify_checked(targetloc, sender, buff, 00741 MSG_ME | MSG_F_UP | MSG_S_INSIDE); 00742 if(key & MSG_S_INSIDE) { 00743 free_lbuf(buff); 00744 } 00745 } 00746 } 00747 if(msg_ns) 00748 free_lbuf(msg_ns); 00749 mudstate.ntfy_nest_lev--; 00750 }
Definition at line 752 of file game.c.
References Contents, DOLIST, MSG_F_DOWN, MSG_F_UP, MSG_ME, MSG_ME_ALL, MSG_NBR_EXITS_A, MSG_NO_SLAVE, MSG_S_INSIDE, MSG_S_OUTSIDE, NOSLAVE, notify_checked(), and Slave.
00753 { 00754 dbref first; 00755 00756 if(loc != exception) 00757 notify_checked(loc, player, msg, 00758 (MSG_ME_ALL | MSG_F_UP | MSG_S_INSIDE | 00759 MSG_NBR_EXITS_A)); 00760 DOLIST(first, Contents(loc)) { 00761 if(exception == NOSLAVE) 00762 if(Slave(first)) 00763 continue; 00764 if(first != exception) 00765 notify_checked(first, player, msg, 00766 (MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE | 00767 (exception == NOSLAVE ? MSG_NO_SLAVE : 0))); 00768 } 00769 }
Definition at line 771 of file game.c.
References Contents, DOLIST, MSG_F_DOWN, MSG_F_UP, MSG_ME, MSG_ME_ALL, MSG_NBR_EXITS_A, MSG_S_INSIDE, MSG_S_OUTSIDE, and notify_checked().
Referenced by did_it(), do_pemit(), do_toad(), process_enter_loc(), and process_leave_loc().
00773 { 00774 dbref first; 00775 00776 if((loc != exc1) && (loc != exc2)) 00777 notify_checked(loc, player, msg, 00778 (MSG_ME_ALL | MSG_F_UP | MSG_S_INSIDE | 00779 MSG_NBR_EXITS_A)); 00780 DOLIST(first, Contents(loc)) { 00781 if(first != exc1 && first != exc2) { 00782 notify_checked(first, player, msg, 00783 (MSG_ME | MSG_F_DOWN | MSG_S_OUTSIDE)); 00784 } 00785 } 00786 }
void notify_printf | ( | dbref | , | |
const char * | , | |||
... | ||||
) |
Definition at line 248 of file netcommon.c.
References DESC_ITER_PLAYER, LBUF_SIZE, and queue_string().
Referenced by _logcache_list(), addtic_sub_func(), aero_thrust(), aero_vheading(), auto_addcommand(), auto_delcommand(), auto_eventstats(), auto_jump(), canpayfees(), cf_log_syntax(), char_disembark(), char_eject(), char_getskillsuccess(), check_dead_refs(), check_floating(), check_mail(), cleartic_sub_func(), convert_flags(), create_obj(), debug_check_stuff(), debug_EventTypes(), debug_examine(), debug_fixmap(), debug_memory(), decode_power(), decompile_powers(), deltic_sub_func(), destroy_obj(), disp_from_on(), DisplayTarget(), do_addcom(), do_addcommand(), do_attribute(), do_cemit(), do_channelwho(), do_chanobj(), do_chanstatus(), do_charclear(), do_chboot(), do_chclose(), do_chloud(), do_chopaque(), do_chopen(), do_chown_macro(), do_chownall(), do_chsquelch(), do_chtransparent(), do_clear_macro(), do_clone(), do_comconnectchannel(), do_comlast(), do_comlist(), do_comtitle(), do_comwho(), do_create(), do_createchannel(), do_decomp(), do_del_macro(), do_delcom(), do_delcomchannel(), do_desc_macro(), do_destroychannel(), do_dig(), do_doing(), do_edit_macro(), do_editchannel(), do_entrances(), do_ex_macro(), do_examine(), do_expmail_start(), do_fixdb(), do_get(), do_gex_macro(), do_halt(), do_joinchannel(), do_kill(), do_last(), do_leavechannel(), do_list_macro(), do_listchannels(), do_listcommands(), do_mail_cc(), do_mail_change_folder(), do_mail_debug(), do_mail_file(), do_mail_flags(), do_mail_list(), do_mail_proof(), do_mail_read(), do_mail_review(), do_mail_stats(), do_malias_add(), do_malias_adminlist(), do_malias_chown(), do_malias_create(), do_malias_desc(), do_malias_list(), do_malias_list_all(), do_malias_send(), do_malias_status(), do_mvattr(), do_page(), do_pemit(), do_postpend(), do_prepend(), do_processcom(), do_ps(), do_queue(), do_say(), do_score(), do_set(), do_show_stat(), do_stats(), do_status_macro(), do_wipe(), firetic_sub_func(), FireWeaponNumber(), flag_set(), fwdlist_load(), get_stats(), give_money(), helpindex_load(), ice_growth(), ice_melt(), list_charvaluestuff(), list_costs(), list_mapobjs(), ListForms(), loading_bay_whine(), look_exits(), make_numlist(), map_add_block(), map_add_mine(), map_addfire(), map_addsmoke(), map_delobj(), map_listmechs(), map_loadmap(), map_savemap(), map_setlinked(), map_updatelinks(), mech_contacts(), mech_createbays(), mech_findcenter(), mech_heading(), mech_list_freqs(), mech_lrsmap(), mech_Rfixstuff(), mech_Rsetmapindex(), mech_Rsetteam(), mech_Rsetxy(), mech_set_channelfreq(), mech_set_channelmode(), mech_set_channeltitle(), mech_settarget(), mech_speed(), mech_stand(), mech_target(), mech_turret(), mechrep_Raddinftech(), mechrep_Raddspecial(), mechrep_Raddtech(), mechrep_Raddweap(), mechrep_Rdeltech(), mechrep_Rsavetemp(), mechrep_Rsavetemp2(), mechrep_Rsetarmor(), mechrep_Rsetradio(), mechrep_Rsettarget(), mechrep_Rshowtech(), mechrep_setcargospace(), move_object(), page_check(), parse_boolexp_L(), pickup_mw(), power_set(), PrintEnemyStatus(), PrintGenericStatus(), PrintInfoStatus(), PrintReport(), process_cmdent(), process_command(), record_login(), search_setup(), send_mail(), sensor_mode(), set_attr_internal(), set_colorscheme(), show_brief_flags(), show_narc_pods(), show_que(), showNetworkData(), showNetworkTargets(), showWeaponDamageAndInfo(), ShutDownMap(), stuff_change_sub(), sweep_check(), tcache_finish(), tech_checkstatus(), tech_roll(), tech_weapon_roll(), TFUNC_LOC(), TFUNC_LOC_RESEAL(), TFUNC_LOC_VAL(), TFUNC_LOCPOS(), update_entry(), update_entry_set(), update_entry_toggle(), view_atr(), and whisper_pose().
00249 { 00250 DESC *d; 00251 char buffer[LBUF_SIZE]; 00252 va_list ap; 00253 memset(buffer, 0, LBUF_SIZE); 00254 00255 va_start(ap, format); 00256 00257 vsnprintf(buffer, LBUF_SIZE-1, format, ap); 00258 va_end(ap); 00259 00260 strncat(buffer, "\r\n", LBUF_SIZE-1); 00261 buffer[LBUF_SIZE-1] = '\0'; 00262 00263 DESC_ITER_PLAYER(player, d) { 00264 queue_string(d, buffer); 00265 } 00266 }
char* OBJTYP | ( | dbref | ) |
Definition at line 293 of file log.c.
References Good_obj, TYPE_EXIT, TYPE_GARBAGE, TYPE_PLAYER, TYPE_ROOM, TYPE_THING, and Typeof.
Referenced by log_type_and_name(), and log_type_and_num().
00294 { 00295 if(!Good_obj(thing)) { 00296 return (char *) "??OUT-OF-RANGE??"; 00297 } 00298 switch (Typeof(thing)) { 00299 case TYPE_PLAYER: 00300 return (char *) "PLAYER"; 00301 case TYPE_THING: 00302 return (char *) "THING"; 00303 case TYPE_ROOM: 00304 return (char *) "ROOM"; 00305 case TYPE_EXIT: 00306 return (char *) "EXIT"; 00307 case TYPE_GARBAGE: 00308 return (char *) "GARBAGE"; 00309 default: 00310 return (char *) "??ILLEGAL??"; 00311 } 00312 }
int ok_attr_name | ( | const char * | ) |
Definition at line 471 of file predicates.c.
Referenced by vattr_define(), vattr_delete(), vattr_find(), and vattr_rename().
00472 { 00473 const char *scan; 00474 00475 if(!isalpha(*attrname)) 00476 return 0; 00477 for(scan = attrname; *scan; scan++) { 00478 if(isalnum(*scan)) 00479 continue; 00480 if(!(index("'?!`/-_.@#$^&~=+<>()%", *scan))) 00481 return 0; 00482 } 00483 return 1; 00484 }
int ok_name | ( | const char * | ) |
Definition at line 393 of file predicates.c.
References AND_TOKEN, ARG_DELIMITER, ESC_CHAR, LBUF_SIZE, LOOKUP_TOKEN, NOT_TOKEN, NUMBER_TOKEN, OR_TOKEN, string_compare(), and strip_ansi_r().
Referenced by create_obj(), do_clone(), do_fixdb(), do_name(), fun_valid(), and ok_player_name().
00394 { 00395 const char *cp; 00396 char new[LBUF_SIZE]; 00397 00398 /* Disallow pure ANSI names */ 00399 strncpy(new, name, LBUF_SIZE-1); 00400 if(strlen(strip_ansi_r(new,name,strlen(name))) == 0) 00401 return 0; 00402 00403 /* Disallow leading spaces */ 00404 00405 if(isspace(*name)) 00406 return 0; 00407 00408 /* 00409 * Only printable characters 00410 */ 00411 00412 for(cp = name; cp && *cp; cp++) { 00413 if((!isprint(*cp)) && (*cp != ESC_CHAR)) 00414 return 0; 00415 } 00416 00417 /* 00418 * Disallow trailing spaces 00419 */ 00420 cp--; 00421 if(isspace(*cp)) 00422 return 0; 00423 00424 /* 00425 * Exclude names that start with or contain certain magic cookies 00426 */ 00427 00428 return (name && *name && *name != LOOKUP_TOKEN && *name != NUMBER_TOKEN 00429 && *name != NOT_TOKEN && !index(name, ARG_DELIMITER) && 00430 !index(name, AND_TOKEN) && !index(name, OR_TOKEN) && 00431 string_compare(name, "me") && string_compare(name, "home") && 00432 string_compare(name, "here")); 00433 }
int ok_password | ( | const char * | ) |
Definition at line 486 of file predicates.c.
Referenced by create_player(), do_newpassword(), and do_password().
00487 { 00488 const char *scan; 00489 00490 if(*password == '\0') 00491 return 0; 00492 00493 for(scan = password; *scan; scan++) { 00494 if(!(isprint(*scan) && !isspace(*scan))) { 00495 return 0; 00496 } 00497 } 00498 00499 /* 00500 * Needed. Change it if you like, but be sure yours is the same. 00501 */ 00502 if((strlen(password) == 13) && (password[0] == 'X') && 00503 (password[1] == 'X')) 00504 return 0; 00505 00506 return 1; 00507 }
int ok_player_name | ( | const char * | ) |
Definition at line 435 of file predicates.c.
References ESC_CHAR, mudconf, confdata::name_spaces, ok_name(), and PLAYER_NAME_LIMIT.
Referenced by create_obj(), do_alias(), do_fixdb(), and do_name().
00436 { 00437 const char *cp, *good_chars; 00438 00439 /* 00440 * No leading spaces 00441 */ 00442 00443 if(isspace(*name)) 00444 return 0; 00445 00446 /* 00447 * Not too long and a good name for a thing 00448 */ 00449 00450 if(!ok_name(name) || (strlen(name) >= PLAYER_NAME_LIMIT)) 00451 return 0; 00452 00453 if(mudconf.name_spaces) 00454 good_chars = " `$_-.,'"; 00455 else 00456 good_chars = "`$_-.,'"; 00457 00458 /* 00459 * Make sure name only contains legal characters 00460 */ 00461 00462 for(cp = name; cp && *cp; cp++) { 00463 if(isalnum(*cp)) 00464 continue; 00465 if((!index(good_chars, *cp)) || (*cp == ESC_CHAR)) 00466 return 0; 00467 } 00468 return 1; 00469 }
void olist_add | ( | dbref | item | ) |
Add an entry to the object list
Definition at line 906 of file walkdb.c.
References alloc_lbuf, objlist_stack::count, objlist_block::data, objlist_stack::head, mudstate, objlist_block::next, OBLOCK_SIZE, statedata::olist, and objlist_stack::tail.
Referenced by find_wild_attrs(), and search_perform().
00907 { 00908 OBLOCK *op; 00909 00910 if(!mudstate.olist->head) { 00911 op = (OBLOCK *) alloc_lbuf("olist_add.first"); 00912 mudstate.olist->head = mudstate.olist->tail = op; 00913 mudstate.olist->count = 0; 00914 op->next = NULL; 00915 } else if(mudstate.olist->count >= OBLOCK_SIZE) { 00916 op = (OBLOCK *) alloc_lbuf("olist_add.next"); 00917 mudstate.olist->tail->next = op; 00918 mudstate.olist->tail = op; 00919 mudstate.olist->count = 0; 00920 op->next = NULL; 00921 } else { 00922 op = mudstate.olist->tail; 00923 } 00924 op->data[mudstate.olist->count++] = item; 00925 }
dbref olist_first | ( | void | ) |
Return the first entry in the object list
Definition at line 930 of file walkdb.c.
References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_block::data, objlist_stack::head, mudstate, NOTHING, statedata::olist, and objlist_stack::tail.
Referenced by do_decomp(), do_edit(), do_search(), do_wipe(), exam_wildattrs(), fun_lattr(), fun_search(), and grep_util().
00931 { 00932 if(!mudstate.olist->head) 00933 return NOTHING; 00934 if((mudstate.olist->head == mudstate.olist->tail) && 00935 (mudstate.olist->count == 0)) 00936 return NOTHING; 00937 mudstate.olist->cblock = mudstate.olist->head; 00938 mudstate.olist->citm = 0; 00939 return mudstate.olist->cblock->data[mudstate.olist->citm++]; 00940 }
dbref olist_next | ( | void | ) |
Definition at line 942 of file walkdb.c.
References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_block::data, mudstate, objlist_block::next, NOTHING, OBLOCK_SIZE, statedata::olist, and objlist_stack::tail.
Referenced by do_decomp(), do_edit(), do_search(), do_wipe(), exam_wildattrs(), fun_lattr(), fun_search(), and grep_util().
00943 { 00944 dbref thing; 00945 00946 if(!mudstate.olist->cblock) 00947 return NOTHING; 00948 if((mudstate.olist->cblock == mudstate.olist->tail) && 00949 (mudstate.olist->citm >= mudstate.olist->count)) 00950 return NOTHING; 00951 thing = mudstate.olist->cblock->data[mudstate.olist->citm++]; 00952 if(mudstate.olist->citm >= OBLOCK_SIZE) { 00953 mudstate.olist->cblock = mudstate.olist->cblock->next; 00954 mudstate.olist->citm = 0; 00955 } 00956 return thing; 00957 }
void olist_pop | ( | void | ) |
Pop one entire list off the object list stack
Definition at line 888 of file walkdb.c.
References free_lbuf, objlist_stack::head, mudstate, objlist_stack::next, objlist_block::next, statedata::olist, and XFREE.
Referenced by do_decomp(), do_edit(), do_examine(), do_search(), do_wipe(), fun_lattr(), fun_search(), and grep_util().
00889 { 00890 OLSTK *ol; 00891 OBLOCK *op, *onext; 00892 00893 ol = mudstate.olist->next; 00894 00895 for(op = mudstate.olist->head; op != NULL; op = onext) { 00896 onext = op->next; 00897 free_lbuf(op); 00898 } 00899 XFREE(mudstate.olist, "olist_pop"); 00900 mudstate.olist = ol; 00901 }
void olist_push | ( | void | ) |
Create a new object list at the top of the object list stack
Definition at line 870 of file walkdb.c.
References objlist_stack::cblock, objlist_stack::citm, objlist_stack::count, objlist_stack::head, mudstate, objlist_stack::next, statedata::olist, objlist_stack::tail, and XMALLOC.
Referenced by do_decomp(), do_edit(), do_examine(), do_search(), do_wipe(), fun_lattr(), fun_search(), and grep_util().
00871 { 00872 OLSTK *ol; 00873 00874 ol = (OLSTK *) XMALLOC(sizeof(OLSTK), "olist_push"); 00875 ol->next = mudstate.olist; 00876 mudstate.olist = ol; 00877 00878 ol->head = NULL; 00879 ol->tail = NULL; 00880 ol->cblock = NULL; 00881 ol->count = 0; 00882 ol->citm = 0; 00883 }
Definition at line 207 of file eval.c.
References alloc_lbuf, EV_EVAL, EV_FCHECK, exec(), parse_to(), and StringCopy.
Referenced by do_verb(), exec(), and process_cmdent().
00210 { 00211 char *rstr, *tstr, *bp, *str; 00212 int arg, peval; 00213 00214 for(arg = 0; arg < nfargs; arg++) 00215 fargs[arg] = NULL; 00216 if(dstr == NULL) 00217 return NULL; 00218 rstr = parse_to(&dstr, delim, 0); 00219 arg = 0; 00220 00221 peval = (eval & ~EV_EVAL); 00222 00223 while ((arg < nfargs) && rstr) { 00224 if(arg < (nfargs - 1)) 00225 tstr = parse_to(&rstr, ',', peval); 00226 else 00227 tstr = parse_to(&rstr, '\0', peval); 00228 if(eval & EV_EVAL) { 00229 bp = fargs[arg] = alloc_lbuf("parse_arglist"); 00230 str = tstr; 00231 exec(fargs[arg], &bp, 0, player, cause, eval | EV_FCHECK, &str, 00232 cargs, ncargs); 00233 *bp = '\0'; 00234 } else { 00235 fargs[arg] = alloc_lbuf("parse_arglist"); 00236 StringCopy(fargs[arg], tstr); 00237 } 00238 arg++; 00239 } 00240 return dstr; 00241 }
Definition at line 1035 of file set.c.
References alloc_lbuf, atr_pget_info(), atr_str(), attr, free_lbuf, NOTHING, attr::number, parse_thing_slash(), See_attr, and StringCopy.
Referenced by do_addcommand(), do_chown(), do_delcommand(), do_lock(), do_prog(), do_set(), do_trigger(), do_ufun(), do_unlock(), fun_colorpairs(), fun_default(), fun_edefault(), fun_eval(), fun_filter(), fun_fold(), fun_foreach(), fun_get(), fun_get_eval(), fun_map(), fun_mix(), fun_munge(), fun_owner(), fun_pairs(), fun_set(), fun_setlock(), fun_sortby(), fun_udefault(), fun_visible(), and fun_xget().
01036 { 01037 ATTR *attr; 01038 char *buff; 01039 dbref aowner; 01040 int aflags; 01041 01042 if(!str) 01043 return 0; 01044 01045 /* 01046 * Break apart string into obj and attr. Return on failure 01047 */ 01048 01049 buff = alloc_lbuf("parse_attrib"); 01050 StringCopy(buff, str); 01051 if(!parse_thing_slash(player, buff, &str, thing)) { 01052 free_lbuf(buff); 01053 return 0; 01054 } 01055 /* 01056 * Get the named attribute from the object if we can 01057 */ 01058 01059 attr = atr_str(str); 01060 free_lbuf(buff); 01061 if(!attr) { 01062 *atr = NOTHING; 01063 } else { 01064 atr_pget_info(*thing, attr->number, &aowner, &aflags); 01065 if(!See_attr(player, *thing, attr, aowner, aflags)) { 01066 *atr = NOTHING; 01067 } else { 01068 *atr = attr->number; 01069 } 01070 } 01071 return 1; 01072 }
Definition at line 1131 of file set.c.
References alloc_lbuf, find_wild_attrs(), free_lbuf, Good_obj, init_match(), ITER_PARENTS, MAT_EXIT_PARENTS, match_everything(), match_result(), mudstate, nhashflush(), NOTYPE, Parent, statedata::parent_htab, parse_thing_slash(), and StringCopy.
Referenced by do_decomp(), do_edit(), do_examine(), do_wipe(), fun_lattr(), and grep_util().
01133 { 01134 char *buff; 01135 dbref parent; 01136 int check_exclude, hash_insert, lev; 01137 01138 if(!str) 01139 return 0; 01140 01141 buff = alloc_lbuf("parse_attrib_wild"); 01142 StringCopy(buff, str); 01143 01144 /* 01145 * Separate name and attr portions at the first / 01146 */ 01147 01148 if(!parse_thing_slash(player, buff, &str, thing)) { 01149 01150 /* 01151 * Not in obj/attr format, return if not defaulting to * 01152 */ 01153 01154 if(!df_star) { 01155 free_lbuf(buff); 01156 return 0; 01157 } 01158 /* 01159 * Look for the object, return failure if not found 01160 */ 01161 01162 init_match(player, buff, NOTYPE); 01163 match_everything(MAT_EXIT_PARENTS); 01164 *thing = match_result(); 01165 01166 if(!Good_obj(*thing)) { 01167 free_lbuf(buff); 01168 return 0; 01169 } 01170 str = (char *) "*"; 01171 } 01172 /* 01173 * Check the object (and optionally all parents) for attributes 01174 */ 01175 01176 if(check_parents) { 01177 check_exclude = 0; 01178 hash_insert = check_parents; 01179 nhashflush(&mudstate.parent_htab, 0); 01180 ITER_PARENTS(*thing, parent, lev) { 01181 if(!Good_obj(Parent(parent))) 01182 hash_insert = 0; 01183 find_wild_attrs(player, parent, str, check_exclude, 01184 hash_insert, get_locks); 01185 check_exclude = 1; 01186 } 01187 } else { 01188 find_wild_attrs(player, *thing, str, 0, 0, get_locks); 01189 } 01190 free_lbuf(buff); 01191 return 1; 01192 }
Definition at line 552 of file boolexp.c.
References parse_boolexp_E(), parse_player, parsebuf, parsestore, parsing_internal, StringCopy, and TRUE_BOOLEXP.
Referenced by db_write_object(), debug_examine(), do_decomp(), do_examine(), do_lock(), eval_boolexp_atr(), fun_colorpairs(), fun_elock(), fun_eval(), fun_get(), fun_get_eval(), fun_lock(), fun_pairs(), fun_setlock(), fun_xget(), and view_atr().
00553 { 00554 StringCopy(parsestore, buf); 00555 parsebuf = parsestore; 00556 parse_player = player; 00557 if((buf == NULL) || (*buf == '\0')) 00558 return (TRUE_BOOLEXP); 00559 parsing_internal = internal; 00560 return parse_boolexp_E(); 00561 } /* end parse_boolexp() */
break up <what>,<low>,<high> syntax
Definition at line 1193 of file predicates.c.
References statedata::db_top, EV_STRIP_TS, mudstate, NUMBER_TOKEN, and parse_to().
Referenced by do_entrances(), do_find(), and search_setup().
01194 { 01195 char *buff1, *buff2; 01196 01197 buff1 = *name; 01198 if(buff1 && *buff1) 01199 *name = parse_to(&buff1, ',', EV_STRIP_TS); 01200 if(buff1 && *buff1) { 01201 buff2 = parse_to(&buff1, ',', EV_STRIP_TS); 01202 if(buff1 && *buff1) { 01203 while (*buff1 && isspace(*buff1)) 01204 buff1++; 01205 if(*buff1 == NUMBER_TOKEN) 01206 buff1++; 01207 *high_bound = atoi(buff1); 01208 if(*high_bound >= mudstate.db_top) 01209 *high_bound = mudstate.db_top - 1; 01210 } else { 01211 *high_bound = mudstate.db_top - 1; 01212 } 01213 while (*buff2 && isspace(*buff2)) 01214 buff2++; 01215 if(*buff2 == NUMBER_TOKEN) 01216 buff2++; 01217 *low_bound = atoi(buff2); 01218 if(*low_bound < 0) 01219 *low_bound = 0; 01220 } else { 01221 *low_bound = 0; 01222 *high_bound = mudstate.db_top - 1; 01223 } 01224 }
Definition at line 1226 of file predicates.c.
References Good_obj, init_match(), MAT_EXIT_PARENTS, match_everything(), match_result(), NOTHING, and NOTYPE.
Referenced by get_obj_and_lock(), parse_attrib(), and parse_attrib_wild().
01227 { 01228 char *str; 01229 01230 /* 01231 * get name up to / 01232 */ 01233 for(str = thing; *str && (*str != '/'); str++); 01234 01235 /* 01236 * If no / in string, return failure 01237 */ 01238 01239 if(!*str) { 01240 *after = NULL; 01241 *it = NOTHING; 01242 return 0; 01243 } 01244 *str++ = '\0'; 01245 *after = str; 01246 01247 /* 01248 * Look for the object 01249 */ 01250 01251 init_match(player, thing, NOTYPE); 01252 match_everything(MAT_EXIT_PARENTS); 01253 *it = match_result(); 01254 01255 /* 01256 * Return status of search 01257 */ 01258 01259 return (Good_obj(*it)); 01260 }
char* parse_to | ( | char ** | , | |
char | , | |||
int | ||||
) |
Definition at line 58 of file eval.c.
References ESC_CHAR, EV_NO_COMPRESS, EV_STRIP, EV_STRIP_ESC, EV_STRIP_LS, mudconf, NEXTCHAR, parse_to_cleanup(), confdata::space_compress, and stacklim.
Referenced by check_filter(), do_cpattr(), do_dolist(), do_force_prefixed(), do_mail_quick(), do_notify(), do_prog(), do_top(), do_wait(), exec(), parse_arglist(), parse_range(), process_cmdent(), and search_setup().
00059 { 00060 #define stacklim 32 00061 char stack[stacklim]; 00062 char *rstr, *cstr, *zstr; 00063 int sp, tp, first, bracketlev; 00064 00065 if((dstr == NULL) || (*dstr == NULL)) 00066 return NULL; 00067 if(**dstr == '\0') { 00068 rstr = *dstr; 00069 *dstr = NULL; 00070 return rstr; 00071 } 00072 sp = 0; 00073 first = 1; 00074 rstr = *dstr; 00075 if((mudconf.space_compress || (eval & EV_STRIP_LS)) && 00076 !(eval & EV_NO_COMPRESS)) { 00077 while (*rstr && isspace(*rstr)) 00078 rstr++; 00079 *dstr = rstr; 00080 } 00081 zstr = cstr = rstr; 00082 while (*cstr) { 00083 switch (*cstr) { 00084 case '\\': /* 00085 * general escape 00086 */ 00087 case '%': /* 00088 * also escapes chars 00089 */ 00090 if((*cstr == '\\') && (eval & EV_STRIP_ESC)) 00091 cstr++; 00092 else 00093 NEXTCHAR; 00094 if(*cstr) 00095 NEXTCHAR; 00096 first = 0; 00097 break; 00098 case ']': 00099 case ')': 00100 for(tp = sp - 1; (tp >= 0) && (stack[tp] != *cstr); tp--); 00101 00102 /* 00103 * If we hit something on the stack, unwind to it 00104 * Otherwise (it's not on stack), if it's our 00105 * delim we are done, and we convert the 00106 * delim to a null and return a ptr to the 00107 * char after the null. If it's not our 00108 * delimiter, skip over it normally 00109 */ 00110 00111 if(tp >= 0) 00112 sp = tp; 00113 else if(*cstr == delim) { 00114 rstr = parse_to_cleanup(eval, first, cstr, rstr, zstr); 00115 *dstr = ++cstr; 00116 return rstr; 00117 } 00118 first = 0; 00119 NEXTCHAR; 00120 break; 00121 case '{': 00122 bracketlev = 1; 00123 if(eval & EV_STRIP) { 00124 cstr++; 00125 } else { 00126 NEXTCHAR; 00127 } 00128 while (*cstr && (bracketlev > 0)) { 00129 switch (*cstr) { 00130 case '\\': 00131 case '%': 00132 if(cstr[1]) { 00133 if((*cstr == '\\') && (eval & EV_STRIP_ESC)) 00134 cstr++; 00135 else 00136 NEXTCHAR; 00137 } 00138 break; 00139 case '{': 00140 bracketlev++; 00141 break; 00142 case '}': 00143 bracketlev--; 00144 break; 00145 } 00146 if(bracketlev > 0) { 00147 NEXTCHAR; 00148 } 00149 } 00150 if((eval & EV_STRIP) && (bracketlev == 0)) { 00151 cstr++; 00152 } else if(bracketlev == 0) { 00153 NEXTCHAR; 00154 } 00155 first = 0; 00156 break; 00157 default: 00158 if((*cstr == delim) && (sp == 0)) { 00159 rstr = parse_to_cleanup(eval, first, cstr, rstr, zstr); 00160 *dstr = ++cstr; 00161 return rstr; 00162 } 00163 switch (*cstr) { 00164 case ' ': /* 00165 * space 00166 */ 00167 if(mudconf.space_compress && !(eval & EV_NO_COMPRESS)) { 00168 if(first) 00169 rstr++; 00170 else if(cstr[-1] == ' ') 00171 zstr--; 00172 } 00173 break; 00174 case '[': 00175 if(cstr != rstr && cstr[-1] == ESC_CHAR) { 00176 first = 0; 00177 break; 00178 } 00179 if(sp < stacklim) 00180 stack[sp++] = ']'; 00181 first = 0; 00182 break; 00183 case '(': 00184 if(sp < stacklim) 00185 stack[sp++] = ')'; 00186 first = 0; 00187 break; 00188 default: 00189 first = 0; 00190 } 00191 NEXTCHAR; 00192 } 00193 } 00194 rstr = parse_to_cleanup(eval, first, cstr, rstr, zstr); 00195 *dstr = NULL; 00196 return rstr; 00197 }
int payfor | ( | dbref | , | |
int | ||||
) |
Definition at line 352 of file predicates.c.
References Free_Money, Immortal, Owner, Pennies(), s_Pennies(), and Wizard.
Referenced by canpayfees(), do_entrances(), do_find(), do_kill(), do_mail_stats(), do_processcom(), get_stats(), give_money(), open_exit(), page_check(), search_setup(), and setup_que().
00353 { 00354 dbref tmp; 00355 00356 if(Wizard(who) || Wizard(Owner(who)) || Free_Money(who) || 00357 Free_Money(Owner(who)) || Immortal(who) || Immortal(Owner(who))) { 00358 return 1; 00359 } 00360 who = Owner(who); 00361 if((tmp = Pennies(who)) >= cost) { 00362 s_Pennies(who, tmp - cost); 00363 return 1; 00364 } 00365 return 0; 00366 }
int prefix_match | ( | const char * | s1, | |
const char * | s2 | |||
) |
returns the number of identical characters in the two strings
Definition at line 467 of file stringutil.c.
References ToLower.
00468 { 00469 int count = 0; 00470 00471 while (*s1 && *s2 && (ToLower(*s1) == ToLower(*s2))) 00472 s1++, s2++, count++; 00473 /* 00474 * If the whole string matched, count the null. (Yes really.) 00475 */ 00476 if(!*s1 && !*s2) 00477 count++; 00478 return count; 00479 }
char* PureName | ( | dbref | ) |
Definition at line 514 of file db.c.
References A_NAME, atr_get(), atr_get_str(), confdata::cache_names, statedata::db_top, free_lbuf, LBUF_SIZE, mudconf, mudstate, purenames, set_string(), and strip_ansi_r().
Referenced by do_find(), match_exit_internal(), match_here(), match_list(), and search_perform().
00515 { 00516 dbref aowner; 00517 int aflags; 00518 char *buff; 00519 static char *tbuff[LBUF_SIZE]; 00520 char new[LBUF_SIZE]; 00521 00522 if(mudconf.cache_names) { 00523 if(thing > mudstate.db_top || thing < 0) { 00524 return "#-1 INVALID DBREF"; 00525 } 00526 if(!purenames[thing]) { 00527 buff = atr_get(thing, A_NAME, &aowner, &aflags); 00528 strncpy(new, buff, LBUF_SIZE-1); 00529 set_string(&purenames[thing], strip_ansi_r(new,buff,strlen(buff))); 00530 free_lbuf(buff); 00531 } 00532 return purenames[thing]; 00533 } 00534 00535 atr_get_str((char *) tbuff, thing, A_NAME, &aowner, &aflags); 00536 strncpy(new, (char *) tbuff,LBUF_SIZE-1); 00537 return (strip_ansi_r(new,(char *) tbuff,strlen((char *) tbuff))); 00538 }
int que_next | ( | void | ) |
int quick_wild | ( | char * | tstr, | |
char * | dstr | |||
) |
Do a wildcard match, without remembering the wild data. This routine will cause crashes if fed NULLs instead of strings.
Definition at line 36 of file wild.c.
References EQUAL, NOTEQUAL, and quick_wild().
Referenced by badname_check(), check_filter(), find_wild_attrs(), fun_grab(), fun_graball(), fun_match(), fun_matchall(), fun_strmatch(), fun_switch(), help_write(), quick_wild(), wild(), wild1(), and wild_match().
00037 { 00038 while (*tstr != '*') { 00039 switch (*tstr) { 00040 case '?': 00041 /* 00042 * Single character match. Return false if at * end 00043 * * * * of data. 00044 */ 00045 if(!*dstr) 00046 return 0; 00047 break; 00048 case '\\': 00049 /* 00050 * Escape character. Move up, and force literal * * 00051 * * * match of next character. 00052 */ 00053 tstr++; 00054 /* 00055 * FALL THROUGH 00056 */ 00057 default: 00058 /* 00059 * Literal character. Check for a match. * If * * * 00060 * matching end of data, return true. 00061 */ 00062 if(NOTEQUAL(*dstr, *tstr)) 00063 return 0; 00064 if(!*dstr) 00065 return 1; 00066 } 00067 tstr++; 00068 dstr++; 00069 } 00070 00071 /* 00072 * Skip over '*'. 00073 */ 00074 00075 tstr++; 00076 00077 /* 00078 * Return true on trailing '*'. 00079 */ 00080 00081 if(!*tstr) 00082 return 1; 00083 00084 /* 00085 * Skip over wildcards. 00086 */ 00087 00088 while ((*tstr == '?') || (*tstr == '*')) { 00089 if(*tstr == '?') { 00090 if(!*dstr) 00091 return 0; 00092 dstr++; 00093 } 00094 tstr++; 00095 } 00096 00097 /* 00098 * Skip over a backslash in the pattern string if it is there. 00099 */ 00100 00101 if(*tstr == '\\') 00102 tstr++; 00103 00104 /* 00105 * Return true on trailing '*'. 00106 */ 00107 00108 if(!*tstr) 00109 return 1; 00110 00111 /* 00112 * Scan for possible matches. 00113 */ 00114 00115 while (*dstr) { 00116 if(EQUAL(*dstr, *tstr) && quick_wild(tstr + 1, dstr + 1)) 00117 return 1; 00118 dstr++; 00119 } 00120 return 0; 00121 }
void raw_broadcast | ( | int | , | |
char * | , | |||
... | ||||
) |
Definition at line 310 of file netcommon.c.
References DESC_ITER_CONN, Flags, flush_sockets(), LBUF_SIZE, descriptor_data::player, queue_write(), and strnlen().
Referenced by announce_connect(), announce_disconnect(), do_restart(), do_say(), do_shutdown(), fork_and_dump(), load_restart_db(), load_restart_db_xdr(), say_shout(), signal_BUS(), and signal_SEGV().
00311 { 00312 char buff[LBUF_SIZE]; 00313 DESC *d; 00314 va_list ap; 00315 00316 va_start(ap, template); 00317 if(!template || !*template) 00318 return; 00319 00320 vsnprintf(buff, LBUF_SIZE, template, ap); 00321 buff[LBUF_SIZE-1] = '\0'; 00322 00323 DESC_ITER_CONN(d) { 00324 if((Flags(d->player) & inflags) == inflags) { 00325 queue_write(d, buff, strnlen(buff, LBUF_SIZE-1)); 00326 queue_write(d, "\r\n", 2); 00327 } 00328 } 00329 flush_sockets(); 00330 va_end(ap); 00331 }
void record_login | ( | dbref | player, | |
int | isgood, | |||
char * | ldate, | |||
char * | lhost, | |||
char * | lusername | |||
) |
Record successful or failed login attempt. If successful, report last successful login and number of failures since last successful login.
Definition at line 138 of file player.c.
References A_LASTSITE, A_LOGINDATA, atr_add_raw(), atr_get(), logindata::bad, check_mail(), decrypt_logindata(), hostdtm::dtm, encrypt_logindata(), free_lbuf, logindata::good, confdata::have_mailer, hostdtm::host, mudconf, logindata::new_bad, notify, notify_printf(), NUM_BAD, NUM_GOOD, logindata::tot_bad, logindata::tot_good, and tprintf().
Referenced by announce_connect(), and connect_player().
00140 { 00141 LDATA login_info; 00142 char *atrbuf; 00143 dbref aowner; 00144 int aflags, i; 00145 00146 atrbuf = atr_get(player, A_LOGINDATA, &aowner, &aflags); 00147 decrypt_logindata(atrbuf, &login_info); 00148 if(isgood) { 00149 if(login_info.new_bad > 0) { 00150 notify(player, ""); 00151 notify_printf(player, 00152 "**** %d failed connect%s since your last successful connect. ****", 00153 login_info.new_bad, 00154 (login_info.new_bad == 1 ? "" : "s")); 00155 notify_printf(player, 00156 "Most recent attempt was from %s on %s.", 00157 login_info.bad[0].host, login_info.bad[0].dtm); 00158 notify(player, ""); 00159 login_info.new_bad = 0; 00160 } 00161 if(login_info.good[0].host && *login_info.good[0].host && 00162 login_info.good[0].dtm && *login_info.good[0].dtm) { 00163 notify_printf(player, "Last connect was from %s on %s.", 00164 login_info.good[0].host, login_info.good[0].dtm); 00165 } 00166 if(mudconf.have_mailer) 00167 check_mail(player, 0, 0); 00168 for(i = NUM_GOOD - 1; i > 0; i--) { 00169 login_info.good[i].dtm = login_info.good[i - 1].dtm; 00170 login_info.good[i].host = login_info.good[i - 1].host; 00171 } 00172 login_info.good[0].dtm = ldate; 00173 login_info.good[0].host = lhost; 00174 login_info.tot_good++; 00175 if(*lusername) 00176 atr_add_raw(player, A_LASTSITE, tprintf("%s@%s", lusername, 00177 lhost)); 00178 else 00179 atr_add_raw(player, A_LASTSITE, lhost); 00180 } else { 00181 for(i = NUM_BAD - 1; i > 0; i--) { 00182 login_info.bad[i].dtm = login_info.bad[i - 1].dtm; 00183 login_info.bad[i].host = login_info.bad[i - 1].host; 00184 } 00185 login_info.bad[0].dtm = ldate; 00186 login_info.bad[0].host = lhost; 00187 login_info.tot_bad++; 00188 login_info.new_bad++; 00189 } 00190 encrypt_logindata(atrbuf, &login_info); 00191 atr_add_raw(player, A_LOGINDATA, atrbuf); 00192 free_lbuf(atrbuf); 00193 }
void recover_queue_deposits | ( | void | ) |
void release_descriptor | ( | DESC * | ) |
Definition at line 136 of file bsd.c.
References clearstrings(), DESC_ITER_PLAYER, descriptor_data::descriptor, descriptor_list, dprintk, free_lbuf, freeqs(), MAX_GLOBAL_REGS, ndescriptors, descriptor_data::next, descriptor_data::player, descriptor_data::prev, descriptor_data::program_data, descriptor_data::refcount, descriptor_data::sock_buff, descriptor_data::sock_ev, and prog_data::wait_regs.
Referenced by accept_client_input(), desc_delhash(), and shutdownsock().
00136 { 00137 d->refcount--; 00138 //dprintk("descriptor %p released, refcount now %d", d, d->refcount); 00139 if(d->refcount == 0) { 00140 dprintk("%p destructing", d); 00141 freeqs(d); 00142 00143 if(d->program_data != NULL) { 00144 int num = 0; 00145 DESC *dtemp; 00146 DESC_ITER_PLAYER(d->player, dtemp) num++; 00147 00148 if(num == 0) { 00149 for(int i = 0; i < MAX_GLOBAL_REGS; i++) { 00150 free_lbuf(d->program_data->wait_regs[i]); 00151 } 00152 free(d->program_data); 00153 } 00154 } 00155 clearstrings(d); 00156 if(d->descriptor) { 00157 fsync(d->descriptor); 00158 event_del(&d->sock_ev); 00159 shutdown(d->descriptor, 2); 00160 close(d->descriptor); 00161 } 00162 d->descriptor = 0; 00163 if(d->sock_buff) 00164 bufferevent_free(d->sock_buff); 00165 d->sock_buff = NULL; 00166 00167 /* if(descriptor_list == d) { 00168 descriptor_list = d->next; 00169 } else { 00170 if(!descriptor_list) { 00171 dprintk("Oh sweet jesus, we have major braindamage."); 00172 descriptor_list = d->next; 00173 } else { 00174 DESC *dtemp = descriptor_list; 00175 while(dtemp->next != NULL) { 00176 if(dtemp->next == d) { 00177 dtemp->next = d->next; 00178 break; 00179 } else { 00180 dtemp = dtemp->next; 00181 } 00182 } 00183 } 00184 } 00185 00186 d->next = NULL; 00187 */ 00188 if (d->prev) 00189 d->prev->next = d->next; 00190 else /* d was the first one! */ 00191 descriptor_list = d->next; 00192 if (d->next) 00193 d->next->prev = d->prev; 00194 00195 ndescriptors--; 00196 free(d); 00197 } 00198 }
void release_player | ( | dbref | ) |
Definition at line 209 of file netcommon.c.
Referenced by announce_connect(), announce_disconnect(), and do_top().
Definition at line 100 of file predicates.c.
References DOLIST, Next, and s_Next.
Referenced by destroy_exit(), do_drop(), do_get(), do_teleport(), and move_object().
00101 { 00102 dbref prev; 00103 00104 if(head == thing) 00105 return (Next(thing)); 00106 00107 DOLIST(prev, head) { 00108 if(Next(prev) == thing) { 00109 s_Next(prev, Next(thing)); 00110 return head; 00111 } 00112 } 00113 return head; 00114 }
char* replace_string | ( | const char * | old, | |
const char * | new, | |||
const char * | string | |||
) |
Returns an lbuf containing string STRING with all occurances of OLD replaced by NEW. OLD and NEW may be different lengths.
Definition at line 392 of file stringutil.c.
References alloc_lbuf, safe_chr, and safe_str.
Referenced by add_folder_name(), bind_and_queue(), do_edit_msg(), do_setnewtitle(), edit_string(), edit_string_ansi(), fun_iter(), fun_list(), fun_parse(), replace_string_inplace(), and search_perform().
00393 { 00394 char *result, *r, *s; 00395 int olen; 00396 00397 if(string == NULL) 00398 return NULL; 00399 s = (char *) string; 00400 olen = strlen(old); 00401 r = result = alloc_lbuf("replace_string"); 00402 while (*s) { 00403 00404 /* 00405 * Copy up to the next occurrence of the first char of OLD 00406 */ 00407 00408 while (*s && *s != *old) { 00409 safe_chr(*s, result, &r); 00410 s++; 00411 } 00412 00413 /* 00414 * If we are really at an OLD, append NEW to the result and * 00415 * 00416 * * * * * * bump the input string past the occurrence of 00417 * OLD. * * * * Otherwise, copy the char and try again. 00418 */ 00419 00420 if(*s) { 00421 if(!strncmp(old, s, olen)) { 00422 safe_str((char *) new, result, &r); 00423 s += olen; 00424 } else { 00425 safe_chr(*s, result, &r); 00426 s++; 00427 } 00428 } 00429 } 00430 *r = '\0'; 00431 return result; 00432 }
char* replace_string_inplace | ( | const char * | old, | |
const char * | new, | |||
char * | string | |||
) |
Returns string STRING with all occurances * of OLD replaced by NEW. OLD and NEW may be different lengths. Modifies string, so: Note - STRING must already be allocated large enough to handle the new size. (mitch 1 feb 91)
Definition at line 439 of file stringutil.c.
References free_lbuf, replace_string(), and StringCopy.
00440 { 00441 char *s; 00442 00443 s = replace_string(old, new, string); 00444 StringCopy(string, s); 00445 free_lbuf(s); 00446 return string; 00447 }
void report | ( | void | ) |
print out stuff into error file
Definition at line 107 of file game.c.
References statedata::curr_enactor, statedata::curr_player, statedata::debug_cmd, ENDLOG, Good_obj, LOG_BUGS, log_name_and_loc(), log_text(), mudstate, and STARTLOG.
Referenced by signal_BUS(), and signal_SEGV().
00108 { 00109 STARTLOG(LOG_BUGS, "BUG", "INFO") { 00110 log_text((char *) "Command: '"); 00111 log_text(mudstate.debug_cmd); 00112 log_text((char *) "'"); 00113 ENDLOG; 00114 } if(Good_obj(mudstate.curr_player)) { 00115 STARTLOG(LOG_BUGS, "BUG", "INFO") { 00116 log_text((char *) "Player: "); 00117 log_name_and_loc(mudstate.curr_player); 00118 if((mudstate.curr_enactor != mudstate.curr_player) && 00119 Good_obj(mudstate.curr_enactor)) { 00120 log_text((char *) " Enactor: "); 00121 log_name_and_loc(mudstate.curr_enactor); 00122 } 00123 ENDLOG; 00124 }} 00125 }
void ResetSpecialObjects | ( | void | ) |
Definition at line 1510 of file glue.c.
Referenced by do_restart(), and do_shutdown().
01511 { 01512 #if 0 /* Nowadays no longer neccessary, see mech.tech.saverepair.c */ 01513 int i; 01514 01515 for(i = FIRST_TECH_EVENT; i <= LAST_TECH_EVENT; i++) 01516 while (muxevent_run_by_type(i)); 01517 #endif 01518 muxevent_run_by_type(EVENT_HIDE); 01519 muxevent_run_by_type(EVENT_BLINDREC); 01520 }
Reverse the order of members in a list.
Definition at line 119 of file predicates.c.
References Next, NOTHING, and s_Next.
Referenced by process_sticky_dropto().
00120 { 00121 dbref newlist, rest; 00122 00123 newlist = NOTHING; 00124 while (list != NOTHING) { 00125 rest = Next(list); 00126 s_Next(list, newlist); 00127 newlist = list; 00128 list = rest; 00129 } 00130 return newlist; 00131 }
void run_command | ( | DESC * | d, | |
char * | ||||
) |
Definition at line 1756 of file netcommon.c.
References do_command(), dprintk, handle_prog(), descriptor_data::input_size, descriptor_data::player, descriptor_data::program_data, queue_string(), descriptor_data::quota, and Staff.
Referenced by process_input().
01757 { 01758 if(!Staff(d->player)) { 01759 if(d->quota <= 0) { 01760 queue_string(d, "quota exceed, dropping command.\n"); 01761 dprintk("aborting execution of %s for #%d.", command, d->player); 01762 return; 01763 } 01764 d->quota--; 01765 } 01766 d->input_size -= (strlen(command) + 1); 01767 if(d->program_data != NULL) 01768 handle_prog(d, command); 01769 else 01770 do_command(d, command); 01771 }
void s_Name | ( | dbref | , | |
char * | ||||
) |
Definition at line 540 of file db.c.
References A_NAME, atr_add_raw(), confdata::cache_names, MBUF_SIZE, mudconf, purenames, set_string(), and strip_ansi_r().
Referenced by create_obj(), db_make_minimal(), db_read(), destroy_obj(), do_clone(), do_fixdb(), do_name(), do_toad(), and mmdb_db_read().
00541 { 00542 char new[MBUF_SIZE]; 00543 /* Truncate the name if we have to */ 00544 00545 strncpy(new,s,MBUF_SIZE-1); 00546 if(s && (strlen(s) > MBUF_SIZE)) 00547 s[MBUF_SIZE] = '\0'; 00548 00549 atr_add_raw(thing, A_NAME, (char *) s); 00550 00551 if(mudconf.cache_names) { 00552 00553 set_string(&purenames[thing], strip_ansi_r(new,s,strlen(s))); 00554 } 00555 }
void s_Pass | ( | dbref | , | |
const char * | ||||
) |
Definition at line 557 of file db.c.
References A_PASS, and atr_add_raw().
Referenced by create_player(), and do_newpassword().
00558 { 00559 atr_add_raw(thing, A_PASS, (char *) s); 00560 }
int safe_copy_chr | ( | char | src, | |
char * | buff, | |||
char ** | bufp, | |||
int | max | |||
) |
Copy buffers, watching for overflows.
Definition at line 524 of file stringutil.c.
00525 { 00526 char *tp; 00527 int retval; 00528 00529 tp = *bufp; 00530 retval = 0; 00531 if((tp - buff) < max) { 00532 *tp++ = src; 00533 } else { 00534 retval = 1; 00535 } 00536 *bufp = tp; 00537 return retval; 00538 }
int safe_copy_str | ( | char * | src, | |
char * | buff, | |||
char ** | bufp, | |||
int | max | |||
) |
Copy buffers, watching for overflows.
Definition at line 508 of file stringutil.c.
Referenced by do_doing().
00509 { 00510 char *tp; 00511 00512 tp = *bufp; 00513 if(src == NULL) 00514 return 0; 00515 while (*src && ((tp - buff) < max)) 00516 *tp++ = *src++; 00517 *bufp = tp; 00518 return strlen(src); 00519 }
void safe_tprintf_str | ( | char * | , | |
char ** | , | |||
const char * | , | |||
... | ||||
) |
Referenced by do_drop(), do_malias_list(), fn_range_check(), fun_alphamax(), fun_alphamin(), fun_and(), fun_andflags(), fun_btaddstores(), fun_btarmorstatus(), fun_btarmorstatus_ref(), fun_btcritslot(), fun_btcritslot_ref(), fun_btcritstatus(), fun_btcritstatus_ref(), fun_btdamagemech(), fun_btdamages(), fun_btdesignex(), fun_btengrate(), fun_btengrate_ref(), fun_btfasabasecost_ref(), fun_btgetbv(), fun_btgetbv_ref(), fun_btgetcharvalue(), fun_btgetpartcost(), fun_btgetrange(), fun_btgetrealmaxspeed(), fun_btgetweight(), fun_btgetxcodevalue(), fun_btgetxcodevalue_ref(), fun_bthexemit(), fun_bthexinblz(), fun_bthexlos(), fun_btid2db(), fun_btlistblz(), fun_btlosm2m(), fun_btmakemechs(), fun_btmakepilotroll(), fun_btmapelev(), fun_btmapemit(), fun_btmapterr(), fun_btmapunits(), fun_btmechfreqs(), fun_btnumrepjobs(), fun_btpartmatch(), fun_btpartname(), fun_btparttype(), fun_btpayload_ref(), fun_btremovestores(), fun_btsetarmorstatus(), fun_btsetcharvalue(), fun_btsetmaxspeed(), fun_btsetpartcost(), fun_btsetxcodevalue(), fun_btsetxy(), fun_btshowcritstatus_ref(), fun_btshowstatus_ref(), fun_btshowwspecs_ref(), fun_btstores(), fun_bttechlist(), fun_bttechlist_ref(), fun_bttechstatus(), fun_btthreshold(), fun_btticweaps(), fun_btunderrepair(), fun_btunitfixable(), fun_btweaponstatus(), fun_btweaponstatus_ref(), fun_btweapstat(), fun_ceil(), fun_children(), fun_clist(), fun_cobj(), fun_con(), fun_conn(), fun_connrecord(), fun_controls(), fun_convtime(), fun_create(), fun_cwho(), fun_dec(), fun_die(), fun_digittime(), fun_dist2d(), fun_dist3d(), fun_div(), fun_elock(), fun_eq(), fun_exit(), fun_findable(), fun_floor(), fun_gt(), fun_gte(), fun_home(), fun_idle(), fun_inc(), fun_inzone(), fun_items(), fun_loc(), fun_locate(), fun_lt(), fun_lte(), fun_mail(), fun_mailfrom(), fun_match(), fun_member(), fun_mod(), fun_money(), fun_neq(), fun_next(), fun_not(), fun_num(), fun_objmem(), fun_or(), fun_orflags(), fun_owner(), fun_parent(), fun_playmem(), fun_pmatch(), fun_pos(), fun_rand(), fun_regmatch(), fun_rloc(), fun_room(), fun_round(), fun_secs(), fun_shl(), fun_shr(), fun_startsecs(), fun_stats(), fun_strlen(), fun_t(), fun_trunc(), fun_valid(), fun_vdim(), fun_visible(), fun_vmag(), fun_vmul(), fun_where(), fun_wordpos(), fun_words(), fun_xor(), fun_zone(), fun_zplayers(), fun_zwho(), fval(), get_folder_number(), and grep_util().
void SaveSpecialObjects | ( | int | ) |
Definition at line 747 of file glue.c.
Referenced by debug_savedb(), and dump_database_internal().
00748 { 00749 FILE *f; 00750 int filemode, count; 00751 byte xcode_version = XCODE_VERSION; 00752 char target[LBUF_SIZE]; 00753 00754 switch (i) { 00755 case DUMP_KILLED: 00756 sprintf(target, "%s.KILLED", mudconf.hcode_db); 00757 break; 00758 case DUMP_CRASHED: 00759 sprintf(target, "%s.CRASHED", mudconf.hcode_db); 00760 break; 00761 default: /* RESTART / normal */ 00762 sprintf(target, "%s.tmp", mudconf.hcode_db); 00763 break; 00764 } 00765 f = my_open_file(target, "w", &filemode); 00766 if(!f) { 00767 log_perror("SAV", "FAIL", "Opening new hcode-save file", target); 00768 SendDB("ERROR occured during opening of new hcode-savefile."); 00769 return; 00770 } 00771 fwrite(&xcode_version, 1, 1, f); 00772 count = SaveTree(f, xcode_tree); 00773 global_file_kludge = f; 00774 /* Then, check each xcode thing for stuff */ 00775 GoThruTree(xcode_tree, save_maps_func); 00776 00777 /* Save autopilot data */ 00778 /* GoThruTree(xcode_tree, save_autopilot_data); */ 00779 00780 saverepairs(f); 00781 my_close_file(f, &filemode); 00782 if(i == DUMP_RESTART || i == DUMP_NORMAL) { 00783 if(rename(mudconf.hcode_db, tprintf("%s.prev", mudconf.hcode_db)) 00784 < 0) { 00785 log_perror("SAV", "FAIL", "Renaming old hcode-save file ", 00786 target); 00787 SendDB("ERROR occured during renaming of old hcode save-file."); 00788 } 00789 if(rename(target, mudconf.hcode_db) < 0) { 00790 log_perror("SAV", "FAIL", "Renaming new hcode-save file ", 00791 target); 00792 SendDB("ERROR occured during renaming of new hcode save-file."); 00793 } 00794 } 00795 if(count) 00796 SendDB(tprintf("Hcode saved. %d xcode entries dumped.", count)); 00797 #ifdef BT_ADVANCED_ECON 00798 save_econdb(target, i); 00799 #endif 00800 }
char* seek_char | ( | const char * | s, | |
char | c | |||
) |
returns a pointer to the next character in s matching c, or a pointer to the at the end of s. Yes, this is a lot like index, but not exactly.
Definition at line 213 of file stringutil.c.
Referenced by parse_msglist().
00214 { 00215 char *cp; 00216 00217 cp = (char *) s; 00218 while (cp && *cp && (*cp != c)) 00219 cp++; 00220 return (cp); 00221 }
void set_prefix_cmds | ( | void | ) |
Definition at line 741 of file command.c.
References A_USER_START, statedata::command_htab, hashfind(), mudstate, and prefix_cmds.
00742 { 00743 int i; 00744 00745 /* 00746 * Load the command prefix table. Note - these commands can never * 00747 * * * * * * be typed in by a user because commands are lowercased * 00748 * before * * * * the * hash table is checked. The names are * 00749 * abbreviated to * * * minimise * * name checking time. 00750 */ 00751 00752 for(i = 0; i < A_USER_START; i++) 00753 prefix_cmds[i] = NULL; 00754 prefix_cmds['"'] = 00755 (CMDENT *) hashfind((char *) "\"", &mudstate.command_htab); 00756 prefix_cmds[':'] = 00757 (CMDENT *) hashfind((char *) ":", &mudstate.command_htab); 00758 prefix_cmds[';'] = 00759 (CMDENT *) hashfind((char *) ";", &mudstate.command_htab); 00760 prefix_cmds['\\'] = 00761 (CMDENT *) hashfind((char *) "\\", &mudstate.command_htab); 00762 prefix_cmds['#'] = 00763 (CMDENT *) hashfind((char *) "#", &mudstate.command_htab); 00764 prefix_cmds['&'] = 00765 (CMDENT *) hashfind((char *) "&", &mudstate.command_htab); 00766 prefix_cmds['-'] = 00767 (CMDENT *) hashfind((char *) "-", &mudstate.command_htab); 00768 prefix_cmds['~'] = 00769 (CMDENT *) hashfind((char *) "~", &mudstate.command_htab); 00770 #ifdef USE_PYTHON 00771 prefix_cmds[','] = 00772 (CMDENT *) hashfind((char *) ",", &mudstate.command_htab); 00773 #endif 00774 }
void shutdown_services | ( | ) |
Definition at line 200 of file bsd.c.
References dnschild_destruct(), flush_sockets(), logcache_destruct(), and sqlchild_destruct().
Referenced by do_restart().
00201 { 00202 dnschild_destruct(); 00203 flush_sockets(); 00204 #ifdef SQL_SUPPORT 00205 sqlchild_destruct(); 00206 #endif 00207 #ifdef ARBITRARY_LOGFILES 00208 logcache_destruct(); 00209 #endif 00210 event_loopexit(NULL); 00211 }
char* skip_space | ( | const char * | ) |
Definition at line 199 of file stringutil.c.
00200 { 00201 char *cp; 00202 00203 cp = (char *) s; 00204 while (cp && *cp && isspace(*cp)) 00205 cp++; 00206 return (cp); 00207 }
dbref start_home | ( | void | ) |
start_home, default_home, can_set_home, new_home, clone_home: Routines for validating and determining homes.
Definition at line 92 of file object.c.
References mudconf, NOTHING, confdata::start_home, and confdata::start_room.
Referenced by create_player().
00093 { 00094 if(mudconf.start_home != NOTHING) 00095 return mudconf.start_home; 00096 return mudconf.start_room; 00097 }
int start_log | ( | const char * | primary, | |
const char * | secondary | |||
) |
See if it's is OK to log something, and if so, start writing the log entry.
Definition at line 107 of file log.c.
References statedata::buffer, confdata::log_info, statedata::logging, LOGOPT_TIMESTAMP, confdata::mud_name, mudconf, mudstate, and time().
Referenced by log_perror().
00108 { 00109 struct tm *tp; 00110 time_t now; 00111 00112 mudstate.logging++; 00113 switch (mudstate.logging) { 00114 case 1: 00115 case 2: 00116 00117 /* 00118 * Format the timestamp 00119 */ 00120 00121 if((mudconf.log_info & LOGOPT_TIMESTAMP) != 0) { 00122 time((time_t *) (&now)); 00123 tp = localtime((time_t *) (&now)); 00124 sprintf(mudstate.buffer, "%d%02d%02d.%02d%02d%02d ", 00125 tp->tm_year + 1900, tp->tm_mon + 1, tp->tm_mday, 00126 tp->tm_hour, tp->tm_min, tp->tm_sec); 00127 } else { 00128 mudstate.buffer[0] = '\0'; 00129 } 00130 00131 /* 00132 * Write the header to the log 00133 */ 00134 00135 if(secondary && *secondary) 00136 fprintf(stderr, "%s%s %3s/%-5s: ", mudstate.buffer, 00137 mudconf.mud_name, primary, secondary); 00138 else 00139 fprintf(stderr, "%s%s %-9s: ", mudstate.buffer, 00140 mudconf.mud_name, primary); 00141 /* 00142 * If a recursive call, log it and return indicating no log 00143 */ 00144 00145 if(mudstate.logging == 1) 00146 return 1; 00147 fprintf(stderr, "Recursive logging request.\r\n"); 00148 default: 00149 mudstate.logging--; 00150 } 00151 return 0; 00152 }
int string_compare | ( | const char * | , | |
const char * | ||||
) |
Definition at line 307 of file stringutil.c.
References mudconf, confdata::space_compress, and ToLower.
Referenced by badname_remove(), cf_func_access(), do_chown(), do_convtime(), do_last(), do_move(), do_name(), do_teleport(), eval_boolexp(), fun_stats(), lookup_player(), match_here(), match_home(), match_list(), match_me(), ok_name(), and process_command().
00308 { 00309 if(!mudconf.space_compress) { 00310 while (*s1 && *s2 && ToLower(*s1) == ToLower(*s2)) 00311 s1++, s2++; 00312 00313 return (ToLower(*s1) - ToLower(*s2)); 00314 } else { 00315 while (isspace(*s1)) 00316 s1++; 00317 while (isspace(*s2)) 00318 s2++; 00319 while (*s1 && *s2 && ((ToLower(*s1) == ToLower(*s2)) || 00320 (isspace(*s1) && isspace(*s2)))) { 00321 if(isspace(*s1) && isspace(*s2)) { /* 00322 * skip all 00323 * other 00324 * spaces 00325 */ 00326 while (isspace(*s1)) 00327 s1++; 00328 while (isspace(*s2)) 00329 s2++; 00330 } else { 00331 s1++; 00332 s2++; 00333 } 00334 } 00335 if((*s1) && (*s2)) 00336 return (1); 00337 if(isspace(*s1)) { 00338 while (isspace(*s1)) 00339 s1++; 00340 return (*s1); 00341 } 00342 if(isspace(*s2)) { 00343 while (isspace(*s2)) 00344 s2++; 00345 return (*s2); 00346 } 00347 if((*s1) || (*s2)) 00348 return (1); 00349 return (0); 00350 } 00351 }
const char* string_match | ( | const char * | src, | |
const char * | sub | |||
) |
Accepts only nonempty matches starting at the beginning of a word
Definition at line 370 of file stringutil.c.
References string_prefix().
Referenced by add_folder_name(), do_find(), get_folder_name(), and match_list().
00371 { 00372 if((*sub != '\0') && (src)) { 00373 while (*src) { 00374 if(string_prefix(src, sub)) 00375 return src; 00376 /* 00377 * else scan to beginning of next word 00378 */ 00379 while (*src && isalnum(*src)) 00380 src++; 00381 while (*src && !isalnum(*src)) 00382 src++; 00383 } 00384 } 00385 return 0; 00386 }
int string_prefix | ( | const char * | , | |
const char * | ||||
) |
Definition at line 353 of file stringutil.c.
References ToLower.
Referenced by check_connect(), do_mail_debug(), dump_users(), find_connected_name(), search_perform(), search_setup(), and string_match().
00354 { 00355 int count = 0; 00356 00357 while (*string && *prefix && ToLower(*string) == ToLower(*prefix)) 00358 string++, prefix++, count++; 00359 if(*prefix == '\0') /* 00360 * Matched all of prefix 00361 */ 00362 return (count); 00363 else 00364 return (0); 00365 }
char* strip_ansi_r | ( | char * | , | |
const char * | , | |||
size_t | ||||
) |
Definition at line 53 of file log.c.
References ESC_CHAR.
Referenced by decompile_powers(), do_channelwho(), do_create(), do_decomp(), do_name(), fun_center(), fun_columns(), fun_edit(), fun_ljust(), fun_mid(), fun_rjust(), fun_stripansi(), fun_strlen(), fun_strtrunc(), log_error(), log_name(), log_printf(), log_text(), Name(), ok_name(), PureName(), queue_string(), and s_Name().
00054 { 00055 char *p = (char *) raw; 00056 char *q = dest; 00057 00058 while (p && *p && ((q - dest) < n)) { 00059 if(*p == ESC_CHAR) { 00060 /* 00061 * Start of ANSI code. Skip to end. 00062 */ 00063 while (*p && !isalpha(*p)) 00064 p++; 00065 if(*p) 00066 p++; 00067 } else 00068 *q++ = *p++; 00069 } 00070 *q = '\0'; 00071 return dest; 00072 }
char* strsave | ( | const char * | ) |
Definition at line 495 of file stringutil.c.
References StringCopy, and XMALLOC.
Referenced by cf_cmd_alias(), dup_bool(), getboolexp1(), init_cmdtab(), and test_atr().
00496 { 00497 char *p; 00498 p = (char *) XMALLOC(sizeof(char) * (strlen(s) + 1), "strsave"); 00499 00500 if(p) 00501 StringCopy(p, s); 00502 return p; 00503 }
void tcache_init | ( | void | ) |
Definition at line 287 of file eval.c.
References tcache_count, tcache_head, and tcache_top.
Referenced by main().
00288 { 00289 tcache_head = NULL; 00290 tcache_top = 1; 00291 tcache_count = 0; 00292 }
void toast_player | ( | dbref | ) |
Definition at line 2065 of file db.c.
References del_commac(), do_channelnuke(), do_clear_macro(), and do_clearcom().
Referenced by announce_disconnect(), destroy_guest(), destroy_obj(), and destroy_player().
02066 { 02067 do_clearcom(player, player, 0); 02068 do_channelnuke(player); 02069 del_commac(player); 02070 do_clear_macro(player, NULL); 02071 }
char* tprintf | ( | const char * | , | |
... | ||||
) |
Referenced by AccumulateArtyXP(), AccumulateCommXP(), AccumulateComputerXP(), AccumulateGunXPold(), AccumulatePilXP(), AccumulateSpotXP(), AccumulateTechWeaponsXP(), AccumulateTechXP(), add_mail_message(), addMechToC3iNetwork(), addMechToC3Network(), aero_checklz(), aero_land(), aero_takeoff(), aero_takeoff_event(), aero_thrust(), aero_vheading(), announce_connect(), announce_disconnect(), artillery_hit(), artillery_shoot(), auto_com_event(), autoeject(), bind_and_queue(), bomb_list(), BreachLoc(), bsuit_attackleg(), CalculateLOSMap(), ChannelEmitKill(), char_disembark(), char_eject(), ChargeMech(), check_stagger_event(), CheckDamage(), CheckEdgeOfMap(), CheckNavalHeight(), clear_hex(), clear_mech_from_LOS(), clearC3iNetwork(), clearC3Network(), clearMechFromC3iNetwork(), clearMechFromC3Network(), countMaxC3Units(), countTotalC3MastersOnMech(), countWorkingC3MastersOnMech(), create_guest(), create_obj(), damage_cf(), db_grow(), dbrefs_to_names(), DeathFromAbove(), debug_examine(), debug_xptop(), destroy_guest(), destroy_player(), did_it(), DisplayTarget(), do_boot(), do_clone(), do_cpattr(), do_destroy(), do_edit(), do_find(), do_mail_fwd(), do_mail_nuke(), do_malias_send(), do_motd(), do_mvattr(), do_name(), do_open(), do_page(), do_pcreate(), do_pemit(), do_prog(), do_say(), do_sub_magic(), do_toad(), doBSuitCommonChecks(), DoSpecialObjectHelp(), DS_BlastNearbyMechsAndTrees(), dump_database_internal(), dump_item(), dump_users(), econ_change_items(), edit_string_ansi(), engine_weight(), findC3RangeWithNetwork(), FindTargetDBREFFromMapNumber(), fire_hex(), FireWeapon(), FireWeaponNumber(), fun_btaddstores(), fun_btgetbv(), fun_btgetrealmaxspeed(), fun_btgetweight(), fun_btsetcharvalue(), fun_btticweaps(), fun_iter(), fun_list(), get_lrshexstr(), give_money(), give_thing(), handle_ears(), handle_prog(), HandleMechCrit(), initialize_pc(), initiate_ood(), InLineOfSight(), InWeaponArc(), Leave_DS_Bay(), Leave_Hangar(), list_costs(), list_matching(), list_options(), list_process(), list_vattrs(), list_xcodestuff(), list_xcodevalues(), listtic_sub(), load_game(), load_macros(), load_mail(), load_mechdata(), load_template(), load_update1(), load_update4(), LOSMap_Hex2Index(), MadePerceptionRoll(), MadePilotSkillRoll_Advanced(), MadePilotSkillRoll_NoXP(), make_mine_explode(), make_portlist(), make_ulist(), map_load(), map_savemap(), mech_attachcables(), mech_bootlegger(), mech_c3_join_leave(), mech_c3i_join_leave(), mech_createbays(), mech_detachcables(), mech_dropoff(), mech_dump(), mech_embark(), mech_enter_event(), mech_enterbase(), mech_enterbay_event(), mech_explode(), mech_explode_event(), mech_inarc_ammo_toggle(), mech_int_check(), mech_list_maker(), mech_ood_event(), mech_pickup(), mech_rac(), mech_radio(), mech_Rresetstuff(), mech_Rsetmapindex(), mech_Rsetxy(), mech_scan(), mech_set_channelfreq(), Mech_ShowFlags(), mech_snipe_func(), mech_tag(), mech_thrash(), mech_toggle_mode_sub_func(), mech_udisembark(), mech_usebin(), mech_vertical(), mech_weaponspecs(), mech_weight_sub_mech(), mech_weight_sub_veh(), MechFloodsLoc(), multi_weap_sel(), mung_quotas(), my_shortform(), NewHexEntered(), nonrecursive_commlink(), open_exit(), page_check(), page_return(), phys_fail(), phys_succeed(), PhysicalAttack(), pickup_mw(), pos_part_name(), possibly_see_mech(), PrintInfoStatus(), PrintWeaponStatus(), process_enter_loc(), process_leave_loc(), record_login(), remove_inarc_pods_mech(), remove_mech_from_map(), replicateC3iNetwork(), replicateC3Network(), SaveSpecialObjects(), Sensor_ToHitBonus(), show_charstatus(), show_mechs_damage(), show_quota(), ShowTurretFacing(), store_attrs(), store_health(), stuff_change_sub(), tech_addtechtime(), tech_repairs(), TECHCOMMANDH(), trimC3Network(), turret_deinitialize(), turret_initialize(), update_specials(), update_wanted_heading(), validateC3iNetwork(), validateC3Network(), vehicle_int_check(), and whisper_pose().
char* translate_string | ( | const char * | str, | |
int | type | |||
) |
Convert raw character sequences into MUX substitutions (type = 1) or strips them (type = 0).
Definition at line 23 of file stringutil.c.
References c, ESC_CHAR, LBUF_SIZE, safe_chr, safe_str, and StringCopy.
Referenced by fun_translate().
00024 { 00025 char old[LBUF_SIZE]; 00026 static char new[LBUF_SIZE]; 00027 char *j, *c, *bp; 00028 int i; 00029 00030 bp = new; 00031 StringCopy(old, str); 00032 00033 for(j = old; *j != '\0'; j++) { 00034 switch (*j) { 00035 case ESC_CHAR: 00036 c = strchr(j, 'm'); 00037 if(c) { 00038 if(!type) { 00039 j = c; 00040 break; 00041 } 00042 00043 *c = '\0'; 00044 i = atoi(j + 2); 00045 switch (i) { 00046 case 0: 00047 safe_str("%cn", new, &bp); 00048 break; 00049 case 1: 00050 safe_str("%ch", new, &bp); 00051 break; 00052 case 5: 00053 safe_str("%cf", new, &bp); 00054 break; 00055 case 7: 00056 safe_str("%ci", new, &bp); 00057 break; 00058 case 30: 00059 safe_str("%cx", new, &bp); 00060 break; 00061 case 31: 00062 safe_str("%cr", new, &bp); 00063 break; 00064 case 32: 00065 safe_str("%cg", new, &bp); 00066 break; 00067 case 33: 00068 safe_str("%cy", new, &bp); 00069 break; 00070 case 34: 00071 safe_str("%cb", new, &bp); 00072 break; 00073 case 35: 00074 safe_str("%cm", new, &bp); 00075 break; 00076 case 36: 00077 safe_str("%cc", new, &bp); 00078 break; 00079 case 37: 00080 safe_str("%cw", new, &bp); 00081 break; 00082 case 40: 00083 safe_str("%cX", new, &bp); 00084 break; 00085 case 41: 00086 safe_str("%cR", new, &bp); 00087 break; 00088 case 42: 00089 safe_str("%cG", new, &bp); 00090 break; 00091 case 43: 00092 safe_str("%cY", new, &bp); 00093 break; 00094 case 44: 00095 safe_str("%cB", new, &bp); 00096 break; 00097 case 45: 00098 safe_str("%cM", new, &bp); 00099 break; 00100 case 46: 00101 safe_str("%cC", new, &bp); 00102 break; 00103 case 47: 00104 safe_str("%cW", new, &bp); 00105 break; 00106 } 00107 j = c; 00108 } else { 00109 safe_chr(*j, new, &bp); 00110 } 00111 break; 00112 case ' ': 00113 if((*(j + 1) == ' ') && type) 00114 safe_str("%b", new, &bp); 00115 else 00116 safe_chr(' ', new, &bp); 00117 break; 00118 case '\\': 00119 if(type) 00120 safe_str("\\", new, &bp); 00121 else 00122 safe_chr('\\', new, &bp); 00123 break; 00124 case '%': 00125 if(type) 00126 safe_str("%%", new, &bp); 00127 else 00128 safe_chr('%', new, &bp); 00129 break; 00130 case '[': 00131 if(type) 00132 safe_str("%[", new, &bp); 00133 else 00134 safe_chr('[', new, &bp); 00135 break; 00136 case ']': 00137 if(type) 00138 safe_str("%]", new, &bp); 00139 else 00140 safe_chr(']', new, &bp); 00141 break; 00142 case '{': 00143 if(type) 00144 safe_str("%{", new, &bp); 00145 else 00146 safe_chr('{', new, &bp); 00147 break; 00148 case '}': 00149 if(type) 00150 safe_str("%}", new, &bp); 00151 else 00152 safe_chr('}', new, &bp); 00153 break; 00154 case '(': 00155 if(type) 00156 safe_str("%(", new, &bp); 00157 else 00158 safe_chr('(', new, &bp); 00159 break; 00160 case ')': 00161 if(type) 00162 safe_str("%)", new, &bp); 00163 else 00164 safe_chr(')', new, &bp); 00165 break; 00166 case '\r': 00167 break; 00168 case '\n': 00169 if(type) 00170 safe_str("%r", new, &bp); 00171 else 00172 safe_chr(' ', new, &bp); 00173 break; 00174 default: 00175 safe_chr(*j, new, &bp); 00176 } 00177 } 00178 *bp = '\0'; 00179 return new; 00180 }
char* trim_spaces | ( | char * | string | ) |
Remove leading and trailing spaces.
Definition at line 256 of file stringutil.c.
References alloc_lbuf.
Referenced by create_player(), do_alias(), and do_name().
00257 { 00258 char *buffer, *p, *q; 00259 00260 buffer = alloc_lbuf("trim_spaces"); 00261 p = string; 00262 q = buffer; 00263 while (p && *p && isspace(*p)) /* 00264 * remove inital spaces 00265 */ 00266 p++; 00267 while (p && *p) { 00268 while (*p && !isspace(*p)) /* 00269 * copy nonspace chars 00270 */ 00271 *q++ = *p++; 00272 while (*p && isspace(*p)) /* 00273 * compress spaces 00274 */ 00275 p++; 00276 if(*p) 00277 *q++ = ' '; /* 00278 * leave one space 00279 */ 00280 } 00281 *q = '\0'; /* 00282 * terminate string 00283 */ 00284 return (buffer); 00285 }
void unbind_signals | ( | ) |
Definition at line 96 of file signal.c.
References sighandler_stack.
Referenced by dnschild_request(), and fork_and_dump().
00097 { 00098 signal(SIGTERM, SIG_DFL); 00099 signal(SIGPIPE, SIG_DFL); 00100 signal(SIGUSR1, SIG_DFL); 00101 signal(SIGSEGV, SIG_DFL); 00102 signal(SIGBUS, SIG_DFL); 00103 signal(SIGCHLD, SIG_DFL); 00104 if(sighandler_stack.ss_sp != NULL) { 00105 void *temp_ptr; 00106 sighandler_stack.ss_flags = SS_DISABLE; 00107 temp_ptr = sighandler_stack.ss_sp; 00108 sigaltstack(&sighandler_stack, NULL); 00109 free(temp_ptr); 00110 sighandler_stack.ss_sp = NULL; 00111 } 00112 }
const char* uncompress | ( | const char * | , | |
int | ||||
) |
char* uncompress_str | ( | char * | , | |
const char * | , | |||
int | ||||
) |
Definition at line 222 of file unparse.c.
References boolexp_buf, BOOLEXP_CONST, buftop, F_EXAMINE, and unparse_boolexp1().
Referenced by debug_examine(), do_examine(), fun_colorpairs(), fun_eval(), fun_get(), fun_get_eval(), fun_pairs(), fun_xget(), and view_atr().
00223 { 00224 buftop = boolexp_buf; 00225 unparse_boolexp1(player, b, BOOLEXP_CONST, F_EXAMINE); 00226 *buftop++ = '\0'; 00227 return boolexp_buf; 00228 }
Definition at line 230 of file unparse.c.
References boolexp_buf, BOOLEXP_CONST, buftop, F_DECOMPILE, and unparse_boolexp1().
Referenced by do_decomp().
00231 { 00232 buftop = boolexp_buf; 00233 unparse_boolexp1(player, b, BOOLEXP_CONST, F_DECOMPILE); 00234 *buftop++ = '\0'; 00235 return boolexp_buf; 00236 }
Definition at line 238 of file unparse.c.
References boolexp_buf, BOOLEXP_CONST, buftop, F_FUNCTION, and unparse_boolexp1().
Referenced by fun_lock().
00239 { 00240 buftop = boolexp_buf; 00241 unparse_boolexp1(player, b, BOOLEXP_CONST, F_FUNCTION); 00242 *buftop++ = '\0'; 00243 return boolexp_buf; 00244 }
Definition at line 214 of file unparse.c.
References boolexp_buf, BOOLEXP_CONST, buftop, F_QUIET, and unparse_boolexp1().
Referenced by db_read(), do_lock(), and fun_setlock().
00215 { 00216 buftop = boolexp_buf; 00217 unparse_boolexp1(player, b, BOOLEXP_CONST, F_QUIET); 00218 *buftop++ = '\0'; 00219 return boolexp_buf; 00220 }
void UpdateSpecialObjects | ( | void | ) |
Definition at line 821 of file glue.c.
Referenced by dispatch().
00822 { 00823 char *cmdsave; 00824 int i; 00825 int times = lastrun ? (mudstate.now - lastrun) : 1; 00826 00827 if(times > 20) 00828 times = 20; /* Machine's hopelessly lagged, 00829 we don't want to make it [much] worse */ 00830 cmdsave = mudstate.debug_cmd; 00831 for(i = 0; i < times; i++) { 00832 muxevent_run(); 00833 mudstate.debug_cmd = (char *) "< Generic hcode update handler>"; 00834 GoThruTree(xcode_tree, UpdateSpecialObject_func); 00835 } 00836 lastrun = mudstate.now; 00837 mudstate.debug_cmd = cmdsave; 00838 }
Definition at line 746 of file cque.c.
References bque::attr, CF_INTERP, confdata::control_flags, cque_enqueue(), mudconf, mudstate, statedata::now, bque::sem, setup_que(), and bque::waittime.
Referenced by announce_connect(), announce_disconnect(), atr_match1(), bind_and_queue(), did_it(), do_force(), do_postpend(), do_prepend(), do_switch(), do_wait(), handle_prog(), and process_cmdent().
00748 { 00749 BQUE *cmd; 00750 if(mudconf.control_flags & CF_INTERP) 00751 cmd = setup_que(player, cause, command, args, nargs, sargs); 00752 else 00753 cmd = NULL; 00754 00755 if(cmd == NULL) { 00756 return; 00757 } 00758 00759 if(wait > 0) { 00760 cmd->waittime = mudstate.now + wait; 00761 } else { 00762 cmd->waittime = 0; 00763 } 00764 00765 cmd->sem = sem; 00766 cmd->attr = attr; 00767 00768 cque_enqueue(player, cmd); 00769 }
Returns place where obj is linked into a list. ie. location for players/things, source for exits, NOTHING for rooms.
Definition at line 1316 of file predicates.c.
References Exits, Good_obj, loc, Location, NOTHING, TYPE_EXIT, TYPE_PLAYER, TYPE_THING, and Typeof.
Referenced by do_pemit(), do_say(), exec(), fun_con(), fun_home(), fun_lexits(), fun_next(), fun_where(), locatable(), nearby(), and notify_checked().
01317 { 01318 dbref loc; 01319 01320 if(!Good_obj(what)) 01321 return NOTHING; 01322 01323 switch (Typeof(what)) { 01324 case TYPE_PLAYER: 01325 case TYPE_THING: 01326 loc = Location(what); 01327 break; 01328 case TYPE_EXIT: 01329 loc = Exits(what); 01330 break; 01331 default: 01332 loc = NOTHING; 01333 break; 01334 } 01335 return loc; 01336 }
Return room containing player, or NOTHING if no room or recursion exceeded. If player is a room, returns itself.
Definition at line 1342 of file predicates.c.
References Good_obj, Has_location, isRoom, Location, mudconf, NOTHING, and confdata::ntfy_nest_lim.
Referenced by do_teleport(), dump_users(), and locatable().
01343 { 01344 int count; 01345 01346 for(count = mudconf.ntfy_nest_lim; count > 0; count--) { 01347 if(!Good_obj(what)) 01348 break; 01349 if(isRoom(what)) 01350 return what; 01351 if(!Has_location(what)) 01352 break; 01353 what = Location(what); 01354 } 01355 return NOTHING; 01356 }
int wild | ( | char * | tstr, | |
char * | dstr, | |||
char * | args[], | |||
int | nargs | |||
) |
wild: do a wildcard match, remembering the wild data.
This routine will cause crashes if fed NULLs instead of strings.
This function may crash if alloc_lbuf() fails.
Side Effect: this routine modifies the 'arglist' and 'numargs' static global variables.
Definition at line 337 of file wild.c.
References alloc_lbuf, arglist, free_lbuf, LBUF_SIZE, NOTEQUAL, numargs, quick_wild(), and wild1().
Referenced by atr_match1(), notify_checked(), and process_cmdent().
00338 { 00339 int i, value; 00340 char *scan; 00341 00342 /* 00343 * Initialize the return array. 00344 */ 00345 00346 for(i = 0; i < nargs; i++) 00347 args[i] = NULL; 00348 00349 /* 00350 * Do fast match. 00351 */ 00352 00353 while ((*tstr != '*') && (*tstr != '?')) { 00354 if(*tstr == '\\') 00355 tstr++; 00356 if(NOTEQUAL(*dstr, *tstr)) 00357 return 0; 00358 if(!*dstr) 00359 return 1; 00360 tstr++; 00361 dstr++; 00362 } 00363 00364 /* 00365 * Allocate space for the return args. 00366 */ 00367 00368 i = 0; 00369 scan = tstr; 00370 while (*scan && (i < nargs)) { 00371 switch (*scan) { 00372 case '?': 00373 args[i] = alloc_lbuf("wild.?"); 00374 memset(args[i], 0, LBUF_SIZE); 00375 i++; 00376 break; 00377 case '*': 00378 args[i] = alloc_lbuf("wild.*"); 00379 memset(args[i], 0, LBUF_SIZE); 00380 i++; 00381 } 00382 scan++; 00383 } 00384 00385 /* 00386 * Put stuff in globals for quick recursion. 00387 */ 00388 00389 arglist = args; 00390 numargs = nargs; 00391 00392 /* 00393 * Do the match. 00394 */ 00395 00396 value = nargs ? wild1(tstr, dstr, 0) : quick_wild(tstr, dstr); 00397 00398 /* 00399 * Clean out any fake match data left by wild1. 00400 */ 00401 00402 for(i = 0; i < nargs; i++) 00403 if((args[i] != NULL) && (!*args[i] || !value)) { 00404 free_lbuf(args[i]); 00405 args[i] = NULL; 00406 } 00407 return value; 00408 }
int wild_match | ( | char * | tstr, | |
char * | dstr | |||
) |
wild_match: do either an order comparison or a wildcard match, remembering the wild data, if wildcard match is done.
This routine will cause crashes if fed NULLs instead of strings.
Definition at line 416 of file wild.c.
References quick_wild().
Referenced by check_attr(), and do_switch().
00417 { 00418 switch (*tstr) { 00419 case '>': 00420 tstr++; 00421 if(isdigit(*tstr) || (*tstr == '-')) 00422 return (atoi(tstr) < atoi(dstr)); 00423 else 00424 return (strcmp(tstr, dstr) < 0); 00425 case '<': 00426 tstr++; 00427 if(isdigit(*tstr) || (*tstr == '-')) 00428 return (atoi(tstr) > atoi(dstr)); 00429 else 00430 return (strcmp(tstr, dstr) > 0); 00431 } 00432 00433 return quick_wild(tstr, dstr); 00434 }
int xlate | ( | char * | ) |
Definition at line 2030 of file functions.c.
Referenced by fun_ifelse(), fun_not(), fun_t(), and search_perform().
02031 { 02032 int temp; 02033 char *temp2; 02034 02035 if(arg[0] == '#') { 02036 arg++; 02037 /* #- anything is false */ 02038 if(arg[1] == '-') { 02039 return 0; 02040 } 02041 if(is_integer(arg)) { 02042 temp = atoi(arg); 02043 if(temp == -1) 02044 temp = 0; 02045 return temp; 02046 } 02047 return 0; 02048 } 02049 temp2 = trim_space_sep(arg, ' '); 02050 if(!*temp2) 02051 return 0; 02052 if(is_integer(temp2)) 02053 return atoi(temp2); 02054 return 1; 02055 }