Fixes a bug introduced in 0bf90da597 that prevents entity placement on some rectangular maps e.g. Phoenician Levant and Corsica vs Sardinia. Also fixes a typo in the Phoenician Levant .js and .json files. Fixes #4012

This was SVN commit r18360.
This commit is contained in:
FeXoR 2016-06-11 11:16:07 +00:00
parent ab9cef172b
commit 759aaa2264
3 changed files with 3 additions and 6 deletions

View File

@ -1,7 +1,7 @@
{
"settings" : {
"Name" : "Phoenician Levant",
"Script" : "pheonician_levant.js",
"Script" : "phoenician_levant.js",
"Description" : "Players start in the eastern part of the map while a great sea is located to the west.",
"BaseTerrain" : ["medit_dirt", "medit_dirt_b", "medit_dirt_c", "medit_rocks_grass", "medit_rocks_grass"],
"BaseHeight" : 1,

View File

@ -88,17 +88,14 @@ Map.prototype.getEntityID = function()
}
// Check bounds on tile map
Map.prototype.validT = function(x, z, distance)
Map.prototype.validT = function(x, z, distance = 0)
{
if (g_MapSettings.CircularMap)
{ // Within map circle
var halfSize = Math.floor(0.5*this.size);
var dx = (x - halfSize);
var dz = (z - halfSize);
if (distance === undefined)
return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize - 1;
else
return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize - distance - 1;
return Math.round(Math.sqrt(dx*dx + dz*dz)) < halfSize - distance - 1;
}
else
// Within map square