Fix asteroid double-impact and levelgen theme fallback

Explode asteroid on player contact instead of letting it continue
falling to the ground for a second impact. Return a safe default
theme when theme_count is zero to avoid reading uninitialized data.
This commit is contained in:
Thomas
2026-03-01 09:41:45 +00:00
parent fac7085056
commit 3ce879fe98
2 changed files with 8 additions and 1 deletions

View File

@@ -602,7 +602,7 @@ static void gen_transition(Tilemap *map, int x0, int w,
/* Get the theme for a given segment index from the config */
static LevelTheme theme_for_segment(const LevelGenConfig *config, int seg_idx) {
if (config->theme_count <= 0) return config->themes[0];
if (config->theme_count <= 0) return THEME_PLANET_SURFACE;
if (seg_idx >= config->theme_count) return config->themes[config->theme_count - 1];
return config->themes[seg_idx];
}