wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src game.cpp


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src game.cpp
Date: Sat, 18 Sep 2004 16:15:30 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/09/18 20:09:23

Modified files:
        src            : game.cpp 

Log message:
        Added option to control verbosity. Now you can use --log-info=all to 
get back the old behavior.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.129&tr2=1.130&r1=text&r2=text

Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.129 wesnoth/src/game.cpp:1.130
--- wesnoth/src/game.cpp:1.129  Mon Sep 13 03:16:19 2004
+++ wesnoth/src/game.cpp        Sat Sep 18 20:09:22 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.129 2004/09/13 03:16:19 Sirp Exp $ */
+/* $Id: game.cpp,v 1.130 2004/09/18 20:09:22 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -338,6 +338,9 @@
                        << "  -t, --test        Runs the game in a small 
example scenario\n"
                        << "  -w, --windowed    Runs the game in windowed 
mode\n"
                        << "  -v, --version     Prints the game's version 
number and exits\n"
+                       << "  --log-error=\"domain1,domain2,...\", 
--log-warning=..., --log-info=...\n"
+                       << "                    Set the severity level of the 
debug domains\n"
+                       << "                    \"all\" can be used to match 
any debug domain\n"
                        << "  --nocache         Disables caching of game 
data\n";
                        return 0;
                } else if(val == "--version" || val == "-v") {
@@ -350,6 +353,30 @@
                        return 0;
                } else if(val == "--nosound") {
                        use_sound = false;
+               } else if (val.substr(0, 6) == "--log-") {
+                       size_t p = val.find('=');
+                       if (p == std::string::npos) {
+                               std::cerr << "unknown option: " << val << '\n';
+                               return 0;
+                       }
+                       std::string s = val.substr(6, p - 6);
+                       int severity;
+                       if (s == "error") severity = 0;
+                       else if (s == "warning") severity = 1;
+                       else if (s == "info") severity = 2;
+                       else {
+                               std::cerr << "unknown debug level: " << s << 
'\n';
+                               return 0;
+                       }
+                       while (p != std::string::npos) {
+                               size_t q = val.find(',', p + 1);
+                               s = val.substr(p + 1, q == std::string::npos ? 
q : q - (p + 1));
+                               if (!lg::set_log_domain_severity(s, severity)) {
+                                       std::cerr << "unknown debug domain: " 
<< s << '\n';
+                                       return 0;
+                               }
+                               p = q;
+                       }
                } else if(val == "--publish-campaign") {
                        if(arg+3 != argc && arg+4 != argc && arg+5 != argc) {
                                std::cerr << "usage: --publish-campaign 
<campaign> <passphrase> [<server> [<port>]]\n";
@@ -477,6 +504,7 @@
                        test_mode = true;
                } else if(val == "--debug" || val == "-d") {
                        game_config::debug = true;
+               } else if (val.substr(0, 6) == "--log-") {
                } else if(val[0] == '-') {
                        std::cerr << "unknown option: " << val << "\n";
                        return 0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]