diff --git a/apps/game/src/lib.rs b/apps/game/src/lib.rs index ce045976fe..9050df5a43 100644 --- a/apps/game/src/lib.rs +++ b/apps/game/src/lib.rs @@ -553,10 +553,13 @@ fn finish_app_setup( } Mode::TutorialIntro => sandbox::gameplay::Tutorial::start(ctx, app), Mode::Challenges => challenges::ChallengesPicker::new_state(ctx, app), - Mode::Sandbox => GameplayMode::PlayScenario( - app.primary.map.get_name().clone(), - Scenario::default_scenario_for_map(app.primary.map.get_name()), - Vec::new(), + Mode::Sandbox => SandboxMode::simple_new( + app, + GameplayMode::PlayScenario( + app.primary.map.get_name().clone(), + Scenario::default_scenario_for_map(app.primary.map.get_name()), + Vec::new(), + ), ), Mode::Proposals => pregame::proposals::Proposals::new_state(ctx, None), Mode::Ungap => { diff --git a/apps/game/src/pregame/mod.rs b/apps/game/src/pregame/mod.rs index 3a1f49907a..3e953ae32a 100644 --- a/apps/game/src/pregame/mod.rs +++ b/apps/game/src/pregame/mod.rs @@ -29,7 +29,7 @@ fn enter_state(ctx: &mut EventCtx, app: &mut App, args: Vec<&str>) -> Box Distance { - if let Some(x) = self.queues[&car.router.head()] + self.queues[&car.router.head()] .get_car_positions(now, &self.cars, &self.queues) .into_iter() .find(|entry| entry.member == Queued::Vehicle(car.vehicle.id)) - { - x.front - } else { - panic!( - "get_car_front of {:?} at {} on {:?}... car positions are {:?}", - car, - now, - car.router.head(), - self.queues[&car.router.head()] - ); - } + .unwrap() + .front } /// Does the given car want to over-take the vehicle in front of it? diff --git a/sim/src/mechanics/intersection.rs b/sim/src/mechanics/intersection.rs index 94afca2fb0..faf68175de 100644 --- a/sim/src/mechanics/intersection.rs +++ b/sim/src/mechanics/intersection.rs @@ -1020,13 +1020,6 @@ impl IntersectionSimState { let head = if let Some(c) = q.laggy_head { c } else { - if q.get_active_cars().is_empty() { - panic!( - "what? look for {} near {}", - car, - cars[¤t].router.head() - ); - } q.get_active_cars()[0] }; if current != head { diff --git a/sim/src/transit.rs b/sim/src/transit.rs index 7c8d5324ff..c2265394e2 100644 --- a/sim/src/transit.rs +++ b/sim/src/transit.rs @@ -102,12 +102,13 @@ impl TransitSimState { }); continue; } + // TODO Why're we calculating these again? Use bus_route.all_path_requests(), so + // that all the nice checks in the map_model layer are preserved here let req = PathRequest::vehicle( stop1.driving_pos, map.get_ts(bus_route.stops[idx + 1]).driving_pos, bus_route.route_type, ); - let orig = req.clone(); match map.pathfind(req) { Ok(path) => { if path.is_empty() { @@ -115,11 +116,10 @@ impl TransitSimState { } if stop1.driving_pos != path.get_req().start { panic!( - "will warp! {} to {} for {}. orig req {}", + "{} will warp from {} to {}", + bus_route.long_name, stop1.driving_pos, path.get_req().start, - bus_route.long_name, - orig ); } @@ -153,13 +153,6 @@ impl TransitSimState { } else { None }; - - /*for pair in stops.windows(2) { - if pair[0].next_stop.as_ref().unwrap().end != pair[1].start { - panic!("what? {} vs {} on {}", pair[0], pair[1], result.long_name); - } - }*/ - Route { active_vehicles: BTreeSet::new(), stops, @@ -297,15 +290,6 @@ impl TransitSimState { self.events .push(Event::BusDepartedFromStop(id, bus.route, stop.id)); if let Some(path) = stop.next_stop.clone() { - if stop.driving_pos != path.get_req().start { - panic!( - "warp! {} to {} for {}", - stop.driving_pos, - path.get_req().start, - id - ); - } - bus.state = BusState::DrivingToStop(stop_idx + 1); Router::follow_bus_route(id, path) } else if let Some(path) = route.end_at_border.clone() {