1pub mod error;
2pub mod ids;
3
4pub mod model;
5pub mod rules;
6pub mod state;
7pub mod engine;
8pub mod util;
9pub mod display;
10pub mod pack;
11
12pub use engine::core::{GameEngine, StepResult};
13pub use engine::init::initialize_game;
14pub use error::{EngineError, LegalityError};
15pub use model::action::Action;
16pub use model::command::Command;
17pub use model::event::Event;
18pub use rules::schema::Ruleset;
19pub use rules::RulesModule;
20pub use state::gamestate::GameState;
21pub use util::rng::GameRng;
22pub use display::{GameDisplay, LogEntry};
23
24use std::fs;
25use std::path::Path;
26
27use crate::error::CardinalError;
28use crate::rules::schema::Ruleset as RulesetToml;
29
30pub fn load_rules<P: AsRef<Path>>(path: P) -> Result<RulesetToml, CardinalError> {
32 let content = fs::read_to_string(path).map_err(|e| CardinalError(format!("Failed to read rules file: {}", e)))?;
33 toml::from_str(&content).map_err(|e| CardinalError(format!("Failed to parse TOML: {}", e)))
34}