9 Jun 2011 11:47
Re: Move of command line parsing code and new dependency (Boost.Program_options)
Lukasz Dobrogowski <lukasz.dobrogowski <at> gmail.com>
2011-06-09 09:47:03 GMT
2011-06-09 09:47:03 GMT
Hello, I finished the move. All important points should be listed below. Changes: * --ai_config, --new_storyscreens renamed to --ai-config, --new-storyscreens (consistency, no underscores were used except for here) * --no-delay renamed to --nodelay (consistency with nogui, nocache, nosound and nomusic) * --campaign[[<difficulty>] <id_c> [<id_s>]] split into --campaign, --campaign-difficulty and --campaign-scenario (KISS) * split optional comma-separated defines list from --preprocess= (or -p=) to --preprocess-defines= (KISS) * dropped --log= syntax. It was the same as --log-error. * added unit tests at src/tests/test_commandline_options.cpp. It's worth looking at them, since they show examples of working and tested syntax. Should probably be extended to test for exceptions and border cases as well. Benefits: * better code clarity (I hope) * centralized the commandline parsing instead of keeping it spread across 3 functions * delegating the parsing code to an external library, which guarantees consistency * as grzywacz pointed out, easy access to commandline arguments at any point: the bug with bpp going back to default regardless of commandline parameters after changing resolution should now be an easy fix * unit testing Undocumented before:(Continue reading)
RSS Feed