src/db.h File Reference

#include "copyright.h"
#include "config.h"
#include "mudconf.h"
#include <sys/file.h>

Include dependency graph for db.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  attr
struct  atrlist
struct  stack
struct  boolexp
struct  object

Defines

#define ITER_PARENTS(t, p, l)
#define Hasprivs(x)   (Royalty(x) || Wizard(x))
#define anum_get(x)   (anum_table[(x)])
#define anum_set(x, v)   anum_table[(x)] = v
#define ATR_INFO_CHAR   '\1'
#define BOOLEXP_AND   0
#define BOOLEXP_OR   1
#define BOOLEXP_NOT   2
#define BOOLEXP_CONST   3
#define BOOLEXP_ATR   4
#define BOOLEXP_INDIR   5
#define BOOLEXP_CARRY   6
#define BOOLEXP_IS   7
#define BOOLEXP_OWNER   8
#define BOOLEXP_EVAL   9
#define TRUE_BOOLEXP   ((BOOLEXP *) 0)
#define F_UNKNOWN   0
#define F_MUSH   1
#define F_MUSE   2
#define F_MUD   3
#define F_MUCK   4
#define F_MUX   5
#define V_MASK   0x000000ff
#define V_ZONE   0x00000100
#define V_LINK   0x00000200
#define V_GDBM   0x00000400
#define V_ATRNAME   0x00000800
#define V_ATRKEY   0x00001000
#define V_PERNKEY   0x00001000
#define V_PARENT   0x00002000
#define V_COMM   0x00004000
#define V_ATRMONEY   0x00008000
#define V_XFLAGS   0x00010000
#define V_POWERS   0x00020000
#define V_3FLAGS   0x00040000
#define V_QUOTED   0x00080000
#define DB_CHANNELS   0x2
#define DB_SLOCK   0x4
#define DB_MC   0x8
#define DB_MPAR   0x10
#define DB_CLASS   0x20
#define DB_RANK   0x40
#define DB_DROPLOCK   0x80
#define DB_GIVELOCK   0x100
#define DB_GETLOCK   0x200
#define DB_THREEPOW   0x400
#define NOTHING   (-1)
#define AMBIGUOUS   (-2)
#define HOME   (-3)
#define NOPERM   (-4)
#define NOSLAVE   (-5)
#define Location(t)   db[t].location
#define Zone(t)   db[t].zone
#define Contents(t)   db[t].contents
#define Exits(t)   db[t].exits
#define Next(t)   db[t].next
#define Link(t)   db[t].link
#define Owner(t)   db[t].owner
#define Parent(t)   db[t].parent
#define Flags(t)   db[t].flags
#define Flags2(t)   db[t].flags2
#define Flags3(t)   db[t].flags3
#define Powers(t)   db[t].powers
#define Powers2(t)   db[t].powers2
#define Stack(t)   db[t].stackhead
#define Home(t)   Link(t)
#define Dropto(t)   Location(t)
#define i_Name(t)   if (mudconf.cache_names) purenames[t] = NULL;
#define s_Location(t, n)   db[t].location = (n)
#define s_Zone(t, n)   db[t].zone = (n)
#define s_Contents(t, n)   db[t].contents = (n)
#define s_Exits(t, n)   db[t].exits = (n)
#define s_Next(t, n)   db[t].next = (n)
#define s_Link(t, n)   db[t].link = (n)
#define s_Owner(t, n)   db[t].owner = (n)
#define s_Parent(t, n)   db[t].parent = (n)
#define s_Flags(t, n)   db[t].flags = (n)
#define s_Flags2(t, n)   db[t].flags2 = (n)
#define s_Flags3(t, n)   db[t].flags3 = (n)
#define s_Powers(t, n)   db[t].powers = (n)
#define s_Powers2(t, n)   db[t].powers2 = (n)
#define s_Stack(t, n)   db[t].stackhead = (n)
#define s_Home(t, n)   s_Link(t,n)
#define s_Dropto(t, n)   s_Location(t,n)
#define DOLIST(thing, list)
#define SAFE_DOLIST(thing, next, list)
#define DO_WHOLE_DB(thing)   for ((thing)=0; (thing)<mudstate.db_top; (thing)++)
#define DO_WHOLE_DB_REV(thing)   for ((thing)=mudstate.db_top-1; (thing)>0; (thing)--)
#define HAG_WAS_HERE
#define Dropper(thing)   (Connected(Owner(thing)) && Hearer(thing))
#define DUMP_NORMAL   0
#define DUMP_CRASHED   1
#define DUMP_RESTART   2
#define DUMP_KILLED   4

Typedefs

typedef attr ATTR
typedef atrlist ATRLIST
typedef stack STACK
typedef boolexp BOOLEXP
typedef object OBJ
typedef char * NAME

Functions

int get_atr ()
ATTRatr_num (int anum)
ATTRatr_str (char *s)
void anum_extend (int)
int Pennies (dbref)
void s_Pennies (dbref, int)
dbref getref (FILE *)
void putref (FILE *, dbref)
BOOLEXPdup_bool (BOOLEXP *)
void free_boolexp (BOOLEXP *)
dbref parse_dbref (const char *)
int mkattr (char *)
void al_add (dbref, int)
void al_delete (dbref, int)
void al_destroy (dbref)
void al_store (void)
void db_grow (dbref)
void db_free (void)
void db_make_minimal (void)
dbref db_read (FILE *, int *, int *, int *)
dbref db_write (FILE *, int, int)
void destroy_thing (dbref)
void destroy_exit (dbref)
void load_restart_db (void)
void dump_database_internal (int)

Variables

ATTR attr []
ATTR ** anum_table
OBJdb
NAMEnames


Define Documentation

#define AMBIGUOUS   (-2)

Definition at line 117 of file db.h.

Referenced by add_player_name(), do_chown(), do_clone(), do_cut(), do_drop(), do_give(), do_kill(), do_lock(), do_mail_stats(), do_move(), do_pemit(), do_pemit_list(), do_teleport(), do_unlink(), fun_setlock(), give_thing(), match_result(), match_status(), parse_boolexp_L(), and promote_dflt().

#define anum_get ( x   )     (anum_table[(x)])

Definition at line 51 of file db.h.

Referenced by atr_num().

#define anum_set ( x,
 )     anum_table[(x)] = v

Definition at line 52 of file db.h.

Referenced by do_dbclean(), init_attrtab(), vattr_define(), and vattr_delete().

#define ATR_INFO_CHAR   '\1'

Definition at line 55 of file db.h.

Referenced by atr_decode(), and atr_encode().

#define BOOLEXP_AND   0

Definition at line 58 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_T(), putbool_subexp(), and unparse_boolexp1().

#define BOOLEXP_ATR   4

Definition at line 62 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), putbool_subexp(), test_atr(), and unparse_boolexp1().

#define BOOLEXP_CARRY   6

Definition at line 64 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), putbool_subexp(), and unparse_boolexp1().

#define BOOLEXP_CONST   3

Definition at line 61 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), parse_boolexp_L(), putbool_subexp(), unparse_boolexp(), unparse_boolexp1(), unparse_boolexp_decompile(), unparse_boolexp_function(), and unparse_boolexp_quiet().

#define BOOLEXP_EVAL   9

Definition at line 67 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), putbool_subexp(), test_atr(), and unparse_boolexp1().

#define BOOLEXP_INDIR   5

Definition at line 63 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), putbool_subexp(), and unparse_boolexp1().

#define BOOLEXP_IS   7

Definition at line 65 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), putbool_subexp(), and unparse_boolexp1().

#define BOOLEXP_NOT   2

Definition at line 60 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), putbool_subexp(), and unparse_boolexp1().

#define BOOLEXP_OR   1

Definition at line 59 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_E(), putbool_subexp(), and unparse_boolexp1().

#define BOOLEXP_OWNER   8

Definition at line 66 of file db.h.

Referenced by dup_bool(), eval_boolexp(), free_boolexp(), getboolexp1(), parse_boolexp_F(), putbool_subexp(), and unparse_boolexp1().

#define Contents (  )     db[t].contents

Definition at line 164 of file db.h.

Referenced by announce_connect(), announce_disconnect(), check_dead_refs(), check_loc_contents(), check_misplaced_obj(), db_write_object(), debug_examine(), debug_fixmap(), DestroyMech(), divest_object(), do_examine(), do_inventory(), do_sweep(), empty_obj(), eval_boolexp(), explode_unit(), fun_con(), fun_lcon(), HandledCommand(), look_contents(), match_neighbor(), match_possession(), mecha_notify_except(), mmdb_write_object(), move_object(), notify_checked(), notify_except(), notify_except2(), pickup_mw(), process_command(), process_sticky_dropto(), recursive_check_contents(), tele_contents(), xml_db_write_mux(), and xml_db_write_object().

#define DB_CHANNELS   0x2

Definition at line 104 of file db.h.

#define DB_CLASS   0x20

Definition at line 108 of file db.h.

#define DB_DROPLOCK   0x80

Definition at line 110 of file db.h.

#define DB_GETLOCK   0x200

Definition at line 112 of file db.h.

#define DB_GIVELOCK   0x100

Definition at line 111 of file db.h.

#define DB_MC   0x8

Definition at line 106 of file db.h.

#define DB_MPAR   0x10

Definition at line 107 of file db.h.

#define DB_RANK   0x40

Definition at line 109 of file db.h.

#define DB_SLOCK   0x4

Definition at line 105 of file db.h.

#define DB_THREEPOW   0x400

Definition at line 113 of file db.h.

#define DO_WHOLE_DB ( thing   )     for ((thing)=0; (thing)<mudstate.db_top; (thing)++)

Definition at line 231 of file db.h.

Referenced by check_contents_chains(), check_dead_refs(), check_events(), check_exit_chains(), check_floating(), chown_all(), count_quota(), db_write(), debug_xptop(), do_dbclean(), do_poor(), do_quota(), dump_mail(), fun_playmem(), get_stats(), load_player_names(), mmdb_db_write(), process_preload(), purge_going(), and xml_db_write().

#define DO_WHOLE_DB_REV ( thing   )     for ((thing)=mudstate.db_top-1; (thing)>0; (thing)--)

Definition at line 234 of file db.h.

Referenced by make_freelist().

#define DOLIST ( thing,
list   ) 

Value:

for ((thing)=(list); \
             ((thing)!=NOTHING) && (Next(thing)!=(thing)); \
             (thing)=Next(thing))

Definition at line 223 of file db.h.

