private fun CoroutineScope.setCurrentLocation(ptr: MapObjectPtr) {
pushHistoryEntry(ptr)
- renderLore(ptr)
+ renderLore(ptr, this)
setTitle(ptr)
}
}
}
-context(CoroutineScope)
@HtmlTagMarker
-private inline fun FlowOrInteractiveOrPhrasingContent.a(ptr: MapObjectPtr, currentSectorId: String?, crossinline block: A.() -> Unit = {}) {
+private inline fun FlowOrInteractiveOrPhrasingContent.a(ptr: MapObjectPtr, currentSectorId: String?, coroutineScope: CoroutineScope, crossinline block: A.() -> Unit) {
a(href = ptr.toUrl().href) {
onClickFunction = { ev ->
ev.preventDefault()
- openPtr(ptr, currentSectorId, true)
+ coroutineScope.openPtr(ptr, currentSectorId, true)
}
block()
}
}
-private fun CoroutineScope.renderLore(ptr: MapObjectPtr) {
+private fun renderLore(ptr: MapObjectPtr, coroutineScope: CoroutineScope) {
val loreBar = document.getElementById("lore-bar")!!.unsafeCast<HTMLDivElement>()
loreBar.clear()
is SectorPtr -> {
val sector = galaxyMap.sectors.getValue(ptr.sector)
p {
- a(GalaxyPtr, ptr.sector) {
+ a(GalaxyPtr, ptr.sector, coroutineScope) {
+galaxyMap.universeTitle
}
}
val sector = galaxyMap.sectors.getValue(ptr.sector)
val system = sector.starSystems.getValue(ptr.system)
p {
- a(GalaxyPtr, ptr.sector) {
+ a(GalaxyPtr, ptr.sector, coroutineScope) {
+galaxyMap.universeTitle
}
+" > "
val sectorPtr = SectorPtr(ptr.sector)
- a(sectorPtr, ptr.sector) {
+ a(sectorPtr, ptr.sector, coroutineScope) {
+sector.name
}
}
val system = sector.starSystems.getValue(ptr.system)
val body = system.celestialBodies.getValue(ptr.body)
p {
- a(GalaxyPtr, ptr.sector) {
+ a(GalaxyPtr, ptr.sector, coroutineScope) {
+galaxyMap.universeTitle
}
+" > "
val sectorPtr = SectorPtr(ptr.sector)
- a(sectorPtr, ptr.sector) {
+ a(sectorPtr, ptr.sector, coroutineScope) {
+sector.name
}
+" > "
val starSystemPtr = StarSystemPtr(ptr.sector, ptr.system)
- a(starSystemPtr, ptr.sector) {
+ a(starSystemPtr, ptr.sector, coroutineScope) {
+system.name
}
}
for ((sectorId, sector) in sectorsList)
li {
val sectorPtr = SectorPtr(sectorId)
- a(sectorPtr, null) {
+ a(sectorPtr, null, coroutineScope) {
+sector.name
}
}
for ((systemId, system) in systemsList)
li {
val systemPtr = StarSystemPtr(ptr.sector, systemId)
- a(systemPtr, ptr.sector) {
+ a(systemPtr, ptr.sector, coroutineScope) {
+system.name
}
}
for ((bodyId, body) in bodiesList)
li {
val bodyPtr = CelestialBodyPtr(ptr.sector, ptr.system, bodyId)
- a(bodyPtr, ptr.sector) {
+ a(bodyPtr, ptr.sector, coroutineScope) {
+body.name
}
}