fp: Only count enemies that are a mob

This commit is contained in:
doyle 2023-10-29 23:55:36 +11:00
parent 131323fbea
commit 9ba6071f9b

View File

@ -1987,7 +1987,14 @@ static void FP_Update(TELY_OS *os, FP_Game *game, TELY_OSInput *input, TELY_Audi
Dqn_usize enemy_count = 0;
for (FP_GameEntityHandle spawner_handle : game->play.mob_spawners) {
FP_GameEntity *spawner = FP_Game_GetEntity(game, spawner_handle);
enemy_count += spawner->spawn_list.size;
// NOTE: Count all the mobs spawned that are a foe
// (e.g. churches that convert mobs don't count).
for (FP_SentinelListLink<FP_GameEntityHandle> *link = nullptr; FP_SentinelList_Iterate<FP_GameEntityHandle>(&spawner->spawn_list, &link); ) {
FP_GameEntity *mob = FP_Game_GetEntity(game, link->data);
if (mob->faction == FP_GameEntityFaction_Foe)
enemy_count++;
}
}
bool all_enemies_killed = enemy_count == 0;