Referenced by announce_connect(), announce_disconnect(), debug_fixmap(), do_examine(), do_inventory(), eval_boolexp(), fun_exit(), fun_lcon(), fun_lexits(), fun_next(), look_contents(), look_exits(), match_exit_internal(), match_list(), mecha_notify_except(), member(), notify_checked(), notify_except(), notify_except2(), process_command(), process_sticky_dropto(), recursive_check_contents(), and remove_first().

#define Dropper ( thing   )     (Connected(Owner(thing)) && Hearer(thing))

Definition at line 238 of file db.h.

Referenced by process_sticky_dropto().

#define Dropto (  )     Location(t)

Definition at line 177 of file db.h.

Referenced by check_dead_refs(), do_clone(), do_entrances(), do_examine(), fun_home(), process_dropped_dropto(), process_sticky_dropto(), and send_dropto().

#define DUMP_CRASHED   1

Definition at line 241 of file db.h.

Referenced by do_shutdown(), dump_database_internal(), SaveSpecialObjects(), signal_BUS(), and signal_SEGV().

#define DUMP_KILLED   4

Definition at line 243 of file db.h.

Referenced by dump_database_internal(), and SaveSpecialObjects().

#define DUMP_NORMAL   0

Definition at line 240 of file db.h.

Referenced by debug_savedb(), dump_database(), dump_database_internal(), fork_and_dump(), and SaveSpecialObjects().

#define DUMP_RESTART   2

Definition at line 242 of file db.h.

Referenced by do_restart(), dump_database_internal(), and SaveSpecialObjects().

#define Exits (  )     db[t].exits

Definition at line 165 of file db.h.

Referenced by can_destroy_exit(), check_dead_refs(), check_loc_exits(), db_write_object(), debug_examine(), destroy_exit(), do_clone(), do_drop(), do_entrances(), do_examine(), do_get(), do_inventory(), do_search(), do_sweep(), do_teleport(), empty_obj(), fun_create(), fun_exit(), fun_lexits(), look_exits(), mark_place(), match_exit_internal(), mmdb_write_object(), notify_checked(), open_exit(), where_is(), xml_db_write_mux(), and xml_db_write_object().

#define F_MUCK   4

Definition at line 85 of file db.h.

#define F_MUD   3

Definition at line 84 of file db.h.

#define F_MUSE   2

Definition at line 83 of file db.h.

Referenced by getboolexp().

#define F_MUSH   1

Definition at line 82 of file db.h.

Referenced by getboolexp().

#define F_MUX   5

Definition at line 86 of file db.h.

Referenced by db_read(), db_write(), dump_database_internal(), and getboolexp().

#define F_UNKNOWN   0

Definition at line 81 of file db.h.

Referenced by db_read().

#define Flags (  )     db[t].flags

Definition at line 170 of file db.h.

Referenced by accept_client_input(), announce_disconnect(), atr_add_raw(), atr_clr(), check_connect(), check_idle(), chown_all(), create_guest(), db_make_minimal(), db_write_object(), decompile_flags(), do_chown(), do_chzone(), do_clone(), fh_any(), flag_description(), handle_flaglists(), has_flag(), link_exit(), mmdb_write_object(), process_preload(), raw_broadcast(), search_perform(), shutdownsock(), unparse_object(), xml_db_write_mux(), and xml_db_write_object().

#define Flags2 (  )     db[t].flags2

Definition at line 171 of file db.h.

Referenced by announce_connect(), atr_add_raw(), atr_clr(), check_events(), db_write_object(), decompile_flags(), do_edit_msg(), do_expmail_abort(), do_expmail_start(), do_expmail_stop(), do_mail_cc(), do_mail_proof(), do_mail_quick(), do_postpend(), do_prepend(), fh_any(), flag_description(), handle_flaglists(), has_flag(), load_restart_db(), load_restart_db_xdr(), mmdb_write_object(), search_perform(), shutdownsock(), unparse_object(), xml_db_write_mux(), and xml_db_write_object().

#define Flags3 (  )     db[t].flags3

Definition at line 172 of file db.h.

Referenced by db_write_object(), decompile_flags(), fh_any(), flag_description(), has_flag(), mmdb_write_object(), search_perform(), shutdownsock(), xml_db_write_mux(), and xml_db_write_object().

#define HAG_WAS_HERE

Definition at line 237 of file db.h.

#define Hasprivs ( x   )     (Royalty(x) || Wizard(x))

Definition at line 20 of file db.h.

Referenced by do_mail_list(), do_mail_read(), and do_mail_review().

#define Home (  )     Link(t)

Definition at line 176 of file db.h.

Referenced by check_dead_refs(), clone_home(), do_entrances(), do_examine(), empty_obj(), fun_home(), move_exit(), move_object(), move_via_exit(), move_via_generic(), move_via_teleport(), new_home(), and process_leave_loc().

#define HOME   (-3)

Definition at line 118 of file db.h.

Referenced by check_contents_chains(), check_dead_refs(), check_loc_exits(), divest_object(), do_examine(), do_kill(), do_link(), do_move(), do_teleport(), empty_obj(), link_exit(), match_home(), move_exit(), move_object(), move_via_exit(), move_via_generic(), move_via_teleport(), parse_linkable_room(), process_dropped_dropto(), process_leave_loc(), send_dropto(), unparse_object(), unparse_object_numonly(), and unparse_object_quiet().

#define i_Name (  )     if (mudconf.cache_names) purenames[t] = NULL;

Definition at line 179 of file db.h.

#define ITER_PARENTS ( t,
p,
 ) 

Value:

for ((l)=0, (p)=(t); \
                                     (Good_obj(p) && \
                                      ((l) < mudconf.parent_nest_lim)); \
                                     (p)=Parent(p), (l)++)

Definition at line 15 of file db.h.

Referenced by atr_match(), atr_pget_info(), atr_pget_str(), check_events(), do_parent(), fun_lexits(), look_atrs(), look_exits(), match_carried_exit_with_parents(), match_exit_with_parents(), parse_attrib_wild(), process_preload(), and sweep_check().

#define Link (  )     db[t].link

Definition at line 167 of file db.h.

Referenced by check_dead_refs(), create_obj(), db_write_object(), debug_examine(), mmdb_write_object(), xml_db_write_mux(), and xml_db_write_object().

#define Location (  )     db[t].location

Definition at line 160 of file db.h.

Referenced by announce_connect(), announce_disconnect(), auto_astar_follow_event(), auto_astar_goto_event(), auto_astar_roam_event(), auto_cal_mapindex(), auto_dumbfollow_event(), auto_dumbgoto_event(), auto_engage(), auto_enter_event(), auto_leave_event(), auto_listcommands(), auto_reply(), autoeject(), can_destroy_exit(), check_contents_chains(), check_dead_refs(), check_loc_contents(), check_loc_exits(), check_misplaced_obj(), db_write_object(), debug_examine(), did_it(), do_chown(), do_clone(), do_destroy(), do_dig(), do_drop(), do_enter_internal(), do_entrances(), do_examine(), do_get(), do_kill(), do_leave(), do_look(), do_move(), do_open(), do_pcreate(), do_pemit(), do_say(), do_search(), do_sweep(), do_teleport(), do_toad(), dump_users(), empty_obj(), fun_lcon(), fun_loc(), fun_rloc(), fun_room(), In_IC_Loc(), Leave_DS_Bay(), Leave_Hangar(), link_exit(), list_xcodestuff(), load_update4(), log_name_and_loc(), look_exits(), look_in(), map_updatelinks(), mark_place(), match_exit(), match_exit_with_parents(), match_here(), match_neighbor(), mech_disembark(), mech_eject(), mech_loadcargo(), mech_manifest(), mech_ood_event(), mech_Raddstuff(), mech_Rfixstuff(), mech_Rremovestuff(), mech_Rresetstuff(), mech_stores(), mech_udisembark(), MechPilotSkillRoll_BTH(), mmdb_write_object(), move_exit(), move_object(), move_via_exit(), move_via_generic(), move_via_teleport(), new_home(), notify_checked(), process_command(), process_dropped_dropto(), process_enter_loc(), process_leave_loc(), send_dropto(), sendchannelstuff(), set_xcodestuff(), shutdownsock(), sp_ok(), stuff_change_sub(), turret_initialize(), where_is(), where_room(), xml_db_write_mux(), and xml_db_write_object().

#define Next (  )     db[t].next

Definition at line 166 of file db.h.

Referenced by check_dead_refs(), check_loc_contents(), check_loc_exits(), db_write_object(), debug_examine(), do_sweep(), fun_next(), list_check(), mark_place(), mmdb_write_object(), next_exit(), remove_first(), reverse_list(), and xml_db_write_object().

#define NOPERM   (-4)

Definition at line 119 of file db.h.

Referenced by do_destroy(), match_possessed(), match_status(), and promote_dflt().

#define NOSLAVE   (-5)

Definition at line 120 of file db.h.

Referenced by mech_notify(), mech_printf(), and notify_except().

#define NOTHING   (-1)

Definition at line 116 of file db.h.

