fixup! Keep unfinished retarget routes in a bounded job queue (#127)
The relief snapshot was still global: a smart plan finishing while a retarget job waited could replace Sim::known_relief, so the pending route was planned on the newer map. RouteJob now carries Arc<KnownRelief> for its knowledge version; Sim::known_relief keeps the same Arc only to seed new jobs. retarget_relief reads the job's snapshot, and relief sampling, price grids and route caches are keyed by that version. The new regression makes a job wait, swaps the global relief for another grid with a wall, and checks the pending route and sample stay those of the original version; outside its grid is Unknown. Core release, adapter and WASM contract pass.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
//! parts are drawn (`Sim::draw_sam`).
|
||||
use glam::{DQuat, DVec3};
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub mod battery;
|
||||
pub mod launch;
|
||||
@@ -1305,9 +1306,9 @@ pub struct Sim {
|
||||
/// Routes still to work out after a mass retarget (#127): the drones were given a new aim, but the
|
||||
/// planner's share of a tick ran out. They keep their old route until a new one is ready.
|
||||
retargets: VecDeque<ew::RouteJob>,
|
||||
/// The known land of the last smart raid's plan: its grid and cell heights (NaN unknown). A retarget
|
||||
/// is planned over the same knowledge, never over land mapped after it (#127).
|
||||
known_relief: Option<(raid::Grid, Vec<f32>)>,
|
||||
/// The known land of the last smart raid's plan: its grid and cell heights (NaN unknown). New retarget
|
||||
/// jobs take this `Arc` as their version; a later plan replaces the pointer, not a pending job's map (#127).
|
||||
known_relief: Option<Arc<ew::KnownRelief>>,
|
||||
/// The vehicles' ground routes, and the jobs the trucks found out of reach (#94).
|
||||
routes: route::Routes,
|
||||
/// Each marked object's health, 0 to 100 (`targets`' order).
|
||||
|
||||
Reference in New Issue
Block a user