Beispiel #1
1
static int create(varargs int clone) {
  string *files;
  int i, n;

  if(!find_object(EVENT_CODE_D)) compile_object(EVENT_CODE_D);
  if(!find_object(GAME_D)) compile_object(GAME_D);
}
Beispiel #2
1
/* This function looks through the appropriate subdirectories for room
   files and sets them up with the MapD */
static void load_custom_rooms(void) {
  mixed **dir_list;
  int     ctr;
  string  err, prog_name;
  object  new_obj;

  dir_list = get_dir(GAME_ROOMS_DIR + "*");
  for(ctr = 0; ctr < sizeof(dir_list[0]); ctr++) {
    if(dir_list[1][ctr] == -2) {
      /* TODO: Directory, recurse */
    } else if(sscanf(dir_list[0][ctr], "%s.c", prog_name) == 1) {
      /* Custom room file, make sure the room is used */
      LOGD->write_syslog("Compiling room " + prog_name);
      /* Try to compile object for use. */
      compile_object(GAME_ROOMS_DIR + prog_name);
      new_obj = find_object(GAME_ROOMS_DIR + prog_name);
      if(new_obj)
	/* Add the object type to the room binder by calling its create() */
	call_other_unprotected(new_obj, "???");
      else
	error("Can't find room type " + GAME_ROOMS_DIR + prog_name
	      + "!  Aborting!");
    }
  }
}
Beispiel #3
1
static void create(void) {
  string throwaway, mob_file;

  /* Build game driver and set it */
  throwaway = catch (find_object(GAME_DRIVER) ? nil
		     : compile_object(GAME_DRIVER));
  if(find_object(GAME_DRIVER))
    CONFIGD->set_game_driver(find_object(GAME_DRIVER));

  /* Register a help directory for the HelpD to use */
  HELPD->new_help_directory("/usr/game/help");

  load_sould();

  /* Load stuff into MAPD and EXITD */
  if(read_object_dir(ROOM_DIR) >= 0) {
    EXITD->add_deferred_exits();
    MAPD->do_room_resolution(1);
  } else {
    error("Can't read object files!  Dying!\n");
  }

  /* Load the mobilefile into MOBILED */
  mob_file = read_file(MOB_FILE);
  if(mob_file) {
    MOBILED->add_unq_text_mobiles(mob_file, MOB_FILE);
  } else {
    error("Can't read mobile file!  Dying!\n");
  }

  LOGD->write_syslog("Configured Phantasmal from /usr/game!");
}
Beispiel #4
0
/*
 * NAME:	create()
 * DESCRIPTION:	initialize object
 */
