remove BATTLE_FAST code

it didn't actually make battles fast.
This commit is contained in:
Enno Rehling 2021-03-24 21:13:59 +01:00
parent 44765edede
commit 081965f0bc
2 changed files with 1 additions and 54 deletions

View File

@ -878,9 +878,6 @@ void remove_troop(troop dt)
fighter *df = dt.fighter;
struct person p = df->person[dt.index];
battle *b = df->side->battle;
#ifdef BATTLE_FAST
b->fast.alive = -1; /* invalidate cached value */
#endif
b->rowcache.alive = -1; /* invalidate cached value */
++df->removed;
++df->side->removed;
@ -1420,55 +1417,14 @@ count_enemies_i(battle * b, const fighter * af, int minrow, int maxrow,
return i;
}
#ifdef BATTLE_FAST
int
count_enemies_fast(battle * b, const fighter * af, int minrow, int maxrow,
int select)
{
int sr = statusrow(af->status);
side *as = af->side;
if (b->alive == b->fast.alive && as == b->fast.side && sr == b->fast.status
&& minrow == b->fast.minrow && maxrow == b->fast.maxrow) {
if (b->fast.enemies[select] >= 0) {
return b->fast.enemies[select];
}
else if (select & SELECT_FIND) {
if (b->fast.enemies[select - SELECT_FIND] >= 0) {
return b->fast.enemies[select - SELECT_FIND];
}
}
}
else if (select != SELECT_FIND || b->alive != b->fast.alive) {
b->fast.side = as;
b->fast.status = sr;
b->fast.minrow = minrow;
b->fast.alive = b->alive;
b->fast.maxrow = maxrow;
memset(b->fast.enemies, -1, sizeof(b->fast.enemies));
}
if (maxrow >= FIRST_ROW) {
int i = count_enemies_i(b, af, minrow, maxrow, select);
b->fast.enemies[select] = i;
return i;
}
return 0;
}
#endif
int
count_enemies(battle *b, const fighter *af, int minrow, int maxrow,
int select)
{
#ifdef BATTLE_FAST
return count_enemies_fast(b, af, minrow, maxrow, select);
#else
if (maxrow >= FIRST_ROW) {
int i = count_enemies_i(b, af, minrow, maxrow, select);
return i;
return count_enemies_i(b, af, minrow, maxrow, select);
}
return 0;
#endif
}
troop select_enemy(fighter * af, int minrow, int maxrow, int select)

View File

@ -93,15 +93,6 @@ extern "C" {
int row;
int result;
} rowcache;
#ifdef BATTLE_FAST
struct {
struct side *side;
int status;
int alive;
int minrow, maxrow;
int enemies[8];
} fast;
#endif
} battle;
typedef struct weapon {