From 73bfa33438d0b1a20d8187f7260bc98c0ce2ed56 Mon Sep 17 00:00:00 2001 From: poly000 <1348292515@qq.com> Date: Wed, 27 Mar 2024 01:07:36 +0800 Subject: [PATCH] fix: reload stage_table after switch locale --- src/game/shared_game_state.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/game/shared_game_state.rs b/src/game/shared_game_state.rs index 3d33d33..1e57177 100644 --- a/src/game/shared_game_state.rs +++ b/src/game/shared_game_state.rs @@ -522,6 +522,16 @@ 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.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 { @@ -531,8 +541,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.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)?; @@ -589,6 +598,7 @@ impl SharedGameState { .unwrap(); self.font = font; + let _ = self.reload_stage_table(ctx); } pub fn graphics_reset(&mut self) {