/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
inherit "/std/room";

mapping room_cont;
int     max_num;

void    create()
{
    room_cont = ([ ]);
    max_num = 8;
    ::create();
    call_out( "test_cont", 0 );
}

mapping query_room_cont()
{
    return room_cont;
}

int     query_max_num()
{
    return max_num;
}
void    set_max_num( int i )
{
    max_num = i;
}

void    add_thing( object ob )
{
    string  shr;
    int     value;

    if( !ob || environment( ob ) != this_object() )
	return;
    shr = (string)ob->short();

    if( !room_cont[ shr ] )
    {
	room_cont[ shr ] = ({ ob });
	return;
    }
    if( sizeof( room_cont[ shr ] ) > max_num )
	call_out( "do_dest", 0, ob );
    else
	room_cont[ shr ] += ({ ob });
    return;
}

void    do_dest( object ob )
{
    if( ob && environment( ob ) == this_object() )
	ob->dest_me();
}

/* for updateing etc.... */
void    test_cont()
{
    int     i;
    object *obs;

    obs = all_inventory();
    for( i = 0; i < sizeof( obs ); i++ )
	add_thing( obs[ i ] );
}

void    remove_thing( object ob )
{
    mixed * arr;
    int     i, val;
    string  sh;

    if( !ob || environment( ob ) == this_object() )
	return;
    sh = (string)ob->short();

    if( !room_cont[ sh ] )
	return;
    arr = room_cont[ sh ];
    if( (i = member_array( ob, arr )) == -1 )
	return;
    if( sizeof( arr ) <= 1 )
    {
	room_cont = m_delete( room_cont, sh );
    }
    else
	room_cont[ sh ] = delete( arr, i, 1 );
}

void    event_enter( object ob )
{
    call_out( "add_thing", 0, ob );
}

void    event_exit( object ob )
{
    call_out( "remove_thing", 0, ob );
}