Index: binaries/data/mods/public/maps/random/rmgen/painter/CityPainter.js =================================================================== --- binaries/data/mods/public/maps/random/rmgen/painter/CityPainter.js +++ binaries/data/mods/public/maps/random/rmgen/painter/CityPainter.js @@ -34,22 +34,10 @@ let mapCenter = g_Map.getCenter(); let mapSize = g_Map.getSize(); - // TODO: Due to the rounding, this is wasting a lot of space. - // The city would be much denser if it would test for actual shape intersection or - // if it would use a custom, more fine-grained obstruction grid let tileClass = g_Map.createTileClass(); - let processed = new Array(mapSize).fill(0).map(() => new Uint8Array(mapSize)); - - for (let x = 0; x < mapSize; x += 0.5) - for (let y = 0; y < mapSize; y += 0.5) - { - let point = new Vector2D(x, y).rotateAround(this.angle, mapCenter).round(); - if (!area.contains(point) || processed[point.x][point.y] || !g_Map.validTilePassable(point)) - continue; - - processed[point.x][point.y] = 1; - + for (let point of area.getPoints()) + { for (let template of shuffleArray(templates)) { if (template.constraint && !template.constraint.allows(point)) @@ -80,5 +68,5 @@ templates = templates.filter(template => templateCounts[template.templateName] < template.maxCount); break; } - } + } };