tmi2_fluffos_v2/
tmi2_fluffos_v2/bin/
tmi2_fluffos_v2/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/ChangeLog.old/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/Win32/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/compat/simuls/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/clone/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/command/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/data/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/etc/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/include/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/inherit/master/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/log/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/compiler/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/efuns/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/single/tests/operators/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/testsuite/u/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/tmp/
tmi2_fluffos_v2/fluffos-2.7-ds2.018/windows/
tmi2_fluffos_v2/lib/
tmi2_fluffos_v2/lib/adm/
tmi2_fluffos_v2/lib/adm/daemons/languages/
tmi2_fluffos_v2/lib/adm/daemons/network/I3/
tmi2_fluffos_v2/lib/adm/daemons/virtual/
tmi2_fluffos_v2/lib/adm/daemons/virtual/template/
tmi2_fluffos_v2/lib/adm/news/
tmi2_fluffos_v2/lib/adm/obj/
tmi2_fluffos_v2/lib/adm/obj/master/
tmi2_fluffos_v2/lib/adm/priv/
tmi2_fluffos_v2/lib/adm/shell/
tmi2_fluffos_v2/lib/adm/tmp/
tmi2_fluffos_v2/lib/cmds/
tmi2_fluffos_v2/lib/d/
tmi2_fluffos_v2/lib/d/Conf/
tmi2_fluffos_v2/lib/d/Conf/adm/
tmi2_fluffos_v2/lib/d/Conf/boards/
tmi2_fluffos_v2/lib/d/Conf/cmds/
tmi2_fluffos_v2/lib/d/Conf/data/
tmi2_fluffos_v2/lib/d/Conf/logs/
tmi2_fluffos_v2/lib/d/Conf/obj/
tmi2_fluffos_v2/lib/d/Conf/text/help/
tmi2_fluffos_v2/lib/d/Fooland/adm/
tmi2_fluffos_v2/lib/d/Fooland/data/
tmi2_fluffos_v2/lib/d/Fooland/data/attic/
tmi2_fluffos_v2/lib/d/Fooland/items/
tmi2_fluffos_v2/lib/d/TMI/
tmi2_fluffos_v2/lib/d/TMI/adm/
tmi2_fluffos_v2/lib/d/TMI/boards/
tmi2_fluffos_v2/lib/d/TMI/data/
tmi2_fluffos_v2/lib/d/TMI/rooms/
tmi2_fluffos_v2/lib/d/grid/
tmi2_fluffos_v2/lib/d/grid/adm/
tmi2_fluffos_v2/lib/d/grid/data/
tmi2_fluffos_v2/lib/d/std/
tmi2_fluffos_v2/lib/d/std/adm/
tmi2_fluffos_v2/lib/data/adm/
tmi2_fluffos_v2/lib/data/adm/daemons/
tmi2_fluffos_v2/lib/data/adm/daemons/doc_d/
tmi2_fluffos_v2/lib/data/adm/daemons/emoted/
tmi2_fluffos_v2/lib/data/adm/daemons/network/http/
tmi2_fluffos_v2/lib/data/adm/daemons/network/services/mail_q/
tmi2_fluffos_v2/lib/data/adm/daemons/network/smtp/
tmi2_fluffos_v2/lib/data/adm/daemons/news/archives/
tmi2_fluffos_v2/lib/data/attic/connection/
tmi2_fluffos_v2/lib/data/attic/user/
tmi2_fluffos_v2/lib/data/std/connection/b/
tmi2_fluffos_v2/lib/data/std/connection/l/
tmi2_fluffos_v2/lib/data/std/user/a/
tmi2_fluffos_v2/lib/data/std/user/b/
tmi2_fluffos_v2/lib/data/std/user/d/
tmi2_fluffos_v2/lib/data/std/user/f/
tmi2_fluffos_v2/lib/data/std/user/l/
tmi2_fluffos_v2/lib/data/std/user/x/
tmi2_fluffos_v2/lib/data/u/d/dm/working/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/doc_d/
tmi2_fluffos_v2/lib/data/u/l/leto/smtp/
tmi2_fluffos_v2/lib/doc/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/
tmi2_fluffos_v2/lib/doc/driverdoc/applies/interactive/
tmi2_fluffos_v2/lib/doc/driverdoc/concepts/
tmi2_fluffos_v2/lib/doc/driverdoc/driver/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/arrays/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/buffers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/compile/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/ed/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/filesystem/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/floats/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/functions/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/general/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/mappings/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/numbers/
tmi2_fluffos_v2/lib/doc/driverdoc/efuns/parsing/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/constructs/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/preprocessor/
tmi2_fluffos_v2/lib/doc/driverdoc/lpc/types/
tmi2_fluffos_v2/lib/doc/driverdoc/platforms/
tmi2_fluffos_v2/lib/doc/mudlib/
tmi2_fluffos_v2/lib/ftp/
tmi2_fluffos_v2/lib/include/driver/
tmi2_fluffos_v2/lib/log/
tmi2_fluffos_v2/lib/log/driver/
tmi2_fluffos_v2/lib/obj/net/
tmi2_fluffos_v2/lib/obj/shells/
tmi2_fluffos_v2/lib/obj/tools/
tmi2_fluffos_v2/lib/std/adt/
tmi2_fluffos_v2/lib/std/board/
tmi2_fluffos_v2/lib/std/body/
tmi2_fluffos_v2/lib/std/fun/
tmi2_fluffos_v2/lib/std/living/
tmi2_fluffos_v2/lib/std/object/
tmi2_fluffos_v2/lib/std/shop/
tmi2_fluffos_v2/lib/std/socket/
tmi2_fluffos_v2/lib/std/user/
tmi2_fluffos_v2/lib/std/virtual/
tmi2_fluffos_v2/lib/student/
tmi2_fluffos_v2/lib/student/kalypso/
tmi2_fluffos_v2/lib/student/kalypso/armor/
tmi2_fluffos_v2/lib/student/kalypso/rooms/
tmi2_fluffos_v2/lib/student/kalypso/weapons/
tmi2_fluffos_v2/lib/u/l/leto/
tmi2_fluffos_v2/lib/u/l/leto/cmds/
tmi2_fluffos_v2/lib/www/errors/
tmi2_fluffos_v2/lib/www/gateways/
tmi2_fluffos_v2/lib/www/images/
tmi2_fluffos_v2/old/
tmi2_fluffos_v2/win32/
// This file is part of the TMI mudlib distribution.
// Please include this header if you use this code.
// Written by Buddha@TMI, modularized and revised (5/1/92)
// This is a common module to the different standard objects available.
// Also thanks to Mobydick for his work here.

