Fix for duplication issue, changes to metadata generation, and code cleanups.

- There was an issue where capitalized preprocessor conditionals (e.g. #IFNDEF)
were causing _main.cfg to be loaded prematurely, resulting in duplicate levels.
- Metadata now contains all attributes of toplevel tag and side tags.
- Addressed thunderstruck's comments and added some code comments.

TODO:
-Implement config reloading for mp_connect and sp campaigns.
-Extend metadata functionality to eras/mods