本文整理汇总了C++中ABORT_MPI函数的典型用法代码示例。如果您正苦于以下问题:C++ ABORT_MPI函数的具体用法?C++ ABORT_MPI怎么用?C++ ABORT_MPI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ABORT_MPI函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mfn_holds
const char *
mfn_holds(MFUNARGS)
{
dbref obj1 = mesg_dbref_raw(descr, player, what, perms, argv[0]);
dbref obj2 = player;
if (argc > 1)
obj2 = mesg_dbref_local(descr, player, what, perms, argv[1], mesgtyp);
if (obj1 == UNKNOWN || obj1 == AMBIGUOUS || obj1 == NOTHING || obj1 == HOME)
ABORT_MPI("HOLDS", "Match failed (1).");
if (obj1 == PERMDENIED)
ABORT_MPI("HOLDS", "Permission Denied (1).");
if (obj2 == UNKNOWN || obj2 == AMBIGUOUS || obj2 == NOTHING || obj2 == HOME)
ABORT_MPI("HOLDS", "Match failed (2).");
if (obj2 == PERMDENIED)
ABORT_MPI("HOLDS", "Permission Denied (2).");
if (obj2 == getloc(obj1)) {
return "1";
} else {
return "0";
}
}
示例2: mfn_name
const char *
mfn_name(MFUNARGS)
{
char *ptr;
// dbref obj = mesg_dbref_proximity(player, what, perms, argv[0]);
dbref obj = mesg_dbref_raw(player, what, perms, argv[0]);
if (obj == UNKNOWN)
ABORT_MPI("NAME","Match failed.");
if (obj == NOTHING) {
strcpy(buf, "#NOTHING#");
return buf;
}
if (obj == AMBIGUOUS) {
strcpy(buf, "#AMBIGUOUS#");
return buf;
}
if (obj == HOME) {
strcpy(buf, "#HOME#");
return buf;
}
if (!(Typeof(obj) == TYPE_PLAYER) &&
!mesg_proximity_perms(player, perms, obj))
ABORT_MPI("NAME","Permission denied.");
strcpy(buf, RNAME(obj));
if (Typeof(obj) == TYPE_EXIT) {
ptr = index(buf, ';');
if (ptr) *ptr = '\0';
}
return buf;
}
示例3: mfn_controls
const char *
mfn_controls(MFUNARGS)
{
dbref obj;
dbref obj2;
obj = mesg_dbref_raw(player, what, perms, argv[0]);
if (obj == AMBIGUOUS || obj == NOTHING || obj == UNKNOWN)
ABORT_MPI("CONTROLS","Match failed. (1)");
if (obj == PERMDENIED)
ABORT_MPI("CONTROLS","Permission denied. (1)");
if (obj == HOME) obj = DBFETCH(player)->sp.player.home;
if (argc > 1) {
obj2 = mesg_dbref_raw(player, what, perms, argv[1]);
if (obj2 == AMBIGUOUS || obj2 == NOTHING || obj2 == UNKNOWN)
ABORT_MPI("CONTROLS","Match failed. (2)");
if (obj2 == PERMDENIED)
ABORT_MPI("CONTROLS","Permission denied. (2)");
if (obj2 == HOME) obj2 = DBFETCH(player)->sp.player.home;
if (Typeof(obj2) != TYPE_PLAYER) obj2 = OWNER(obj2);
} else {
obj2 = OWNER(perms);
}
if (controls(obj2, obj)) {
return "1";
} else {
return "0";
}
}
示例4: mfn_testlock
const char *
mfn_testlock(MFUNARGS)
{
struct boolexp *lok;
dbref who = player;
dbref obj = mesg_dbref_local(player, what, perms, argv[0]);
if (argc > 2)
who = mesg_dbref_local(player, what, perms, argv[2]);
if (who == AMBIGUOUS || who == UNKNOWN || who == NOTHING || who == HOME)
ABORT_MPI("TESTLOCK","Match failed. (1)");
if (who == PERMDENIED)
ABORT_MPI("TESTLOCK","Permission denied. (1)");
if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
ABORT_MPI("TESTLOCK","Match failed. (2)");
if (obj == PERMDENIED)
ABORT_MPI("TESTLOCK","Permission denied. (2)");
lok = get_property_lock(obj, argv[1]);
if (argc > 3 && lok == TRUE_BOOLEXP)
return (argv[3]);
if (eval_boolexp(who, lok, obj)) {
return "1";
} else {
return "0";
}
}
示例5: mfn_lunion
const char *
mfn_lunion(MFUNARGS)
{
int iter_limit = MAX_MFUN_LIST_LEN;
char *ptr, *ptr2, *p;
int len;
int outlen, nextlen;
*buf = '\0';
outlen = 0;
ptr = argv[0];
while (*ptr) {
for (ptr2 = ptr; *ptr2 && *ptr2 != '\r'; ptr2++);
if (*ptr2) *(ptr2++) = '\0';
len = strlen(ptr);
p = buf;
do {
if (string_prefix(p, ptr) && (!p[len] || p[len] == '\r'))
break;
while (*p && *p != '\r') p++;
if (*p) p++;
} while (*p);
if (!*p) {
nextlen = strlen(ptr);
if (outlen + nextlen > BUFFER_LEN - 3)
break;
if (outlen) strcat((buf+(outlen++)), "\r");
strcat((buf+outlen), ptr);
outlen += nextlen;
}
ptr = ptr2;
if (!(--iter_limit))
ABORT_MPI("LUNION","Iteration limit exceeded");
}
ptr = argv[1];
while (*ptr) {
for (ptr2 = ptr; *ptr2 && *ptr2 != '\r'; ptr2++);
if (*ptr2) *(ptr2++) = '\0';
len = strlen(ptr);
p = buf;
do {
if (string_prefix(p, ptr) && (!p[len] || p[len] == '\r'))
break;
while (*p && *p != '\r') p++;
if (*p) p++;
} while (*p);
if (!*p) {
nextlen = strlen(ptr);
if (outlen + nextlen > BUFFER_LEN - 3)
break;
if (outlen) strcat((buf+(outlen++)), "\r");
strcat((buf+outlen), ptr);
outlen += nextlen;
}
ptr = ptr2;
if (!(--iter_limit))
ABORT_MPI("LUNION","Iteration limit exceeded");
}
return buf;
}
示例6: mfn_showlist
const char *
mfn_showlist(MFUNARGS)
{
dbref obj;
const char *m = NULL;
int lines=0;
if(argc > 1) {
obj = mesg_dbref_mage(player, what, perms, argv[1]);
if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
ABORT_MPI("SHOWLIST","Match failed");
if (obj == PERMDENIED)
ABORT_MPI("SHOWLIST",NOPERM_MESG);
} else obj = what;
if (Prop_Hidden(argv[0]) && (Permlevel(perms) < tp_hidden_prop_mlevel))
ABORT_MPI("SHOWLIST",NOPERM_MESG);
while ( (lines < MAX_MFUN_LIST_LEN) && (!lines || (m && *m)) ) {
sprintf(buf, "%s#/%d", argv[0], ++lines);
m = safegetprop_strict(player, obj, perms, buf);
if( m && *m ) {
notify_nolisten(player, m, 1);
}
}
buf[0] = '\0';
return buf;
}
示例7: mfn_func
const char *
mfn_func(MFUNARGS)
{
char *funcname;
char *ptr=NULL, *def;
char namebuf[BUFFER_LEN];
char argbuf[BUFFER_LEN];
char defbuf[BUFFER_LEN];
int i;
funcname = MesgParse(argv[0], namebuf, sizeof(namebuf));
CHECKRETURN(funcname, "FUNC", "name argument (1)");
def = argv[argc - 1];
for (i = 1; i < argc - 1; i++) {
ptr = MesgParse(argv[i], argbuf, sizeof(argbuf));
CHECKRETURN(ptr, "FUNC", "variable name argument");
snprintf(defbuf, sizeof(defbuf), "{with:%.*s,{:%d},%.*s}", MAX_MFUN_NAME_LEN, ptr, i,
(BUFFER_LEN - MAX_MFUN_NAME_LEN - 20), def);
}
i = new_mfunc(funcname, defbuf);
if (i == 1)
ABORT_MPI("FUNC", "Function Name too long.");
if (i == 2)
ABORT_MPI("FUNC", "Too many functions defined.");
return "";
}
示例8: mfn_center
const char *
mfn_center(MFUNARGS)
{
/* {center:string,fieldwidth,padstr} */
/* Center justify string to a fieldwidth, filling with padstr */
char *ptr;
char *fptr;
int i, len, halflen;
char *fillstr;
len = (argc > 1) ? atoi(argv[1]) : 78;
if (len > BUFFER_LEN - 1)
ABORT_MPI("CENTER", "Fieldwidth too big.");
halflen = len / 2;
fillstr = (argc > 2) ? argv[2] : " ";
if (!*fillstr)
ABORT_MPI("CENTER", "Null pad string.");
for (ptr = buf, fptr = fillstr, i = strlen(argv[0]) / 2; i < halflen; i++) {
*ptr++ = *fptr++;
if (!*fptr)
fptr = fillstr;
}
strcpyn(ptr, buflen - (ptr - buf), argv[0]);
for (i = strlen(buf), ptr = &buf[i], fptr = fillstr; i < len; i++) {
*ptr++ = *fptr++;
if (!*fptr)
fptr = fillstr;
}
*ptr = '\0';
return buf;
}
示例9: mfn_with
const char *
mfn_with(MFUNARGS)
{
char vbuf[BUFFER_LEN];
char *ptr, *valptr;
int v, cnt;
ptr = MesgParse(argv[0], argv[0]);
CHECKRETURN(ptr,"WITH","arg 1");
v = new_mvar(ptr, vbuf);
if (v == 1)
ABORT_MPI("WITH","Variable name too long");
if (v == 2)
ABORT_MPI("WITH","Too many variables already defined");
valptr = MesgParse(argv[1], argv[1]);
CHECKRETURN(valptr,"WITH","arg 2");
*buf = '\0';
strcpy(vbuf, valptr);
for (cnt = 2; cnt < argc; cnt++) {
ptr = MesgParse(argv[cnt],argv[cnt]);
if (!ptr) {
sprintf(buf, "%s %cWITH%c (%d)", get_mvar("how"),
MFUN_LEADCHAR, MFUN_ARGEND, cnt);
notify(player, buf);
return NULL;
}
}
free_top_mvar();
return ptr;
}
示例10: mfn_lexec
const char *
mfn_lexec(MFUNARGS)
{
dbref trg = (dbref) 0, obj = what;
char *pname;
const char *ptr;
int blessed = 0;
pname = argv[0];
if (argc == 2) {
obj = mesg_dbref(descr, player, what, perms, argv[1], mesgtyp);
}
if (obj == PERMDENIED)
ABORT_MPI("LEXEC", "Permission denied.");
if (obj == UNKNOWN || obj == AMBIGUOUS || obj == NOTHING || obj == HOME)
ABORT_MPI("LEXEC", "Match failed.");
while (*pname == PROPDIR_DELIMITER)
pname++;
ptr = get_concat_list(player, what, perms, obj, (char *)pname, buf, BUFFER_LEN, 2, mesgtyp, &blessed);
if (!ptr)
ptr = "";
trg = what;
if (blessed) {
mesgtyp |= MPI_ISBLESSED;
} else {
mesgtyp &= ~MPI_ISBLESSED;
}
if (Prop_ReadOnly(pname) || Prop_Private(pname) || Prop_SeeOnly(pname) || Prop_Hidden(pname))
trg = obj;
ptr = mesg_parse(descr, player, obj, trg, ptr, buf, BUFFER_LEN, mesgtyp);
CHECKRETURN(ptr, "LEXEC", "listval");
return ptr;
}
示例11: mfn_fullname
const char *
mfn_fullname(MFUNARGS)
{
dbref obj;
obj = tp_compatible_mpi
? mesg_dbref_raw(player, what, perms, argv[0])
: mesg_dbref_local(player, what, perms, argv[0])
;
if (obj == UNKNOWN)
ABORT_MPI("NAME","Match failed");
if (obj == PERMDENIED)
ABORT_MPI("NAME",NOPERM_MESG);
if (obj == NOTHING) {
strcpy(buf, "#NOTHING#");
return buf;
}
if (obj == AMBIGUOUS) {
strcpy(buf, "#AMBIGUOUS#");
return buf;
}
if (obj == HOME) {
strcpy(buf, "#HOME#");
return buf;
}
strcpy(buf, RNAME(obj));
return buf;
}
示例12: mfn_name
const char *
mfn_name(MFUNARGS)
{
char *ptr;
dbref obj;
obj = tp_compatible_mpi
? mesg_dbref_raw(player, what, perms, argv[0])
: mesg_dbref_local(player, what, perms, argv[0])
;
if (obj == UNKNOWN)
ABORT_MPI("NAME","Match failed");
if (obj == PERMDENIED)
ABORT_MPI("NAME",NOPERM_MESG);
if (obj == NOTHING) {
strcpy(buf, "#NOTHING#");
return buf;
}
if (obj == AMBIGUOUS) {
strcpy(buf, "#AMBIGUOUS#");
return buf;
}
if (obj == HOME) {
strcpy(buf, "#HOME#");
return buf;
}
strcpy(buf, RNAME(obj));
if (Typeof(obj) == TYPE_EXIT) {
ptr = index(buf, ';');
if (ptr) *ptr = '\0';
}
return buf;
}
示例13: mfn_right
const char *
mfn_right(MFUNARGS)
{
/* {right:string,fieldwidth,padstr} */
/* Right justify string to a fieldwidth, filling with padstr */
char *ptr;
char *fptr;
int i, len;
char *fillstr;
len = (argc > 1) ? atoi(argv[1]) : 78;
if (len > BUFFER_LEN - 1)
ABORT_MPI("RIGHT", "Fieldwidth too big.");
fillstr = (argc > 2) ? argv[2] : " ";
if (!*fillstr)
ABORT_MPI("RIGHT", "Null pad string.");
for (ptr = buf, fptr = fillstr, i = strlen(argv[0]); i < len; i++) {
*ptr++ = *fptr++;
if (!*fptr)
fptr = fillstr;
}
strcpyn(ptr, buflen - (ptr - buf), argv[0]);
return buf;
}
示例14: mfn_left
const char *
mfn_left(MFUNARGS)
{
/* {left:string,fieldwidth,padstr} */
/* Left justify string to a fieldwidth, filling with padstr */
char *ptr;
char *fptr;
int i, len;
char *fillstr;
len = (argc > 1) ? atoi(argv[1]) : 78;
if (len > BUFFER_LEN - 1)
ABORT_MPI("LEFT", "Fieldwidth too big.");
fillstr = (argc > 2) ? argv[2] : " ";
if (!*fillstr)
ABORT_MPI("LEFT", "Null pad string.");
strcpyn(buf, buflen, argv[0]);
for (i = strlen(argv[0]), ptr = &buf[i], fptr = fillstr; i < len; i++) {
*ptr++ = *fptr++;
if (!*fptr)
fptr = fillstr;
}
*ptr = '\0';
return buf;
}
示例15: mfn_nearby
const char *
mfn_nearby(MFUNARGS)
{
dbref obj;
dbref obj2;
obj = mesg_dbref_raw(descr, player, what, perms, argv[0]);
if (obj == UNKNOWN || obj == AMBIGUOUS || obj == NOTHING)
ABORT_MPI("NEARBY", "Match failed (arg1).");
if (obj == PERMDENIED)
ABORT_MPI("NEARBY", "Permission denied (arg1).");
if (obj == HOME)
obj = PLAYER_HOME(player);
if (argc > 1) {
obj2 = mesg_dbref_raw(descr, player, what, perms, argv[1]);
if (obj2 == UNKNOWN || obj2 == AMBIGUOUS || obj2 == NOTHING)
ABORT_MPI("NEARBY", "Match failed (arg2).");
if (obj2 == PERMDENIED)
ABORT_MPI("NEARBY", "Permission denied (arg2).");
if (obj2 == HOME)
obj2 = PLAYER_HOME(player);
} else {
obj2 = what;
}
if (!(mesgtyp & MPI_ISBLESSED) && !isneighbor(obj, what) && !isneighbor(obj2, what) &&
!isneighbor(obj, player) && !isneighbor(obj2, player)
) {
ABORT_MPI("NEARBY", "Permission denied. Neither object is local.");
}
if (isneighbor(obj, obj2)) {
return "1";
} else {
return "0";
}
}