foundation2_fluffos_v1/
foundation2_fluffos_v1/bin/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/ChangeLog.old/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/Win32/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/compat/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/compat/simuls/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/include/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/clone/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/command/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/data/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/etc/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/include/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/inherit/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/inherit/master/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/log/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/single/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/single/tests/compiler/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/single/tests/efuns/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/single/tests/operators/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/testsuite/u/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/tmp/
foundation2_fluffos_v1/fluffos-2.9-ds2.13/windows/
foundation2_fluffos_v1/lib/cfg/
foundation2_fluffos_v1/lib/cmds/adm/
foundation2_fluffos_v1/lib/daemon/save/
foundation2_fluffos_v1/lib/daemon/services/
foundation2_fluffos_v1/lib/daemon/soul/
foundation2_fluffos_v1/lib/doc/build/
foundation2_fluffos_v1/lib/doc/classes/
foundation2_fluffos_v1/lib/doc/driver/
foundation2_fluffos_v1/lib/doc/driver/applies/
foundation2_fluffos_v1/lib/doc/driver/applies/interactive/
foundation2_fluffos_v1/lib/doc/driver/concepts/
foundation2_fluffos_v1/lib/doc/driver/driver/
foundation2_fluffos_v1/lib/doc/driver/efuns/arrays/
foundation2_fluffos_v1/lib/doc/driver/efuns/buffers/
foundation2_fluffos_v1/lib/doc/driver/efuns/calls/
foundation2_fluffos_v1/lib/doc/driver/efuns/compile/
foundation2_fluffos_v1/lib/doc/driver/efuns/filesystem/
foundation2_fluffos_v1/lib/doc/driver/efuns/floats/
foundation2_fluffos_v1/lib/doc/driver/efuns/functions/
foundation2_fluffos_v1/lib/doc/driver/efuns/general/
foundation2_fluffos_v1/lib/doc/driver/efuns/mappings/
foundation2_fluffos_v1/lib/doc/driver/efuns/numbers/
foundation2_fluffos_v1/lib/doc/driver/efuns/parsing/
foundation2_fluffos_v1/lib/doc/driver/lpc/constructs/
foundation2_fluffos_v1/lib/doc/driver/lpc/types/
foundation2_fluffos_v1/lib/doc/driver/platforms/
foundation2_fluffos_v1/lib/doc/efun/
foundation2_fluffos_v1/lib/doc/etc/
foundation2_fluffos_v1/lib/doc/faq/
foundation2_fluffos_v1/lib/doc/help/creator/
foundation2_fluffos_v1/lib/doc/help/player/
foundation2_fluffos_v1/lib/doc/lpc/basic/
foundation2_fluffos_v1/lib/doc/lpc/data_types/
foundation2_fluffos_v1/lib/doc/lpc/etc/
foundation2_fluffos_v1/lib/doc/lpc/intermediate/
foundation2_fluffos_v1/lib/doc/lpc/types/
foundation2_fluffos_v1/lib/doc/mudlib/
foundation2_fluffos_v1/lib/doc/mudlib/Features/
foundation2_fluffos_v1/lib/domains/Examples/armour/
foundation2_fluffos_v1/lib/domains/Examples/etc/
foundation2_fluffos_v1/lib/domains/Examples/npc/
foundation2_fluffos_v1/lib/domains/Examples/room/
foundation2_fluffos_v1/lib/domains/Examples/virtual/
foundation2_fluffos_v1/lib/domains/Examples/virtual/exaA/
foundation2_fluffos_v1/lib/domains/Examples/virtual/exaB/
foundation2_fluffos_v1/lib/domains/Examples/weapon/
foundation2_fluffos_v1/lib/domains/School/doc/
foundation2_fluffos_v1/lib/domains/School/room/
foundation2_fluffos_v1/lib/domains/School/room/Classes/
foundation2_fluffos_v1/lib/domains/School/room/Offices/
foundation2_fluffos_v1/lib/domains/Standard/
foundation2_fluffos_v1/lib/domains/Standard/pools/
foundation2_fluffos_v1/lib/domains/Standard/std/
foundation2_fluffos_v1/lib/domains/Standard/xtra/
foundation2_fluffos_v1/lib/include/
foundation2_fluffos_v1/lib/lib/obj/
foundation2_fluffos_v1/lib/news/
foundation2_fluffos_v1/lib/save/
foundation2_fluffos_v1/lib/secure/cfg/
foundation2_fluffos_v1/lib/secure/cmds/player/
foundation2_fluffos_v1/lib/secure/lib/
foundation2_fluffos_v1/old/
foundation2_fluffos_v1/win32/
/*    /lib/room.c
 *    from the Foundation II LPC Library
 *    the generic room object
 *    created by Descartes of Borg 940711
 *    modified for new inheritables structure 950208
 */

