Fix potential crash with reading from empty string
Add parentheses to silence compiler error - these were almost definitely bugs
Minor cleanup to determine_terrain_with_simple_method -some other compilers choke on this
Fix class/struct definition mismatches
Fix some incorrect types