tmuck2.4/
tmuck2.4/admin/scripts/
tmuck2.4/docs/
tmuck2.4/minimal-db/
tmuck2.4/minimal-db/data/
tmuck2.4/minimal-db/logs/
tmuck2.4/minimal-db/muf/
tmuck2.4/old/
tmuck2.4/src/
tmuck2.4/src/compile/
tmuck2.4/src/editor/
tmuck2.4/src/game/
tmuck2.4/src/interface/
tmuck2.4/src/scripts/
tmuck2.4/src/utilprogs/
/* Copyright (c) 1992 by David Moore.  All rights reserved. */
/* recycle.c,v 2.3 1993/04/08 20:24:37 dmoore Exp */
#include "config.h"

#include "db.h"
#include "match.h"
#include "externs.h"

void do_recycle(const dbref player, const char *name, const char *ignore1, const char *ignore2)
{
    dbref thing;
    struct match_data md;
    
    init_match(player, name, TYPE_THING, &md);
    match_all_exits(&md);
    match_neighbor(&md);
    match_possession(&md);
    match_here(&md);
    match_absolute(&md);
    thing = noisy_match_result(&md);
    
    if (thing == NOTHING) return;

    if (thing < 0 || thing >= db_top) return;

    if (Typeof(thing) == TYPE_GARBAGE) {
        notify(player, "That's already garbage!");
	return;
    }

    if (!controls(player, thing, 0)) {
        notify(player, "Permission denied.");
	return;
    }

    switch (Typeof(thing)) {
    case TYPE_ROOM:
        if (thing == player_start || thing == global_environment) {
            notify(player, "This room may not be recycled.");
            return;
        }
        break;
    case TYPE_PLAYER:
        notify(player, "You can't recycle a player!");
	return;
	break;
    }
    recycle(player, thing);
}