mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Fixed inconsistent map size (#3915)
* Fixed inconsistent map size * removed empty lines of code * removed print
This commit is contained in:
parent
61c8ab3a8f
commit
3b599d3b50
@ -23,6 +23,7 @@ class MapSizeNew {
|
||||
constructor()
|
||||
|
||||
constructor(name: String) {
|
||||
this.name = name
|
||||
/** Hard coded values from getEquivalentRectangularSize() */
|
||||
when (name) {
|
||||
Constants.tiny -> { radius = 10; width = 23; height = 15 }
|
||||
@ -32,6 +33,7 @@ class MapSizeNew {
|
||||
Constants.huge -> { radius = 40; width = 87; height = 57 }
|
||||
}
|
||||
}
|
||||
|
||||
constructor(radius: Int) {
|
||||
name = Constants.custom
|
||||
this.radius = radius
|
||||
@ -47,8 +49,6 @@ class MapSizeNew {
|
||||
this.radius = getEquivalentHexagonalRadius(width, height)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
object MapShape {
|
||||
|
@ -135,9 +135,9 @@ class TileMap {
|
||||
if (!mapParameters.worldWrap)
|
||||
return null
|
||||
|
||||
var radius = mapParameters.size.radius
|
||||
var radius = mapParameters.mapSize.radius
|
||||
if (mapParameters.shape == MapShape.rectangular)
|
||||
radius = HexMath.getEquivalentRectangularSize(radius).x.toInt() / 2
|
||||
radius = mapParameters.mapSize.width / 2
|
||||
|
||||
//tile is outside of the map
|
||||
if (contains(x + radius, y - radius)) { //tile is on right side
|
||||
@ -328,9 +328,9 @@ class TileMap {
|
||||
* Returns -1 if not neighbors
|
||||
*/
|
||||
fun getNeighborTileClockPosition(tile: TileInfo, otherTile: TileInfo): Int {
|
||||
var radius = mapParameters.size.radius
|
||||
var radius = mapParameters.mapSize.radius
|
||||
if (mapParameters.shape == MapShape.rectangular)
|
||||
radius = HexMath.getEquivalentRectangularSize(radius).x.toInt() / 2
|
||||
radius = mapParameters.mapSize.width / 2
|
||||
|
||||
val xDifference = tile.position.x - otherTile.position.x
|
||||
val yDifference = tile.position.y - otherTile.position.y
|
||||
@ -358,9 +358,9 @@ class TileMap {
|
||||
if (!contains(position))
|
||||
return position //The position is outside the map so its unwrapped already
|
||||
|
||||
var radius = mapParameters.size.radius
|
||||
var radius = mapParameters.mapSize.radius
|
||||
if (mapParameters.shape == MapShape.rectangular)
|
||||
radius = HexMath.getEquivalentRectangularSize(radius).x.toInt() / 2
|
||||
radius = mapParameters.mapSize.width / 2
|
||||
|
||||
val vectorUnwrappedLeft = Vector2(position.x + radius, position.y - radius)
|
||||
val vectorUnwrappedRight = Vector2(position.x - radius, position.y + radius)
|
||||
|
Loading…
Reference in New Issue
Block a user