mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 06:04:02 +07:00
Better exploration - units explore to tiles adjacent to those they don't know, which solved the "I can't see the coastline" effect
This may have a performance impact, so reduced the radius of the search significantly - beyond that, people can send them manually to explore and then automate whe they're close enough
This commit is contained in:
parent
cbeb9a96a6
commit
b6f75f0583
@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.unciv.Constants
|
||||
import com.unciv.logic.battle.*
|
||||
import com.unciv.logic.city.CityInfo
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.civilization.GreatPersonManager
|
||||
import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
|
||||
import com.unciv.logic.map.MapUnit
|
||||
@ -19,8 +20,8 @@ object UnitAutomation {
|
||||
internal fun tryExplore(unit: MapUnit): Boolean {
|
||||
if (tryGoToRuin(unit) && unit.currentMovement == 0f) return true
|
||||
|
||||
for (tile in unit.currentTile.getTilesInDistance(10))
|
||||
if (unit.movement.canMoveTo(tile) && tile.position !in unit.civInfo.exploredTiles
|
||||
for (tile in unit.currentTile.getTilesInDistance(5)) // number increases exponentially with distance - at 10 this took a looong time
|
||||
if (unit.movement.canMoveTo(tile) && tile.neighbors.any { it.position !in unit.civInfo.exploredTiles }
|
||||
&& unit.movement.canReach(tile)
|
||||
&& (tile.getOwner() == null || !tile.getOwner()!!.isCityState())) {
|
||||
unit.movement.headTowards(tile)
|
||||
|
@ -103,7 +103,7 @@ class CivilizationInfo {
|
||||
|
||||
// This is the only thing that is NOT switched out, which makes it a source of ConcurrentModification errors.
|
||||
// Cloning it by-pointer is a horrific move, since the serialization would go over it ANYWAY and still led to concurrency prolems.
|
||||
// Cloning it by iiterating on the tilemap values may seem ridiculous, but it's a perfectly thread-safe way to go about it, unlike the other solutions.
|
||||
// Cloning it by iterating on the tilemap values may seem ridiculous, but it's a perfectly thread-safe way to go about it, unlike the other solutions.
|
||||
toReturn.exploredTiles.addAll(gameInfo.tileMap.values.asSequence().map { it.position }.filter { it in exploredTiles })
|
||||
toReturn.notifications.addAll(notifications)
|
||||
toReturn.citiesCreated = citiesCreated
|
||||
|
Loading…
Reference in New Issue
Block a user