Author: esr
Date: Thu Oct 23 09:28:21 2008
New Revision: 30333
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30333&view=rev
Log:
Notice when a unit moving to attack should be a support target.
Modified:
trunk/src/ai.cpp
Modified: trunk/src/ai.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=30333&r1=30332&r2=30333&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Thu Oct 23 09:28:21 2008
@@ -1208,6 +1208,7 @@
std::vector<attack_analysis>::iterator choice_it = analysis.end();
double choice_rating = -1000.0;
+ double vuln = 0.0;
for(std::vector<attack_analysis>::iterator it = analysis.begin();
it != analysis.end(); ++it) {
@@ -1231,6 +1232,7 @@
if(rating > choice_rating) {
choice_it = it;
choice_rating = rating;
+ vuln = it->vulnerability/it->support;
}
}
@@ -1252,6 +1254,9 @@
<< from << '\n';
return true;
}
+
+ if (vuln > 1.5)
+ add_target(target(to, vuln,target::SUPPORT));
// Recalc appropriate weapons here: AI uses approximations.
game_events::fire("consider attack", to, target_loc);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits