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/
/*
 * pathspecial.c
 *
 * Once ConfigD has set this object up, the Object Daemon will query
 * it to determine the path-special objects for everything in the
 * system.  The idea is that this file hardcodes certain files as
 * having particular special AUTO objects, and then hands off to the
 * game's path-special object (set in GAME_INITD) for everything else
 * that isn't in /usr/common or /usr/System.

 * Currently, only files under a /usr/ directory may have a special
 * AUTO object.  The Kernel Library prevents files under /usr/System
 * from having one, though.
 */

#include <phantasmal/lpc_names.h>

inherit COMMON_AUTO;

private object game_path_object;

string path_special(string file) {
  string user, subdir;

  if(file == COMMON_AUTO)
    return nil;

  if(sscanf(file, "/usr/%s/%s/%*s", user, subdir) != 3) {
    return nil;
  }

  if(user != "System" && user != "common" && subdir == "script")
    return INHERIT_SCRIPT_AUTO;

  if(user == "common") {
    return INHERIT_COMMON_AUTO;
  }

  if(game_path_object) {
    return game_path_object->path_special(file);
  }

  return nil;
}

void set_game_path_object(object new_obj) {
  if(previous_program() == CONFIGD)
    game_path_object = new_obj;
  else
    error("Only ConfigD can set the game_path_object!");
}