diff --git a/src/kernel/curse.c b/src/kernel/curse.c index ac2e917a7..bc3cdbfba 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -97,6 +97,15 @@ static void cunhash(curse * c) } } +curse *cfindhash(int i) +{ + curse *old; + + for (old = cursehash[i % MAXENTITYHASH]; old; old = old->nexthash) + if (old->no == i) + return old; + return NULL; +} /* ------------------------------------------------------------- */ /* at_curse */ void curse_init(attrib * a) diff --git a/src/kernel/curse.h b/src/kernel/curse.h index a1518bbdd..9f6688a4f 100644 --- a/src/kernel/curse.h +++ b/src/kernel/curse.h @@ -287,6 +287,7 @@ extern "C" { void ct_remove(const char *c); void ct_checknames(void); + curse *cfindhash(int i); curse *findcurse(int curseid); void curse_init(struct attrib *a); diff --git a/src/kernel/unit.c b/src/kernel/unit.c index ab3bd294c..2046a72c5 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1938,6 +1938,7 @@ int newunitid(void) start_random_no = random_unit_no; while (ufindhash(random_unit_no) || dfindhash(random_unit_no) + || cfindhash(random_unit_no) || forbiddenid(random_unit_no)) { random_unit_no++; if (random_unit_no == MAX_UNIT_NR + 1) {