mapgen and bugfix

move generator code from the server to mapgen.
repair a problem that created regions with coordinates that were out of
bounds.