diff --git a/src/simulator/api-wasm/src/resources.rs b/src/simulator/api-wasm/src/resources.rs index 7e167fa6..eddb1055 100644 --- a/src/simulator/api-wasm/src/resources.rs +++ b/src/simulator/api-wasm/src/resources.rs @@ -1,8 +1,9 @@ //! Resource catalog WASM bridge — exposes per-tile resource metadata //! including the 3-axis visibility schema landed in p2-54. //! -//! The catalog is baked at compile time from `public/resources/resources.json` -//! and parsed once via `OnceLock` on first access. +//! The catalog is read from the host-fed `mc_core::content` registry (embedded +//! `public/resources/resources.json` fallback) and parsed once via `OnceLock` +//! on first access. use mc_core::grid::GridState; use serde::{Deserialize, Serialize}; @@ -44,8 +45,8 @@ static CATALOG: OnceLock> = OnceLock::new(); fn catalog() -> &'static HashMap { CATALOG.get_or_init(|| { - const JSON: &str = include_str!("../../../../public/resources/resources.json"); - let bundle: ResourcesJson = serde_json::from_str(JSON).unwrap_or(ResourcesJson { + let json = mc_core::content::get(mc_core::content::ContentKey::Resources); + let bundle: ResourcesJson = serde_json::from_str(&json).unwrap_or(ResourcesJson { bonus: vec![], luxury: vec![], strategic: vec![], diff --git a/src/simulator/crates/mc-player-api/src/projection.rs b/src/simulator/crates/mc-player-api/src/projection.rs index c9f58d78..be61d416 100644 --- a/src/simulator/crates/mc-player-api/src/projection.rs +++ b/src/simulator/crates/mc-player-api/src/projection.rs @@ -938,16 +938,15 @@ fn classify_relation(rel: &mc_trade::relation::RelationState) -> String { /// Canonical score weights, loaded once from /// `public/games/age-of-dwarves/data/score.json` (Rail-2 — no hardcoded weights). -/// Compiled in via `include_str!` because the projector runs on every `view()` -/// and per-call I/O is unacceptable. +/// The raw JSON comes from the host-fed [`mc_core::content`] registry (embedded +/// `include_str!` fallback, no per-call I/O) and is cached for the process — the +/// projector runs on every `view()` so per-call I/O would be unacceptable. fn score_weights() -> &'static mc_score::ScoreWeights { use std::sync::OnceLock; static WEIGHTS: OnceLock = OnceLock::new(); WEIGHTS.get_or_init(|| { - const JSON: &str = include_str!( - "../../../../../public/games/age-of-dwarves/data/score.json" - ); - mc_score::ScoreWeights::from_json(JSON).expect("score.json must parse") + let json = mc_core::content::get(mc_core::content::ContentKey::ScoreWeights); + mc_score::ScoreWeights::from_json(&json).expect("score.json must parse") }) }