Ticket #5150: cb4410b4d5707db91073a46f39a93d3bbb25cc41.diff

File cb4410b4d5707db91073a46f39a93d3bbb25cc41.diff, 2.8 KB (added by elexis, 6 years ago)

Giant mapsize bugfix and wall alignment improvement

  • binaries/data/mods/public/maps/random/jebel_barkal.js

    diff --git a/binaries/data/mods/public/maps/random/jebel_barkal.js b/binaries/data/mods/public/maps/random/jebel_barkal.js
    index e06d945a54..be9c2aa47f 100644
    a b Engine.SetProgress(60);  
    665665// The city is a circle segment of this maximum size
    666666g_Map.log("Computing city grid");
    667667var gridCenter = new Vector2D(0, fractionToTiles(0.3)).rotate(-riverAngle).add(mapCenter).round();
    668 var gridMaxAngle = scaleByMapSize(Math.PI / 3, Math.PI);
     668var gridMaxAngle = Math.min(scaleByMapSize(1/3, 1), 2/3) * Math.PI;
    669669var gridStartAngle = -Math.PI / 2 -gridMaxAngle / 2 + riverAngle;
    670670var gridRadius = y => hillRadius + 18 * y;
    671671
    var areaCityPaths = new Area(areasCityPaths.reduce((points, area) => points.conc  
    976976var areaRoads = [];
    977977for (let roadStart of roadStartLocations)
    978978{
    979     if (areaRoads.length >= scaleByMapSize(2, 4))
     979    if (areaRoads.length >= scaleByMapSize(2, 5))
    980980        break;
    981981
    982982    let closestPoint = areaCityPaths.getClosestPointTo(roadStart);
    for (let roadStart of roadStartLocations)  
    987987            new PathPlacer(
    988988                Vector2D.add(closestPoint, new Vector2D(0, 3/4 * mapSize).rotate(closestPoint.angleTo(roadStart))),
    989989                roadStart,
    990                 4,
     990                scaleByMapSize(5, 3),
    991991                0.1,
    992992                5,
    993993                0.5,
  • binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js

    diff --git a/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js b/binaries/data/mods/public/maps/random/rmgen-common/wall_builder.js
    index 4ed8b39749..5273d4bec2 100644
    a b function placeCircularWall(center, radius, wallPart, style, playerId = 0, orient  
    619619
    620620            // Placement
    621621            if (wallEle.templateName && g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))
    622                 entities.push(g_Map.placeEntityPassable(wallEle.templateName, playerId, place, placeAngle + wallEle.angle));
     622            {
     623                let entity = g_Map.placeEntityPassable(wallEle.templateName, playerId, place, placeAngle + wallEle.angle);
     624                if (entity)
     625                    entities.push(entity);
     626            }
    623627
    624628            // Prepare for the next wall element
    625629            actualAngle += addAngle;
    function placeCircularWall(center, radius, wallPart, style, playerId = 0, orient  
    634638        let place = Vector2D.average([position, target]);
    635639        let placeAngle = actualAngle + addAngle / 2;
    636640        if (g_Map.inMapBounds(place) && constraint.allows(place.clone().floor()))
    637             entities.push(g_Map.placeEntityPassable(wallEle.templateName, playerId, place, placeAngle + wallEle.angle));
     641        {
     642            let entity = g_Map.placeEntityPassable(wallEle.templateName, playerId, place, placeAngle + wallEle.angle);
     643            if (entity)
     644                entities.push(entity);
     645        }
    638646    }
    639647
    640648    return entities;