Skill tree progression system & whitespace support

This commit is contained in:
2026-02-15 07:30:34 +00:00
parent 13550505c1
commit 6d6815af02
22 changed files with 2883 additions and 238 deletions

View File

@@ -49,8 +49,17 @@ impl JsonStore {
Ok(())
}
pub fn load_profile(&self) -> ProfileData {
self.load("profile.json")
/// Load and deserialize profile. Returns None if file exists but
/// cannot be parsed (schema mismatch / corruption).
pub fn load_profile(&self) -> Option<ProfileData> {
let path = self.file_path("profile.json");
if path.exists() {
let content = fs::read_to_string(&path).ok()?;
serde_json::from_str(&content).ok()
} else {
// No file yet — return fresh default (not a schema mismatch)
Some(ProfileData::default())
}
}
pub fn save_profile(&self, data: &ProfileData) -> Result<()> {