feat: limitar modo BOIDS a escenarios con ≤1.000 bolas

Pulsar B en escenarios 6-8 (o custom >1K) no activa boids y muestra
notificación. Cambiar de escenario estando en BOIDS queda bloqueado
si el destino supera BOIDS_MAX_BALLS (= SCENE_BALLS_5).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 01:13:17 +01:00
parent e1f6fd0f39
commit 9ae851d5b6
3 changed files with 25 additions and 0 deletions

View File

@@ -564,7 +564,21 @@ void Engine::toggleDepthZoom() {
}
// Boids (comportamiento de enjambre)
bool Engine::isScenarioAllowedForBoids(int scenario_id) const {
int ball_count = (scenario_id == CUSTOM_SCENARIO_IDX)
? custom_scenario_balls_
: BALL_COUNT_SCENARIOS[scenario_id];
return ball_count <= BOIDS_MAX_BALLS;
}
void Engine::toggleBoidsMode(bool force_gravity_on) {
if (current_mode_ != SimulationMode::BOIDS) {
// Intentando activar BOIDS — verificar escenario actual
if (!isScenarioAllowedForBoids(scene_manager_->getCurrentScenario())) {
showNotificationForAction("Boids: máximo 1.000 pelotas");
return;
}
}
if (current_mode_ == SimulationMode::BOIDS) {
// Salir del modo boids
current_mode_ = SimulationMode::PHYSICS;
@@ -654,6 +668,12 @@ void Engine::setCustomScenario(int balls) {
// Escenarios (número de pelotas)
void Engine::changeScenario(int scenario_id, const char* notification_text) {
if (current_mode_ == SimulationMode::BOIDS) {
if (!isScenarioAllowedForBoids(scenario_id)) {
showNotificationForAction("Boids: máximo 1.000 pelotas");
return;
}
}
// Pasar el modo actual al SceneManager para inicialización correcta
scene_manager_->changeScenario(scenario_id, current_mode_);