mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-03 00:49:14 +00:00
Added ai_testing logs to log information about the winner,
...including information about AI indentifier
This commit is contained in:
parent
4d8e34290d
commit
101af19730
@ -41,6 +41,7 @@
|
||||
#define LOG_NG LOG_STREAM(info, engine)
|
||||
#define ERR_NG LOG_STREAM(err, engine)
|
||||
|
||||
#define LOG_AI_TESTING LOG_STREAM(info, ai_testing)
|
||||
struct castle_cost_calculator : cost_calculator
|
||||
{
|
||||
castle_cost_calculator(const gamemap& map) : map_(map)
|
||||
@ -1903,7 +1904,7 @@ void advance_unit(unit_map& units,
|
||||
game_events::fire("post_advance",loc);
|
||||
}
|
||||
|
||||
void check_victory(unit_map& units, std::vector<team>& teams, display& disp)
|
||||
void check_victory(const gamestatus& status, unit_map& units, std::vector<team>& teams, display& disp)
|
||||
{
|
||||
std::vector<int> seen_leaders;
|
||||
for(unit_map::const_iterator i = units.begin();
|
||||
@ -1962,6 +1963,16 @@ void check_victory(unit_map& units, std::vector<team>& teams, display& disp)
|
||||
std::cout << *i << " (using " << ai << ") ";
|
||||
}
|
||||
std::cout << "\n";
|
||||
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 << "VERSION: " << game_config::revision << std::endl;
|
||||
|
||||
}
|
||||
|
||||
LOG_NG << "throwing end level exception...\n";
|
||||
|
@ -297,7 +297,7 @@ map_location under_leadership(const unit_map& units,
|
||||
* an end_level_exception if one has.
|
||||
* Will also remove control of villages from sides with dead leaders.
|
||||
*/
|
||||
void check_victory(unit_map& units, std::vector<team>& teams, display& disp);
|
||||
void check_victory(const gamestatus& status, unit_map& units, std::vector<team>& teams, display& disp);
|
||||
|
||||
/**
|
||||
* Gets the time of day at a certain tile.
|
||||
|
@ -1273,7 +1273,7 @@ void ai_interface::attack_enemy(const location u,
|
||||
}
|
||||
}
|
||||
|
||||
check_victory(get_info().units,get_info().teams, get_info().disp);
|
||||
check_victory(get_info().state,get_info().units,get_info().teams, get_info().disp);
|
||||
raise_enemy_attacked();
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ bool mouse_handler::attack_enemy_(unit_map::iterator attacker, unit_map::iterato
|
||||
dialogs::advance_unit(map_,units_,defender_loc,gui(),!defender_human);
|
||||
}
|
||||
|
||||
check_victory(units_, teams_, gui());
|
||||
check_victory(status_, units_, teams_, gui());
|
||||
|
||||
gui().draw();
|
||||
|
||||
|
@ -581,7 +581,7 @@ void playsingle_controller::play_turn(bool save)
|
||||
std::endl;
|
||||
}
|
||||
|
||||
check_victory(units_, teams_, *gui_);
|
||||
check_victory(status_, units_, teams_, *gui_);
|
||||
}
|
||||
|
||||
// Time has run out
|
||||
|
@ -796,7 +796,7 @@ bool do_replay_handle(game_display& disp, const gamemap& map,
|
||||
//if there are no more advancing units, then we check for victory,
|
||||
//in case the battle that led to advancement caused the end of scenario
|
||||
if(advancing_units.empty()) {
|
||||
check_victory(units, teams, disp);
|
||||
check_victory(state, units, teams, disp);
|
||||
}
|
||||
|
||||
continue;
|
||||
@ -1174,7 +1174,7 @@ bool do_replay_handle(game_display& disp, const gamemap& map,
|
||||
//check victory now if we don't have any advancements. If we do have advancements,
|
||||
//we don't check until the advancements are processed.
|
||||
if(advancing_units.empty()) {
|
||||
check_victory(units, teams, disp);
|
||||
check_victory(state, units, teams, disp);
|
||||
}
|
||||
fix_shroud = !get_replay_source().is_skipping();
|
||||
}
|
||||
|
@ -627,6 +627,11 @@ const std::string& team::ai_algorithm() const
|
||||
return ai_manager::get_active_ai_algorithm_type_for_side(info_.side);
|
||||
}
|
||||
|
||||
const std::string& team::ai_algorithm_identifier() const
|
||||
{
|
||||
return ai_manager::get_active_ai_global_parameters_for_side(info_.side)["ai_identifier"];
|
||||
}
|
||||
|
||||
const config& team::ai_parameters() const
|
||||
{
|
||||
return ai_manager::get_active_ai_effective_parameters_for_side(info_.side);
|
||||
|
@ -246,6 +246,7 @@ public:
|
||||
const std::string& flag_icon() const { return info_.flag_icon; }
|
||||
|
||||
const std::string& ai_algorithm() const;
|
||||
const std::string& ai_algorithm_identifier() const;
|
||||
const config& ai_parameters() const;
|
||||
const config& ai_memory() const;
|
||||
void set_ai_memory(const config& ai_mem);
|
||||
|
Loading…
x
Reference in New Issue
Block a user