feat(demo): el pilot IA retén el tret si té el company en la línia de tir (evita foc amic)

This commit is contained in:
2026-05-30 10:06:30 +02:00
parent 5407f66c9e
commit 8d659c44e5
3 changed files with 40 additions and 3 deletions
+7
View File
@@ -408,8 +408,15 @@ auto GameScene::stepDemo(float delta_time, bool input_blocked) -> bool {
demo_ctrls_[i] = {}; // nau inactiva/morta: sense control
continue;
}
// Company per a evitar foc amic en demo de 2 naus: només es passa si l'altre
// jugador està actiu al match (un slot no usat tindria isActive()==true).
const uint8_t OTHER = 1U - i;
const bool OTHER_ACTIVE = (OTHER == 0) ? match_config_.player1_active
: match_config_.player2_active;
const Ship* teammate = OTHER_ACTIVE ? &ships_[OTHER] : nullptr;
demo_ctrls_[i] = demo_pilots_[i].compute(
ships_[i],
teammate,
enemies_,
bullets_,
Defaults::Zones::PLAYAREA,