Unify rmgen modifyTilesBasedOnHeight (rP20189) with the HeightPlacer (rP20361).
Create global constants for the elevation modes and make that Placer more versatile by adding the mode argument.
Improves the performance of these functions by not repeating the mode, createTerrain and getTileClass lookups every tile.
Move the functions to library.js, refs #4804.