move.c

foundation2_fluffos_v1/lib/lib/move.c · 1.2 KB

From the archive foundation2_fluffos_v1.zip

Download the archive   « Back to the archive contents

/* /lib/move.c
 * from the Foundation II LPC Library
 * functions for basic movement
 * created by Descartes of Borg 950209
 */

#include "move.h"

private static object LastEnvironment;

/***********        /lib/move.c events          **********/

int eventMove(mixed dest) {
    object ob;

    if( !this_object() ) return 0;
    if( environment() ) {
	int x;

	x = (int)environment()->CanRelease(this_object());
        if( !x && !archp() ) return 0;
    }
    if( stringp(dest) ) {
        if( !(ob = find_object(dest)) ) {
	    string str;

            if( str = catch(call_other(dest, "???")) ) {
                if( creatorp() ) message("error", str, this_object());
                return 0;
            }
            ob = find_object(dest);
        }
    }
    else ob = dest;
    if( !ob || ob == this_object() ) return 0;
    if( living(this_object()) && living(ob) ) return 0;
    if( !((int)ob->CanReceive(this_object())) ) return 0;
    if( LastEnvironment = environment() ) environment()->eventReleaseObject();
    move_object(ob);
    environment()->eventReceiveObject();
    return (LastEnvironment != environment());
}

/* ***************  /lib/move.c data functions  *************** */

object GetLastEnvironment() { return LastEnvironment; }

Site Stats

Snippets: 1791
Codebases: 571