mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04: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()
|
||||||
|
|
||||||
constructor(name: String) {
|
constructor(name: String) {
|
||||||
|
this.name = name
|
||||||
/** Hard coded values from getEquivalentRectangularSize() */
|
/** Hard coded values from getEquivalentRectangularSize() */
|
||||||
when (name) {
|
when (name) {
|
||||||
Constants.tiny -> { radius = 10; width = 23; height = 15 }
|
Constants.tiny -> { radius = 10; width = 23; height = 15 }
|
||||||
@ -32,6 +33,7 @@ class MapSizeNew {
|
|||||||
Constants.huge -> { radius = 40; width = 87; height = 57 }
|
Constants.huge -> { radius = 40; width = 87; height = 57 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(radius: Int) {
|
constructor(radius: Int) {
|
||||||
name = Constants.custom
|
name = Constants.custom
|
||||||
this.radius = radius
|
this.radius = radius
|
||||||
@ -47,8 +49,6 @@ class MapSizeNew {
|
|||||||
this.radius = getEquivalentHexagonalRadius(width, height)
|
this.radius = getEquivalentHexagonalRadius(width, height)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object MapShape {
|
object MapShape {
|
||||||
|
@ -135,9 +135,9 @@ class TileMap {
|
|||||||
if (!mapParameters.worldWrap)
|
if (!mapParameters.worldWrap)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
var radius = mapParameters.size.radius
|
var radius = mapParameters.mapSize.radius
|
||||||
if (mapParameters.shape == MapShape.rectangular)
|
if (mapParameters.shape == MapShape.rectangular)
|
||||||
radius = HexMath.getEquivalentRectangularSize(radius).x.toInt() / 2
|
radius = mapParameters.mapSize.width / 2
|
||||||
|
|
||||||
//tile is outside of the map
|
//tile is outside of the map
|
||||||
if (contains(x + radius, y - radius)) { //tile is on right side
|
if (contains(x + radius, y - radius)) { //tile is on right side
|
||||||
@ -328,9 +328,9 @@ class TileMap {
|
|||||||
* Returns -1 if not neighbors
|
* Returns -1 if not neighbors
|
||||||
*/
|
*/
|
||||||
fun getNeighborTileClockPosition(tile: TileInfo, otherTile: TileInfo): Int {
|
fun getNeighborTileClockPosition(tile: TileInfo, otherTile: TileInfo): Int {
|
||||||
var radius = mapParameters.size.radius
|
var radius = mapParameters.mapSize.radius
|
||||||
if (mapParameters.shape == MapShape.rectangular)
|
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 xDifference = tile.position.x - otherTile.position.x
|
||||||
val yDifference = tile.position.y - otherTile.position.y
|
val yDifference = tile.position.y - otherTile.position.y
|
||||||
@ -358,9 +358,9 @@ class TileMap {
|
|||||||
if (!contains(position))
|
if (!contains(position))
|
||||||
return position //The position is outside the map so its unwrapped already
|
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)
|
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 vectorUnwrappedLeft = Vector2(position.x + radius, position.y - radius)
|
||||||
val vectorUnwrappedRight = Vector2(position.x - radius, position.y + radius)
|
val vectorUnwrappedRight = Vector2(position.x - radius, position.y + radius)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user