mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 11:44:25 +03:00
debug a car in a different color
This commit is contained in:
parent
cca0915ff3
commit
0e2ae49596
@ -234,6 +234,12 @@
|
||||
0.0,
|
||||
1.0
|
||||
],
|
||||
"DebugCar": [
|
||||
0.0,
|
||||
0.0,
|
||||
1.0,
|
||||
0.8
|
||||
],
|
||||
"MovingCar": [
|
||||
0.0,
|
||||
1.0,
|
||||
|
@ -55,6 +55,7 @@ pub enum Colors {
|
||||
YieldTurn,
|
||||
StopTurn,
|
||||
|
||||
DebugCar,
|
||||
MovingCar,
|
||||
StuckCar,
|
||||
ParkedCar,
|
||||
|
@ -370,6 +370,7 @@ impl UI {
|
||||
return c;
|
||||
}
|
||||
match self.sim_ctrl.sim.get_car_state(id) {
|
||||
CarState::Debug => ezgui::shift_color(self.cs.get(Colors::DebugCar), id.0),
|
||||
CarState::Moving => ezgui::shift_color(self.cs.get(Colors::MovingCar), id.0),
|
||||
CarState::Stuck => ezgui::shift_color(self.cs.get(Colors::StuckCar), id.0),
|
||||
CarState::Parked => ezgui::shift_color(self.cs.get(Colors::ParkedCar), id.0),
|
||||
|
@ -162,6 +162,8 @@ impl Car {
|
||||
}
|
||||
|
||||
constraints.push(accel);
|
||||
} else if self.debug {
|
||||
println!(" {} is {} behind {}. Lookahead dist {} + following dist {} is less than that, so ignore them", self.id, dist_behind_other, other.id, dist_to_lookahead, other_vehicle.following_dist());
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,7 +477,9 @@ impl DrivingSimState {
|
||||
|
||||
pub fn get_car_state(&self, c: CarID) -> CarState {
|
||||
if let Some(driving) = self.cars.get(&c) {
|
||||
if driving.speed > kinematics::EPSILON_SPEED {
|
||||
if driving.debug {
|
||||
CarState::Debug
|
||||
} else if driving.speed > kinematics::EPSILON_SPEED {
|
||||
CarState::Moving
|
||||
} else {
|
||||
CarState::Stuck
|
||||
|
@ -233,6 +233,7 @@ pub enum CarState {
|
||||
Moving,
|
||||
Stuck,
|
||||
Parked,
|
||||
Debug,
|
||||
}
|
||||
|
||||
// TODO Don't just alias types; assert that time, dist, and speed are always positive
|
||||
|
Loading…
Reference in New Issue
Block a user