Referenced by absolute_name(), announce_connect(), announce_disconnect(), atr_decode(), atr_encode(), atr_match1(), bind_and_queue(), cf_init(), check_connect(), check_contents_chains(), check_dead_refs(), check_exit_chains(), check_loc_contents(), check_loc_exits(), check_misplaced_obj(), check_pennies(), check_zone(), check_zone_for_player(), connect_player(), cque_enqueue(), create_guest(), create_obj(), create_player(), damage_cf(), db_free(), db_grow(), db_make_minimal(), db_read(), dbrefs_to_names(), default_home(), delete_player_name(), destroy_exit(), destroy_obj(), destroy_player(), destroy_thing(), did_it(), dispatch(), divest_object(), do_addcommand(), do_alias(), do_boot(), do_chanlist(), do_chanobj(), do_chanstatus(), do_charclear(), do_charstatus(), do_chboot(), do_chopen(), do_chown(), do_chown_macro(), do_chownall(), do_chzone(), do_clone(), do_create(), do_createchannel(), do_cut(), do_dbck(), do_decomp(), do_delcommand(), do_destroy(), do_dig(), do_drop(), do_edit(), do_editchannel(), do_enter(), do_examine(), do_fixdb(), do_force(), do_give(), do_halt(), do_inventory(), do_kill(), do_last(), do_leave(), do_link(), do_listchannels(), do_lock(), do_look(), 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_move(), do_mvattr(), do_name(), do_newpassword(), do_open(), do_page(), do_parent(), do_pcreate(), do_pemit(), do_pemit_list(), do_postpend(), do_power(), do_prepend(), do_prog(), do_ps(), do_say(), do_search(), do_second(), do_set(), do_setattr(), do_shutdown(), do_stats(), do_sweep(), do_switch(), do_teleport(), do_test_access(), do_toad(), do_trigger(), do_ufun(), do_unlink(), do_unlock(), do_use(), do_wait(), do_wipe(), empty_obj(), exam_wildattrs(), failconn(), fcache_init(), fcache_load(), find_connected_name(), fun_btarmorstatus(), fun_btcharlist(), fun_btcritslot(), fun_btcritstatus(), fun_btdamagemech(), fun_btdamages(), fun_btengrate(), fun_btgetbv(), fun_btgetcharvalue(), fun_btgetrange(), fun_btgetrealmaxspeed(), fun_btgetxcodevalue(), fun_bthexlos(), fun_btid2db(), fun_btlosm2m(), fun_btmakepilotroll(), fun_btmapelev(), fun_btmapterr(), fun_btnumrepjobs(), fun_btremovestores(), fun_btsetarmorstatus(), fun_btsetcharvalue(), fun_btsetmaxspeed(), fun_btsetxcodevalue(), fun_btsetxy(), fun_btshowcritstatus_ref(), fun_btshowstatus_ref(), fun_btshowwspecs_ref(), fun_bttechlist(), fun_bttechstatus(), fun_btticweaps(), fun_btunderrepair(), fun_btweaponstatus(), fun_colorpairs(), fun_con(), fun_conn(), fun_controls(), fun_create(), fun_default(), fun_doing(), fun_edefault(), fun_eval(), fun_filter(), fun_findable(), fun_flags(), fun_fold(), fun_foreach(), fun_fullname(), fun_get(), fun_get_eval(), fun_grep(), fun_grepi(), fun_hasattr(), fun_hasattrp(), fun_hastype(), fun_idle(), fun_lattr(), fun_lcon(), fun_mail(), fun_mailfrom(), fun_map(), fun_mix(), fun_money(), fun_munge(), fun_name(), fun_objeval(), fun_objmem(), fun_owner(), fun_pairs(), fun_playmem(), fun_pmatch(), fun_search(), fun_set(), fun_setlock(), fun_sortby(), fun_stats(), fun_udefault(), fun_visible(), fun_xget(), fun_zfun(), fun_zone(), get_stats(), give_thing(), grep_util(), halt_que(), handle_flaglists(), handle_prog(), helpindex_init(), helpindex_load(), init_match(), initialize_objects(), link_exit(), list_check(), locatable(), Log_header_err(), Log_pointer_err(), Log_simple_err(), lookup_player(), mail_to_list(), main(), make_freelist(), make_guest(), make_numlist(), map_updatelinks(), mark_place(), match_affected(), match_controlled(), match_controlled_quiet(), match_examinable(), match_player(), match_possessed(), match_result(), match_status(), mech_createbays(), move_exit(), move_object(), move_via_teleport(), next_exit(), nfy_que(), olist_first(), olist_next(), open_exit(), parse_attrib(), parse_boolexp_L(), parse_dbref(), parse_linkable_room(), parse_msglist(), parse_thing_slash(), process_cmdent(), process_command(), process_dropped_dropto(), process_enter_loc(), process_leave_loc(), process_sticky_dropto(), promote_dflt(), purge_going(), que_want(), reverse_list(), search_perform(), search_setup(), send_mail(), setup_que(), signal_TERM(), start_home(), turret_deinitialize(), turret_initialize(), unparse_object(), unparse_object_numonly(), unparse_object_quiet(), view_atr(), where_is(), and where_room().

#define Owner (  )     db[t].owner

Definition at line 168 of file db.h.

Referenced by atr_chown(), atr_cpy(), atr_decode(), atr_encode(), atr_get_info(), atr_get_str(), atr_pget_info(), atr_pget_str(), canpayfees(), check_dead_refs(), check_events(), check_floating(), check_loc_contents(), check_loc_exits(), chown_all(), clone_home(), count_quota(), create_obj(), db_write_object(), debug_examine(), destroy_obj(), destroy_thing(), do_alias(), do_chown(), do_clone(), do_comwho(), do_destroy(), do_edit(), do_examine(), do_halt(), do_kill(), do_last(), do_lock(), do_move(), do_mvattr(), do_page(), do_prog(), do_ps(), do_quitprog(), do_quota(), do_restart(), do_search(), do_shutdown(), do_stats(), do_teleport(), do_top(), do_unlock(), DoSpecialObjectHelp(), eval_boolexp(), exam_wildattrs(), fun_objeval(), fun_owner(), fun_playmem(), fun_setlock(), get_stats(), giveto(), halt_que(), HandledCommand_sub(), link_exit(), load_commac(), load_comsystem(), log_name(), match_status(), mmdb_db_read(), mmdb_write_object(), new_home(), nfy_que(), notify_checked(), pay_quota(), payfor(), process_command(), process_preload(), purge_commac(), que_want(), search_perform(), search_setup(), set_attr_internal(), setup_que(), show_que(), sweep_check(), tcache_finish(), view_atr(), xml_db_write_mux(), and xml_db_write_object().

#define Parent (  )     db[t].parent

Definition at line 169 of file db.h.

Referenced by atr_match(), atr_pget_info(), atr_pget_str(), check_dead_refs(), create_guest(), db_write_object(), do_clone(), do_entrances(), do_examine(), fun_children(), fun_lparent(), fun_parent(), look_atrs(), mmdb_write_object(), parse_attrib_wild(), search_perform(), xml_db_write_mux(), and xml_db_write_object().

#define Powers (  )     db[t].powers

Definition at line 173 of file db.h.

Referenced by db_write_object(), decompile_powers(), do_chzone(), has_power(), mmdb_write_object(), ph_any(), power_description(), search_perform(), xml_db_write_mux(), and xml_db_write_object().

#define Powers2 (  )     db[t].powers2

Definition at line 174 of file db.h.

Referenced by db_write_object(), decompile_powers(), has_power(), mmdb_write_object(), ph_any(), power_description(), search_perform(), xml_db_write_mux(), and xml_db_write_object().

#define s_Contents ( t,
 )     db[t].contents = (n)

Definition at line 185 of file db.h.

Referenced by check_dead_refs(), check_loc_contents(), check_misplaced_obj(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_fixdb(), initialize_objects(), mmdb_db_read(), move_object(), and process_sticky_dropto().

#define s_Dropto ( t,
 )     s_Location(t,n)

Definition at line 198 of file db.h.

Referenced by check_dead_refs(), do_clone(), do_link(), and do_unlink().

#define s_Exits ( t,
 )     db[t].exits = (n)

Definition at line 186 of file db.h.

Referenced by check_loc_exits(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_exit(), destroy_obj(), do_clone(), do_drop(), do_fixdb(), do_get(), do_teleport(), fun_create(), initialize_objects(), mmdb_db_read(), and open_exit().

#define s_Flags ( t,
 )     db[t].flags = (n)

Definition at line 191 of file db.h.

Referenced by accept_client_input(), announce_disconnect(), atr_add_raw(), atr_clr(), check_connect(), check_idle(), chown_all(), create_guest(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_chown(), do_clone(), do_toad(), fh_any(), initialize_objects(), link_exit(), and mmdb_db_read().

#define s_Flags2 ( t,
 )     db[t].flags2 = (n)

Definition at line 192 of file db.h.

Referenced by announce_connect(), atr_add_raw(), atr_clr(), create_obj(), db_read(), destroy_obj(), do_toad(), fh_any(), initialize_objects(), load_restart_db(), load_restart_db_xdr(), and mmdb_db_read().

#define s_Flags3 ( t,
 )     db[t].flags3 = (n)

Definition at line 193 of file db.h.

Referenced by create_obj(), db_read(), destroy_obj(), do_toad(), fh_any(), initialize_objects(), and mmdb_db_read().

#define s_Home ( t,
 )     s_Link(t,n)

Definition at line 197 of file db.h.

Referenced by check_dead_refs(), create_player(), do_clone(), do_create(), do_link(), empty_obj(), and fun_create().

#define s_Link ( t,
 )     db[t].link = (n)

Definition at line 188 of file db.h.

Referenced by check_dead_refs(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), initialize_objects(), make_freelist(), and mmdb_db_read().

#define s_Location ( t,
 )     db[t].location = (n)

Definition at line 181 of file db.h.

Referenced by check_loc_exits(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_clone(), do_fixdb(), do_unlink(), initialize_objects(), link_exit(), mmdb_db_read(), move_object(), and open_exit().

#define s_Next ( t,
 )     db[t].next = (n)

Definition at line 187 of file db.h.

Referenced by check_dead_refs(), check_loc_contents(), check_loc_exits(), check_misplaced_obj(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_cut(), do_fixdb(), fun_create(), initialize_objects(), insert_first(), mmdb_db_read(), move_object(), open_exit(), remove_first(), and reverse_list().

#define s_Owner ( t,
 )     db[t].owner = (n)

Definition at line 189 of file db.h.

Referenced by check_dead_refs(), chown_all(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_chown(), do_fixdb(), do_toad(), initialize_objects(), link_exit(), and mmdb_db_read().

#define s_Parent ( t,
 )     db[t].parent = (n)

Definition at line 190 of file db.h.

Referenced by check_dead_refs(), create_guest(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_clone(), do_parent(), initialize_objects(), and mmdb_db_read().

#define s_Powers ( t,
 )     db[t].powers = (n)

Definition at line 194 of file db.h.

Referenced by db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_chown(), initialize_objects(), mmdb_db_read(), and ph_any().

#define s_Powers2 ( t,
 )     db[t].powers2 = (n)

Definition at line 195 of file db.h.

Referenced by db_grow(), db_make_minimal(), db_read(), destroy_obj(), do_chown(), initialize_objects(), mmdb_db_read(), and ph_any().

#define s_Stack ( t,
 )     db[t].stackhead = (n)

Definition at line 196 of file db.h.

Referenced by db_grow(), destroy_obj(), fun_empty(), fun_pop(), fun_push(), and initialize_objects().

#define s_Zone ( t,
 )     db[t].zone = (n)

Definition at line 183 of file db.h.

Referenced by check_dead_refs(), create_guest(), create_obj(), db_grow(), db_make_minimal(), db_read(), destroy_obj(), initialize_objects(), and mmdb_db_read().

#define SAFE_DOLIST ( thing,
next,
list   ) 

Value:

for ((thing)=(list),(next)=((thing)==NOTHING ? NOTHING: Next(thing)); \
             (thing)!=NOTHING && (Next(thing)!=(thing)); \
             (thing)=(next), (next)=Next(next))

Definition at line 227 of file db.h.

Referenced by DestroyMech(), divest_object(), empty_obj(), explode_unit(), HandledCommand(), process_sticky_dropto(), and tele_contents().

#define Stack (  )     db[t].stackhead

