forked from github/server
a_select is not fast, so we try to avoid it
This commit is contained in:
parent
318f348f27
commit
5c474b9eb7
1 changed files with 16 additions and 5 deletions
|
@ -324,10 +324,21 @@ get_cursex(attrib *ap, const curse_type * ctype, variant data, boolean(*compare)
|
||||||
curse *
|
curse *
|
||||||
get_curse(attrib *ap, const curse_type * ctype)
|
get_curse(attrib *ap, const curse_type * ctype)
|
||||||
{
|
{
|
||||||
attrib * a = a_select(ap, ctype, cmp_cursetype);
|
attrib * a = ap;
|
||||||
|
while (a) {
|
||||||
|
if (a->type->flags & ATF_CURSE) {
|
||||||
|
const attrib_type * at = a->type;
|
||||||
|
while (a && a->type==at) {
|
||||||
|
curse* c = (curse *)a->data.v;
|
||||||
|
if (c->type==ctype) return c;
|
||||||
|
a = a->next;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
a = a->nexttype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!a) return NULL;
|
return NULL;
|
||||||
return (curse*)a->data.v;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
Loading…
Reference in a new issue