#include <lib.h>
#include <rooms.h>
#include <config.h>
#include "room.h"

inherit LIB_CONTAINER;
inherit LIB_OBJECT;
inherit LIB_EXITS;
inherit LIB_ITEMS;

private mapping Inventory;
private static int ResetNumber;
private static object *ExtraLongs;

static void create() {
    string *tmp;

    object::create();
    container::create();
    exits::create();
    items::create();
    ResetNumber = 0;
    ExtraLongs = ({});
    Inventory = ([]);
    reset();
    if( replaceable(this_object()) ) {
	tmp = inherit_list(this_object());
	if( sizeof(tmp) == 1 ) replace_program(tmp[0]);
    }
}

void reset() {
    object::reset();
    LoadInventory();
    ResetNumber++;
}

static void init() {
    object::init();
    exits::init();
}

int id(string str) { return items::id(str); }

/* ***************  /lib/room.c command functions  *************** */

int cmdLook(string args) {
    object ob;
    string item;

    if( args == "" || !args ) {
	this_player()->eventDescribeEnvironment(0);
	message("other_action", (string)this_player()->GetName() + 
		" looks around.", this_object(), ({ this_player() }));
	return 1;
    }
    if( sscanf(args, "at %s", item) == 1 ) args = item;
    if( id(args) ) {
	message("item_descriptions", GetLong(args), this_player());
	message("other_action", (string)this_player()->GetName() +
		" looks at the " + args + ".", this_object(), 
		({ this_player() }));
	return 1;
    }
    if( ob=present(args, this_player()) || ob = present(args, this_object()) ){
	string str;

	if( (int)ob->GetInvis(this_player()) ) 
	  return notify_fail(DEFAULT_ITEM_MESSAGE "\n");
	if( !(str = (string)ob->GetLong(args)) ) 
	  return notify_fail(DEFAULT_ITEM_MESSAGE "\n");
	message("item_description", str, this_player());
	if( living(ob) ) {
	  message("other_action", (string)this_player()->GetName() + 
		  " looks you over.", ob);
	  message("other_action", (string)this_player()->GetName() +
		  " looks over " + (string)ob->GetName() + ".",
		  this_object(), ({ ob, this_player() }));
        }
	else message("other_action", (string)this_player()->GetName() + 
		     " looks over " + (string)ob->GetShort() + ".",
		     this_object(), ({ this_player() }));
	return 1;
    }
    return notify_fail(DEFAULT_ITEM_MESSAGE "\n");
}
    
/***********          /lib/room.c events          ***********/

int eventMove(mixed dest) { return 0; }

/* ***************  /lib/room.c lfuns  *************** */

static void LoadInventory() {
    string *files, *borg;
    int i;

    borg = map(all_inventory(this_object()), (: base_name :));
    i = sizeof(files = keys(Inventory));
    while(i--) {
	int x;

	x = Inventory[files[i]] - 
	  sizeof(filter(borg, (: $1 == $(files[i]) :)));
	while(x--) new(files[i])->eventMove(this_object());
    }
}

/***********      /lib/room.c data manipulation functions      **********/

string SetShort(string str) { return object::SetShort(str); }

string SetLong(string str) { return object::SetLong(str); }

string GetShort() { return object::GetShort(); }

varargs string GetLong(string str) {
    string ret, tmp;
    object ob;

    if( str ) return items::GetLong(str);
    else ret = object::GetLong();
    if( !ret ) ret = "";
    if( tmp = GetExtraLong() ) ret += GetExtraLong();
    return ret;
}

object *AddExtraLong(object ob) { 
    if(environment(ob) == this_object()) ExtraLongs += ({ ob });
    return ExtraLongs;
}

static string GetExtraLong() {
    function f;
    string ret;
    int i;

    if( !sizeof(ExtraLongs) ) return 0;
    ret = "";
    ExtraLongs = filter(ExtraLongs, (: environment($1) == this_object() :));
    i = sizeof(ExtraLongs);
    while(i--) ret += "  " + (string)ExtraLongs[i]->GetAffectEnvironment();
    return ret;
}

int GetResetNumber() { return ResetNumber; }
 
string *GetId() { return items::GetId(); }

mapping SetInventory(mapping mp) { 
    Inventory = mp;
    LoadInventory();
    return Inventory;
}

mapping GetInventory() { return Inventory; }