Exemplo n.º 1
0
void restore_autoload()
{
  int i;
  object ob;
  string file, *autodir, param, err;

  if( !pointerp(autoload) ) return;

  for(i=0; i<sizeof(autoload); i++) {
    printf ("autoload %d = %s\n", i+1, autoload[i]);
    if( sscanf(autoload[i], "%s:%s", file, param)!=2 ) {
      file = autoload[i];
      param = 0;
    }
    autodir = explode (file, "/");
#ifndef SAVEEQ
    if (autodir[0] != "obj" &&
        (autodir[0] != "data" || autodir[1] != "autoload")) {
      write ("你有一个自动载入的物件没放在该放的地方:"+file+"\n");
      continue;
    }
#endif
    err = catch(ob = new(file));
    if( err || !ob ) {
      write("你觉得似乎失落了什么重要的东西,最好通知一下巫师。\n");
      log_file("AUTOLOAD", sprintf("Fail to autoload %s of %s, error %s\n",
        file, this_object()->query("name"), err));
      continue;
    }
    export_uid(ob);
    ob->move(this_object());
    ob->autoload(param);
  }
  clean_up_autoload();    // To save memory.
}
Exemplo n.º 2
0
void restore_autoload() {
        int i;
        object ob;
        string file, param, err; 
        if(!pointerp(autoload)) {
                return;
        }
        for(i=0; i<sizeof(autoload); i++) {
                if( sscanf(autoload[i], "%s:%s", file, param)!=2 ) {
                        file = autoload[i];
                   param = 0;
                }
                err = catch(ob = new(file));
                if( err || !objectp(ob) ) {
                        write("你觉得似乎失落了什麽重要的东西,最好通知一下巫师。\n");
                        log_file("AUTOLOAD", sprintf("Fail to autoload %s of %s, error %s\n",
                                file, this_object()->query("name"), err));
                        continue;
                }
                export_uid(ob);
                ob->move(this_object());
                ob->autoload(param);
        }
        clean_up_autoload();            // To save memory.
}