Definition at line 175 of file db.h.

Referenced by destroy_obj(), fun_empty(), fun_lstack(), fun_peek(), fun_pop(), fun_push(), and stacksize().

#define TRUE_BOOLEXP   ((BOOLEXP *) 0)

Definition at line 77 of file db.h.

Referenced by do_lock(), dup_bool(), eval_boolexp(), free_boolexp(), fun_setlock(), getboolexp1(), parse_boolexp(), parse_boolexp_E(), parse_boolexp_F(), parse_boolexp_L(), parse_boolexp_T(), putboolexp(), and unparse_boolexp1().

#define V_3FLAGS   0x00040000

Definition at line 100 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_ATRKEY   0x00001000

Definition at line 93 of file db.h.

Referenced by db_read(), db_write_object(), xml_db_write_mux(), and xml_db_write_object().

#define V_ATRMONEY   0x00008000

Definition at line 97 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_ATRNAME   0x00000800

Definition at line 92 of file db.h.

Referenced by db_read(), db_write_object(), xml_db_write_mux(), and xml_db_write_object().

#define V_COMM   0x00004000

Definition at line 96 of file db.h.

#define V_GDBM   0x00000400

Definition at line 91 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_LINK   0x00000200

Definition at line 90 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_MASK   0x000000ff

Definition at line 88 of file db.h.

Referenced by db_read().

#define V_PARENT   0x00002000

Definition at line 95 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_PERNKEY   0x00001000

Definition at line 94 of file db.h.

#define V_POWERS   0x00020000

Definition at line 99 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_QUOTED   0x00080000

Definition at line 101 of file db.h.

Referenced by db_read().

#define V_XFLAGS   0x00010000

Definition at line 98 of file db.h.

Referenced by db_read(), and db_write_object().

#define V_ZONE   0x00000100

Definition at line 89 of file db.h.

Referenced by db_read(), and db_write_object().

#define Zone (  )     db[t].zone

Definition at line 162 of file db.h.

Referenced by announce_connect(), announce_disconnect(), check_dead_refs(), check_zone(), check_zone_for_player(), create_guest(), create_obj(), db_write_object(), debug_examine(), do_examine(), fun_zfun(), fun_zone(), fun_zplayers(), fun_zwho(), match_zone_exit(), mmdb_write_object(), process_command(), search_perform(), xml_db_write_mux(), and xml_db_write_object().


Typedef Documentation

typedef struct atrlist ATRLIST

Definition at line 31 of file db.h.

typedef struct attr ATTR

Definition at line 23 of file db.h.

typedef struct boolexp BOOLEXP

Definition at line 69 of file db.h.

typedef char* NAME

Definition at line 155 of file db.h.

typedef struct object OBJ

Definition at line 122 of file db.h.

typedef struct stack STACK

Definition at line 38 of file db.h.


Function Documentation

void al_add ( dbref  ,
int   
)

void al_delete ( dbref  ,
int   
)

void al_destroy ( dbref   ) 

void al_store ( void   ) 

void anum_extend ( int   ) 

Definition at line 857 of file db.c.

References anum_alc_top, anum_table, confdata::init_size, and mudconf.

Referenced by init_attrtab(), mmdb_db_read(), vattr_alloc(), and vattr_define().

00858 {
00859         ATTR **anum_table2;
00860         int delta, i;
00861 
00862         delta = mudconf.init_size;
00863 
00864         if(newtop <= anum_alc_top)
00865                 return;
00866         if(newtop < anum_alc_top + delta)
00867                 newtop = anum_alc_top + delta;
00868         if(anum_table == NULL) {
00869                 anum_table = (ATTR **) malloc((newtop + 1) * sizeof(ATTR *));
00870                 for(i = 0; i <= newtop; i++)
00871                         anum_table[i] = NULL;
00872         } else {
00873                 anum_table2 = (ATTR **) malloc((newtop + 1) * sizeof(ATTR *));
00874                 for(i = 0; i <= anum_alc_top; i++)
00875                         anum_table2[i] = anum_table[i];
00876                 for(i = anum_alc_top + 1; i <= newtop; i++)
00877                         anum_table2[i] = NULL;
00878                 free((char *) anum_table);
00879                 anum_table = anum_table2;
00880         }
00881         anum_alc_top = newtop;
00882 }

ATTR* atr_num ( int  anum  ) 

Definition at line 889 of file db.c.

References A_USER_START, anum_alc_top, anum_get, attr::check, user_attribute::flags, attr::flags, user_attribute::name, attr::name, user_attribute::number, and attr::number.

Referenced by atr_cpy(), atr_match1(), atr_pget_info(), atr_pget_str(), Commer(), db_write_object(), debug_examine(), do_alias(), do_chown(), do_decomp(), do_edit(), do_examine(), do_listcommands(), do_lock(), do_mvattr(), do_prog(), do_set(), do_ufun(), do_unlock(), do_verb(), do_wait(), do_wipe(), eval_boolexp(), exam_wildattrs(), find_wild_attrs(), fun_colorpairs(), fun_default(), fun_edefault(), fun_eval(), fun_filter(), fun_fold(), fun_foreach(), fun_get(), fun_get_eval(), fun_lattr(), fun_map(), fun_mix(), fun_munge(), fun_pairs(), fun_set(), fun_setlock(), fun_sortby(), fun_udefault(), fun_visible(), fun_xget(), fun_zfun(), get_obj_and_lock(), grep_util(), Hearer(), look_atrs1(), mem_usage(), putbool_subexp(), set_attr_internal(), set_player_folder(), sweep_check(), unparse_boolexp1(), xml_db_write_mux(), and xml_db_write_object().

00890 {
00891         VATTR *va;
00892         static ATTR tattr;
00893 
00894         /*
00895          * Look for a predefined attribute 
00896          */
00897 
00898         if(anum < A_USER_START)
00899                 return anum_get(anum);
00900 
00901         if(anum >= anum_alc_top)
00902                 return NULL;
00903 
00904         /*
00905          * It's a user-defined attribute, we need to copy data 
00906          */
00907 
00908         va = (VATTR *) anum_get(anum);
00909         if(va != NULL) {
00910                 tattr.name = va->name;
00911                 tattr.number = va->number;
00912                 tattr.flags = va->flags;
00913                 tattr.check = NULL;
00914                 return &tattr;
00915         }
00916         /*
00917          * All failed, return NULL 
00918          */
00919 
00920         return NULL;
00921 }

ATTR* atr_str ( char *  s  ) 

Definition at line 795 of file db.c.

References alloc_sbuf, statedata::attr_name_htab, attr::check, user_attribute::flags, attr::flags, free_sbuf, hashfind(), mudstate, user_attribute::name, attr::name, user_attribute::number, attr::number, SBUF_SIZE, ToUpper, and vattr_find().

Referenced by bt_get_attr(), bt_set_attr(), cf_attr_access(), do_attribute(), do_mvattr(), do_notify(), do_ufun(), do_verb(), do_wait(), fun_filter(), fun_fold(), fun_foreach(), fun_hasattr(), fun_hasattrp(), fun_map(), fun_mix(), fun_munge(), fun_sortby(), fun_udefault(), fun_v(), get_atr(), mkattr(), parse_attrib(), and test_atr().

00796 {
00797         char *buff, *p, *q;
00798         ATTR *a;
00799         VATTR *va;
00800         static ATTR tattr;
00801 
00802         if(!s || !*s) {
00803                 return (NULL);
00804         }
00805 
00806         /*
00807          * Convert the buffer name to lowercase 
00808          */
00809 
00810         buff = alloc_sbuf("atr_str");
00811         for(p = buff, q = s; *q && ((p - buff) < (SBUF_SIZE - 1)); p++, q++)
00812                 *p = ToUpper(*q);
00813         *p = '\0';
00814 
00815         /*
00816          * Look for a predefined attribute 
00817          */
00818 
00819         a = (ATTR *) hashfind(buff, &mudstate.attr_name_htab);
00820         if(a != NULL) {
00821                 free_sbuf(buff);
00822                 return a;
00823         }
00824         /*
00825          * Nope, look for a user attribute 
00826          */
00827 
00828         va = (VATTR *) vattr_find(buff);
00829         free_sbuf(buff);
00830 
00831         /*
00832          * If we got one, load tattr and return a pointer to it. 
00833          */
00834 
00835         if(va != NULL) {
00836                 tattr.name = va->name;
00837                 tattr.number = va->number;
00838                 tattr.flags = va->flags;
00839                 tattr.check = NULL;
00840                 return &tattr;
00841         }
00842         /*
00843          * All failed, return NULL 
00844          */
00845 
00846         return NULL;
00847 }

void db_free ( void   ) 

Definition at line 1790 of file db.c.

References flatfiledb::db, statedata::db_size, statedata::db_top, statedata::freelist, mudstate, NOTHING, SIZE_HACK, and XFREE.

Referenced by db_make_minimal(), db_read(), main(), and mmdb_db_read().

01791 {
01792         char *cp;
01793 
01794         if(db != NULL) {
01795                 db -= SIZE_HACK;
01796                 cp = (char *) db;
01797                 XFREE(cp, "db_grow");
01798                 db = NULL;
01799         }
01800         mudstate.db_top = 0;
01801         mudstate.db_size = 0;
01802         mudstate.freelist = NOTHING;
01803 }

void db_grow ( dbref   ) 

Definition at line 1609 of file db.c.

01610 {
01611         int newsize, marksize, delta, i;
01612         MARKBUF *newmarkbuf;
01613         OBJ *newdb;
01614         NAME *newpurenames;
01615 
01616         char *cp;
01617 
01618         delta = mudconf.init_size;
01619 
01620         /*
01621          * Determine what to do based on requested size, current top and  * * 
01622          * 
01623          * *  * *  * *  * * size.  Make sure we grow in reasonable-sized
01624          * chunks to * * prevent *  * *  * frequent reallocations of the db
01625          * array. 
01626          */
01627 
01628         /*
01629          * If requested size is smaller than the current db size, ignore it 
01630          */
01631 
01632         if(newtop <= mudstate.db_top) {
01633                 return;
01634         }
01635         /*
01636          * If requested size is greater than the current db size but smaller
01637          * * * * * * * than the amount of space we have allocated, raise the
01638          * db  * *  * size * * and * initialize the new area. 
01639          */
01640 
01641         if(newtop <= mudstate.db_size) {
01642                 for(i = mudstate.db_top; i < newtop; i++) {
01643                         if(mudconf.cache_names)
01644                                 purenames[i] = NULL;
01645                 }
01646                 initialize_objects(mudstate.db_top, newtop);
01647                 mudstate.db_top = newtop;
01648                 return;
01649         }
01650         /*
01651          * Grow by a minimum of delta objects 
01652          */
01653 
01654         if(newtop <= mudstate.db_size + delta) {
01655                 newsize = mudstate.db_size + delta;
01656         } else {
01657                 newsize = newtop;
01658         }
01659 
01660         /*
01661          * Enforce minimumdatabase size 
01662          */
01663 
01664         if(newsize < mudstate.min_size)
01665                 newsize = mudstate.min_size + delta;;
01666 
01667         /*
01668          * Grow the name tables 
01669          */
01670 
01671         if(mudconf.cache_names) {
01672                 newpurenames =
01673                         (NAME *) XMALLOC((newsize + SIZE_HACK) * sizeof(NAME),
01674                                                          "db_grow.purenames");
01675 
01676                 if(!newpurenames) {
01677                         LOG_SIMPLE(LOG_ALWAYS, "ALC", "DB",
01678                                            tprintf
01679                                            ("Could not allocate space for %d item name cache.",
01680                                                 newsize));
01681                         abort();
01682                 }
01683                 bzero((char *) newpurenames, (newsize + SIZE_HACK) * sizeof(NAME));
01684 
01685                 if(purenames) {
01686 
01687                         /*
01688                          * An old name cache exists.  Copy it. 
01689                          */
01690 
01691                         purenames -= SIZE_HACK;
01692                         bcopy((char *) purenames, (char *) newpurenames,
01693                                   (newtop + SIZE_HACK) * sizeof(NAME));
01694                         cp = (char *) purenames;
01695                         XFREE(cp, "db_grow.purename");
01696                 } else {
01697 
01698                         /*
01699                          * Creating a brand new struct database.  Fill in the
01700                          * 'reserved' area in case it gets referenced.  
01701                          */
01702 
01703                         purenames = newpurenames;
01704                         for(i = 0; i < SIZE_HACK; i++) {
01705                                 purenames[i] = NULL;
01706                         }
01707                 }
01708                 purenames = newpurenames + SIZE_HACK;
01709                 newpurenames = NULL;
01710         }
01711         /*
01712          * Grow the db array 
01713          */
01714 
01715         newdb = (OBJ *)
01716                 XMALLOC((newsize + SIZE_HACK) * sizeof(OBJ), "db_grow.db");
01717         if(!newdb) {
01718 
01719                 LOG_SIMPLE(LOG_ALWAYS, "ALC", "DB",
01720                                    tprintf
01721                                    ("Could not allocate space for %d item struct database.",
01722                                         newsize));
01723                 abort();
01724         }
01725         if(db) {
01726 
01727                 /*
01728                  * An old struct database exists.  Copy it to the new buffer 
01729                  */
01730 
01731                 db -= SIZE_HACK;
01732                 bcopy((char *) db, (char *) newdb,
01733                           (mudstate.db_top + SIZE_HACK) * sizeof(OBJ));
01734                 cp = (char *) db;
01735                 XFREE(cp, "db_grow.db");
01736         } else {
01737 
01738                 /*
01739                  * Creating a brand new struct database.  Fill in the * * * * 
01740                  * 
01741                  * *  * * 'reserved' area in case it gets referenced. 
01742                  */
01743 
01744                 db = newdb;
01745                 for(i = 0; i < SIZE_HACK; i++) {
01746                         s_Owner(i, GOD);
01747                         s_Flags(i, (TYPE_GARBAGE | GOING));
01748                         s_Powers(i, 0);
01749                         s_Powers2(i, 0);
01750                         s_Location(i, NOTHING);
01751                         s_Contents(i, NOTHING);
01752                         s_Exits(i, NOTHING);
01753                         s_Link(i, NOTHING);
01754                         s_Next(i, NOTHING);
01755                         s_Zone(i, NOTHING);
01756                         s_Parent(i, NOTHING);
01757                         s_Stack(i, NULL);
01758                         db[i].ahead = NULL;
01759                         db[i].at_count = 0;
01760                 }
01761         }
01762         db = newdb + SIZE_HACK;
01763         newdb = NULL;
01764 
01765         for(i = mudstate.db_top; i < newtop; i++) {
01766                 if(mudconf.cache_names) {
01767                         purenames[i] = NULL;
01768                 }
01769         }
01770         initialize_objects(mudstate.db_top, newtop);
01771         mudstate.db_top = newtop;
01772         mudstate.db_size = newsize;
01773 
01774         /*
01775          * Grow the db mark buffer 
01776          */
01777 
01778         marksize = (newsize + 7) >> 3;
01779         newmarkbuf = (MARKBUF *) XMALLOC(marksize, "db_grow");
01780         bzero((char *) newmarkbuf, marksize);
01781         if(mudstate.markbits) {
01782                 marksize = (newtop + 7) >> 3;
01783                 bcopy((char *) mudstate.markbits, (char *) newmarkbuf, marksize);
01784                 cp = (char *) mudstate.markbits;
01785                 XFREE(cp, "db_grow");
01786         }
01787         mudstate.markbits = newmarkbuf;
01788 }

void db_make_minimal ( void   ) 

Definition at line 1805 of file db.c.

References create_player(), flatfiledb::db, db_free(), db_grow(), Flags, load_player_names(), NOTHING, s_Contents, s_Exits, s_Flags, s_Link, s_Location, s_Name(), s_Next, s_Owner, s_Parent, s_Pennies(), s_Powers, s_Powers2, s_Zone, TYPE_ROOM, and WIZARD.

Referenced by main().

01806 {
01807         dbref obj;
01808 
01809         db_free();
01810         db_grow(1);
01811         s_Name(0, "Limbo");
01812         s_Flags(0, TYPE_ROOM);
01813         s_Powers(0, 0);
01814         s_Powers2(0, 0);
01815         s_Location(0, NOTHING);
01816         s_Exits(0, NOTHING);
01817         s_Link(0, NOTHING);
01818         s_Parent(0, NOTHING);
01819         s_Zone(0, NOTHING);
01820         s_Pennies(0, 1);
01821         s_Owner(0, 1);
01822         db[0].ahead = NULL;
01823         db[0].at_count = 0;
01824         /*
01825          * should be #1 
01826          */
01827         load_player_names();
01828         obj =
01829                 create_player((char *) "Wizard", (char *) "potrzebie", NOTHING, 0, 0);
01830         s_Flags(obj, Flags(obj) | WIZARD);
01831         s_Powers(obj, 0);
01832         s_Powers2(obj, 0);
01833         s_Pennies(obj, 1000);
01834 
01835         /*
01836          * Manually link to Limbo, just in case 
01837          */
01838         s_Location(obj, 0);
01839         s_Next(obj, NOTHING);
01840         s_Contents(0, obj);
01841         s_Link(obj, 0);
01842 }

dbref db_read ( FILE *  ,
int *  ,
int *  ,
int *   
)

Definition at line 429 of file db_rw.c.

References A_LOCK, atr_add_raw(), statedata::attr_next, c_Connected, db_free(), db_grow(), statedata::db_top, F_MUX, F_UNKNOWN, free_boolexp(), g_flags, g_format, g_version, get_list(), getboolexp(), getref(), getstring_noalloc(), load_player_names(), statedata::min_size, mudconf, mudstate, NOTHING, statedata::record_players, 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_Zone, TYPE_PLAYER, Typeof, unparse_boolexp_quiet(), V_3FLAGS, V_ATRKEY, V_ATRMONEY, V_ATRNAME, V_GDBM, V_LINK, V_MASK, V_PARENT, V_POWERS, V_QUOTED, V_XFLAGS, V_ZONE, vattr_define(), and confdata::vattr_flags.

Referenced by load_game().

