Cleaned up a lot of generation code

Fixed a bug where the terrain would default to water after generation
was finished.

Slightly reworked the way tile updates are handled internally.  Tiles
can now schedule multiple tile updates, and handling the tile updates
now takes less time.  Only tiles that need updates are considered each
frame, instead of all tiles that need updates.

Commented and cleaned up a lot of code.