mail[Wesnoth-commits] r33860 - /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 19, 2009 - 22:03:
Author: dragonking
Date: Thu Mar 19 22:03:25 2009
New Revision: 33860

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33860&view=rev
Log:
Fixed defense_on function causing errors while trying to get defense value on 
unpassable terrain

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=33860&r1=33859&r2=33860&view=diff
==============================================================================
--- trunk/src/formula_ai.cpp (original)
+++ trunk/src/formula_ai.cpp Thu Mar 19 22:03:25 2009
@@ -945,6 +945,9 @@
                {
                        const unit& un = u_call->get_unit();
 
+                        if( un.total_movement() < un.movement_cost( 
ai_.get_info().map[loc]) )
+                            return variant();
+
                        if(!ai_.get_info().map.on_board(loc)) {
                                return variant();
                        }
@@ -955,6 +958,9 @@
                if (u_type)
                {
                        const unit_type& un = u_type->get_unit_type();
+                        
+                        if( un.movement() < 
un.movement_type().movement_cost(ai_.get_info().map, ai_.get_info().map[loc]) 
)
+                            return variant();
 
                        if(!ai_.get_info().map.on_board(loc)) {
                                return variant();




Related Messages


Powered by MHonArc, Updated Thu Mar 19 22:20:14 2009