XML parse errors cause segfault during running game
A syntax issue with one of the xml files (data.xml, graphics.xml) passes silently until called upon in game.
I guess it returns some random value instead of default, I have not investigated very closely yet. This does bring up the issue of tinyxml2.cpp. Perhaps it needs looking at. Many config file get_ handlers require default value to be passed in, which is returned on error or missing item.
Not a high priority issue, just worth mentioning.
You are right, the code is missing a proper error handling, when parsing the xml failes.
But default values wouldn't be of much help there. When the xml can't be loaded at all, you would get a complete 'default unit'. So in this case, maxr should either stop loading with an error message or just skip loading the entire unit.
We should rework the entire loading code, to use proper exception handling.
Exactly, my thoughts also. Abort on load when XML errors are encountered. It took me quite a while to find the problem (missing quotes) as I thought it was with the code I was hacking related to the XML file.
Many markup parsers will let missing quotes pass as long as the value is a single word-unit, like '16' or 'false'. In this case it was the unquoted digit that manifested as a segfault.
Anyway, the XML doesn't get tweaked too often, so it's a project for a rainy sunday sometime in the future.
OT: what indent settings are used on the source files? It seems non-traditional. I've seen no mention yet in any docs. I'd like to match up nicely for diff, but I like my own style for working files.