diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-14 22:44:04 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-14 22:44:04 +0300 |
| commit | d43524a8e40bb923d9275e17d3dc586701f08bbf (patch) | |
| tree | cf60379bbb567ebb31d2089d39c23ae42af3f2eb /crates/fparkan-runtime/src/research.rs | |
| parent | 947be441148cea94b2a847268b885cc20d36b2aa (diff) | |
| download | fparkan-d43524a8e40bb923d9275e17d3dc586701f08bbf.tar.xz fparkan-d43524a8e40bb923d9275e17d3dc586701f08bbf.zip | |
feat(ai): build the clan transport from the AI catalog
Let a scripted transport order survive a busy factory and use the unique eligible design from the clan technology table. The AI reserves its transport independently of the player scheme list.
Two Fortresses released sml_cargo.dat from the stock start in the FParkan window and the licensed regression covers both factories. The x86 DLL chooser confirmed class, readiness, and fastest selection. Transport routes and live timing parity remain open.
Diffstat (limited to 'crates/fparkan-runtime/src/research.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/research.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crates/fparkan-runtime/src/research.rs b/crates/fparkan-runtime/src/research.rs index c9f0084e..94f5d55a 100644 --- a/crates/fparkan-runtime/src/research.rs +++ b/crates/fparkan-runtime/src/research.rs @@ -1,6 +1,6 @@ use super::{ - mission_events::on_communicator, normalize_engine_path, read_vfs, ClanBody, Engine, - EngineError, LoadedMissionState, MissionObjectDraft, StartingCockpit, + mission_events::on_communicator, normalize_engine_path, ClanBody, Engine, EngineError, + LoadedMissionState, MissionObjectDraft, StartingCockpit, }; use fparkan_assets::ResearchTrfDocument; use fparkan_vfs::Vfs; @@ -235,8 +235,15 @@ pub(super) fn load_clan_table( mission: &LoadedMissionState, owner: OwnerId, ) -> Result<ResearchTrfDocument, EngineError> { + load_technology_table(vfs.as_ref(), &mission.mission, owner) +} + +pub(super) fn load_technology_table( + vfs: &dyn Vfs, + mission: &crate::MissionDocument, + owner: OwnerId, +) -> Result<ResearchTrfDocument, EngineError> { let clan = mission - .mission .clans .get(usize::from(owner.0)) .ok_or_else(|| research_error("clan is unavailable"))?; @@ -254,7 +261,11 @@ pub(super) fn load_clan_table( return Err(research_error("clan has no technology table")); } let path = normalize_engine_path("clan technology table", path)?; - ResearchTrfDocument::decode(read_vfs(vfs, &path)?).map_err(research_error) + let bytes = vfs.read(&path).map_err(|source| EngineError::Vfs { + path: path.as_str().into(), + source, + })?; + ResearchTrfDocument::decode(bytes).map_err(research_error) } fn research_error(error: impl std::fmt::Display) -> EngineError { |
