Skip to content

Commit 126d1e6

Browse files
authored
Remove GameConfig after on game end (#562)
1 parent 5928a7b commit 126d1e6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

crates/core/src/gamestate.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use bevy::prelude::*;
22
use iyes_progress::prelude::*;
33

44
use crate::{
5+
gconfig::GameConfig,
56
state::AppState,
67
transition::{DeStateTransition, StateWithSet},
78
};
@@ -43,6 +44,7 @@ fn setup(mut next_state: ResMut<NextState<GameState>>) {
4344
next_state.set(GameState::Loading);
4445
}
4546

46-
fn cleanup(mut next_state: ResMut<NextState<GameState>>) {
47+
fn cleanup(mut commands: Commands, mut next_state: ResMut<NextState<GameState>>) {
48+
commands.remove_resource::<GameConfig>();
4749
next_state.set(GameState::None);
4850
}

crates/core/src/gconfig.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use bevy::prelude::Resource;
44

55
use crate::player::{Player, PlayerRange};
66

7+
/// This resource is automatically removed when
8+
/// [`crate::state::AppState::InGame`] is exited.
79
#[derive(Resource)]
810
pub struct GameConfig {
911
map_path: PathBuf,

0 commit comments

Comments
 (0)