mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 12:12:00 +03:00
digging into nondeterminism due to fp issues
This commit is contained in:
parent
686f247b52
commit
11f0f20a3e
@ -105,7 +105,8 @@ impl Sim {
|
||||
{
|
||||
panic!("Three buses didn't fit");
|
||||
}
|
||||
// TODO this is introducing nondeterminism?!
|
||||
// TODO this is introducing nondeterminism, because of slight floating point errors.
|
||||
// fragile that this causes it, but true. :\
|
||||
/*self.make_ped_using_bus(
|
||||
map,
|
||||
LaneID(550),
|
||||
|
@ -79,6 +79,13 @@ impl Sim {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load(path: String, new_scenario_name: String) -> Result<Sim, std::io::Error> {
|
||||
abstutil::read_json(&path).map(|mut s: Sim| {
|
||||
s.scenario_name = new_scenario_name;
|
||||
s
|
||||
})
|
||||
}
|
||||
|
||||
pub fn edit_lane_type(&mut self, id: LaneID, old_type: LaneType, map: &Map) {
|
||||
match old_type {
|
||||
LaneType::Driving => self.driving_state.edit_remove_lane(id),
|
||||
|
@ -86,7 +86,8 @@ fn with_savestating() {
|
||||
);
|
||||
}
|
||||
|
||||
let sim3: sim::Sim = abstutil::read_json(&sim1_save).unwrap();
|
||||
let sim3: sim::Sim =
|
||||
sim::Sim::load(sim1_save.clone(), "with_savestating_3".to_string()).unwrap();
|
||||
if sim3 != sim2 {
|
||||
panic!(
|
||||
"sim state differs between {} and {}",
|
||||
|
Loading…
Reference in New Issue
Block a user