Ticket #4012: map.js2016-6-11.patch

File map.js2016-6-11.patch, 878 bytes (added by FeXoR, 8 years ago)

Fixes the unhandled case if distance is not given

  • binaries/data/mods/public/maps/random/rmgen/map.js

     
    8888}
    8989
    9090// Check bounds on tile map
    91 Map.prototype.validT = function(x, z, distance)
     91Map.prototype.validT = function(x, z, distance = 0)
    9292{
    9393    if (g_MapSettings.CircularMap)
    9494    {   // Within map circle
    9595        var halfSize = Math.floor(0.5*this.size);
    9696        var dx = (x - halfSize);
    9797        var dz = (z - halfSize);
    98         if (distance === undefined)
    99             return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize - 1;
    100         else
    101             return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize - distance - 1;
     98        return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize - distance - 1;
    10299    }
    103100    else
    104101        // Within map square