Use building sizes instead of building count to determine rows and columns. For example, where 4 large buildings would take up a whole row, 5 smaller ones can fill another row instead.

Also fix corners for terrain roughness detection and slightly clean some parts of the code.