fix: reload stage_table after switch locale

This commit is contained in:
poly000 2024-03-27 01:07:36 +08:00
parent 76c4403948
commit f4b1fa39dc
No known key found for this signature in database
1 changed files with 13 additions and 7 deletions

View File

@ -513,6 +513,17 @@ impl SharedGameState {
})
}
pub fn reload_stage_table(&mut self, ctx: &mut Context) -> GameResult {
let stages = StageData::load_stage_table(
ctx,
&self.constants.base_paths,
self.constants.is_switch,
self.constants.stage_encoding,
)?;
self.stages = stages;
Ok(())
}
pub fn reload_resources(&mut self, ctx: &mut Context) -> GameResult {
self.constants.rebuild_path_list(self.mod_path.clone(), self.season, &self.settings);
if !self.constants.is_demo {
@ -522,13 +533,7 @@ impl SharedGameState {
self.constants.load_csplus_tables(ctx)?;
self.constants.load_animated_faces(ctx)?;
self.constants.load_texture_size_hints(ctx)?;
let stages = StageData::load_stage_table(
ctx,
&self.constants.base_paths,
self.constants.is_switch,
self.constants.stage_encoding,
)?;
self.stages = stages;
self.reload_stage_table(ctx)?;
let npc_tbl = filesystem::open_find(ctx, &self.constants.base_paths, "npc.tbl")?;
let npc_table = NPCTable::load_from(npc_tbl)?;
@ -600,6 +605,7 @@ impl SharedGameState {
let font = Self::try_update_locale(&mut self.constants, &locale, ctx).unwrap();
self.loc = locale;
self.font = font;
let _ = self.reload_stage_table(ctx);
}
pub fn graphics_reset(&mut self) {