Skip to content

Commit 1e71d6e

Browse files
committed
[web] implement travel_types hav differents max speeds
1 parent cc4681d commit 1e71d6e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

web/src/graph.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,14 @@ impl Graph {
8585
if way.speed == 0 {
8686
return way.distance;
8787
}
88-
// TODO fix speed with correct travel_type
89-
return way.distance / way.speed;
88+
let speed = match travel_type {
89+
0 => way.speed,
90+
1 if way.speed <= 20 => way.speed,
91+
1 if way.speed >= 20 => 20,
92+
2 => 7,
93+
_ => unreachable!(),
94+
};
95+
return way.distance / speed;
9096
}
9197
}
9298

0 commit comments

Comments
 (0)