Author: crab
Date: Wed Apr 29 03:28:11 2009
New Revision: 35313

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35313&view=rev
Log:
AI testing: called testing hooks at scenario win and draw, and at start of each 
side turn

Modified:
    trunk/src/actions.cpp
    trunk/src/ai/testing.cpp
    trunk/src/playsingle_controller.cpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=35313&r1=35312&r2=35313&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Wed Apr 29 03:28:11 2009
@@ -17,6 +17,7 @@
  * Recruiting, Fighting.
  */
 
+#include "ai/testing.hpp"
 #include "attack_prediction.hpp"
 #include "game_end_exceptions.hpp"
 #include "game_events.hpp"
@@ -1969,6 +1970,8 @@
                                std::cout << *i << " (using " << ai << ") ";
                        }
                        std::cout << "\n";
+                       ai_testing::log_victory();
+                       //@todo 1.7 remove this code, as it will be in 
log_victory
                        for(std::vector<int>::const_iterator i = 
seen_leaders.begin(); i != seen_leaders.end(); ++i) {
                                LOG_AI_TESTING << "WINNER: "<< *i <<std::endl;
                        }

Modified: trunk/src/ai/testing.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai/testing.cpp?rev=35313&r1=35312&r2=35313&view=diff
==============================================================================
--- trunk/src/ai/testing.cpp (original)
+++ trunk/src/ai/testing.cpp Wed Apr 29 03:28:11 2009
@@ -34,6 +34,18 @@
 
 void ai_testing::log_victory()
 {
+/*
+       for(std::vector<int>::const_iterator i = seen_leaders.begin(); i != 
seen_leaders.end(); ++i) {
+               LOG_AI_TESTING << "WINNER: "<< *i <<std::endl;
+       }
+       LOG_AI_TESTING << "VICTORY_TURN: "<< status.turn() <<std::endl;
+       for (std::vector<team>::const_iterator tm = teams.begin(); tm != 
teams.end(); ++tm) {
+               int side = tm-teams.begin()+1;
+               LOG_AI_TESTING << "AI_IDENTIFIER"<<side<<": " << 
tm->ai_algorithm_identifier() <<std::endl;
+               LOG_AI_TESTING << "FACTION"<<side<<": " << tm->name() << 
std::endl;
+       }
+       LOG_AI_TESTING << "VERSION: " << game_config::revision << std::endl;
+*/
 }
 
 void ai_testing::log_unknown_error_while_playing_level()

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=35313&r1=35312&r2=35313&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Wed Apr 29 03:28:11 2009
@@ -22,6 +22,7 @@
 #include "playsingle_controller.hpp"
 
 #include "ai/ai_manager.hpp"
+#include "ai/testing.hpp"
 #include "foreach.hpp"
 #include "game_end_exceptions.hpp"
 #include "gettext.hpp"
@@ -580,6 +581,7 @@
                        std::cout << " Player " << player_number_ << ": " <<
                                current_team().villages().size() << " Villages" 
<<
                                std::endl;
+                       ai_testing::log_turn_start();
                }
 
                check_victory(status_, units_, teams_, *gui_);
@@ -853,6 +855,7 @@
 
                if(non_interactive()) {
                        std::cout << "time over (draw)\n";
+                       ai_testing::log_draw();
                }
 
                LOG_NG << "firing time over event...\n";


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

Reply via email to