forked from github/server
fix crash in 997: re-introduce cfindhash.
this prevents duplicate curse.no values.
This commit is contained in:
parent
a4498f8b43
commit
34a6dd8d54
|
@ -98,6 +98,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)
|
||||
|
|
|
@ -285,6 +285,7 @@ extern "C" {
|
|||
void ct_register(const curse_type *);
|
||||
void ct_checknames(void);
|
||||
|
||||
curse *cfindhash(int i);
|
||||
curse *findcurse(int curseid);
|
||||
|
||||
void curse_init(struct attrib *a);
|
||||
|
|
|
@ -1876,6 +1876,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) {
|
||||
|
|
Loading…
Reference in New Issue