From 093b982e016a273b0639b22bd2f4f888f1d77493 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sat, 21 Mar 2026 00:18:51 +0100 Subject: [PATCH] fix: corregir off-by-one en sprite_capacity para overlay en escenario 8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El +1 por background era incorrecto: addBackground() escribe directamente en los vectores sin pasar por el guard de pushQuad(), así que no consume slots del límite. El +1 que garantiza el slot del overlay ya está dentro de init() con (max_sprites_+1). Quitarlo evita que el overlay se rechace al llenar exactamente el escenario de 100K bolas. Co-Authored-By: Claude Sonnet 4.6 --- source/engine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/engine.cpp b/source/engine.cpp index 7a18c45..7b3e219 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -231,11 +231,12 @@ bool Engine::initialize(int width, int height, int zoom, bool fullscreen, AppMod success = false; } - // Calcular capacidad: background (1) + bolas del escenario máximo + overlay (+1 interno en init) + // Capacidad = número de bolas del escenario máximo (o custom si es mayor). + // addBackground() no usa el guard de pushQuad(), así que no consume slots aquí. + // init() reserva internamente +1 quad extra garantizado para el overlay. int sprite_capacity = BALL_COUNT_SCENARIOS[DEMO_AUTO_MAX_SCENARIO]; if (custom_scenario_enabled_ && custom_scenario_balls_ > sprite_capacity) sprite_capacity = custom_scenario_balls_; - sprite_capacity += 1; // +1 por el background sprite_batch_ = std::make_unique(); if (!sprite_batch_->init(gpu_ctx_->device(), sprite_capacity)) {