00430 {
00431         dbref i, anum;
00432         char ch;
00433         const char *tstr;
00434         int header_gotten, size_gotten, nextattr_gotten;
00435         int read_attribs, read_name, read_zone, read_link, read_key, read_parent;
00436         int read_extflags, read_3flags, read_money, read_timestamps,
00437                 read_new_strings;
00438         int read_powers, read_powers_player, read_powers_any;
00439         int deduce_version, deduce_name, deduce_zone, deduce_timestamps;
00440         int aflags, f1, f2, f3;
00441         BOOLEXP *tempbool;
00442 
00443         header_gotten = 0;
00444         size_gotten = 0;
00445         nextattr_gotten = 0;
00446         g_format = F_UNKNOWN;
00447         g_version = 0;
00448         g_flags = 0;
00449         read_attribs = 1;
00450         read_name = 1;
00451         read_zone = 0;
00452         read_link = 0;
00453         read_key = 1;
00454         read_parent = 0;
00455         read_money = 1;
00456         read_extflags = 0;
00457         read_3flags = 0;
00458         read_timestamps = 0;
00459         read_new_strings = 0;
00460         read_powers = 0;
00461         read_powers_player = 0;
00462         read_powers_any = 0;
00463         deduce_version = 1;
00464         deduce_zone = 1;
00465         deduce_name = 1;
00466         deduce_timestamps = 1;
00467         db_free();
00468         for(i = 0;; i++) {
00469 
00470                 switch (ch = getc(f)) {
00471                 case '-':                               /* Misc tag */
00472                         switch (ch = getc(f)) {
00473                         case 'R':                       /* Record number of players */
00474                                 mudstate.record_players = getref(f);
00475                                 break;
00476                         default:
00477                                 (void) getstring_noalloc(f, 0);
00478                         }
00479                         break;
00480                 case '+':                               /*
00481                                                                  * MUX and MUSH header 
00482                                                                  */
00483                         switch (ch = getc(f)) { /*
00484                                                                          * 2nd char selects 
00485                                                                          * type 
00486                                                                          */
00487                         case 'X':                       /*
00488                                                                  * MUX VERSION 
00489                                                                  */
00490                                 if(header_gotten) {
00491                                         fprintf(stderr,
00492                                                         "\nDuplicate MUX version header entry at object %d, ignored.\n",
00493                                                         i);
00494                                         tstr = getstring_noalloc(f, 0);
00495                                         break;
00496                                 }
00497                                 header_gotten = 1;
00498                                 deduce_version = 0;
00499                                 g_format = F_MUX;
00500                                 g_version = getref(f);
00501 
00502                                 /*
00503                                  * Otherwise extract feature flags 
00504                                  */
00505 
00506                                 if(g_version & V_GDBM) {
00507                                         read_attribs = 0;
00508                                         read_name = !(g_version & V_ATRNAME);
00509                                 }
00510                                 read_zone = (g_version & V_ZONE);
00511                                 read_link = (g_version & V_LINK);
00512                                 read_key = !(g_version & V_ATRKEY);
00513                                 read_parent = (g_version & V_PARENT);
00514                                 read_money = !(g_version & V_ATRMONEY);
00515                                 read_extflags = (g_version & V_XFLAGS);
00516                                 read_3flags = (g_version & V_3FLAGS);
00517                                 read_powers = (g_version & V_POWERS);
00518                                 read_new_strings = (g_version & V_QUOTED);
00519                                 g_flags = g_version & ~V_MASK;
00520 
00521                                 g_version &= V_MASK;
00522                                 deduce_name = 0;
00523                                 deduce_version = 0;
00524                                 deduce_zone = 0;
00525                                 break;
00526                         case 'S':                       /*
00527                                                                  * SIZE 
00528                                                                  */
00529                                 if(size_gotten) {
00530                                         fprintf(stderr,
00531                                                         "\nDuplicate size entry at object %d, ignored.\n",
00532                                                         i);
00533                                         tstr = getstring_noalloc(f, 0);
00534                                 } else {
00535                                         mudstate.min_size = getref(f);
00536                                 }
00537                                 size_gotten = 1;
00538                                 break;
00539                         case 'A':                       /*
00540                                                                  * USER-NAMED ATTRIBUTE 
00541                                                                  */
00542                                 anum = getref(f);
00543                                 tstr = getstring_noalloc(f, read_new_strings);
00544                                 if(isdigit(*tstr)) {
00545                                         aflags = 0;
00546                                         while (isdigit(*tstr))
00547                                                 aflags = (aflags * 10) + (*tstr++ - '0');
00548                                         tstr++;         /*
00549                                                                  * skip ':' 
00550                                                                  */
00551                                 } else {
00552                                         aflags = mudconf.vattr_flags;
00553                                 }
00554                                 vattr_define((char *) tstr, anum, aflags);
00555                                 break;
00556                         case 'F':                       /*
00557                                                                  * OPEN USER ATTRIBUTE SLOT 
00558                                                                  */
00559                                 anum = getref(f);
00560                                 break;
00561                         case 'N':                       /*
00562                                                                  * NEXT ATTR TO ALLOC WHEN NO
00563                                                                  * FREELIST 
00564                                                                  */
00565                                 if(nextattr_gotten) {
00566                                         fprintf(stderr,
00567                                                         "\nDuplicate next free vattr entry at object %d, ignored.\n",
00568                                                         i);
00569                                         tstr = getstring_noalloc(f, 0);
00570                                 } else {
00571                                         mudstate.attr_next = getref(f);
00572                                         nextattr_gotten = 1;
00573                                 }
00574                                 break;
00575                         default:
00576                                 fprintf(stderr,
00577                                                 "\nUnexpected character '%c' in MUX header near object #%d, ignored.\n",
00578                                                 ch, i);
00579                                 tstr = getstring_noalloc(f, 0);
00580                         }
00581                         break;
00582                 case '!':                               /*
00583                                                                  * MUX entry/MUSH entry/MUSE non-zoned entry 
00584                                                                  */
00585                         if(deduce_version) {
00586                                 g_format = F_MUX;
00587                                 g_version = 1;
00588                                 deduce_name = 0;
00589                                 deduce_zone = 0;
00590                                 deduce_version = 0;
00591                         } else if(deduce_zone) {
00592                                 deduce_zone = 0;
00593                                 read_zone = 0;
00594                         }
00595                         i = getref(f);
00596                         db_grow(i + 1);
00597 
00598                         if(read_name) {
00599                                 tstr = getstring_noalloc(f, read_new_strings);
00600                                 if(deduce_name) {
00601                                         if(isdigit(*tstr)) {
00602                                                 read_name = 0;
00603                                                 s_Location(i, atoi(tstr));
00604                                         } else {
00605                                                 s_Name(i, (char *) tstr);
00606                                                 s_Location(i, getref(f));
00607                                         }
00608                                         deduce_name = 0;
00609                                 } else {
00610                                         s_Name(i, (char *) tstr);
00611                                         s_Location(i, getref(f));
00612                                 }
00613                         } else {
00614                                 s_Location(i, getref(f));
00615                         }
00616 
00617                         /*
00618                          * ZONE on MUSE databases and some others 
00619                          */
00620 
00621                         if(read_zone)
00622                                 s_Zone(i, getref(f));
00623 
00624                         /*
00625                          * else
00626                          * * s_Zone(i, NOTHING); 
00627                          */
00628 
00629                         /*
00630                          * CONTENTS and EXITS 
00631                          */
00632 
00633                         s_Contents(i, getref(f));
00634                         s_Exits(i, getref(f));
00635 
00636                         /*
00637                          * LINK 
00638                          */
00639 
00640                         if(read_link)
00641                                 s_Link(i, getref(f));
00642                         else
00643                                 s_Link(i, NOTHING);
00644 
00645                         /*
00646                          * NEXT 
00647                          */
00648 
00649                         s_Next(i, getref(f));
00650 
00651                         /*
00652                          * LOCK
00653                          */
00654 
00655                         if(read_key) {
00656                                 tempbool = getboolexp(f);
00657                                 atr_add_raw(i, A_LOCK, unparse_boolexp_quiet(1, tempbool));
00658                                 free_boolexp(tempbool);
00659                         }
00660                         /*
00661                          * OWNER 
00662                          */
00663 
00664                         s_Owner(i, getref(f));
00665 
00666                         /*
00667                          * PARENT: PennMUSH uses this field for ZONE
00668                          * (which we  use as PARENT if we
00669                          * didn't already read in a  
00670                          * non-NOTHING parent. 
00671                          */
00672 
00673                         if(read_parent) {
00674                                 s_Parent(i, getref(f));
00675                         } else {
00676                                 s_Parent(i, NOTHING);
00677                         }
00678 
00679                         /*
00680                          * PENNIES 
00681                          */
00682 
00683                         if(read_money)          /*
00684                                                                  *  if not fix in
00685                                                                  * unscraw_foreign  
00686                                                                  */
00687                                 s_Pennies(i, getref(f));
00688 
00689                         /*
00690                          * FLAGS 
00691                          */
00692 
00693                         f1 = getref(f);
00694                         if(read_extflags)
00695                                 f2 = getref(f);
00696                         else
00697                                 f2 = 0;
00698 
00699                         if(read_3flags)
00700                                 f3 = getref(f);
00701                         else
00702                                 f3 = 0;
00703 
00704                         s_Flags(i, f1);
00705                         s_Flags2(i, f2);
00706                         s_Flags3(i, f3);
00707 
00708                         if(read_powers) {
00709                                 f1 = getref(f);
00710                                 f2 = getref(f);
00711                                 s_Powers(i, f1);
00712                                 s_Powers2(i, f2);
00713                         }
00714 
00715                         /*
00716                          * ATTRIBUTES 
00717                          */
00718 
00719                         if(read_attribs) {
00720                                 if(!get_list(f, i, read_new_strings)) {
00721                                         fprintf(stderr,
00722                                                         "\nError reading attrs for object #%d\n", i);
00723                                         return -1;
00724                                 }
00725                         }
00726                         /*
00727                          * check to see if it's a player 
00728                          */
00729 
00730                         if(Typeof(i) == TYPE_PLAYER) {
00731                                 c_Connected(i);
00732                         }
00733                         break;
00734                 case '*':                               /*
00735                                                                  * EOF marker 
00736                                                                  */
00737                         tstr = getstring_noalloc(f, 0);
00738                         if(strcmp(tstr, "**END OF DUMP***")) {
00739                                 fprintf(stderr, "\nBad EOF marker at object #%d\n", i);
00740                                 return -1;
00741                         } else {
00742                                 /*
00743                                  * Fix up bizarro foreign DBs 
00744                                  */
00745 
00746                                 *db_version = g_version;
00747                                 *db_format = g_format;
00748                                 *db_flags = g_flags;
00749                                 load_player_names();
00750                                 return mudstate.db_top;
00751                         }
00752                 default:
00753                         fprintf(stderr, "\nIllegal character '%c' near object #%d\n",
00754                                         ch, i);
00755                         return -1;
00756                 }
00757 
00758         }
00759 
00760 }

dbref db_write ( FILE *  ,
int  ,
int   
)

Definition at line 843 of file db_rw.c.

References AF_DELETED, statedata::attr_next, statedata::db_top, db_write_object(), DO_WHOLE_DB, F_MUX, object::flags, user_attribute::flags, Going, mudstate, user_attribute::name, user_attribute::number, statedata::record_players, vattr_first(), and vattr_next().

Referenced by dump_database_internal().

00844 {
00845         dbref i;
00846         int flags;
00847         VATTR *vp;
00848 
00849         switch (format) {
00850         case F_MUX:
00851                 flags = version;
00852                 break;
00853         default:
00854                 fprintf(stderr, "Can only write MUX format.\n");
00855                 return -1;
00856         }
00857         i = mudstate.attr_next;
00858         fprintf(f, "+X%d\n+S%d\n+N%d\n", flags, mudstate.db_top, i);
00859         fprintf(f, "-R%d\n", mudstate.record_players);
00860 
00861         /*
00862          * Dump user-named attribute info 
00863          */
00864 
00865         vp = vattr_first();
00866         while (vp != NULL) {
00867                 if(!(vp->flags & AF_DELETED))
00868                         fprintf(f, "+A%d\n\"%d:%s\"\n", vp->number, vp->flags, vp->name);
00869                 vp = vattr_next(vp);
00870         }
00871 
00872         DO_WHOLE_DB(i) {
00873 
00874                 if(!(Going(i))) {
00875                         fprintf(f, "!%d\n", i);
00876                         db_write_object(f, i, format, flags);
00877                 }
00878         }
00879         fputs("***END OF DUMP***\n", f);
00880         fflush(f);
00881         return (mudstate.db_top);
00882 }

void destroy_exit ( dbref  exit  ) 

Destroys an exit.

Definition at line 545 of file object.c.

References destroy_obj(), Exits, loc, NOTHING, remove_first(), and s_Exits.

Referenced by do_destroy(), and purge_going().

00546 {
00547         dbref loc;
00548 
00549         loc = Exits(exit);
00550         s_Exits(loc, remove_first(Exits(loc), exit));
00551         destroy_obj(NOTHING, exit);
00552 }

void destroy_thing ( dbref  thing  ) 

Destroys a thing.

Definition at line 557 of file object.c.

References destroy_obj(), empty_obj(), move_via_generic(), NOTHING, and Owner.

Referenced by do_destroy(), and purge_going().

00558 {
00559         move_via_generic(thing, NOTHING, Owner(thing), 0);
00560         empty_obj(thing);
00561         destroy_obj(NOTHING, thing);
00562 }

void dump_database_internal ( int   ) 

Definition at line 858 of file game.c.

