这篇教程C++ users函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中users函数的典型用法代码示例。如果您正苦于以下问题:C++ users函数的具体用法?C++ users怎么用?C++ users使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了users函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: saveAllPlayersvoid Mineserver::saveAllPlayers(){ for (std::set<User*>::const_iterator it = users().begin(); it != users().end(); ++it) { if ((*it)->logged) (*it)->saveData(); }}
开发者ID:SkyFire,项目名称:mineserver,代码行数:7,
示例2: update_ads_phasevoid update_ads_phase(){ int i; int ads_count = 0; object* all; remove_call_out("update_ads_phase"); if(current_ads_phase==0) { init_ads_phase(); } current_ads_phase = (++current_ads_phase) % sizeof(ads_phase); message("channel:ads", "【广告】" + ads_phase[current_ads_phase]["time_msg"] + "/n", users()); all = users(); for(i=0;i<sizeof(all);i++) { if( member_array("ads", all[i]->query("channels"))==-1 ) continue; else ads_count++; } if(ads_count >=1) { // message( "channel:wiz", sprintf("【巫师】%d 个玩家接收此广告。/n", ads_count), users()); log_file("ADS", sprintf("[%s] /"" + ads_phase[current_ads_phase]["time_msg"] + "/" 被 [%d] 个玩家接收/n", ctime(time()), ads_count)); } this_object()->event_common(); call_out("update_ads_phase", ads_phase[current_ads_phase]["length"]);}
开发者ID:heypnus,项目名称:xkx2001,代码行数:33,
示例3: getLoggedUsersCountsize_t Mineserver::getLoggedUsersCount(){ size_t count = 0; for(std::set<User*>::const_iterator it = users().begin(); it != users().end(); ++it) { if((*it)->logged) count++; } return count;}
开发者ID:MitchellMarx,项目名称:mineserver,代码行数:8,
示例4: event_noonvoid event_noon(){ object *ob; int i, skill,con,con1,con2,con3; string get_month,ill,msg;get_month = CHINESE_D->chinese_month(TIME_TICK); switch(get_month) { case "三": case "四": case "五": ill = "ill_kesou"; msg = HIG + "忽然喉头一阵痕痒,你感觉似乎要咳嗽了。/n" + NOR; break; case "六": case "七": case "八": ill = "ill_zhongshu"; msg = HIG+"突然你胸臆之间一阵翻腾,你中暑了。/n" + NOR; break; case "九": case "十": case "十一": ill = "ill_shanghan"; msg = HIG+"陡的你打了个冷战,头昏沉沉的,你得伤寒病了。/n"+NOR; break; case "十二": case "一": case "二": ill = "ill_dongshang"; msg = HIG+"你肢体末端一阵僵直,看来你被冻伤了。/n"+NOR; break; } if(random(2)) { ill = "ill_fashao";msg = HIG+"你偶感风寒,竟而发起烧来。/n"+NOR; } ob = users(); for(i=0; i<sizeof(ob); i++) { if( !environment(ob[i]) ) continue; if( !environment(ob[i])->query("outdoors") ) continue; if( ob[i]->query("age")==14 ) continue;con1 = ob[i]->query("kee"); con2 = ob[i]->query("max_kee"); (int)con = con1/con2*50;//形成第一个生病判断条件con3 = ob[i]->query("force");con2 = ob[i]->query("max_force"); if( con2 == 0) con2 = 1; (int)con1 = con3/con2*50;//形成第二个生病判断条件 if(random(con)+random(50)+random(con1)<25) { ob[i]->apply_condition(ill, 10); tell_object(ob[i], msg); } }message("channel:chat", HIY +"【闲聊】太监:时至午正,皇上退朝,文武百官下殿!/n"+ NOR, users());}
开发者ID:mudchina,项目名称:fy3,代码行数:58,
示例5: autosavevoid autosave(){ object *user ; int i; user = users(); message("chat", HIY "自动更新幻想西天TASK任务。/n"NOR, users()); for(i=0; i<sizeof(user); i++) user[i]->save();}
开发者ID:gongfuPanada,项目名称:xyj2006,代码行数:9,
示例6: autosavevoid autosave(){ object *user ; int i; user = users(); message("system", HIR "/n 自动存档...", users()); for(i=0; i<sizeof(user); i++) user[i]->save(); message("system", HIG "...存档完毕 /n" NOR, users()); }
开发者ID:mudchina,项目名称:fy4,代码行数:10,
示例7: mainint main(object me, string str){ if (!str) { write(CYN"你看起来表情丰富。/n"NOR); return 1; } str = replace_string(str, "$BLK$", BLK); str = replace_string(str, "$RED$", RED); str = replace_string(str, "$GRN$", GRN); str = replace_string(str, "$YEL$", YEL); str = replace_string(str, "$BLU$", BLU); str = replace_string(str, "$MAG$", MAG); str = replace_string(str, "$CYN$", CYN); str = replace_string(str, "$WHT$", WHT); str = replace_string(str, "$HIR$", HIR); str = replace_string(str, "$HIG$", HIG); str = replace_string(str, "$HIY$", HIY); str = replace_string(str, "$HIB$", HIB); str = replace_string(str, "$HIM$", HIM); str = replace_string(str, "$HIC$", HIC); str = replace_string(str, "$HIW$", HIW); str = replace_string(str, "$NOR$", NOR); if( strsrch(str, "$ME$") == -1 ) write("你输入的字串中必需含有$ME$/n"); else{ str = replace_string(str, "$ME$", me->name()); if(check_legal_name(str)) message("channel:chat", GRN +"【闲聊】"+ str + "/n" + NOR, users()); } return 1;}
开发者ID:mudchina,项目名称:fy2,代码行数:32,
示例8: cmdint cmd(){ int i; object *user_ob; string ret, name, *user_name; user_ob = users(); user_name = ({ });
开发者ID:Elohim,项目名称:FGmud,代码行数:7,
示例9: cmdmixed cmd(string str) { if(!TP->query_creator() && !TP->query_property("emoteall")) { return notify_fail(NOT_ALLOWED); } if(!str || str == "") { return notify_fail("Syntax : emoteall <string>/n"); } if(!TP->query_creator() && TP->adjust_sp(-EMOTEALL_COST*((strlen(str)/10)+1)+100) < 0) { return notify_fail(NO_POWER); } str = replace(str, BEEP, ""); if (TP->query_volume(D_ALCOHOL)) { str = TP->drunk_speech(str); } log_file("ECHOS", ctime(time())+" "+TP->query_name()+" emotes "+ "to all: "+str+"/n"); str += "%^RESET%^"; my_mess("You emoteall : ", TP->query_cap_name()+" " + str); TP->comm_event(users(), "player_emote_all", "%^BOLD%^%^RED%^" + TP->query_cap_name() + " " + str + "/n"); return 1;}
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:25,
示例10: init_day_phasevoid init_day_phase(){ mixed *local; int i, t; // Get minutes of today. local = localtime(TIME_TICK); t = local[2] * 60 + local[1]; // hour * 60 + minutes // Find the day phase for now. for( i=0; i < sizeof(day_phase); i++) if( t >= day_phase[i]["length"] ) t -= (int)day_phase[i]["length"]; else break; current_day_phase = (i==0? sizeof(day_phase)-1: i - 1); current_day_phase = (i==0? sizeof(day_phase)-1: i - 1); // MUD 运行时间久了,时间会有偏差,这里是调整程序,每小时执行一次 message("channel:sys", HIR"【系统】泥巴时间对齐系统时间,一小时一次。/n"NOR, users()); remove_call_out("init_day_phase"); call_out("init_day_phase", 3600); // Since in our time scale, 1 minute == 1 second in RL, so we don't need // any conversion before using this number as call_out dalay, if you // changed the time scale, be sure to convert it. call_out("update_day_phase", (int)day_phase[(current_day_phase+1) % sizeof(day_phase)]["length"]-t);}
开发者ID:aricxu,项目名称:xkx100,代码行数:29,
示例11: mainint main(object me, string file){ if (! SECURITY_D->valid_grant(me, "(apprentice)")) return 0; if (! file) return notify_fail("指令格式:edit <档名>/n"); if (in_edit(me)) return notify_fail("你已经在使用编辑器了。/n"); file = resolve_path(me->query("cwd"), file); foreach (object user in users()) if (file == in_edit(user)) return notify_fail(HIM "共享冲突:" + user->name(1) + HIM "(" + capitalize(user->query("id")) + ")" + HIM "正在编辑该文件(" + file + ")。/n" NOR); printf("编辑文件:%s/n", file); CHANNEL_D->do_channel(this_object(), "sys", sprintf("%s(%s)正在编辑文件(%s)。", me->name(1), capitalize(me->query("id")), file)); seteuid(geteuid(me)); me->set("cwf", file); SECURITY_D->backup_file(file); ed(file); log_file("static/edit", sprintf("%s %-9s edit %s from %s./n", log_time(), geteuid(me), file, query_ip_name(me))); return 1;}
开发者ID:mudchina,项目名称:nitan3,代码行数:35,
示例12: next_stepvoid next_step(string ours, string later, object tp) { string color; object *people; int i; i = random(6); switch(i) { case 0: color = "%^RED%^"; break; case 1: color = "%^ORANGE%^"; break; case 2: color = "%^BLUE%^"; break; case 3: color = "%^CYAN%^"; break; case 4: color = "%^MAGENTA%^"; break; case 5: color = "%^BOLD%^%^WHITE%^"; break; default: color = "%^GREEN%^"; break; } if(random(2) == 0) color += "%^BOLD%^"; people = users(); i = sizeof(people); message("info", color+later+"%^RESET%^", tp); while(i--) { if(tp == people[i]) continue; if(!environment(people[i])) continue; if(environment(people[i])->query_property("indoors") == 1) continue; message("info", color+ours+"%^RESET%^", people[i]); }}
开发者ID:ehershey,项目名称:pd,代码行数:26,
示例13: where_allint where_all(){ string str; object *list; int i, j, ppl_cnt; object me, where; me = this_player(); str = "* " + MUD_NAME + "/n"; str += "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!/n"; str += " C++ ushort函数代码示例 C++ userret函数代码示例
|