phantasmal_dgd_v1/
phantasmal_dgd_v1/bin/
phantasmal_dgd_v1/doc/
phantasmal_dgd_v1/mud/doc/
phantasmal_dgd_v1/mud/doc/api/
phantasmal_dgd_v1/mud/doc/kernel/
phantasmal_dgd_v1/mud/doc/kernel/hook/
phantasmal_dgd_v1/mud/doc/kernel/lfun/
phantasmal_dgd_v1/mud/include/
phantasmal_dgd_v1/mud/include/kernel/
phantasmal_dgd_v1/mud/kernel/lib/
phantasmal_dgd_v1/mud/kernel/lib/api/
phantasmal_dgd_v1/mud/kernel/obj/
phantasmal_dgd_v1/mud/kernel/sys/
phantasmal_dgd_v1/mud/tmp/
phantasmal_dgd_v1/mud/usr/System/
phantasmal_dgd_v1/mud/usr/System/keys/
phantasmal_dgd_v1/mud/usr/System/obj/
phantasmal_dgd_v1/mud/usr/System/open/lib/
phantasmal_dgd_v1/mud/usr/common/data/
phantasmal_dgd_v1/mud/usr/common/lib/parsed/
phantasmal_dgd_v1/mud/usr/common/obj/telopt/
phantasmal_dgd_v1/mud/usr/common/obj/ustate/
phantasmal_dgd_v1/mud/usr/game/
phantasmal_dgd_v1/mud/usr/game/include/
phantasmal_dgd_v1/mud/usr/game/obj/
phantasmal_dgd_v1/mud/usr/game/object/
phantasmal_dgd_v1/mud/usr/game/object/stuff/
phantasmal_dgd_v1/mud/usr/game/sys/
phantasmal_dgd_v1/mud/usr/game/text/
phantasmal_dgd_v1/mud/usr/game/users/
phantasmal_dgd_v1/src/host/
phantasmal_dgd_v1/src/host/beos/
phantasmal_dgd_v1/src/host/mac/
phantasmal_dgd_v1/src/host/unix/
phantasmal_dgd_v1/src/host/win32/res/
phantasmal_dgd_v1/src/kfun/
phantasmal_dgd_v1/src/lpc/
phantasmal_dgd_v1/src/parser/
#include <phantasmal/lpc_names.h>

/* This is the lightweight object (LWO) which the objectd uses to keep
   track of issues of objects -- that is, individual compiled versions
   of them.  There may be more than one issue per object in some
   cases.
*/

/* The ISSUE_LWO is a structure which contains the info we care about
   for each issue.  That means it stores things like object name,
   issue compile time, and so on.  LWOs may link to each other since
   the group of them exist entirely within the single HEAVY_ARRAY (see
   below).  The ISSUE_LWO is never used directly, but is instead used
   as one of LIB_LWO or CLONABLE_LWO, both of which inherit from
   ISSUE_LWO. */


/*** Object Data ***/

/* The object name - may be shared with other issues of the same object */
string ob_name;
/* The object index -- unique to this issue */
int index;
/* The time this issue was compiled */
private int comp_time;
/* Array of objects inherited from */
private mixed* inherit_from;
/* Array of paths this issue depends on directly other than parents */
private string* depends_on;
/* Previous version, if any, of this issue */
private int prev_index;
/* Whether the object has been destructed */
private int destructed;

static int create(varargs int clone) {
  if(clone) {
    ob_name = "";
    destructed = 0;
  }
}

static void set_vals(int new_index, string new_owner, string new_name,
		     mixed* new_inherit_from,
		     string* new_depends_on, int new_prev_index) {
  if(ob_name != "")
    error("Reinitializing ISSUE object!");

  if(new_name == "" || new_name == nil)
    error("Initializing ISSUE object with invalid name!");

  index = new_index;
  ob_name = new_name;

  comp_time = time();
  inherit_from = new_inherit_from;
  depends_on = new_depends_on;

  prev_index = new_prev_index;
}

string get_name() {
  return ob_name;
}

int get_index() {
  return index;
}

int get_comp_time() {
  return comp_time;
}

mixed* get_dependencies(void) {
  return depends_on;
}

void clear_dependencies(void) {
  depends_on = ({ });
}

void add_dependency(string dep) {
  depends_on += ({ dep });
}

mixed* get_parents(void) {
  return inherit_from;
}

void set_parents(mixed* new_parents) {
  inherit_from = new_parents;
}

void remove_parent(int parent) {
  int ctr;

  for(ctr = 0; ctr < sizeof(inherit_from); ctr++) {
    if(inherit_from[ctr] == parent) {
      inherit_from = inherit_from[..ctr-1] + inherit_from[ctr+1..];
      return;
    }
  }
  error("Cannot remove parent " + parent + " from issue " + index);
}

int get_prev(void) {
  return prev_index;
}

object clear_prev(void) {
  if(previous_program() == OBJECTD) {
    prev_index = -1;
  } else error("Can't set prev from unprivileged program!");
}

void set_prev(int prev) {
  if(previous_program() == OBJECTD) {
    prev_index = prev;
  } else error("Can't set prev from unprivileged program!");
}

void destruct(void) {
  if(destructed)
    error("Object multiply notified of destruction!");

  destructed = 1;
}

int destroyed(void) {
  return destructed;
}