Commit 9c21c5f4 authored by alynna's avatar alynna

Array and MPI fixes backported from Proto2. Version updated.

parent 146d8fea
......@@ -69,6 +69,7 @@ array_tree_compare(array_iter *a, array_iter *b, int case_sens, int objname)
return -1;
}
} else if (a->type == PROG_FLOAT && b->type == PROG_INTEGER) {
if (a->data.fnumber == b->data.fnumber) { return 0; } else
if (fabs((a->data.fnumber - b->data.number) / a->data.fnumber) <
DBL_EPSILON) {
return 0;
......@@ -121,6 +122,7 @@ array_tree_compare(array_iter *a, array_iter *b, int case_sens, int objname)
return 0;
}
if (a->type == PROG_FLOAT) {
if (a->data.fnumber == b->data.fnumber) { return 0; } else
if (fabs((a->data.fnumber - b->data.fnumber) / a->data.fnumber) <
DBL_EPSILON) {
return 0;
......@@ -145,10 +147,15 @@ array_tree_compare(array_iter *a, array_iter *b, int case_sens, int objname)
/* in a perfect world, we'd compare the array elements recursively. */
return (a->data.array - b->data.array);
} else if (a->type == PROG_LOCK) {
/* Sort locks by memory address. */
/* This is a bug, really. */
/* in a perfect world, we'd compare the locks by element. */
return (a->data.lock - b->data.lock);
char* la;
char* lb;
int retval = 0;
la = (char *)unparse_boolexp((dbref)1, a->data.lock, 0);
la = string_dup(la);
lb = (char *)unparse_boolexp((dbref)1, b->data.lock, 0);
retval = strcmp(la, lb);
free(la);
return retval;
} else if (a->type == PROG_ADD) {
int result = (a->data.addr->progref - b->data.addr->progref);
......
#define PROTOBASE "1.81b3"
#define PROTOBASE "1.85"
#define PROTOVER "Proto" PROTOBASE
#define NEONVER "Neon2.17"
#define VERSION "Muck2.2fb6.00rc9"
#define VERSION "Muck2.2fb6.00"
extern const char *infotext[];
......@@ -828,22 +828,32 @@ mesg_parse(int descr, dbref player, dbref what, dbref perms, const char *inbuf,
int literalflag = 0;
mesg_rec_cnt++;
if (mesg_rec_cnt > 26) {
mesg_rec_cnt--;
strncpy(outbuf, inbuf, maxchars);
outbuf[maxchars - 1] = '\0';
return outbuf;
}
if (Typeof(player) == TYPE_GARBAGE) {
return NULL;
}
if (Typeof(what) == TYPE_GARBAGE) {
if (player < 1)
notify_descriptor(descr, "MPI Error: Garbage trigger.");
else
notify_nolisten(player, "MPI Error: Garbage trigger.", 1);
return NULL;
}
if (mesg_rec_cnt > 26) {
char *zptr = get_mvar("how");
snprintf(dbuf, sizeof(dbuf), "%s Recursion limit exceeded.", zptr);
if (player < 1)
notify_descriptor(descr, dbuf);
else
notify_nolisten(player, dbuf, 1);
mesg_rec_cnt--;
outbuf[0] = '\0';
return NULL;
}
if (Typeof(player) == TYPE_GARBAGE) {
mesg_rec_cnt--;
outbuf[0] = '\0';
return NULL;
}
if (Typeof(what) == TYPE_GARBAGE) {
if (player < 1)
notify_descriptor(descr, "MPI Error: Garbage trigger.");
else
notify_nolisten(player, "MPI Error: Garbage trigger.", 1);
mesg_rec_cnt--;
outbuf[0] = '\0';
return NULL;
}
strcpy(wbuf, inbuf);
for (p = q = 0; wbuf[p] && (p < maxchars - 1) && q < (maxchars - 1); p++) {
if (wbuf[p] == '\\') {
......@@ -1133,11 +1143,15 @@ mesg_parse(int descr, dbref player, dbref what, dbref perms, const char *inbuf,
return NULL;
}
} else {
showtextflag = 1;
p = (int) (ptr - wbuf);
if (q < (maxchars - 1))
outbuf[q++] = MFUN_LEADCHAR;
ptr = ""; /* unknown substitution type */
showtextflag = 1;
ptr--;
i = s + 1;
while (ptr && *ptr && i-- && q < (maxchars - 1)) {
outbuf[q++] = *(ptr++);
}
outbuf[q] = '\0';
p = (int) (ptr - wbuf) - 1;
ptr = ""; /* unknown substitution type */
}
while (ptr && *ptr && q < (maxchars - 1))
outbuf[q++] = *(ptr++);
......
......@@ -1988,9 +1988,11 @@ prim_array_interpret(PRIM_PROTOTYPE)
text = buf;
break;
case PROG_OBJECT:
if (in->data.number == -1) { text = "*NOTHING*"; break; }
if (in->data.number < -1) { text = "*INVALID*"; break; }
if (in->data.number >= db_top) { text = "*INVALID*"; break; }
if (in->data.number == -1) { text = "*NOTHING*"; break; }
if (in->data.number == -2) { text = "*AMBIGUOUS*"; break; }
if (in->data.number == -3) { text = "*HOME*"; break; }
if (in->data.number < -3) { text = "*INVALID*"; break; }
sprintf(buf, "%s", NAME(in->data.number));
text = buf;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment