From a7d335b83a17b2320e3cd43bf6a3bb59cb73b1fb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 22 Mar 2021 20:34:55 +0100 Subject: [PATCH] flee_spell did not need an extra argument checking for precombat spells is easy and safe! --- src/spells.c | 6 +++--- src/spells/combatspells.c | 4 ++-- src/spells/combatspells.h | 4 +--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/spells.c b/src/spells.c index ee1ffd5ee..e5f1a3b53 100644 --- a/src/spells.c +++ b/src/spells.c @@ -6195,21 +6195,21 @@ static int sp_flee(castorder *co) { if (co->force <= 0) { return 0; } - return flee_spell(co, 4, false); + return flee_spell(co, 4); } static int sp_song_of_fear(castorder *co) { if (co->force <= 0) { return 0; } - return flee_spell(co, 3, true); + return flee_spell(co, 3); } static int sp_aura_of_fear(castorder *co) { if (co->force <= 0) { return 0; } - return flee_spell(co, 5, false); + return flee_spell(co, 5); } static int sp_armor_shield(struct castorder * co) { diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index a38bda1d2..798953781 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -861,7 +861,7 @@ static bool select_afraid(const side *vs, const fighter *fig, void *cbdata) /* Gesang der Furcht (Kampfzauber) */ /* Panik (Praekampfzauber) */ -int flee_spell(struct castorder * co, int strength, bool wounded) +int flee_spell(struct castorder * co, int strength) { fighter * fi = co->magician.fig; int level = co->level; @@ -882,7 +882,7 @@ int flee_spell(struct castorder * co, int strength, bool wounded) return 0; } - fgs = select_fighters(b, fi->side, FS_ENEMY, wounded?select_afraid:select_alive, NULL); + fgs = select_fighters(b, fi->side, FS_ENEMY, (co->sp->sptyp & PRECOMBATSPELL) ? select_afraid : select_alive, NULL); scramble_fighters(fgs); for (qi = 0, ql = fgs; force > 0 && ql; selist_advance(&ql, &qi, 1)) { diff --git a/src/spells/combatspells.h b/src/spells/combatspells.h index 5007ef4c0..c8bbc3c9c 100644 --- a/src/spells/combatspells.h +++ b/src/spells/combatspells.h @@ -1,8 +1,6 @@ #ifndef H_GC_COMBATSPELLS #define H_GC_COMBATSPELLS -#include - #ifdef __cplusplus extern "C" { #endif @@ -38,7 +36,7 @@ extern "C" { int sp_undeadhero(struct castorder * co); int sp_immolation(struct castorder * co); - int flee_spell(struct castorder * co, int strength, bool wounded); + int flee_spell(struct castorder * co, int strength); int damage_spell(struct castorder * co, int dmg, int strength); int armor_spell(struct castorder * co, int per_level, int time_multi);