Author: dragonking
Date: Wed Jun 24 11:09:05 2009
New Revision: 36383

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36383&view=rev
Log:
Made debug_print print complete info to the console

Modified:
    trunk/src/formula_function.cpp
    trunk/src/variant.cpp
    trunk/src/variant.hpp

Modified: trunk/src/formula_function.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_function.cpp?rev=36383&r1=36382&r2=36383&view=diff
==============================================================================
--- trunk/src/formula_function.cpp (original)
+++ trunk/src/formula_function.cpp Wed Jun 24 11:09:05 2009
@@ -223,13 +223,13 @@
 
                if( args().size() == 1)
                {
-                       str1 = var1.to_debug_string();
+                       str1 = var1.to_debug_string(NULL, true);
                        LOG_AI << str1 << std::endl;
                        return var1;
                } else {
                        str1 = var1.string_cast();
                        const variant var2 = args()[1]->evaluate(variables);
-                       str2 = var2.to_debug_string();
+                       str2 = var2.to_debug_string(NULL, true);
                        LOG_AI << str1 << str2 << std::endl;
                        return var2;
                }

Modified: trunk/src/variant.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variant.cpp?rev=36383&r1=36382&r2=36383&view=diff
==============================================================================
--- trunk/src/variant.cpp (original)
+++ trunk/src/variant.cpp Wed Jun 24 11:09:05 2009
@@ -775,7 +775,7 @@
        }
 }
 
-std::string variant::to_debug_string(std::vector<const 
game_logic::formula_callable*>* seen) const
+std::string variant::to_debug_string(std::vector<const 
game_logic::formula_callable*>* seen, bool verbose) const
 {
        std::vector<const game_logic::formula_callable*> seen_stack;
        if(!seen) {
@@ -796,7 +796,7 @@
                                s << ", ";
                        }
 
-                       s << operator[](n).to_debug_string(seen);
+                       s << operator[](n).to_debug_string(seen, verbose);
                }
                s << "]";
                break;
@@ -804,7 +804,8 @@
        case TYPE_CALLABLE: {
                s << "{";
                if(std::find(seen->begin(), seen->end(), callable_) == 
seen->end()) {
-                       seen->push_back(callable_);
+                       if(!verbose)
+                               seen->push_back(callable_);
                        std::vector<game_logic::formula_input> v = 
callable_->inputs();
                        bool first = true;
                        for(size_t i=0; i<v.size(); ++i) {
@@ -820,7 +821,7 @@
                                        s << "(writeonly) ";
                                }
 
-                               s << "-> " << 
callable_->query_value(input.name).to_debug_string(seen);
+                               s << "-> " << 
callable_->query_value(input.name).to_debug_string(seen, verbose);
                        }
                } else {
                        s << "...";
@@ -836,9 +837,9 @@
                                s << ",";
                        }
                        first_time = false;
-                       s << i->first.to_debug_string(seen);
+                       s << i->first.to_debug_string(seen, verbose);
                        s << "->";
-                       s << i->second.to_debug_string(seen);
+                       s << i->second.to_debug_string(seen, verbose);
                }
                s << "]";
                break;

Modified: trunk/src/variant.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variant.hpp?rev=36383&r1=36382&r2=36383&view=diff
==============================================================================
--- trunk/src/variant.hpp (original)
+++ trunk/src/variant.hpp Wed Jun 24 11:09:05 2009
@@ -119,7 +119,7 @@
 
        std::string string_cast() const;
 
-       std::string to_debug_string(std::vector<const 
game_logic::formula_callable*>* seen=NULL) const;
+       std::string to_debug_string(std::vector<const 
game_logic::formula_callable*>* seen=NULL, bool verbose = false) const;
        enum TYPE { TYPE_NULL, TYPE_INT, TYPE_CALLABLE, TYPE_LIST, TYPE_STRING, 
TYPE_MAP };
 private:
        void must_be(TYPE t) const;


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

Reply via email to