References confdata::commac_db, confdata::compress, confdata::compress_db, confdata::crashdb, db_write(), DUMP_CRASHED, DUMP_KILLED, dump_mail(), DUMP_NORMAL, DUMP_RESTART, statedata::epoch, F_MUX, confdata::have_comsys, confdata::have_macros, confdata::have_mailer, confdata::have_specials, confdata::indb, log_perror(), confdata::mail_db, mudconf, mudstate, confdata::outdb, OUTPUT_FLAGS, OUTPUT_VERSION, save_comsys_and_macros(), SaveSpecialObjects(), StringCopy, tprintf(), UNLOAD_OUTFLAGS, and UNLOAD_VERSION.

Referenced by do_restart(), do_shutdown(), dump_database(), fork_and_dump(), signal_BUS(), and signal_SEGV().

00859 {
00860         char tmpfile[256], outfn[256], prevfile[256];
00861         FILE *f;
00862 
00863 #ifdef USE_PYTHON
00864         runPythonHook("save");
00865 #endif
00866 
00867         if(dump_type == DUMP_CRASHED) {
00868                 unlink(mudconf.crashdb);
00869                 f = fopen(mudconf.crashdb, "w");
00870                 if(f != NULL) {
00871                         db_write(f, F_MUX, UNLOAD_VERSION | UNLOAD_OUTFLAGS);
00872                         fclose(f);
00873                 } else {
00874                         log_perror("DMP", "FAIL", "Opening crash file", mudconf.crashdb);
00875                 }
00876                 if(mudconf.have_mailer)
00877                         if((f = fopen(mudconf.mail_db, "w"))) {
00878                                 dump_mail(f);
00879                                 fclose(f);
00880                         }
00881                 if(mudconf.have_comsys || mudconf.have_macros)
00882                         save_comsys_and_macros(mudconf.commac_db);
00883                 SaveSpecialObjects(DUMP_CRASHED);
00884                 return;
00885         }
00886 
00887         if(dump_type == DUMP_RESTART) {
00888                 f = fopen(mudconf.indb, "w");
00889                 if(f != NULL) {
00890                         /* Write a flatfile */
00891                         db_write(f, F_MUX, UNLOAD_VERSION | UNLOAD_OUTFLAGS);
00892                         fclose(f);
00893                 } else {
00894                         log_perror("DMP", "FAIL", "Opening restart file", mudconf.indb);
00895                 }
00896                 if(mudconf.have_mailer)
00897                         if((f = fopen(mudconf.mail_db, "w"))) {
00898                                 dump_mail(f);
00899                                 fclose(f);
00900                         }
00901                 if(mudconf.have_comsys || mudconf.have_macros)
00902                         save_comsys_and_macros(mudconf.commac_db);
00903                 if(mudconf.have_specials)
00904                         SaveSpecialObjects(DUMP_RESTART);
00905                 return;
00906         }
00907         if(dump_type == DUMP_KILLED) {
00908                 sprintf(tmpfile, "%s.KILLED", mudconf.indb);
00909                 f = fopen(tmpfile, "w");
00910                 if(f != NULL) {
00911                         /* Write a flatfile */
00912                         db_write(f, F_MUX, UNLOAD_VERSION | UNLOAD_OUTFLAGS);
00913                         fclose(f);
00914                 } else {
00915                         log_perror("DMP", "FAIL", "Opening killed file", mudconf.indb);
00916                 }
00917                 if(mudconf.have_mailer)
00918                         if((f = fopen(mudconf.mail_db, "w"))) {
00919                                 dump_mail(f);
00920                                 fclose(f);
00921                         }
00922                 if(mudconf.have_comsys || mudconf.have_macros)
00923                         save_comsys_and_macros(mudconf.commac_db);
00924                 if(mudconf.have_specials)
00925                         SaveSpecialObjects(DUMP_KILLED);
00926                 return;
00927         }
00928 
00929         sprintf(prevfile, "%s.prev", mudconf.outdb);
00930         sprintf(tmpfile, "%s.#%d#", mudconf.outdb, mudstate.epoch - 1);
00931         unlink(tmpfile);                        /*
00932                                                                  * nuke our predecessor 
00933                                                                  */
00934         sprintf(tmpfile, "%s.#%d#", mudconf.outdb, mudstate.epoch);
00935 
00936         if(mudconf.compress_db) {
00937                 sprintf(tmpfile, "%s.#%d#.gz", mudconf.outdb, mudstate.epoch - 1);
00938                 unlink(tmpfile);
00939                 sprintf(tmpfile, "%s.#%d#.gz", mudconf.outdb, mudstate.epoch);
00940                 StringCopy(outfn, mudconf.outdb);
00941                 strcat(outfn, ".gz");
00942                 f = popen(tprintf("%s > %s", mudconf.compress, tmpfile), "w");
00943                 if(f) {
00944                         db_write(f, F_MUX, OUTPUT_VERSION | OUTPUT_FLAGS);
00945                         pclose(f);
00946                         rename(mudconf.outdb, prevfile);
00947                         if(rename(tmpfile, outfn) < 0)
00948                                 log_perror("SAV", "FAIL",
00949                                                    "Renaming output file to DB file", tmpfile);
00950                 } else {
00951                         log_perror("SAV", "FAIL", "Opening", tmpfile);
00952                 }
00953         } else {
00954                 f = fopen(tmpfile, "w");
00955                 if(f) {
00956                         db_write(f, F_MUX, OUTPUT_VERSION | OUTPUT_FLAGS);
00957                         fclose(f);
00958                         rename(mudconf.outdb, prevfile);
00959                         if(rename(tmpfile, mudconf.outdb) < 0)
00960                                 log_perror("SAV", "FAIL",
00961                                                    "Renaming output file to DB file", tmpfile);
00962                 } else {
00963                         log_perror("SAV", "FAIL", "Opening", tmpfile);
00964                 }
00965                 rename(prevfile, mudconf.indb);
00966         }
00967 
00968         if(mudconf.have_mailer)
00969                 if((f = fopen(mudconf.mail_db, "w"))) {
00970                         dump_mail(f);
00971                         fclose(f);
00972                 }
00973         if(mudconf.have_comsys || mudconf.have_macros)
00974                 save_comsys_and_macros(mudconf.commac_db);
00975         if(mudconf.have_specials)
00976                 SaveSpecialObjects(DUMP_NORMAL);
00977 }

BOOLEXP* dup_bool ( BOOLEXP  ) 

Definition at line 1978 of file db.c.

References alloc_bool, BOOLEXP_AND, BOOLEXP_ATR, BOOLEXP_CARRY, BOOLEXP_CONST, BOOLEXP_EVAL, BOOLEXP_INDIR, BOOLEXP_IS, BOOLEXP_NOT, BOOLEXP_OR, BOOLEXP_OWNER, dup_bool(), strsave(), boolexp::sub1, boolexp::sub2, boolexp::thing, TRUE_BOOLEXP, and boolexp::type.

Referenced by dup_bool().

01979 {
01980         BOOLEXP *r;
01981 
01982         if(b == TRUE_BOOLEXP)
01983                 return (TRUE_BOOLEXP);
01984 
01985         r = alloc_bool("dup_bool");
01986         switch (r->type = b->type) {
01987         case BOOLEXP_AND:
01988         case BOOLEXP_OR:
01989                 r->sub2 = dup_bool(b->sub2);
01990         case BOOLEXP_NOT:
01991         case BOOLEXP_CARRY:
01992         case BOOLEXP_IS:
01993         case BOOLEXP_OWNER:
01994         case BOOLEXP_INDIR:
01995                 r->sub1 = dup_bool(b->sub1);
01996         case BOOLEXP_CONST:
01997                 r->thing = b->thing;
01998                 break;
01999         case BOOLEXP_EVAL:
02000         case BOOLEXP_ATR:
02001                 r->thing = b->thing;
02002                 r->sub1 = (BOOLEXP *) strsave((char *) b->sub1);
02003                 break;
02004         default:
02005                 fprintf(stderr, "bad bool type!!\n");
02006                 return (TRUE_BOOLEXP);
02007         }
02008         return (r);
02009 }

void free_boolexp ( BOOLEXP  ) 

Definition at line 1947 of file db.c.

References BOOLEXP_AND, BOOLEXP_ATR, BOOLEXP_CARRY, BOOLEXP_CONST, BOOLEXP_EVAL, BOOLEXP_INDIR, BOOLEXP_IS, BOOLEXP_NOT, BOOLEXP_OR, BOOLEXP_OWNER, free_bool, free_boolexp(), boolexp::sub1, boolexp::sub2, TRUE_BOOLEXP, and boolexp::type.

Referenced by db_read(), debug_examine(), do_decomp(), do_examine(), do_lock(), eval_boolexp_atr(), free_boolexp(), fun_colorpairs(), fun_elock(), fun_eval(), fun_get(), fun_get_eval(), fun_lock(), fun_pairs(), fun_setlock(), fun_xget(), parse_boolexp_E(), parse_boolexp_F(), parse_boolexp_L(), parse_boolexp_T(), and view_atr().

01948 {
01949         if(b == TRUE_BOOLEXP)
01950                 return;
01951 
01952         switch (b->type) {
01953         case BOOLEXP_AND:
01954         case BOOLEXP_OR:
01955                 free_boolexp(b->sub1);
01956                 free_boolexp(b->sub2);
01957                 free_bool(b);
01958                 break;
01959         case BOOLEXP_NOT:
01960         case BOOLEXP_CARRY:
01961         case BOOLEXP_IS:
01962         case BOOLEXP_OWNER:
01963         case BOOLEXP_INDIR:
01964                 free_boolexp(b->sub1);
01965                 free_bool(b);
01966                 break;
01967         case BOOLEXP_CONST:
01968                 free_bool(b);
01969                 break;
01970         case BOOLEXP_ATR:
01971         case BOOLEXP_EVAL:
01972                 free((char *) b->sub1);
01973                 free_bool(b);
01974                 break;
01975         }
01976 }

int get_atr (  ) 

dbref getref ( FILE *   ) 

Definition at line 1939 of file db.c.

References SBUF_SIZE.

Referenced by db_read(), get_list(), load_mail(), load_malias(), load_restart_db(), and malias_read().

01940 {
01941         static char buf[SBUF_SIZE];
01942 
01943         fgets(buf, sizeof(buf), f);
01944         return (atoi(buf));
01945 }

void load_restart_db ( void   ) 

Definition at line 2174 of file db.c.

