Author: dhains
Date: Thu May 29 07:53:21 2008
New Revision: 26910

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26910&view=rev
Log:
Further support for persistant FormulaAI object
* added new_turn function to ai object

Modified:
    trunk/src/ai.cpp
    trunk/src/ai.hpp

Modified: trunk/src/ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=26910&r1=26909&r2=26910&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Thu May 29 07:53:21 2008
@@ -251,6 +251,28 @@
        unit_stats_cache_(),
        attack_depth_(0)
 {}
+
+void ai::new_turn(info& info) 
+{
+       ai_interface::new_turn(info);
+       defensive_position_cache_.clear();
+       threats_found_ = false;
+       attacks_.clear();
+       map_ = info.map;
+       units_ = info.units;
+       teams_ = info.teams;
+       team_num_ = info.team_num;
+       state_ = info.state;
+       consider_combat_ = true;
+       additional_targets_.clear();
+       unit_movement_scores_.clear();
+       not_recommended_units_.clear();
+       unit_combat_scores_.clear();
+       keeps_.clear();
+       avoid_.clear();
+       unit_stats_cache_.clear();
+       attack_depth_ = 0;
+}
 
 bool ai::recruit_usage(const std::string& usage)
 {

Modified: trunk/src/ai.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.hpp?rev=26910&r1=26909&r2=26910&view=diff
==============================================================================
--- trunk/src/ai.hpp (original)
+++ trunk/src/ai.hpp Thu May 29 07:53:21 2008
@@ -31,6 +31,7 @@
        virtual ~ai() {}
 
        virtual void play_turn();
+       virtual void new_turn(info& info);
 
        struct target {
                enum TYPE { VILLAGE, LEADER, EXPLICIT, THREAT, BATTLE_AID, 
MASS, SUPPORT };
@@ -248,11 +249,11 @@
        virtual int rate_terrain(const unit& u, const location& loc);
 
        game_display& disp_;
-       const gamemap& map_;
+       gamemap& map_;
        unit_map& units_;
        std::vector<team>& teams_;
        unsigned int team_num_;
-       const gamestatus& state_;
+       gamestatus& state_;
        bool consider_combat_;
        std::vector<target> additional_targets_;
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to