mail[Wesnoth-commits] r33948 - in /trunk: changelog data/core/about.cfg src/formula_function.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by jeremy . rosen on March 20, 2009 - 23:59:
Author: boucman
Date: Fri Mar 20 23:59:15 2009
New Revision: 33948

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33948&view=rev
Log:
new formula function debug_float, will create a floating label with a text at 
a given location, usage is similar to debug_print. patch by Crab

Modified:
    trunk/changelog
    trunk/data/core/about.cfg
    trunk/src/formula_function.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=33948&r1=33947&r2=33948&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Fri Mar 20 23:59:15 2009
@@ -1,6 +1,9 @@
 Version 1.6+svn:
  * Language and i18n:
    * updated translations: Finnish, Hebrew, Turkish
+ * FormulaAI:
+   * Fixed bug #13230: added debug_float FormulaAI function to allow 
debugging
+     via floating popups on the specified hex
 
 Version 1.6a:
  * User interface:

Modified: trunk/data/core/about.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=33948&r1=33947&r2=33948&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Fri Mar 20 23:59:15 2009
@@ -882,6 +882,10 @@
         comment = "Miscellanous text formating and translation engine 
related help"
     [/entry]
     [entry]
+        name = "Yurii Chernyi (Crab)"
+        email = "terraninfo_AT_terraninfo.net"
+    [/entry]
+    [entry]
         name = "Zas"
     [/entry]
 [/about]

Modified: trunk/src/formula_function.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_function.cpp?rev=33948&r1=33947&r2=33948&view=diff
==============================================================================
--- trunk/src/formula_function.cpp (original)
+++ trunk/src/formula_function.cpp Fri Mar 20 23:59:15 2009
@@ -163,6 +163,40 @@
                return variant(res);
        }
 };
+
+class debug_float_function : public function_expression {
+public:
+        explicit debug_float_function(const args_list& args)
+          : function_expression("debug_float", args, 2, 3)
+        {}
+
+private:
+        variant execute(const formula_callable& variables) const {
+                const args_list& arguments = args();
+                const variant var0 = arguments[0]->evaluate(variables);
+                const variant var1 = arguments[1]->evaluate(variables);
+
+                const map_location location = 
convert_variant<location_callable>(var0)->loc();
+                std::string text;
+                
+                if(arguments.size() == 2) {
+                        text = var1.to_debug_string();
+                        display_float(location,text);
+                        return var1;
+                } else {
+                        const variant var2 = 
arguments[2]->evaluate(variables);
+                        text = var1.string_cast() + var2.to_debug_string();
+                        display_float(location,text);
+                        return var2;
+                }
+
+        } 
+
+        void display_float(const map_location& location, const std::string& 
text) const{
+                
game_display::get_singleton()->float_label(location,text,255,0,0);
+        }
+};
+
 
 class debug_print_function : public function_expression {
 public:
@@ -794,6 +828,7 @@
                FUNCTION(min);
                FUNCTION(max);
                FUNCTION(choose);
+                FUNCTION(debug_float);
                FUNCTION(debug_print);
                FUNCTION(wave);
                FUNCTION(sort);




Related Messages


Powered by MHonArc, Updated Sat Mar 21 00:40:39 2009