diff --git a/app/src/main/java/de/westnordost/streetcomplete/overlays/OverlaysModule.kt b/app/src/main/java/de/westnordost/streetcomplete/overlays/OverlaysModule.kt index 67c586b8c8..08f4229dab 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/overlays/OverlaysModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/overlays/OverlaysModule.kt @@ -1,6 +1,9 @@ package de.westnordost.streetcomplete.overlays +import de.westnordost.countryboundaries.CountryBoundaries +import de.westnordost.osmfeatures.Feature import de.westnordost.osmfeatures.FeatureDictionary +import de.westnordost.streetcomplete.data.meta.CountryInfos import de.westnordost.streetcomplete.data.overlays.OverlayRegistry import de.westnordost.streetcomplete.overlays.address.AddressOverlay import de.westnordost.streetcomplete.overlays.cycleway.CyclewayOverlay @@ -17,16 +20,29 @@ import java.util.concurrent.FutureTask /* Each overlay is assigned an ordinal. This is used for serialization and is thus never changed, * even if the order of overlays is changed. */ val overlaysModule = module { - single { OverlayRegistry(listOf( - 0 to WayLitOverlay(), - 6 to SurfaceOverlay(), - 1 to SidewalkOverlay(), - 5 to CyclewayOverlay(get(), get(named("CountryBoundariesFuture"))), - 2 to StreetParkingOverlay(), - 3 to AddressOverlay(get(named("CountryBoundariesFuture"))), - 4 to ShopsOverlay { tags -> - get>(named("FeatureDictionaryFuture")) + single { + overlaysRegistry( + get(), + get(named("CountryBoundariesFuture")), + { tags -> + get>(named("FeatureDictionaryFuture")) .get().getFeature(tags) - }, - )) } + } + ) + } } + +fun overlaysRegistry( + countryInfos: CountryInfos, + countryBoundariesFuture: FutureTask, + getFeature: (tags: Map) -> Feature?, +) = OverlayRegistry(listOf( + + 0 to WayLitOverlay(), + 6 to SurfaceOverlay(), + 1 to SidewalkOverlay(), + 5 to CyclewayOverlay(countryInfos, countryBoundariesFuture), + 2 to StreetParkingOverlay(), + 3 to AddressOverlay(countryBoundariesFuture), + 4 to ShopsOverlay(getFeature), +)) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt index 6e9646f57e..277928a29d 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt @@ -184,10 +184,11 @@ val questsModule = module { get(), get(named("CountryBoundariesFuture")), get(), - ) { tags -> - get>(named("FeatureDictionaryFuture")) - .get().getFeature(tags) - } + { tags -> + get>(named("FeatureDictionaryFuture")) + .get().getFeature(tags) + } + ) } } @@ -252,7 +253,7 @@ fun questTypeRegistry( 9 to AddCarWashType(), 10 to AddBenchBackrest(), - 11 to AddAmenityCover { getFeature(it) }, + 11 to AddAmenityCover(getFeature), 12 to AddBridgeStructure(), @@ -328,7 +329,7 @@ fun questTypeRegistry( /* pulled up in priority to be before CheckExistence because this is basically the check whether the postbox is still there in countries in which it is enabled */ 48 to AddPostboxCollectionTimes(), - 49 to CheckExistence { getFeature(it) }, + 49 to CheckExistence(getFeature), 155 to AddGritBinSeasonal(), 50 to AddBoardType(), @@ -378,9 +379,9 @@ fun questTypeRegistry( 157 to AddHairdresserCustomers(), // almost always marked on sign outside 78 to SpecifyShopType(), // above add place name as some brand presets will set the name too 79 to CheckShopType(), - 80 to AddPlaceName { getFeature(it) }, - 77 to CheckOpeningHoursSigned { getFeature(it) }, - 81 to AddOpeningHours { getFeature(it) }, + 80 to AddPlaceName(getFeature), + 77 to CheckOpeningHoursSigned(getFeature), + 81 to AddOpeningHours(getFeature), 83 to AddBicyclePump(), // visible from the outside, but only during opening hours 84 to AddAtmOperator(), @@ -465,7 +466,7 @@ fun questTypeRegistry( 132 to AddAcceptsCash(), 133 to AddFuelSelfService(), - 156 to CheckShopExistence { getFeature(it) }, // after opening hours and similar so they will be preferred if enabled + 156 to CheckShopExistence(getFeature), // after opening hours and similar so they will be preferred if enabled /* ↓ 5.quests that are very numerous ---------------------------------------------------- */