// #define DEBUG

#include <mudlib.h>
#include <uid.h>
#include <move.h>


// prototypes
mixed query(string what);
varargs void set(string what, mixed value, int access_level);
int remove();
int move(mixed dest);
void add(string what, mixed arg);
varargs void delete(string what, mixed arg);

// The id parsing stuff.

int id(string str) {
        int i;
        string *parts, *ids;
        ids = query("id");
        if (!pointerp(ids) || !ids) return 0;
        if(!stringp(str)) return 0; // bad input
        if(member_array(str, ids) != -1) return 1; // match!
}


// The argument 'dest' is either a string or an object.
// The return values are given in move.h

// updated to use standard properties 8/14/92 buddha@tmi
// also thanks to truilkan for his "last_location" idea, which I converted.

// some stuff commented out by buddha 9/7/92 for speed

int move(mixed dest) {
	object ob;
	string err;
	int bulk, mass;

	bulk = query("bulk");
	mass = query("mass") ;
	// this 'attached' check added by Truilkan 92/06/02
//	if (environment(this_object()) && this_object()->query("attached"))
//		return MOVE_NOT_ALLOWED;
	if (stringp(dest)) {
		ob = find_object(dest);
		if (!ob) { 
                        dest = resolv_path("cwd", dest);
			err = catch(call_other(dest, "???"));
			if (err) { 
				write(err + "\n"); 
				return MOVE_NO_DEST;
			}
			ob = find_object(dest);
		}
	}   
	else ob = dest;
 
	if(environment() && !environment()->release_object(this_object()))
	    return MOVE_NOT_ALLOWED;
 
	if (!ob || !ob->receive_object(this_object()))
	   return MOVE_NOT_ALLOWED;
   
	if (living(this_object()) && living(ob) && !((int)ob->move_ok()))
	   return MOVE_NOT_ALLOWED;
   
        if (environment(this_object()) == ob)
           return MOVE_NOT_ALLOWED;

	if (ob->query("volume") < (int)query("bulk"))
	   return MOVE_NO_ROOM;
   
	if (ob->query("capacity") < (int)query("mass"))
	   return MOVE_TOO_HEAVY ;

	if (environment()) {
	   environment()->add("volume", bulk);
	   environment()->add("capacity", mass) ;
	}
	set("last_location", environment());
	move_object(ob);
	ob->add("volume", -bulk);
	ob->add("capacity", -mass) ;
	return MOVE_OK;
}

