Author: zaroth
Date: Thu Jun  9 11:53:00 2011
New Revision: 49815

URL: http://svn.gna.org/viewcvs/wesnoth?rev=49815&view=rev
Log:
Added clock, nodelay, nomusic, nosound options to commandline_options

Modified:
    trunk/src/commandline_options.cpp
    trunk/src/game_controller.cpp
    trunk/src/tests/test_commandline_options.cpp

Modified: trunk/src/commandline_options.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/commandline_options.cpp?rev=49815&r1=49814&r2=49815&view=diff
==============================================================================
--- trunk/src/commandline_options.cpp (original)
+++ trunk/src/commandline_options.cpp Thu Jun  9 11:53:00 2011
@@ -110,6 +110,7 @@
        // Options are sorted alphabetically by --long-option.
        po::options_description general_opts("General options");
        general_opts.add_options()
+               ("clock", "Adds the option to show a clock for testing the 
drawing timer.")
                ("config-dir", po::value<std::string>(), "sets the path of the 
user config directory to $HOME/<arg> or My Documents\\My Games\\<arg> for 
Windows. You can specify also an absolute path outside the $HOME or My 
Documents\\My Games directory.")
                ("config-path", "prints the path of the user config directory 
and exits.")
                ("data-dir", po::value<std::string>(), "overrides the data 
directory with the one specified.")
@@ -124,6 +125,9 @@
                ("load,l", po::value<std::string>(), "loads the save <arg> from 
the standard save game directory. When launching the map editor via -e, the map 
<arg> is loaded, relative to the current directory. If it is a directory, the 
editor will start with a load map dialog opened there.")
                ("new-syntax", "enables the new campaign syntax parsing.")
                ("nocache", "disables caching of game data.")
+               ("nodelay", "runs the game without any delays.")
+               ("nomusic", "runs the game without music.")
+               ("nosound", "runs the game without sounds and music.")
                ("path", "prints the path to the data directory and exits.")
                ("rng-seed", po::value<unsigned int>(), "seeds the random 
number generator with number <arg>. Example: --rng-seed 0")
                ("screenshot", po::value<two_strings>()->multitoken(), "takes 
two arguments: <map> <output>. Saves a screenshot of <map> to <output> without 
initializing a screen. Editor must be compiled in for this to work.")
@@ -187,6 +191,8 @@
                multiplayer_ai_config = 
parse_to_int_string_tuples_(vm["ai-config"].as<std::vector<std::string> >());
        if (vm.count("bpp"))
                bpp = vm["bpp"].as<int>();
+       if (vm.count("clock"))
+               clock = true;
        if (vm.count("config-dir"))
                config_dir = vm["config-dir"].as<std::string>();
        if (vm.count("config-path"))
@@ -235,6 +241,12 @@
                new_widgets = true;
        if (vm.count("nocache"))
                nocache = true;
+       if (vm.count("nodelay"))
+               nodelay = true;
+       if (vm.count("nomusic"))
+               nomusic = true;
+       if (vm.count("nosound"))
+               nosound = true;
        if (vm.count("nogui"))
                nogui = true;
        if (vm.count("path"))

Modified: trunk/src/game_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller.cpp?rev=49815&r1=49814&r2=49815&view=diff
==============================================================================
--- trunk/src/game_controller.cpp (original)
+++ trunk/src/game_controller.cpp Thu Jun  9 11:53:00 2011
@@ -119,6 +119,8 @@
 
        if (cmdline_opts_.bpp)
                force_bpp_ = *cmdline_opts_.bpp;
+       if (cmdline_opts_.clock)
+               gui2::show_debug_clock_button = true;
        if (cmdline_opts_.debug) {
                game_config::debug = true;
                game_config::mp_debug = true;
@@ -169,6 +171,12 @@
                gui2::new_widgets = true;
        if (cmdline_opts_.nocache)
                cache_.set_use_cache(false);
+       if (cmdline_opts_.nodelay)
+               game_config::no_delay = true;
+       if (cmdline_opts_.nomusic)
+               no_music = true;
+       if (cmdline_opts_.nosound)
+               no_sound = true;
        if (cmdline_opts_.resolution) {
                const int xres = cmdline_opts_.resolution->get<0>();
                const int yres = cmdline_opts_.resolution->get<1>();
@@ -245,16 +253,7 @@
                                jump_to_campaign_.scenario_id_ = 
std::string(argv_[arg_]);
                                std::cerr<<"selected scenario id: 
["<<jump_to_campaign_.scenario_id_<<"]\n";
                        }
-               } else if(val == "--no-delay") {
-                       game_config::no_delay = true;
-               } else if (val.substr(0, 6) == "--log-") {
-               } else if (val == "--rng-seed") {
-                       ++arg_;
-               } else if(val == "--nosound") {
-                       no_sound = true;
-               } else if(val == "--nomusic") {
-                       no_music = true;
-               }   //These commented lines should be used to implement support 
of connection
+               } //These commented lines should be used to implement support 
of connection
             //through a proxy via command line options.
             //The ANA network module should implement these methods (while the 
SDL_net won't.)
         else if(val == "--proxy") {
@@ -292,10 +291,7 @@
             }
             else
                 throw std::runtime_error("Proxy password option requires 
password");
-        }
-               else if(val == "--clock") {
-                       gui2::show_debug_clock_button = true;
-               } else if(val == "-e" || val == "--editor") {
+        } else if(val == "-e" || val == "--editor") {
                        jump_to_editor_ = true;
                        if(arg_+1 != argc_) {
                                if (argv_[arg_ + 1][0] != '-') {

Modified: trunk/src/tests/test_commandline_options.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tests/test_commandline_options.cpp?rev=49815&r1=49814&r2=49815&view=diff
==============================================================================
--- trunk/src/tests/test_commandline_options.cpp (original)
+++ trunk/src/tests/test_commandline_options.cpp Thu Jun  9 11:53:00 2011
@@ -179,6 +179,7 @@
                "--ai-config=1:aifoo",
                "--ai-config=2:aibar",
                "--bpp=32",
+               "--clock",
                "--config-dir=configdirfoo",
                "--config-path",
                "--data-dir=datadirfoo",
@@ -204,6 +205,9 @@
                "--new-syntax",
                "--new-widgets",
                "--nocache",
+               "--nodelay",
+               "--nomusic",
+               "--nosound",
                "--nogui",
                "--path",
                "--preprocess", "preppathfoo", "preptargfoo",
@@ -228,7 +232,7 @@
        BOOST_CHECK(!co.campaign);
        BOOST_CHECK(!co.campaign_difficulty);
        BOOST_CHECK(!co.campaign_scenario);
-       BOOST_CHECK(!co.clock);
+       BOOST_CHECK(co.clock);
        BOOST_CHECK(co.config_path);
        BOOST_CHECK(co.config_dir && *co.config_dir == "configdirfoo");
        BOOST_CHECK(co.data_dir && *co.data_dir == "datadirfoo");
@@ -269,10 +273,10 @@
        BOOST_CHECK(!co.multiplayer_turns);
        BOOST_CHECK(co.max_fps && *co.max_fps == 100);
        BOOST_CHECK(co.nocache);
-       BOOST_CHECK(!co.nodelay);
+       BOOST_CHECK(co.nodelay);
        BOOST_CHECK(co.nogui);
-       BOOST_CHECK(!co.nomusic);
-       BOOST_CHECK(!co.nosound);
+       BOOST_CHECK(co.nomusic);
+       BOOST_CHECK(co.nosound);
        BOOST_CHECK(co.new_storyscreens);
        BOOST_CHECK(co.new_syntax);
        BOOST_CHECK(co.new_widgets);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to