static void create()
{
    /* load essential objects */
    if (!find_object(TELNET_CONN)) { compile_object(TELNET_CONN); }
    if (!find_object(BINARY_CONN)) { compile_object(BINARY_CONN); }
    if (!find_object(DEFAULT_USER)) { compile_object(DEFAULT_USER); }

    /* initialize user arrays */
    users = ({ });
Beispiel #5
0
void enter_hole(void) {
   object obj;

   if (this_player()->is_completed_quest("NewbieVille")) {
      write("You don't seem to fit through the hole anymore.");
      this_object()->tell_room(this_player(), this_player()->query_Name() + 
         " tries to squeeze through the hole but can not seem to " +
         "fit through it.");
      return;
   } else {
      obj = find_object(FILE);
      if (!obj) {
         obj = compile_object(FILE);
         if (!obj) {
            write("Error in loading destination.\n");
            return;
         }
         obj->setup();
         obj->setup_mudlib();
      }
      if (this_player()->move(obj)) {
         write("You wriggle through the hole.");
         this_object()->tell_room(this_player(),
            this_player()->query_Name() + " squeezes through the hole.\n");
         this_player()->do_look(this_environment());
      }
   }
   return;
}
Beispiel #6
0
object new_user_connection(string first_line) {
  if(!AUTHORIZED())
    error("Can't call function!  Not authorized!");

  if(!find_object(GAME_USER))
    compile_object(GAME_USER);

  return clone_object(GAME_USER);
}
Beispiel #7
0
static void create(void) {
  game_driver = nil;

  if(!find_object(PATHSPECIAL))
    compile_object(PATHSPECIAL);

  INITD->set_path_special_object(find_object(PATHSPECIAL));  

  upgraded();
}
Beispiel #8
0
void create() {
   ansid = find_object(ANSI_D);
   if (!ansid) {
      ansid = compile_object(ANSI_D);
   }

   set_property("auto_admin",0,"*","system");
   set_property("auto_wiz",0,"*","system");
   user_name = "Guest";
   data_version = 1;
   run_as("nobody");
}
Beispiel #9
0
static int upgrade_uobj(string * files, int verbose) {
    int pos, sz;

    for( pos = 0, sz = sizeof( files ); pos < sz; pos++ ) {
        if(verbose) write("Upgrading "+files[pos]);
        if(COMPILER_D->test_inheritable(files[pos])) {
            compile_library( files[pos] );
        } else {
            compile_object( files[pos] );
        }
    }
    return pos;
}
Beispiel #10
0
static object clone_object( string path ) {
  object ob, ed;
  string trace;
  string cloner;

  argcheck( path, 1, "string" );

  ed = find_object(ERROR_D);

  /*
   * yeah.. calling the error_d to get a formatted runtime trace.. no, we aren't
   * reporting an error here, just using one of its nice utility functions to get
   * a nicely formatted trace
   *
   */
  if(ed) trace = ed->format_runtime_error("Clone calltrace",::call_trace(),0,0,0);
  else trace = "No clone calltrace available\n";

  if(this_object()->is_player() && this_object()->query_name()) {
    cloner = this_object()->query_name();
  } else if(sscanf(object_name(this_object()),"/cmds/wiz/%*s") == 1 && this_user()) {
    cloner = this_user()->query_name();
  } else {
    cloner = _owner;
  }

  if( strlen(path) > 2 ) {
    if( path[strlen(path)-2] == '.' && path[strlen(path)-1] == 'c' )
      path = path[..strlen(path)-3];
  }

  if(find_object(COMPILER_D)) {
    path = COMPILER_D->allow_object( path );
  }

  if( !(ob = find_object( path ) ) ) {
    ob = compile_object( path );
    call_other(ob,"???");
  }

  ob = ::clone_object( ob );
  ob->_F_set_cloner(cloner,trace);
  ob->_F_create();
  return ob;
}
Beispiel #11
0
void summon_guard() {
   object env;
	remove_corpse();
   env = this_object()->query_environment();
   if (env) {
      if (env->present("guard")) {
			guard->respond("growl");
         return;
      }
      if (!find_object(NOKICLIFFS_BRAIN_GUARD)) {
         compile_object(NOKICLIFFS_BRAIN_GUARD);
      }
      if (!guard) {
         guard = clone_object(NOKICLIFFS_BRAIN_GUARD);
			guard->setup();
      }
      guard->move(env);
      env->tell_room(this_object(), "The brain's guardian " +
         "appears in a puff of smoke.");
		guard->announce_yourself();
   }
}
Beispiel #12
0
// Main compiler dispatch system
void compile(compiler_wrapper *cw, ast_node *root)
{
    switch(root->type)
    {
        case ABINARY_EXPRESSION:
            compile_binary(cw, root);
        break;
        case AUNARY_EXPRESSION:
            compile_unary(cw, root);
        break;
        case AVALUE:
            compile_value(cw, root);
        break;
        case AUNIT:
            compile_unit_value(cw, root);
        break;
        case ACOND_CHAIN:
            compile_cond(cw, root);
        break;
        case AIF:
            compile_if(cw, root);
        break;
        case ALOOP:
            compile_loop(cw, root);
        break;
        case AITERLOOP:
            compile_iter_loop(cw, root);
        break;
        case AFUNC_DECL:
            compile_function(cw, root);
        break;
        case AFUNC_CALL:
            compile_function_call(cw, root);
        break;
        case ACLASS_DECL:
            compile_class_decl(cw, root);
        break;
        case ATERNARY:
            compile_ternary(cw, root);
        break;
        case AMEMBER_ACCESS:
            compile_member_access(cw, root);
        break;
        case AARRAY:
            compile_array(cw, root);
        break;
        case ATABLE:
            compile_table(cw, root);
        break;
        case AOBJDECL:
            compile_object(cw, root);
        break;
        case AINDEX:
            compile_indx(cw, root);
        break;
        case ATRIPLESET:
            compile_triple_set(cw, root);
        break;
        case ATRYCATCH:
            compile_try_catch(cw, root);
        break;
        case AONEOFF:
            compile_one_off(cw, root);
        break;
        case ALOAD:
            compile_load(cw, root);
        break;
        case AREGEX:
            compile_regex(cw, root);
        break;
        default:
        break;
    }
}
Beispiel #13
0
static void create(void) {
  string mob_file;

  LOGD->write_syslog("**** Starting Test Game, "
		     + GAME_VERSION + " ****");

  /* GAME_PATH_SPECIAL should be compiled before any other object.  It
     changes the behavior of other objects because it sets their AUTO
     objects.  Rather than messing with all that nasty complexity,
     just compile this first so other objects in /usr/game always
     inherit from the same AUTO object(s). */
  if(!find_object(GAME_PATH_SPECIAL))
    compile_object(GAME_PATH_SPECIAL);
  CONFIGD->set_path_special_object(find_object(GAME_PATH_SPECIAL));

  /* Build game driver and set it */
  if(!find_object(GAME_DRIVER))
    compile_object(GAME_DRIVER);
  CONFIGD->set_game_driver(find_object(GAME_DRIVER));

  /* Find and compile the room registry *before* the first room is
     loaded.  Otherwise things will crash. */
  if(!find_object(GAME_ROOM_REGISTRY))
    compile_object(GAME_ROOM_REGISTRY);

  /* Load configuration for game driver */
  config_unq_file();

  /* Set up TagD */
  load_tagd();

  /* Tests a simple script */
  set_up_scripting();

  /* Register a help directory for the HelpD to use */
  HELPD->new_help_directory("/usr/game/help");

  /* Load the SoulD with social commands */
  load_sould();

  /* We have to load the custom room types before we read all the
     rooms into MAPD.  That way, rooms of custom types will
     successfully find the binder code that they need. */
  load_custom_rooms();

  compile_object(GAME_ROOM_BINDER);
  MAPD->set_binding_handler(find_object(GAME_ROOM_BINDER));

  /* Load stuff into MAPD and EXITD */
  if(read_object_dir(ROOM_DIR) >= 0) {
    EXITD->add_deferred_exits();
    MAPD->do_room_resolution(1);
  } else {
    LOGD->write_syslog("Can't read object files!  Starting incomplete!",
		       LOG_ERROR);
  }

  /* Load the mobilefile into MOBILED */
  mob_file = read_file(MOB_FILE);
  if(mob_file) {
    MOBILED->add_unq_text_mobiles(mob_file, MOB_FILE);
  } else {
    LOGD->write_syslog("Can't read mobile file!  Starting w/o mobiles!",
		       LOG_ERROR);
  }

  /* Set up heart_beat functions */
  if(!find_object(HEART_BEAT))
    compile_object(HEART_BEAT);
  HEART_BEAT->set_up_heart_beat();

  /* Support particular MUDclient protocols */
  MUDCLIENTD->protocol_allow("FIRECLIENT", 1);

  LOGD->write_syslog("Configured Phantasmal from /usr/game!");
}
Beispiel #14
0
static void set_up_scripting(void) {
  /* Test script obj */
  compile_object("/usr/game/script/test_script");
  call_other_unprotected("/usr/game/script/test_script", "???");
}
Beispiel #15
0
static void create (varargs int clone){
    if (!find_object (SYSTEM_USER))
	compile_object (SYSTEM_USER);
    USERD->set_binary_manager (0, this_object ());
}
Beispiel #16
0
static void create(varargs int clone) {
    object driver;
    object telnet_manager;
    object http_manager;
    object rsrc_manager;
    object objreg_manager;

    driver = find_object(DRIVER);

    if(!find_object(LOG_D)) {
      compile_object(LOG_D);
    }

    if(find_object(LOG_D)) {
      /* driver -> set_error_manager(find_object(LOG_D)); */
    }

    if(!find_object(TELNET_D)) {
        compile_object(TELNET_D);
    }

    telnet_manager = find_object(TELNET_D);
    "/kernel/sys/userd" -> set_telnet_manager(0, telnet_manager);

    if(!find_object(HTTP_D)) {
      compile_object(HTTP_D);
    }

    http_manager = find_object(HTTP_D);

    "/kernel/sys/userd" -> set_binary_manager(1, http_manager);

    if(!find_object(HTTP_SYSTEM_RESOURCE)) {
      compile_object(HTTP_SYSTEM_RESOURCE);
    }


    if(!find_object("/usr/System/obj/wiztool")) {
        compile_object("/usr/System/obj/wiztool");
    }

    if(!find_object(MAPPING_D)) compile_object(MAPPING_D);
    if(!find_object(STRING_D)) compile_object(STRING_D);
    if(!find_object(AUTH_D)) compile_object(AUTH_D);
    if(!find_object(COMMAND_D)) compile_object(COMMAND_D);

    rsrc::create();

    rsrc::add_owner("ToolLib");
    rsrc::add_owner("DevLib");
    rsrc::add_owner("IFLib");
    rsrc::add_owner("WorldLib");
    rsrc::add_owner("GameLib");

    if(!find_object(TOOLLIB_INIT)) compile_object(TOOLLIB_INIT);
    if(!find_object(DEVLIB_INIT)) compile_object(DEVLIB_INIT);
    if(!find_object(WORLDLIB_INIT)) compile_object(WORLDLIB_INIT);
    if(!find_object(IFLIB_INIT)) compile_object(IFLIB_INIT);
    if(!find_object(GAMELIB_INIT)) compile_object(GAMELIB_INIT);

    http_manager -> update_resource_handlers_from_config();
    find_object(COMMAND_D) -> hash_commands();
}