/*
* To destruct objects, call 'remove()' in the object. The default here
* is to allow destruction and update encumbrance.
* All objects inside this object is also moved to the "outside" (if any).
*/
int remove() {

   object super;
   int i, res ;
   object *ob_list;
   
   super = environment(this_object());
   if (super) {
      super->add("volume", query("bulk"));
      super->add("capacity", query("mass")) ;
      ob_list = all_inventory(this_object());
      for (i=0; i < sizeof(ob_list); i++) {
         res = ob_list[i]->move(super);
	   if (res!=MOVE_OK) {
		write ("An object vanishes. Tell a wiz!\n") ;
	   }
	}
   }
   destruct(this_object());
   return 1;
}

// clean_up() is called on all objects by the driver in an attempt to do some
// garbage collection.  If it returns 0, then it will never be called again,
// otherwise it will be called after an interval set in the runtime config 
// file.


int clean_up(int inherited) {
	object env, *contents;
	int i;

	if (inherited)  return 0;
	if (userp(this_object())) return 0; /* don't clean_up players */ 
	env = environment();
	if (env && userp(env)) return 1; /* carried ob */
	if (env && environment(env)) 
		return (int)environment(env)->clean_up(); /* recurse */
	contents = deep_inventory(this_object());
	if (contents) {
		for (i=0;i<sizeof(contents);i++)
			if (userp(contents[i])) return 1; /* holding a user */
	}
	if (!env) {
		/* Don't clean up base objects from /std/ */
		if (!inherits(ROOM, this_object()) && !clonep(this_object()) 
		      && (file_name(this_object())[0..4] == "/std/"))
		    return 0;

		/* we're a room with no users inside or a lost object */
		remove();
		return 1;
	}
	return 1; /* try again later... */
}


// anything can get anything right now.

int receive_object(object foo) {
	return 1;
}

// anything can be moved from it right now.

int release_object(object foo) {
	return 1;
}
 
// The recursive light checking function.
// Blame Mobydick, it's his fault.

int check_light() {

	int i ;
	object *obs ;

// First, if this object is emitting light, we have a light source.

	if (query("light")) return 1 ;

// Second, if this object has no inventory, we do not have a light source.

	obs = all_inventory(this_object()) ;
	if (!obs) return 0 ;

// Third, if this object is opaque, we do not have a light source.

	if (query("opaque")) return 0 ;

// If this is a transparent container that is not itself emitting light, then
// we recursively check light on its contents until we find one of them that
// is emitting light or we run out, in which case we do not have a source.

	for (i=0;i<sizeof(obs);i++) {
		if (obs[i]->check_light()) return 1 ;
	}
	return 0 ;
}