Author: soliton
Date: Fri Sep 12 20:38:48 2008
New Revision: 29421
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29421&view=rev
Log:
* fixed bug #12304
* this changes AI behaviour to not try intial scout recruitment when
there are no scouts in the recruitment_pattern. (we could still be
able to recruit scouts if the pattern is empty.)
Modified:
trunk/src/ai.cpp
Modified: trunk/src/ai.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=29421&r1=29420&r2=29421&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Fri Sep 12 20:38:48 2008
@@ -1787,14 +1787,8 @@
analyze_potential_recruit_movements();
analyze_potential_recruit_combat();
- // FIXME: This entire block of code should be conditionalized
- // on a test for whether the recruitment list of the team contains
- // any units with scout usage. Otherwise, the AI will emit a spurious
- // message beginning "Deprecated WML found: Trying to recruit a: scout
- // but no unit of that type (usage=) is available." on teams with no
- // recruitment list and no scout-type units. This happens, for example,
- // when team Gore first recruits in NR:The Eastern Flank.
- {
+ std::vector<std::string> options = current_team().recruitment_pattern();
+ if (std::count(options.begin(), options.end(), "scout") > 0) {
size_t neutral_villages = 0;
// We recruit the initial allocation of scouts
@@ -1853,17 +1847,18 @@
}
}
- std::vector<std::string> options;
-
- do {
+ // If there is no recruitment_pattern use "" which makes us consider
+ // any unit available.
+ if (options.empty()) {
+ options.push_back("");
+ }
+ // Buy units as long as we have room and can afford it.
+ while (recruit_usage(options[rand()%options.size()])) {
options = current_team().recruitment_pattern();
- // If there is no recruitment_pattern use "" which makes us
consider
- // any unit available.
if (options.empty()) {
options.push_back("");
}
- // Buy units as long as we have room and can afford it.
- }while(recruit_usage(options[rand()%options.size()]));
+ }
}
void ai::move_leader_to_goals( const move_map& enemy_dstsrc)
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits