#include #include #include #include #include "db.h" #include "match.h" #include "externs.h" #include "unused-arg.h" void do_debug(dbref player, UNUSED_ARG(const char *cmd), const char *arg1, UNUSED_ARG(const char *arg2)) { dbref loc; struct match_data md; char buf[64]; if (*arg1) { init_match(player,arg1,TYPE_ROOM,&md); match_here(&md); match_absolute(&md); loc = noisy_match_result(&md); if (loc == NOTHING) return; } else { loc = DBFETCH(player)->location; } if ((loc < 0) || (loc >= db_top)) { notify(player,"Not a valid dbref."); return; } if (Typeof(loc) != TYPE_ROOM) { notify(player,"Not a room."); return; } if (!controls(player,loc)) { notify(player,"Permission denied."); return; } { time_t t; double d; t = DBFETCH(loc)->sp.room.stamp; d = DBFETCH(loc)->sp.room.useval * pow(USEVAL_SCALE,curtm()-t); sprintf(&buf[0],"%g %.24s -> %g (%g)",DBFETCH(loc)->sp.room.useval,ctime(&t),d,exp(-d)); } notify(player,&buf[0]); } struct object *dbfetch(int x) { if ((x < 0) || (x >= db_top)) kill(getpid(),SIGABRT); return(db+x); }