References accept_client_input(), descriptor_data::addr, alloc_lbuf, bsd_error_callback(), bsd_read_callback(), bsd_write_callback(), confdata::cmd_quota_max, descriptor_data::command_count, CONNECTED, descriptor_data::connected_at, desc_addhash(), DESC_ITER_CONN, descriptor_data::descriptor, descriptor_list, dnschild_request(), descriptor_data::doing, statedata::doing_hdr, dprintk, descriptor_data::flags, Flags2, getref(), getstring_noalloc(), descriptor_data::hashnext, descriptor_data::host_info, descriptor_data::hudkey, HUDKEYLEN, descriptor_data::input, descriptor_data::input_lost, descriptor_data::input_size, descriptor_data::input_tail, descriptor_data::input_tot, isPlayer, descriptor_data::last_time, mudconf, mudstate, descriptor_data::next, descriptor_data::output_lost, descriptor_data::output_prefix, descriptor_data::output_size, descriptor_data::output_suffix, descriptor_data::output_tot, descriptor_data::outstanding_dnschild_query, descriptor_data::player, descriptor_data::prev, descriptor_data::program_data, descriptor_data::quota, R_QUIT, raw_broadcast(), statedata::record_players, descriptor_data::refcount, statedata::restart_time, statedata::restarting, RS_HUDKEY, RS_NEW_STRINGS, RS_RECORD_PLAYERS, s_Flags2, descriptor_data::saddr, descriptor_data::saddr_len, shutdownsock(), descriptor_data::sock_buff, descriptor_data::sock_ev, statedata::start_time, time(), descriptor_data::timeout, and descriptor_data::username.

Referenced by main().

02175 {
02176         FILE *f;
02177         DESC *d;
02178         DESC *p;
02179     struct stat statbuffer;
02180 
02181         int val, version, new_strings = 0;
02182         char *temp, buf[8];
02183 
02184         f = fopen("restart.db", "r");
02185         if(!f) {
02186                 mudstate.restarting = 0;
02187                 return;
02188         }
02189         mudstate.restarting = 1;
02190 
02191         fgets(buf, 3, f);
02192         if(strncmp(buf, "+V", 2)) {
02193                 abort();
02194         }
02195         version = getref(f);
02196 
02197         if(version & RS_NEW_STRINGS)
02198                 new_strings = 1;
02199 
02200         mudstate.start_time = getref(f);
02201         time(&mudstate.restart_time);
02202         strcpy(mudstate.doing_hdr, getstring_noalloc(f, new_strings));
02203 
02204         if(version & RS_RECORD_PLAYERS) {
02205                 mudstate.record_players = getref(f);
02206         }
02207 
02208         while ((val = getref(f)) != 0) {
02209                 d = malloc(sizeof(DESC));
02210                 memset(d, 0, sizeof(DESC));
02211                 d->descriptor = val;
02212                 d->flags = getref(f);
02213                 d->connected_at = getref(f);
02214                 d->command_count = getref(f);
02215                 d->timeout = getref(f);
02216                 d->host_info = getref(f);
02217                 d->player = getref(f);
02218                 d->last_time = getref(f);
02219                 temp = (char *) getstring_noalloc(f, new_strings);
02220                 if(*temp) {
02221                         d->output_prefix = alloc_lbuf("set_userstring");
02222                         strcpy(d->output_prefix, temp);
02223                 } else {
02224                         d->output_prefix = NULL;
02225                 }
02226                 temp = (char *) getstring_noalloc(f, new_strings);
02227                 if(*temp) {
02228                         d->output_suffix = alloc_lbuf("set_userstring");
02229                         strcpy(d->output_suffix, temp);
02230                 } else {
02231                         d->output_suffix = NULL;
02232                 }
02233 
02234                 strcpy(d->addr, getstring_noalloc(f, new_strings));
02235                 strcpy(d->doing, getstring_noalloc(f, new_strings));
02236                 strcpy(d->username, getstring_noalloc(f, new_strings));
02237 
02238                 if(version & RS_HUDKEY)
02239                         strncpy(d->hudkey, getstring_noalloc(f, new_strings), HUDKEYLEN);
02240                 else
02241                         d->hudkey[0] = '\0';
02242 
02243                 d->output_size = 0;
02244                 d->output_tot = 0;
02245                 d->output_lost = 0;
02246                 d->input_size = 0;
02247                 d->input_tot = 0;
02248                 d->input_lost = 0;
02249                 memset(d->input, 0, sizeof(d->input));
02250         d->input_tail = 0;
02251                 d->quota = mudconf.cmd_quota_max;
02252                 d->program_data = NULL;
02253                 d->hashnext = NULL;
02254         d->refcount = 1;
02255 
02256                 d->saddr_len = sizeof(d->saddr);
02257                 getpeername(d->descriptor, (struct sockaddr *) &d->saddr,
02258                                         (socklen_t *) & d->saddr_len);
02259                 d->outstanding_dnschild_query = dnschild_request(d);
02260         
02261 
02262 
02263          if (descriptor_list)
02264                  descriptor_list->prev = d;
02265          d->next = descriptor_list;
02266          d->prev = NULL;
02267          descriptor_list = d;
02268                    
02269         d->sock_buff = bufferevent_new(d->descriptor, bsd_write_callback,
02270                                                                            bsd_read_callback, bsd_error_callback,
02271                                                                            NULL);
02272 
02273                 bufferevent_disable(d->sock_buff, EV_READ);
02274                 bufferevent_enable(d->sock_buff, EV_WRITE);
02275 
02276                 event_set(&d->sock_ev, d->descriptor, EV_READ | EV_PERSIST,
02277                                   accept_client_input, d);
02278                 event_add(&d->sock_ev, NULL);
02279 
02280                 desc_addhash(d);
02281                 if(isPlayer(d->player))
02282                         s_Flags2(d->player, Flags2(d->player) | CONNECTED);
02283         }
02284 
02285     DESC_ITER_CONN(d) {
02286         if(!isPlayer(d->player) || fstat(d->descriptor, &statbuffer) < 0) {
02287             dprintk("dropping descriptor %d.\n", d->descriptor);
02288             shutdownsock(d, R_QUIT);
02289         }
02290 
02291     }
02292 
02293         fclose(f);
02294         remove("restart.db");
02295         raw_broadcast(0, "Game: Restart finished.");
02296 }

int mkattr ( char *   ) 

Definition at line 928 of file db.c.

References atr_str(), mudconf, attr::number, user_attribute::number, vattr_alloc(), and confdata::vattr_flags.

Referenced by bt_set_attr(), do_mvattr(), do_set(), do_setvattr(), do_wait(), fun_set(), and getboolexp1().

00929 {
00930         ATTR *ap;
00931         VATTR *va;
00932 
00933         if(!(ap = atr_str(buff))) {
00934 
00935                 /*
00936                  * Unknown attr, create a new one 
00937                  */
00938 
00939                 va = vattr_alloc(buff, mudconf.vattr_flags);
00940                 if(!va || !(va->number))
00941                         return -1;
00942                 return va->number;
00943         }
00944         if(!(ap->number))
00945                 return -1;
00946         return ap->number;
00947 }

dbref parse_dbref ( const char *   ) 

Definition at line 1844 of file db.c.

References NOTHING, and x.

Referenced by absolute_name(), do_malias_add(), do_malias_remove(), and fun_isdbref().

01845 {
01846         const char *p;
01847         int x;
01848 
01849         /*
01850          * Enforce completely numeric dbrefs 
01851          */
01852 
01853         for(p = s; *p; p++) {
01854                 if(!isdigit(*p))
01855                         return NOTHING;
01856         }
01857 
01858         x = atoi(s);
01859         return ((x >= 0) ? x : NOTHING);
01860 }

int Pennies ( dbref   ) 

Definition at line 198 of file player_c.c.

References A_MONEY, atr_get_raw(), player_cache::money, OwnsOthers, pcache_find(), and safe_atoi.

Referenced by canpayfees(), check_pennies(), create_guest(), db_write_object(), debug_examine(), destroy_obj(), do_chown(), do_clone(), do_examine(), do_kill(), do_poor(), do_score(), fun_money(), give_money(), giveto(), mmdb_write_object(), move_object(), payfor(), shutdownsock(), xml_db_write_mux(), and xml_db_write_object().

00199 {
00200         char *cp;
00201 
00202         PCACHE *pp;
00203 
00204         if(OwnsOthers(obj)) {
00205                 pp = pcache_find(obj);
00206                 if(pp)
00207                         return pp->money;
00208         }
00209         cp = atr_get_raw(obj, A_MONEY);
00210         return (safe_atoi(cp));
00211 }

void putref ( FILE *  ,
dbref   
)

Definition at line 1862 of file db.c.

Referenced by db_write_object(), dump_mail(), and dump_restart_db().

01863 {
01864         fprintf(f, "%d\n", ref);
01865 }

void s_Pennies ( dbref  ,
int   
)

Definition at line 213 of file player_c.c.

References A_MONEY, atr_add_raw(), player_cache::cflags, player_cache::money, OwnsOthers, pcache_find(), and PF_MONEY_CH.

Referenced by check_pennies(), create_guest(), create_obj(), db_make_minimal(), db_read(), destroy_obj(), do_fixdb(), do_poor(), do_toad(), giveto(), mmdb_db_read(), and payfor().

00214 {
00215         IBUF tbuf;
00216 
00217         PCACHE *pp;
00218 
00219         if(OwnsOthers(obj)) {
00220                 pp = pcache_find(obj);
00221                 if(pp) {
00222                         pp->money = howfew;
00223                         pp->cflags |= PF_MONEY_CH;
00224                 }
00225         }
00226         sprintf(tbuf, "%d", howfew);
00227         atr_add_raw(obj, A_MONEY, tbuf);
00228 }


Variable Documentation

ATTR** anum_table

Definition at line 854 of file db.c.

Referenced by anum_extend().

ATTR attr[]

Definition at line 85 of file db.c.

Referenced by atr_chown(), atr_cpy(), check_attr(), check_read_perms(), Commer(), debug_examine(), do_decomp(), do_set(), find_wild_attrs(), fun_colorpairs(), fun_default(), fun_edefault(), fun_elock(), fun_eval(), fun_get(), fun_get_eval(), fun_hasattr(), fun_hasattrp(), fun_lattr(), fun_lock(), fun_pairs(), fun_set(), fun_xget(), get_obj_and_lock(), init_attrtab(), look_atrs1(), mem_usage(), parse_attrib(), and set_attr_internal().

OBJ* db

Definition at line 38 of file db.c.

NAME* names

Definition at line 39 of file db.c.

Referenced by do_expmail_start(), do_mail_cc(), do_mail_proof(), do_mail_read(), and make_namelist().


Generated on Mon May 28 04:25:28 2007 for BattletechMUX by  doxygen 1.4.7