count_enemies ist verflucht lahm. Ich werde mal sehen, ob ich das shcneller machen kann.

This commit is contained in:
Enno Rehling 2004-04-18 21:44:24 +00:00
parent 619a2ff69c
commit 1e9538b8d8
4 changed files with 316 additions and 321 deletions

View File

@ -175,8 +175,7 @@ attack_firesword(const troop * at, int *casualties, int row)
int force = 1+rand()%10;
if (row==FIGHT_ROW) {
enemies = count_enemies(fi->side->battle, fi->side, FS_ENEMY,
minrow, maxrow);
enemies = count_enemies(fi->side->battle, fi->side, minrow, maxrow);
}
if (!enemies) {
if (casualties) *casualties = 0;
@ -243,7 +242,7 @@ attack_catapult(const troop * at, int * casualties, int row)
minrow = FIGHT_ROW;
maxrow = FIGHT_ROW;
n = min(CATAPULT_ATTACKS, count_enemies(b, af->side, FS_ENEMY, minrow, maxrow));
n = min(CATAPULT_ATTACKS, count_enemies(b, af->side, minrow, maxrow));
#if CATAPULT_AMMUNITION
new_use_pooled(au, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);

View File

@ -502,74 +502,74 @@ hpflee(int status)
}
int
get_unitrow(fighter * af)
get_unitrow(const fighter * af)
{
static boolean * counted = NULL;
static size_t csize = 0;
static boolean * counted = NULL;
static size_t csize = 0;
battle * b = af->side->battle;
void **si;
int enemyfront = 0;
int line, result;
int retreat = 0;
int size[NUMROWS];
int row = statusrow(af->status);
int front = 0;
size_t bsize;
battle * b = af->side->battle;
void **si;
int enemyfront = 0;
int line, result;
int retreat = 0;
int size[NUMROWS];
int row = statusrow(af->status);
int front = 0;
size_t bsize;
#ifdef FAST_GETUNITROW
if (!b->nonblockers && b->alive==af->row.alive) {
return af->row.cached;
}
if (!b->nonblockers && b->alive==af->row.alive) {
return af->row.cached;
}
#endif
bsize = cv_size(&b->sides);
bsize = cv_size(&b->sides);
if (csize<bsize) {
if (counted) free(counted);
csize=bsize;
counted = calloc(sizeof(boolean), bsize);
}
else memset(counted, 0, bsize*sizeof(boolean));
memset(size, 0, sizeof(size));
for (line=FIRST_ROW;line!=NUMROWS;++line) {
/* how many enemies are there in the first row? */
for (si = b->sides.begin; si != b->sides.end; ++si) {
side *s = *si;
if (s->size[line] && enemy(s, af->side))
{
void ** sf;
enemyfront += s->size[line]; /* - s->nonblockers[line] (nicht, weil angreifer) */
for (sf = b->sides.begin; sf != b->sides.end; ++sf) {
side * ally = *sf;
if (!counted[ally->index] && enemy(s, ally) && !enemy(ally, af->side))
{
int i;
counted[ally->index] = true;
for (i=0;i!=NUMROWS;++i) size[i] += ally->size[i] - ally->nonblockers[i];
}
}
}
}
if (enemyfront) break;
}
if (enemyfront) {
for (line=FIRST_ROW;line!=NUMROWS;++line) {
front += size[line];
if (!front || front<enemyfront/10) ++retreat;
else if (front) break;
}
}
if (csize<bsize) {
if (counted) free(counted);
csize=bsize;
counted = calloc(sizeof(boolean), bsize);
}
else memset(counted, 0, bsize*sizeof(boolean));
memset(size, 0, sizeof(size));
for (line=FIRST_ROW;line!=NUMROWS;++line) {
/* how many enemies are there in the first row? */
for (si = b->sides.begin; si != b->sides.end; ++si) {
side *s = *si;
if (s->size[line] && enemy(s, af->side))
{
void ** sf;
enemyfront += s->size[line]; /* - s->nonblockers[line] (nicht, weil angreifer) */
for (sf = b->sides.begin; sf != b->sides.end; ++sf) {
side * ally = *sf;
if (!counted[ally->index] && enemy(s, ally) && !enemy(ally, af->side))
{
int i;
counted[ally->index] = true;
for (i=0;i!=NUMROWS;++i) size[i] += ally->size[i] - ally->nonblockers[i];
}
}
}
}
if (enemyfront) break;
}
if (enemyfront) {
for (line=FIRST_ROW;line!=NUMROWS;++line) {
front += size[line];
if (!front || front<enemyfront/10) ++retreat;
else if (front) break;
}
}
/* every entry in the size[] array means someone trying to defend us.
* 'retreat' is the number of rows falling.
*/
result = max(FIRST_ROW, row - retreat);
/* every entry in the size[] array means someone trying to defend us.
* 'retreat' is the number of rows falling.
*/
result = max(FIRST_ROW, row - retreat);
#ifdef FAST_GETUNITROW
af->row.alive = b->alive;
af->row.cached = result;
af->row.alive = b->alive;
af->row.cached = result;
#endif
return result;
return result;
}
static int
@ -1297,80 +1297,84 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
return true;
}
/* ------------------------------------------------------------- */
int
count_enemies(battle * b, side * as, int mask, int minrow, int maxrow)
/* new implementation of count_enemies ignores mask, since it was never used */
static int
count_side(const side * s, int minrow, int maxrow)
{
int i = 0;
void **si;
void **fi;
int people = 0;
if (maxrow<FIRST_ROW) return 0;
for (fi = s->fighters.begin; fi != s->fighters.end; ++fi) {
const fighter *fig = *fi;
int row;
for (si = b->sides.begin; si != b->sides.end; ++si) {
side *side = *si;
if (as==NULL || enemy(side, as))
{
void **fi;
if (fig->alive - fig->removed <= 0) continue;
row = get_unitrow(fig);
for (fi = side->fighters.begin; fi != side->fighters.end; ++fi) {
fighter *fig = *fi;
int row;
if (fig->alive - fig->removed <= 0)
continue;
else
row = get_unitrow(fig);
if (row >= minrow && row <= maxrow)
i += fig->alive - fig->removed;
}
}
}
return i;
if (row >= minrow && row <= maxrow) {
people += fig->alive - fig->removed;
}
}
return people;
}
/* new implementation of count_enemies ignores mask, since it was never used */
int
count_enemies(battle * b, side * as, int minrow, int maxrow)
{
int i = 0;
void **si;
if (maxrow<FIRST_ROW) return 0;
for (si = b->sides.begin; si != b->sides.end; ++si) {
side *side = *si;
if (as==NULL || enemy(side, as)) {
i += count_side(side, minrow, maxrow);
}
}
return i;
}
/* ------------------------------------------------------------- */
troop
select_enemy(battle * b, fighter * af, int minrow, int maxrow)
{
side *as = af?af->side:NULL;
troop dt = no_troop;
void ** si;
int enemies;
side *as = af?af->side:NULL;
troop dt = no_troop;
void ** si;
int enemies;
if (af && af->unit->race->flags & RCF_FLY) {
/* flying races ignore min- and maxrow and can attack anyone fighting
* them */
minrow = FIGHT_ROW;
maxrow = BEHIND_ROW;
}
minrow = max(minrow, FIGHT_ROW);
if (af && af->unit->race->flags & RCF_FLY) {
/* flying races ignore min- and maxrow and can attack anyone fighting
* them */
minrow = FIGHT_ROW;
maxrow = BEHIND_ROW;
}
minrow = max(minrow, FIGHT_ROW);
enemies = count_enemies(b, as, FS_ENEMY, minrow, maxrow);
enemies = count_enemies(b, as, minrow, maxrow);
if (!enemies)
return dt; /* Niemand ist in der angegebenen Entfernung */
enemies = rand() % enemies;
for (si=b->sides.begin;!dt.fighter && si!=b->sides.end;++si) {
side *ds = *si;
void ** fi;
if (as!=NULL && !enemy(as, ds)) continue;
for (fi=ds->fighters.begin;fi!=ds->fighters.end;++fi) {
fighter * df = *fi;
int dr = get_unitrow(df);
if (dr < minrow || dr > maxrow) continue;
if (df->alive - df->removed > enemies) {
dt.index = enemies;
dt.fighter = df;
enemies = 0;
break;
}
else enemies -= (df->alive - df->removed);
}
}
assert(!enemies);
return dt;
if (!enemies)
return dt; /* Niemand ist in der angegebenen Entfernung */
enemies = rand() % enemies;
for (si=b->sides.begin;!dt.fighter && si!=b->sides.end;++si) {
side *ds = *si;
void ** fi;
if (as!=NULL && !enemy(as, ds)) continue;
for (fi=ds->fighters.begin;fi!=ds->fighters.end;++fi) {
fighter * df = *fi;
int dr = get_unitrow(df);
if (dr < minrow || dr > maxrow) continue;
if (df->alive - df->removed > enemies) {
dt.index = enemies;
dt.fighter = df;
enemies = 0;
break;
}
else enemies -= (df->alive - df->removed);
}
}
assert(!enemies);
return dt;
}
/*
@ -2115,7 +2119,7 @@ do_attack(fighter * af)
while (ta.index--) {
/* Wir suchen eine beliebige Feind-Einheit aus. An der können
* wir feststellen, ob noch jemand da ist. */
int enemies = count_enemies(b, af->side, FS_ENEMY, FIGHT_ROW, LAST_ROW);
int enemies = count_enemies(b, af->side, FIGHT_ROW, LAST_ROW);
if (!enemies) break;
for (apr=attacks_per_round(ta); apr > 0; apr--) {

View File

@ -1,15 +1,15 @@
/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifndef H_KRNL_BATTLE
#define H_KRNL_BATTLE
@ -17,16 +17,16 @@
extern "C" {
#endif
/** new code defines **/
/** new code defines **/
#undef FAST_GETUNITROW
/** more defines **/
/** more defines **/
#define FS_ENEMY 1
#define FS_HELP 2
/***** Verteidigungslinien.
* Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enthält Summen
*/
/***** Verteidigungslinien.
* Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enthält Summen
*/
#define NUMROWS 5
#define SUM_ROW 0
#define FIGHT_ROW 1
@ -36,73 +36,73 @@ extern "C" {
#define LAST_ROW (NUMROWS-1)
#define FIRST_ROW FIGHT_ROW
typedef struct bfaction {
struct bfaction * next;
struct side * sides;
struct faction *faction;
int lastturn; /* last time this struct faction was involved in combat */
boolean attacker;
} bfaction;
typedef struct bfaction {
struct bfaction * next;
struct side * sides;
struct faction *faction;
int lastturn; /* last time this struct faction was involved in combat */
boolean attacker;
} bfaction;
typedef struct battle {
cvector leaders;
struct region *region;
struct plane *plane;
bfaction * factions;
int nfactions;
cvector fighters;
cvector sides;
cvector meffects;
int max_tactics;
int turn;
boolean has_tactics_turn;
int keeploot;
boolean reelarrow;
int dh;
int alive;
boolean small;
typedef struct battle {
cvector leaders;
struct region *region;
struct plane *plane;
bfaction * factions;
int nfactions;
cvector fighters;
cvector sides;
cvector meffects;
int max_tactics;
int turn;
boolean has_tactics_turn;
int keeploot;
boolean reelarrow;
int dh;
int alive;
boolean small;
#ifdef FAST_GETUNITROW
boolean nonblockers;
boolean nonblockers;
#endif
} battle;
} battle;
typedef struct tactics {
cvector fighters;
int value;
} tactics;
typedef struct tactics {
cvector fighters;
int value;
} tactics;
typedef struct side {
struct tactics leader; /* der beste Taktiker des Heeres */
struct side * nextF; /* nächstes Heer der gleichen Partei */
struct battle * battle;
struct bfaction * bf; /* Die Partei, die hier kämpft */
const struct group * group;
typedef struct side {
struct tactics leader; /* der beste Taktiker des Heeres */
struct side * nextF; /* nächstes Heer der gleichen Partei */
struct battle * battle;
struct bfaction * bf; /* Die Partei, die hier kämpft */
const struct group * group;
# define E_ENEMY 1
# define E_ATTACKING 2
int enemy[128];
cvector fighters; /* vector der Einheiten dieser Fraktion */
int index; /* Eintrag der Fraktion in b->matrix/b->enemies */
int size[NUMROWS]; /* Anzahl Personen in Reihe X. 0 = Summe */
int nonblockers[NUMROWS]; /* Anzahl nichtblockierender Kämpfer, z.B. Schattenritter. */
int alive; /* Die Partei hat den Kampf verlassen */
int removed; /* stoned */
int flee;
int dead;
int casualties;
int healed;
boolean dh;
boolean stealth; /* Die Einheiten sind getarnt */
const struct faction *stealthfaction;
} side;
int enemy[128];
cvector fighters; /* vector der Einheiten dieser Fraktion */
int index; /* Eintrag der Fraktion in b->matrix/b->enemies */
int size[NUMROWS]; /* Anzahl Personen in Reihe X. 0 = Summe */
int nonblockers[NUMROWS]; /* Anzahl nichtblockierender Kämpfer, z.B. Schattenritter. */
int alive; /* Die Partei hat den Kampf verlassen */
int removed; /* stoned */
int flee;
int dead;
int casualties;
int healed;
boolean dh;
boolean stealth; /* Die Einheiten sind getarnt */
const struct faction *stealthfaction;
} side;
typedef struct weapon {
int count, used;
const struct weapon_type * type;
int attackskill : 8;
int defenseskill : 8;
} weapon;
typedef struct weapon {
int count, used;
const struct weapon_type * type;
int attackskill : 8;
int defenseskill : 8;
} weapon;
/*** fighter::person::flags ***/
/*** fighter::person::flags ***/
#define FL_TIRED 1
#define FL_DAZZLED 2 /* durch Untote oder Dämonen eingeschüchtert */
#define FL_PANICED 4
@ -110,127 +110,127 @@ typedef struct weapon {
#define FL_SLEEPING 16
#define FL_STUNNED 32 /* eine Runde keinen Angriff */
/*** fighter::flags ***/
/*** fighter::flags ***/
#define FIG_ATTACKED 1
#define FIG_NOLOOT 2
typedef unsigned char armor_t;
enum {
typedef unsigned char armor_t;
enum {
#ifdef COMPATIBILITY
AR_MAGICAL,
AR_MAGICAL,
#endif
AR_PLATE,
AR_CHAIN,
AR_RUSTY_CHAIN,
AR_SHIELD,
AR_RUSTY_SHIELD,
AR_EOGSHIELD,
AR_EOGCHAIN,
AR_MAX,
AR_NONE
};
AR_PLATE,
AR_CHAIN,
AR_RUSTY_CHAIN,
AR_SHIELD,
AR_RUSTY_SHIELD,
AR_EOGSHIELD,
AR_EOGCHAIN,
AR_MAX,
AR_NONE
};
typedef struct fighter {
struct side *side;
struct unit *unit; /* Die Einheit, die hier kämpft */
struct building *building; /* Gebäude, in dem die Einheit evtl. steht */
status_t status; /* Kampfstatus */
struct weapon * weapons;
int armor[AR_MAX]; /* Anzahl Rüstungen jeden Typs */
int alive; /* Anzahl der noch nicht Toten in der Einheit */
int fighting; /* Anzahl der Kämpfer in der aktuellen Runde */
int removed; /* Anzahl Kaempfer, die nicht tot sind, aber
aus dem Kampf raus sind (zB weil sie
versteinert wurden). Diese werden auch
in alive noch mitgezählt! */
int magic; /* Magietalent der Einheit */
int horses; /* Anzahl brauchbarer Pferde der Einheit */
int elvenhorses; /* Anzahl brauchbarer Elfenpferde der Einheit */
struct item * loot;
int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */
struct person {
int attack : 8; /* (Magie) Attackenbonus der Personen */
int defence : 8; /* (Magie) Paradenbonus der Personen */
int damage : 8; /* (Magie) Schadensbonus der Personen im Nahkampf */
int damage_rear : 8; /* (Magie) Schadensbonus der Personen im Fernkampf */
int hp : 16; /* Trefferpunkte der Personen */
int flags : 8; /* (Magie) Diverse Flags auf Kämpfern */
int speed : 8; /* (Magie) Geschwindigkeitsmultiplkator. */
int reload : 4; /* Anzahl Runden, die die Waffe x noch laden muss.
* dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
int last_action : 8; /* In welcher Runde haben wir zuletzt etwas getan */
struct weapon * missile; /* missile weapon */
struct weapon * melee; /* melee weapon */
} * person;
int flags;
struct {
int number; /* number of people who have flown */
int hp; /* accumulated hp of fleeing people */
typedef struct fighter {
struct side *side;
struct unit *unit; /* Die Einheit, die hier kämpft */
struct building *building; /* Gebäude, in dem die Einheit evtl. steht */
status_t status; /* Kampfstatus */
struct weapon * weapons;
int armor[AR_MAX]; /* Anzahl Rüstungen jeden Typs */
int alive; /* Anzahl der noch nicht Toten in der Einheit */
int fighting; /* Anzahl der Kämpfer in der aktuellen Runde */
int removed; /* Anzahl Kaempfer, die nicht tot sind, aber
aus dem Kampf raus sind (zB weil sie
versteinert wurden). Diese werden auch
in alive noch mitgezählt! */
int magic; /* Magietalent der Einheit */
int horses; /* Anzahl brauchbarer Pferde der Einheit */
int elvenhorses; /* Anzahl brauchbarer Elfenpferde der Einheit */
struct item * loot;
int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */
struct person {
int attack : 8; /* (Magie) Attackenbonus der Personen */
int defence : 8; /* (Magie) Paradenbonus der Personen */
int damage : 8; /* (Magie) Schadensbonus der Personen im Nahkampf */
int damage_rear : 8; /* (Magie) Schadensbonus der Personen im Fernkampf */
int hp : 16; /* Trefferpunkte der Personen */
int flags : 8; /* (Magie) Diverse Flags auf Kämpfern */
int speed : 8; /* (Magie) Geschwindigkeitsmultiplkator. */
int reload : 4; /* Anzahl Runden, die die Waffe x noch laden muss.
* dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
int last_action : 8; /* In welcher Runde haben wir zuletzt etwas getan */
struct weapon * missile; /* missile weapon */
struct weapon * melee; /* melee weapon */
} * person;
int flags;
struct {
int number; /* number of people who have flown */
int hp; /* accumulated hp of fleeing people */
#ifndef NO_RUNNING
struct region *region; /* destination of fleeing people */
struct item * items; /* items they take */
struct region *region; /* destination of fleeing people */
struct item * items; /* items they take */
#endif
} run;
int action_counter; /* number of active actions the struct unit did in the fight */
} run;
int action_counter; /* number of active actions the struct unit did in the fight */
#ifdef SHOW_KILLS
int kills;
int hits;
int kills;
int hits;
#endif
#ifdef FAST_GETUNITROW
struct {
int alive;
int cached;
} row;
struct {
int alive;
int cached;
} row;
#endif
} fighter;
} fighter;
typedef struct troop {
struct fighter *fighter;
int index;
} troop;
typedef struct troop {
struct fighter *fighter;
int index;
} troop;
/* schilde */
/* schilde */
enum {
SHIELD_REDUCE,
SHIELD_ARMOR,
SHIELD_WIND,
SHIELD_BLOCK,
SHIELD_MAX
};
enum {
SHIELD_REDUCE,
SHIELD_ARMOR,
SHIELD_WIND,
SHIELD_BLOCK,
SHIELD_MAX
};
typedef struct meffect {
fighter *magician; /* Der Zauberer, der den Schild gezaubert hat */
int typ; /* Wirkungsweise des Schilds */
int effect;
int duration;
} meffect;
typedef struct meffect {
fighter *magician; /* Der Zauberer, der den Schild gezaubert hat */
int typ; /* Wirkungsweise des Schilds */
int effect;
int duration;
} meffect;
extern const troop no_troop;
extern const troop no_troop;
extern void do_battle(void);
extern void do_battle(void);
/* for combar spells and special attacks */
extern int damage_unit(struct unit *u, const char *dam, boolean armor, boolean magic);
extern troop select_enemy(struct battle * b, struct fighter * af, int minrow, int maxrow);
extern int count_enemies(struct battle * b, struct side * as, int mask, int minrow, int maxrow);
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
extern void battlemsg(battle * b, struct unit * u, const char * s);
extern void battlerecord(battle * b, const char *s);
extern int hits(troop at, troop dt, weapon * awp);
extern void damage_building(struct battle *b, struct building *bldg, int damage_abs);
extern struct cvector * fighters(struct battle *b, struct fighter *af, int minrow, int maxrow, int mask);
extern int countallies(struct side * as);
extern int get_unitrow(struct fighter * af);
extern boolean helping(struct side * as, struct side * ds);
extern void rmfighter(fighter *df, int i);
extern struct region * fleeregion(const struct unit * u);
extern struct troop select_corpse(struct battle * b, struct fighter * af);
extern fighter * make_fighter(struct battle * b, struct unit * u, side * s, boolean attack);
extern int statusrow(int status);
extern void drain_exp(struct unit *u, int d);
extern void rmtroop(troop dt);
/* for combar spells and special attacks */
extern int damage_unit(struct unit *u, const char *dam, boolean armor, boolean magic);
extern troop select_enemy(struct battle * b, struct fighter * af, int minrow, int maxrow);
extern int count_enemies(struct battle * b, struct side * as, int minrow, int maxrow);
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
extern void battlemsg(battle * b, struct unit * u, const char * s);
extern void battlerecord(battle * b, const char *s);
extern int hits(troop at, troop dt, weapon * awp);
extern void damage_building(struct battle *b, struct building *bldg, int damage_abs);
extern struct cvector * fighters(struct battle *b, struct fighter *af, int minrow, int maxrow, int mask);
extern int countallies(struct side * as);
extern int get_unitrow(const struct fighter * af);
extern boolean helping(struct side * as, struct side * ds);
extern void rmfighter(fighter *df, int i);
extern struct region * fleeregion(const struct unit * u);
extern struct troop select_corpse(struct battle * b, struct fighter * af);
extern fighter * make_fighter(struct battle * b, struct unit * u, side * s, boolean attack);
extern int statusrow(int status);
extern void drain_exp(struct unit *u, int d);
extern void rmtroop(troop dt);
#ifdef __cplusplus
}

View File

@ -139,8 +139,7 @@ sp_kampfzauber(fighter * fi, int level, double power, spell * sp)
force = lovar(get_force(power,10));
}
enemies = count_enemies(b, fi->side, FS_ENEMY,
minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
@ -181,8 +180,7 @@ sp_versteinern(fighter * fi, int level, double power, spell * sp)
force = lovar(get_force(power,0));
enemies = count_enemies(b, fi->side, FS_ENEMY,
minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
@ -241,7 +239,7 @@ sp_stun(fighter * fi, int level, double power, spell * sp)
assert(0);
}
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
@ -297,7 +295,7 @@ sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
force = lovar(power * 15);
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
battlemsg(b, fi->unit, msgt[0]);
return 0;
@ -383,7 +381,7 @@ sp_sleep(fighter * fi, int level, double power, spell * sp)
sprintf(buf, "%s zaubert %s", unitname(mage),
spell_name(sp, default_locale));
force = lovar(power * 25);
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
@ -530,7 +528,7 @@ sp_mindblast(fighter * fi, int level, double power, spell * sp)
spell_name(sp, default_locale));
force = lovar(power * 25);
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
@ -615,8 +613,7 @@ sp_dragonodem(fighter * fi, int level, double power, spell * sp)
/* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
force = lovar(get_force(level,6));
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow,
maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
@ -665,8 +662,7 @@ sp_immolation(fighter * fi, int level, double power, spell * sp)
/* Betrifft alle Gegner */
force = 99999;
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow,
maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
@ -715,8 +711,7 @@ sp_drainodem(fighter * fi, int level, double power, spell * sp)
/* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
force = lovar(get_force(level,6));
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow,
maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
@ -924,7 +919,7 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp)
break;
}
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
@ -1021,7 +1016,7 @@ sp_flee(fighter * fi, int level, double power, spell * sp)
force = (int)get_force(power,10);
}
if (!count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow)) {
if (!count_enemies(b, fi->side, minrow, maxrow)) {
scat(", aber es gab niemanden mehr, der beeinflusst werden konnte.");
battlerecord(b, buf);
return 0;
@ -1200,8 +1195,7 @@ sp_frighten(fighter * fi, int level, double power, spell * sp)
sprintf(buf, "%s zaubert %s", unitname(mage),
spell_name(sp, default_locale));
enemies = count_enemies(b, fi->side, FS_ENEMY,
minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
@ -1250,8 +1244,7 @@ sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp)
sprintf(buf, "%s zaubert %s", unitname(mage),
spell_name(sp, default_locale));
if (!count_enemies(b, fi->side, FS_ENEMY, FIGHT_ROW,
BEHIND_ROW)) {
if (!count_enemies(b, fi->side, FIGHT_ROW, BEHIND_ROW)) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);
return 0;
@ -1311,8 +1304,7 @@ sp_windshield(fighter * fi, int level, double power, spell * sp)
force = (int)power;
at_malus = 2;
}
enemies = count_enemies(b, fi->side, FS_ENEMY,
minrow, maxrow);
enemies = count_enemies(b, fi->side, minrow, maxrow);
if (!enemies) {
scat(", aber niemand war in Reichweite.");
battlerecord(b, buf);