forked from tas/major_tom
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:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user