Obliterate Unknown (0d0bc32736), Unknown Land (25682da568) and Unknown Nomad (7f8adcf8cb) triplication of doom, fixes #4317.

Refactor by moving from procedural programming to functional
programming.
Fix the horrendous shoreline performance bug on "Continent" of Unknown
as in 49721cff33 by dropping the historic differences between the maps.

Remove misleading player coordinate computation when generating the
terrain on Unknown Nomad, because the players are spawned elsewhere
then.
Remove names like md, mdd1 and mdd2 with different connotations in every
landscape type.
Remove six more paintRiver copies in the "Edge Seas" variant as in
7d0cc59136.
Remove createShoreJaggedness and createExtensionsOrIslands duplication
within this triplication.
Remove heightmap initialization octuplication by adding initHeight.
Remove horizontal/vertical duplication by using logical operators.
Remove Painters redundant with the paintTerrainBasedOnHeight calls,
pointless comments and cleanup createArea calls as in 376d8b3d1e.
Remove some forest helper duplication as in ac8f4f49fc.
Remove references to Math proxies and use the prototype functions
directly.
Remove whitespace issues.

Describe remaining calls with human-readable log messages.
Always spawn enough treasures for a CC (instead of sometimes only giving
enough for a dock), refs 5dd3cbb254.
Generate "Mainland" variant with the same probability as the other
landscape types.
Generate "Central Sea" variant on Unknown Land too by forcing an Isthmus
then.
Don't split players on Unknown Nomad on the "Rivers And Lake" variation,
because the resource imbalance is too drastic.
Consistently call markPlayerArea before terrain generation on non-Nomad
maps.

Differential Revision: https://code.wildfiregames.com/D252
This was SVN commit r20420.
This commit is contained in:
elexis
2017-11-07 17:11:51 +00:00
parent 280a797620
commit efd9b3e212
6 changed files with 1191 additions and 4265 deletions
@@ -410,6 +410,11 @@ function setHeight(x, z, height)
g_Map.setHeight(x, z, height);
}
function initHeight(height)
{
g_Map.initHeight(height);
}
/**
* Utility functions for classes
*/
@@ -58,6 +58,16 @@ function Map(size, baseHeight)
this.entityCount = 150;
}
/**
* Sets the elevation of the entire heightmap grid to the given value.
*/
Map.prototype.initHeight = function(height)
{
for (let i = 0; i < this.size; ++i)
for (let j = 0; j < this.size; ++j)
this.height[i][j] = height;
};
/**
* Returns the ID of a texture name.
* Creates a new ID if there isn't one assigned yet.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff