disable the battle.fast cache

it doesn't look very good, anyhow
let's see how much that actually costs
This commit is contained in:
Enno Rehling 2021-03-24 20:40:33 +01:00
parent b5cc4e6fac
commit 195e49e7f0
2 changed files with 22 additions and 1 deletions

View File

@ -878,7 +878,9 @@ 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;
@ -1418,8 +1420,9 @@ count_enemies_i(battle * b, const fighter * af, int minrow, int maxrow,
return i;
}
#ifdef BATTLE_FAST
int
count_enemies(battle * b, const fighter * af, int minrow, int maxrow,
count_enemies_fast(battle * b, const fighter * af, int minrow, int maxrow,
int select)
{
int sr = statusrow(af->status);
@ -1451,6 +1454,22 @@ count_enemies(battle * b, const fighter * af, int minrow, int maxrow,
}
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 0;
#endif
}
troop select_enemy(fighter * af, int minrow, int maxrow, int select)
{

View File

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