From d65c158e4f036b402de1555e118a98539f5a37c5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 29 Feb 2004 09:39:46 +0000 Subject: [PATCH] Bugfix: Exoten-familiars ohne init-routine --- src/common/kernel/eressea.h | 3 ++- src/common/kernel/spell.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index e9660f862..604588537 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -677,7 +677,8 @@ enum { RC_DOLPHIN, RC_OCEANTURTLE, RC_KRAKEN, - RC_SEASERPENT, + + RC_SEASERPENT, RC_SHADOWKNIGHT, /* 51 */ RC_CENTAUR, diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index 6298d390f..9032acee9 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -535,16 +535,22 @@ report_effect(region * r, unit * mage, message * seen, message * unseen) static const race * select_familiar(const race * magerace, magic_t magiegebiet) { + const race * retval = NULL; int rnd = rand()%100; assert(magerace->familiars[0]); - if (rnd < 3) { - /* RC_KRAKEN muß letzter Vertraute sein */ - return new_race[(race_t)(RC_HOUSECAT + rand()%(RC_KRAKEN+1-RC_HOUSECAT))]; - } else if (rnd < 80) { - return magerace->familiars[0]; - } - return magerace->familiars[magiegebiet]; + do { + if (rnd < 3) { + /* RC_KRAKEN muß letzter Vertraute sein */ + int rc = RC_HOUSECAT + rand()%(RC_KRAKEN+1-RC_HOUSECAT); + retval = new_race[rc]; + } else if (rnd < 80) { + retval = magerace->familiars[0]; + } + retval = magerace->familiars[magiegebiet]; + } + while (retval->init_familiar==NULL); + return retval; } /* ------------------------------------------------------------- */