⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 object.c

📁 C实现的MUD,对大家基本入门网络游戏很有帮助!
💻 C
字号:
// object.cvarargs int getoid(object ob){   int id;   if (!ob) ob = previous_object();   sscanf(file_name(ob), "%*s#%d", id);   return id;}// Get the owner of a file.  Used by log_error() in master.c.string file_owner(string file){    string name, rest, dir;    if (file[0] != '/') {        file = "/" + file;    }    if (sscanf(file, "/u/%s/%s/%s", dir, name, rest) == 3) {        return name;    }    return 0;}// domain_file should return the domain associated with a given file.string domain_file(string file){   string domain;   if( sscanf(file, "/d/%s/%*s", domain) )     return domain;   return ROOT_UID;}// creator_file should return the name of the creator of a specific file.string creator_file(string file){   string *path;   path = explode(file, "/") - ({ 0 });   switch(path[0]) {     case "adm":        if( file==SIMUL_EFUN_OB ) return "MudOS";        else return ROOT_UID;     case "cmds":        return ROOT_UID;     case "u":        if( sizeof(path)>=4 ) return path[2];     case "d":     case "open":     case "ftp":        if( sizeof(path)>=3 ) return path[1];     default:        if( this_player(1) )          return getuid(this_player(1));        else          return "MudOS";   }}// author_file should return the name of the author of a specific file.string author_file(string file){   string name;   if( sscanf(file, "/u/%*s/%s/%*s", name) )     return name;   return ROOT_UID;}void destruct(object ob){   if (ob) {     if( previous_object() ) ob->remove( geteuid(previous_object()) );     else ob->remove(0);   efun::destruct(ob);  //put this inside the if(ob). mon 8/19/97   }}// added by xuy. int living(object ob){        if (ob && ob->query_temp("disabled") )                return 0;        return efun::living(ob);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -