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/object.c
 *    from the Foundation II LPC Library
 *    object inherited by all tangible objects (ones with environments)
 *    created by Descartes of Borg 940211
 *    bug in properties fixed by Douglas Reay (Pallando @ many muds) 940601
 *    eventMove() altered by Pallando, 940705
 *    updated to NM IV lfun changes
 */

#include <lib.h>
#include <daemons.h>
#include <config.h>
#include "object.h"

inherit LIB_CLEAN;

private string CapName;
private mixed Short, Long, Read;
private static string *Id, *Adjectives;
private static string KeyName, Creator;
private static mapping Properties;

/***********           /lib/object.c driver applies         **********/

static void create() {
    object ob;

    clean::create();
    Properties = ([]);
    Adjectives = ({});
    Id = ({});
    Creator = ( (ob = previous_object()) ? file_name(ob) : "Unknown" );
}

static void init() { /* nothing goes here... just for design purposes */ }

void reset() { /* Nothing goes here... just for design purposes */ }

int id(string str) {                                          
    if(!str) return 0;                                        
    if(!stringp(str)) error("Bad argument 1 to id().\n");     
    return (member_array(lower_case(str), GetId()) != -1); 
}
      
string *parse_command_id_list() { return GetId(); }

string *parse_command_plural_id_list() { 
    return map(GetId(), (: pluralize :)); 
}
                                                          
string *parse_command_adjectiv_id_list() { return GetAdjectives(); }
             
/***********          /lib/object.c commands          **********/

int cmdRead(string str) {
    mixed val;

    if( !str || !(val = GetRead(str)) ) return notify_fail("Read what?\n");
    if( !id(str) ) return notify_fail("You do not notice that here!\n");
    if( functionp(val) ) return (int)evaluate(val, str);
    message("info", val, this_player());
    message("other_action", sprintf("%s reads %s", 
      (string)this_player()->GetName(), GetShort()),
      environment(this_player()), ({ this_player() }));
    return 1;
}
    
/*  **********        /lib/object.c events          *********  */

/*  ***************  /lib/object.c lfuns  *************** */

static int Destruct() {    
    object env;          
    int x;               
                         
    if( env = environment() ) {                                         
        env->eventReleaseObject(this_object());
        if( !(x = clean::Destruct()) ) env->eventReceiveObject(this_object());
        return x;                                                       
    }
    else return clean::Destruct(); 
}                                                                       

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

void SetId(mixed val) {
    if( stringp(val) ) val = ({ val });
    else if( !pointerp(val) ) error("Bad argument 1 to SetId().\n");
    Id = val;
}

string *GetId() { return (Id + ({ GetKeyName() })); }

void SetAdjectives(mixed adjs) {
    if( stringp(adjs) ) adjs = ({ adjs });
    else if( !pointerp(adjs) ) error("Bad argument 1 to SetAdjectives().\n");
    Adjectives = adjs;
}

string *GetAdjectives() { return Adjectives; }

string SetKeyName(string nom) { 
    if( !stringp(nom) ) error("Bad argument 1 to SetKeyName().\n");
    KeyName = lower_case(nom);
    if( !CapName ) CapName = capitalize(nom);
    return KeyName;
}

string GetKeyName() { return KeyName; }

string SetCapName(string str) {
    if( !stringp(str) ) error("Bad argument 1 to SetCapName().\n");
    else return (CapName = str);
}

string GetCapName() { return CapName; }

string GetName() { return GetCapName(); }

mixed SetShort(mixed val) {
    if( !stringp(val) && !functionp(val) ) 
      error("Bad argument 1 to SetShort().\n");
    return (Short = val);
}

string GetShort() {
    if( !Short ) return 0;
    if( functionp(Short) ) return (string)evaluate(Short);
    else return Short;
}

mixed SetLong(mixed val) {
    if( !stringp(val) && !functionp(val) ) 
      error("Bad argument 1 to SetLong().\n");
    return (Long = val);
}

varargs string GetLong(string str) {
    if( !Long ) return "";
    if( functionp(Long) ) return (string)evaluate(Long, str);
    else return Long;
}

varargs mixed SetRead(mixed val, mixed unused) {  
    if( (stringp(unused) || functionp(unused)) && stringp(val) ) {
	if(mapp(Read)) Read[val] = unused;
	else Read = ([ val : unused ]);
	return Read[val];
    }
    else return (Read = val);
}

varargs mixed GetRead(string str) { 
    if( mapp(Read) ) return Read[str];
    else return Read;
}

mapping SetProperties(mapping props) { return (Properties += props); }

mapping GetProperties() { return Properties; }

mixed SetProperty(string prop, mixed val) { return (Properties[prop] = val); }

mixed GetProperty(string prop) { return Properties[prop]; }

mixed AddProperty(string prop, mixed val) {
    if( Properties[prop] ) Properties[prop] += val;
    else Properties[prop] = val;
    return Properties[prop];
}

int RemoveProperty(string prop) {
    if( undefinedp(Properties[prop]) ) return 1;
    else map_delete(Properties, prop);
    return !Properties[prop];
}