Ticket #3968: remove_duplicated_getDistance.patch

File remove_duplicated_getDistance.patch, 894 bytes (added by FeXoR, 8 years ago)
  • binaries/data/mods/public/maps/random/rmgen2/setup.js

     
    134134}
    135135
    136136/**
    137  * Euclidian distance between two points.
    138  */
    139 function euclid_distance(x1, z1, x2, z2)
    140 {
    141     return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(z2 - z1, 2));
    142 }
    143 
    144 /**
    145137 * Chose starting locations for the given players.
    146138 *
    147139 * @param {string} type - "radial", "stacked", "stronghold", "random"
     
    445437        var tooClose = false;
    446438        for (var j = 0; j < placed.length; ++j)
    447439        {
    448             var sep = euclid_distance(x, z, placed[j].x, placed[j].z);
     440            var sep = getDistance(x, z, placed[j].x, placed[j].z);
    449441            if (sep < 0.25)
    450442            {
    451443                tooClose = true;