This adds initial support for writing new/modified maps, which are made up of layer groups (LGB) and terrain (TERA). Neither one is really tested yet, but I started checking some simple examples and it seems to work.
Now it reads much more of the index file format, and tries to handle
index1/index2 differences more opaquely. I'm not yet happy with the API, it
needs a bit more work.