forked from github/server
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:
parent
b5cc4e6fac
commit
195e49e7f0
21
src/battle.c
21
src/battle.c
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue