本文整理汇总了C++中mixed类的典型用法代码示例。如果您正苦于以下问题:C++ mixed类的具体用法?C++ mixed怎么用?C++ mixed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了mixed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: query
varargs mixed query(string prop, int raw) {
mixed data, pdata;
if(!mapp(dbase)) {
return 0;
}
if(undefinedp(dbase[prop]) && (strsrch(prop, '/')!=-1)) {
data = _query(dbase, explode(prop, "/"));
} else {
data = dbase[prop];
}
if(default_ob) {
if(undefinedp(data)) {
data = default_ob->query(prop, 1);
} else if(mapp(data)) {
pdata = default_ob->query(prop, 1);
if(mapp(pdata)) {
data = pdata + data;
}
}
}
if(raw) {
return data;
}
return evaluate( data, this_object() );
}
开发者ID:mudchina,项目名称:fy4,代码行数:29,代码来源:dbase.c
示例2: CheckOrc
int CheckOrc(mixed val){
if(!val) return 0;
if(!objectp(val)) return 0;
if(val->GetRace() == "orc" || val->GetRace() == "rodent") return 0;
else eventForce("growl at "+val->GetKeyName());
return 1;
}
开发者ID:Elohim,项目名称:FGmud,代码行数:7,代码来源:chieftain.c
示例3: CheckOrc
int CheckOrc(mixed val){
if(!val) return 0;
if(!objectp(val)) return 0;
if(val->GetRace() == "orc" || val->GetRace() == "rodent") return 0;
eventForce("growl at "+val->GetKeyName());
eventForce("say murdering, genocidal humanoids! Leave us alone!");
return 1;
}
开发者ID:Lundex,项目名称:deadsouls,代码行数:8,代码来源:kurogane.c
示例4: receive_wound
varargs int receive_wound(string type, int damage, mixed who)
{
int val;
if( damage < 0 ) error("F_DAMAGE: 伤害值为负值。\n");
if( type!="jing" && type!="qi" )
error("F_DAMAGE: 伤害种类错误( 只能是 jing, qi 其中之一 )。\n");
set_temp("last_damage_from", who);
if(living(this_object()) && objectp(who) && userp(who))
set_temp("last_eff_damage_from", who->query("id"));
val = (int)query("eff_" + type) - damage;
if( val >= 0 ) set("eff_" + type, val);
else {
set( "eff_" + type, -1 );
val = -1;
}
if( (int)query(type) > val ) set(type, val);
set_heart_beat(1);
return damage;
}
开发者ID:heypnus,项目名称:xkx2001,代码行数:28,代码来源:damage_backup.c
示例5: set_default_object
void set_default_object(mixed ob)
{
// if( geteuid(previous_object()) != ROOT_UID )
// error("dbase: Only this_object() or object with root euid can set default_ob.\n");
if( !geteuid() ) seteuid(getuid());
default_ob = ob;
ob->add("no_clean_up", 1);
}
开发者ID:mudchina,项目名称:fy3,代码行数:8,代码来源:dbase.c
示例6: MarriageRequest
int MarriageRequest(mixed arg1, mixed arg2, mixed arg3){
string s1, s2, dudename;
object ob1, ob2;
if(strsrch(arg2,"divorce") != -1){
this_object()->performDivorce(arg1);
return 1;
}
if(sscanf(arg3,"%s and %s", s1, s2) !=2 &&
sscanf(arg3,"%s to %s", s1, s2) !=2){
eventForce("say "+arg1->GetName()+", you are confusing me.");
return 1;
}
dudename = arg1->GetKeyName();
if(s1 == "me" || s1 == "i") s1 = dudename;
if(s2 == "me" || s2 == "i") s2 = dudename;
if(s1 != dudename && s2 != dudename ){
eventForce("say Those people will have to decide "+
"to get married on their own. It isn't "+
"any of your business.");
return 1;
}
if( s1 == s2){
eventForce("say we don't do single-member marriages here.");
return 1;
}
if(! ob1 = present(s1, environment(this_object()))){
eventForce("say "+capitalize(s1)+" isn't here.");
return 1;
}
if(! ob2 = present(s2, environment(this_object()))){
eventForce("say "+capitalize(s2)+" isn't here.");
return 1;
}
if(!living(ob1) || !living(ob2)){
eventForce("say I do not perform marriages with inanimate objects.");
return 1;
}
this_object()->performMarriage(ob1, ob2);
return 1;
}
开发者ID:Elohim,项目名称:FGmud,代码行数:45,代码来源:clerk.c
示例7: pluralize
string pluralize(mixed single) {
int x;
string str, tmp;
if(!single) return single;
if(objectp(single)) {
if(str = (string)single->query("plural name")) return str;
else str = (string)single->query_name();
}
else str = (string)single;
if(!str) return str;
x = strlen(str);
if(ABNORMAL[str]) return ABNORMAL[str];
if(x > 2 && str[x-3..x-1] == "man")
return str[0..x-3]+"en";
if(x > 1) {
tmp = str[x-2..x-1];
switch(tmp) {
case "ts": return str+"";
case "ch": case "sh":
return str+"es";
case "ff": case "fe":
return str[0..x-3]+"ves";
case "us":
return str[0..x-3]+"i";
case "um":
return str[0..x-3]+"a";
case "ef":
return str+"s";
}
}
tmp = str[x-1..x-1];
// 2 bug fixes by Whit
if(str[sizeof(str)-2..sizeof(str)] == "ts") return str;
if(str[sizeof(str)-2..sizeof(str)] == "es") return str;
switch(tmp) {
case "s":
return str+"es";
case "o": case "x":
return str+"es";
case "wolf": return str[0..x-4]+"wolves";
case "f": return str[0..x-2]+"ves";
case "y" : return str[0..x-2]+"ies";
}
return str+"s";
}
开发者ID:ehershey,项目名称:pd,代码行数:45,代码来源:pluralize.c
示例8: send_beep
void send_beep(object o_user, mixed t_user, string t_mud)
{
if(objectp(t_user)) t_user = lower_case(t_user->query_name());
else
if(stringp(t_user)) t_user = lower_case(t_user);
else return;
find_object(I3_CHDMOD)->sendToUser("beep", o_user->query_name(), t_mud, t_user, 0);
}
开发者ID:abzde,项目名称:dock9,代码行数:10,代码来源:mod_beep.c
示例9: setup
void setup( mixed who, int s_o )
{
if ( !who ) return ;
subj_obj = s_o;
if ( stringp( who ) )
{
string used_mudname;
sscanf( who, "%[email protected]%s", user_name, used_mudname );
if ( used_mudname )
mudname = IMUD_D->canon_mudname( used_mudname );
if ( mudname )
{
int gend = IMUD_D->get_gender( mudname, user_name );
// No idea if this is silent or not ...
#if 0
if ( this_body() ) move( this_body(), "in" );
#else
// This is probably safer -Beek
move_object(this_body());
#endif
set_id( "wibblewibble"+lower_case(user_name) + " "+
replace_string( lower_case(used_mudname), ".", " " ) );
set_gender( gend == -1 ? 1 : gend ); // Assume male if unknown
} else
remove();
} else
{
set_gender( who->query_gender() );
user_name = who->query_userid();
}
// we exist temporarily only
call_out( (: remove :), 0);
}
开发者ID:Shea690901,项目名称:lima,代码行数:41,代码来源:ichannelt.c
示例10: _the_short
string _the_short(mixed x)
{
if(objectp(x))
return x->the_short();
// Check for "the" prefix - if missing, add it
if(stringp(x))
if(strsrch(lower_case(x), "the ") != 0)
return "the " + x;
return x;
}
开发者ID:Lundex,项目名称:lima,代码行数:12,代码来源:m_messages.c
示例11: query_with_slash
varargs mixed query_with_slash(string prop, int raw)
{
mixed data;
if( !mapp(dbase) ) return 0;
if( undefinedp(dbase[prop]) && (strsrch(prop, '.')!=-1) )
data = _query(dbase, explode(prop, "."));
else
data = dbase[prop];
if( undefinedp(data) && default_ob )
data = default_ob->query(prop, 1);
if( raw ) return data;
return evaluate( data, this_object() );
}
开发者ID:mudchina,项目名称:fy4,代码行数:13,代码来源:dbase.c
示例12: query_mortal
nomask int query_mortal(mixed player) {
if (objectp(player)) {
if (!player <-"/sys/obj/player") {
return 0;
}
player = player->query_name();
} else {
argcheck(stringp(player), 1, "player object or string");
}
return !query_wizard(player);
}
开发者ID:sirdude,项目名称:gurbalib,代码行数:13,代码来源:query_mortal.c
示例13: query_admin
int query_admin(mixed player) {
if(objectp(player)) {
if( !player<-"/sys/lib/player" ) {
return 0;
}
player = player->query_name();
} else {
argcheck( stringp( player ), 1, "player object or string" );
}
return SECURE_D->query_admin( player ) ;
}
开发者ID:Shea690901,项目名称:gurbalib,代码行数:13,代码来源:query_admin.c
示例14: send_error
varargs void send_error(mixed o_user, string t_mud, mixed t_user, string err_code, string err_msg, mixed *packet)
{
if(intp(o_user)) o_user = 0;
else
if(objectp(o_user)) o_user = o_user->query_name();
else
if(stringp(o_user)) o_user = lower_case(o_user);
else o_user = 0;
if(intp(t_user)) t_user = 0;
else
if(objectp(t_user)) t_user = t_user->query_name();
else
if(stringp(t_user)) t_user = lower_case(t_user);
else t_user = 0;
find_object(I3_CHDMOD)->sendToUser("error", o_user, t_mud, t_user, ({
err_code,
err_msg,
packet ? packet : 0
}) );
开发者ID:abzde,项目名称:dock9,代码行数:22,代码来源:mod_error.c
示例15: destruct
/*
* destruct modified to cope with virtual objects
*/
void destruct(mixed name) {
object obj;
if(stringp(name)) {
obj = find_object(name);
if(obj->query_property("file_name"))
HANDLER->destruct_virtual_object(obj);
destruct(obj);
} else if(objectp(name)) {
if(name->query_property("file_name"))
HANDLER->destruct_virtual_object(name);
destruct(name);
}
}
开发者ID:Yuffster,项目名称:discworld_distribution_mudlib,代码行数:17,代码来源:efuns.c
示例16: remove_eternal_fate
void remove_eternal_fate(mixed ob)
{
string keyword;
if (stringp(ob)) keyword = ob;
else if (objectp(ob)) {
keyword = ob->query("fate_keyword");
if (!keyword)
keyword = file_name(ob);
} else
return;
map_delete(eternal_fates, keyword);
}
开发者ID:wingkit,项目名称:xyj-ali,代码行数:14,代码来源:fate.c
示例17: set_wearing
void set_wearing( mixed obj ) {
object armor;
if( !obj )
return;
if( typeof(obj) == T_STRING ) {
/* We've got to compile our own copy */
armor = clone_object( obj );
if( armor ) {
armor->setup();
armor->move( this_object() );
if( !query_slot( armor->query_slot() ) ) {
do_wear( armor );
}
}
} else {
obj->move( this_object() );
if( !query_slot( obj->query_slot() ) ) {
do_wear( obj );
}
}
}
开发者ID:dworkin,项目名称:gurbalib,代码行数:23,代码来源:monster.c
示例18: add_eternal_fate
void add_eternal_fate(mixed ob, string fate)
{
string keyword;
if (stringp(ob)) keyword = ob;
else if (objectp(ob)) {
keyword = ob->query("fate_keyword");
if (!keyword)
keyword = file_name(ob);
} else
return;
if (!eternal_fates) eternal_fates = ([]);
eternal_fates += ([ keyword : fate ]);
}
开发者ID:wingkit,项目名称:xyj-ali,代码行数:15,代码来源:fate.c
示例19: add_fate
void add_fate(mixed ob, function f)
{
string keyword;
if (stringp(ob)) keyword = ob;
else if (objectp(ob)) {
keyword = ob->query("fate_keyword");
if (!keyword)
keyword = file_name(ob);
} else
return;
if (!fates) fates = ([]);
fates += ([ keyword : f ]);
}
开发者ID:wingkit,项目名称:xyj-ali,代码行数:15,代码来源:fate.c
示例20: _a_short
string _a_short(mixed x)
{
if(objectp(x))
return x->a_short();
// Check for "a"/"an" prefix - if missing, add it
if(stringp(x))
if(strsrch(lower_case(x), "a ") != 0)
if(strsrch(lower_case(x), "an ") != 0)
{
if(member_array(x[0],vowels) == -1)
return "a " + x;
else
return "an " + x;
}
return x;
}
开发者ID:Lundex,项目名称:lima,代码行数:16,代码来源:m_messages.c
注:本文中的mixed类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论