mail[Wesnoth-commits] r25083 - /trunk/src/formula_ai.cpp


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

Header


Content

Posted by dragonking on March 24, 2008 - 20:53:
Author: dragonking
Date: Mon Mar 24 20:53:49 2008
New Revision: 25083

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25083&view=rev
Log:
Fixed bug which made attack function produce invalid results

Modified:
    trunk/src/formula_ai.cpp

Modified: trunk/src/formula_ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_ai.cpp?rev=25083&r1=25082&r2=25083&view=diff
==============================================================================
--- trunk/src/formula_ai.cpp (original)
+++ trunk/src/formula_ai.cpp Mon Mar 24 20:53:49 2008
@@ -95,7 +95,7 @@
 
 private:
        variant execute(const formula_callable& variables) const {
-               const gamemap::location& loc = 
convert_variant<location_callable>(args()[0]->evaluate(variables))->loc();
+               const gamemap::location loc = 
convert_variant<location_callable>(args()[0]->evaluate(variables))->loc();
                int best = 1000000;
                const std::vector<gamemap::location>& villages = 
ai_.get_info().map.villages();
                const std::set<gamemap::location>& my_villages = 
ai_.current_team().villages();
@@ -303,9 +303,9 @@
        {}
 private:
        variant execute(const formula_callable& variables) const {
-               const gamemap::location& move_from = 
convert_variant<location_callable>(args()[0]->evaluate(variables))->loc();
-               const gamemap::location& src = 
convert_variant<location_callable>(args()[1]->evaluate(variables))->loc();
-               const gamemap::location& dst = 
convert_variant<location_callable>(args()[2]->evaluate(variables))->loc();
+               const gamemap::location move_from = 
convert_variant<location_callable>(args()[0]->evaluate(variables))->loc();
+               const gamemap::location src = 
convert_variant<location_callable>(args()[1]->evaluate(variables))->loc();
+               const gamemap::location dst = 
convert_variant<location_callable>(args()[2]->evaluate(variables))->loc();
                const int weapon = args().size() == 4 ? 
args()[3]->evaluate(variables).as_int() : -1;
                if(ai_.get_info().units.count(move_from) == 0 || 
ai_.get_info().units.count(dst) == 0) {
                        std::cerr << "AI ERROR: Formula produced illegal 
attack: " << move_from << " -> " << src << " -> " << dst << "\n";




Related Messages


Powered by MHonArc, Updated Mon Mar 24 21:02:22 2008