mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Probably solved a bug where brushes would cause non-ruleset terrains for mods without grassland
This commit is contained in:
parent
4ce8704969
commit
8aa99c03e2
@ -27,14 +27,10 @@ object Battle {
|
||||
fun moveAndAttack(attacker: ICombatant, attackableTile: AttackableTile) {
|
||||
if (attacker is MapUnitCombatant) {
|
||||
attacker.unit.movement.moveToTile(attackableTile.tileToAttackFrom)
|
||||
/** You might ask: When can this possibly happen?
|
||||
* We always receive an AttackableTile, which means that it was returned from getAttackableTiles!
|
||||
* And getAttackableTiles should ensure that we return only units that are in the range of movement!
|
||||
*
|
||||
* The answer is: when crossing a HIDDEN TILE.
|
||||
/**
|
||||
* When calculating movement distance, we assume that a hidden tile is 1 movement point,
|
||||
* which can lead to EXCEEDINGLY RARE edge cases where you think
|
||||
* that you can attack a tile by passing through a hidden tile,
|
||||
* that you can attack a tile by passing through a HIDDEN TILE,
|
||||
* but the hidden tile is actually IMPASSIBLE so you stop halfway!
|
||||
*/
|
||||
if (attacker.getTile() != attackableTile.tileToAttackFrom) return
|
||||
|
@ -299,12 +299,14 @@ class MapEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(CameraS
|
||||
tileInfo.ruleset = mapEditorScreen.ruleset
|
||||
val terrain = resource.terrainsCanBeFoundOn.first { ruleset.terrains.containsKey(it) }
|
||||
val terrainObject = ruleset.terrains[terrain]!!
|
||||
if (terrainObject.type == TerrainType.TerrainFeature) {
|
||||
|
||||
if (terrainObject.type != TerrainType.TerrainFeature) tileInfo.baseTerrain = terrain
|
||||
else {
|
||||
tileInfo.baseTerrain =
|
||||
if (terrainObject.occursOn.isNotEmpty()) terrainObject.occursOn.first()
|
||||
else "Grassland"
|
||||
if (terrainObject.occursOn.isNotEmpty()) terrainObject.occursOn.first()
|
||||
else ruleset.terrains.values.first { it.type == TerrainType.Land }.name
|
||||
tileInfo.terrainFeatures.add(terrain)
|
||||
} else tileInfo.baseTerrain = terrain
|
||||
}
|
||||
|
||||
tileInfo.resource = resource.name
|
||||
tileInfo.setTerrainTransients()
|
||||
|
Loading…
x
Reference in New Issue
Block a user