clean_up.c

foundationI_fluffos_v1/lib/std/clean_up.c · 1.4 KB

From the archive foundation1_fluffos_v1.zip

Download the archive   « Back to the archive contents

/*    /std/clean_up.c
 *    from Nightmare IV
 *    the central object of the entire mudlib
 *    created by Descartes of Borg 940210
 */

#include <move.h> 
#include "clean_up.h"
 
static private int __NoClean; 
 
void create() { 
    __NoClean = 0; 
} 
 
int clean_up() { 
    object ob, env; 
    object *inv; 
    int i; 
 
    if(__NoClean) return NEVER_AGAIN; 
    if(!(ob = this_object()) || ob->query_auto_load()) return NEVER_AGAIN; 
    if(userp(ob)) return NEVER_AGAIN; 
    if(env = environment(ob)) { 
        if((int)env->is_bag()) return TRY_AGAIN_LATER; 
        if((int)env->query_property("storage room")) return TRY_AGAIN_LATER; 
    } 
    i = sizeof(inv = deep_inventory(ob)); 
    if(sizeof(users() & inv)) return TRY_AGAIN_LATER; 
    if(!env) { 
        while(i--) inv[i]->remove(); 
        if(ob) ob->remove(); 
        if(ob) destruct(ob); 
        return NEVER_AGAIN; 
    } 
    if(userp(env)) return TRY_AGAIN_LATER; 
    return (int)env->clean_up(); 
} 
 
int move(mixed dest) { return MOVE_NOT_ALLOWED; } 
 
int remove() { 
    object env; 
    object *inv; 
    int i; 
 
    if(env = environment(this_object())) { 
        i = sizeof(inv = all_inventory(this_object())); 
        while(i--) inv[i]->move(env); 
    } 
    destruct(this_object()); 
    return !(this_object()); 
} 
 
static void set_no_clean(int x) { __NoClean = x; } 
 
int query_no_clean() { return __NoClean; }  
 
 

Site Stats

Snippets: 1791
Codebases: 571