From 8e9d4ad08a6dcd31dfa8be5b70e157c8279cec28 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 2 Jan 2024 20:44:18 +0100 Subject: [PATCH] Simplify max speed quest logic (#5430) --- .../quests/max_speed/AddMaxSpeedForm.kt | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.kt index c7f310d8f5..0c36e65970 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.kt @@ -249,22 +249,18 @@ class AddMaxSpeedForm : AbstractOsmQuestForm() { private fun determineImplicitMaxspeedType() { val highwayTag = element.tags["highway"]!! - if (countryInfo.countryCode == "GB") { - if (ROADS_WITH_DEFINITE_SPEED_LIMIT_GB.contains(highwayTag)) { - applyNoSignAnswer(highwayTag) - } else { - askIsDualCarriageway( - onYes = { applyNoSignAnswer("nsl_dual") }, - onNo = { - determineLit( - onYes = { applyNoSignAnswer("nsl_restricted", true) }, - onNo = { applyNoSignAnswer("nsl_single", false) } - ) - } - ) - } - } else if (ROADS_WITH_DEFINITE_SPEED_LIMIT.contains(highwayTag)) { + if (ROADS_WITH_DEFINITE_SPEED_LIMIT.contains(highwayTag)) { applyNoSignAnswer(highwayTag) + } else if (countryInfo.countryCode == "GB") { + askIsDualCarriageway( + onYes = { applyNoSignAnswer("nsl_dual") }, + onNo = { + determineLit( + onYes = { applyNoSignAnswer("nsl_restricted", true) }, + onNo = { applyNoSignAnswer("nsl_single", false) } + ) + } + ) } else { askUrbanOrRural( onUrban = { applyNoSignAnswer("urban") }, @@ -321,7 +317,6 @@ class AddMaxSpeedForm : AbstractOsmQuestForm() { private val POSSIBLY_SLOWZONE_ROADS = listOf("residential", "unclassified", "tertiary" /*#1133*/) private val MAYBE_LIVING_STREET = listOf("residential", "unclassified") private val ROADS_WITH_DEFINITE_SPEED_LIMIT = listOf("motorway", "living_street") - private val ROADS_WITH_DEFINITE_SPEED_LIMIT_GB = listOf("motorway", "living_street") /*#2750*/ private var LAST_INPUT_SLOW_ZONE: Int? = null }