bike: normal speed on paths with asphalt, add tests

This commit is contained in:
Emil Tin
2013-09-12 14:15:50 +02:00
parent d9e3c43c91
commit 47f11fc3a6
2 changed files with 47 additions and 2 deletions
+7 -2
View File
@@ -66,6 +66,7 @@ route_speeds = {
}
surface_speeds = {
["asphalt"] = default_speed,
["cobblestone:flattened"] = 10,
["paving_stones"] = 10,
["compacted"] = 10,
@@ -317,8 +318,12 @@ function way_function (way)
if surface then
surface_speed = surface_speeds[surface]
if surface_speed then
way.speed = math.min(way.speed, surface_speed)
way.backward_speed = math.min(way.backward_speed, surface_speed)
if way.speed > 0 then
way.speed = surface_speed
end
if way.backward_speed > 0 then
way.backward_speed = surface_speed
end
end
end