Index: binaries/data/mods/public/maps/random/rmgen/math.js =================================================================== --- binaries/data/mods/public/maps/random/rmgen/math.js +++ binaries/data/mods/public/maps/random/rmgen/math.js @@ -89,7 +89,7 @@ } /** - * Returns the topleft and bottomright coordinate of the given two points. + * Returns the topright and bottomleft coordinate of the given two points. */ function getBoundingBox(points) { Index: binaries/data/mods/public/maps/random/rmgen/placer/centered/DiskPlacer.js =================================================================== --- binaries/data/mods/public/maps/random/rmgen/placer/centered/DiskPlacer.js +++ binaries/data/mods/public/maps/random/rmgen/placer/centered/DiskPlacer.js @@ -4,6 +4,7 @@ function DiskPlacer(radius, centerPosition = undefined) { this.radiusSquared = Math.square(radius); + this.radius = radius; this.centerPosition = undefined; if (centerPosition) @@ -18,14 +19,15 @@ DiskPlacer.prototype.place = function(constraint) { let points = []; + let bottomLeft = new Vector2D(this.centerPosition.x - this.radius, this.centerPosition.y - this.radius); + let topRight = new Vector2D(this.centerPosition.x + this.radius, this.centerPosition.y + this.radius); - for (let x = 0; x < g_Map.getSize(); ++x) - for (let y = 0; y < g_Map.getSize(); ++y) + for (let x = bottomLeft.x; x < topRight.x; ++x) + for (let y = bottomLeft.y; y < topRight.y; ++y) { let point = new Vector2D(x, y); if (this.centerPosition.distanceToSquared(point) <= this.radiusSquared && constraint.allows(point)) points.push(point); } - return points; };