Remove old move-to-targets CA and move new one to default
This commit is contained in:
parent
ab443bcc18
commit
af9be371da
11 changed files with 102 additions and 203 deletions
|
@ -164,19 +164,13 @@
|
|||
{AI_CA_LEADER_SHARES_KEEP}
|
||||
#enddef
|
||||
|
||||
# extra candidate actions
|
||||
|
||||
# Keep for backward compatibility, but redirect it
|
||||
#define AI_CA_SIMPLE_MOVE_TO_TARGETS
|
||||
# Extra candidate action: simple_move_to_targets
|
||||
[candidate_action]
|
||||
id=simple_move_to_targets
|
||||
engine=cpp
|
||||
name=ai_default_rca::simple_move_and_targeting_phase
|
||||
max_score={AI_CA_MOVE_TO_TARGETS_SCORE}
|
||||
score={AI_CA_MOVE_TO_TARGETS_SCORE}
|
||||
[/candidate_action]
|
||||
{AI_CA_MOVE_TO_TARGETS}
|
||||
#enddef
|
||||
|
||||
# extra candidate actions
|
||||
|
||||
#define AI_CA_POISONING
|
||||
# Extra candidate action: Formula AI CA for poisoners to spread poison around
|
||||
[candidate_action]
|
||||
|
|
|
@ -151,6 +151,8 @@
|
|||
<Unit filename="../../src/ai/default/attack.cpp" />
|
||||
<Unit filename="../../src/ai/default/ca.cpp" />
|
||||
<Unit filename="../../src/ai/default/ca.hpp" />
|
||||
<Unit filename="../../src/ai/default/ca_move_to_targets.cpp" />
|
||||
<Unit filename="../../src/ai/default/ca_move_to_targets.hpp" />
|
||||
<Unit filename="../../src/ai/default/contexts.cpp" />
|
||||
<Unit filename="../../src/ai/default/contexts.hpp" />
|
||||
<Unit filename="../../src/ai/default/engine_cpp.cpp" />
|
||||
|
@ -193,8 +195,6 @@
|
|||
<Unit filename="../../src/ai/simulated_actions.hpp" />
|
||||
<Unit filename="../../src/ai/testing.cpp" />
|
||||
<Unit filename="../../src/ai/testing.hpp" />
|
||||
<Unit filename="../../src/ai/testing/ca_testing_move_to_targets.cpp" />
|
||||
<Unit filename="../../src/ai/testing/ca_testing_move_to_targets.hpp" />
|
||||
<Unit filename="../../src/ai/testing/stage_sf_with_rca.cpp" />
|
||||
<Unit filename="../../src/ai/testing/stage_sf_with_rca.hpp" />
|
||||
<Unit filename="../../src/animated.hpp" />
|
||||
|
|
|
@ -2007,6 +2007,62 @@
|
|||
RelativePath="..\..\src\ai\default\ca.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\ai\default\ca_move_to_targets.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\default\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\default\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug_with_VLD|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\default\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Test_Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\default\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Test_Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\default\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseDEBUG|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\default\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\ai\default\ca_move_to_targets.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\ai\default\contexts.cpp"
|
||||
>
|
||||
|
@ -2235,62 +2291,6 @@
|
|||
<Filter
|
||||
Name="testing"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\ai\testing\ca_testing_move_to_targets.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\testing\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\testing\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug_with_VLD|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\testing\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Test_Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\testing\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Test_Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\testing\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseDEBUG|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\ai\testing\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\ai\testing\ca_testing_move_to_targets.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\ai\testing\stage_sf_with_rca.cpp"
|
||||
>
|
||||
|
|
|
@ -275,8 +275,8 @@
|
|||
B54AC7010FEA9FA5006F6FBD /* scrollbar_panel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B54AC6FB0FEA9FA5006F6FBD /* scrollbar_panel.cpp */; };
|
||||
B552D92410869477002D8F86 /* distributor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B552D92210869477002D8F86 /* distributor.cpp */; };
|
||||
B552D92510869477002D8F86 /* distributor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B552D92210869477002D8F86 /* distributor.cpp */; };
|
||||
B552D92D108694BB002D8F86 /* ca_testing_move_to_targets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B552D92A108694BB002D8F86 /* ca_testing_move_to_targets.cpp */; };
|
||||
B552D92F108694BB002D8F86 /* ca_testing_move_to_targets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B552D92A108694BB002D8F86 /* ca_testing_move_to_targets.cpp */; };
|
||||
B552D92D108694BB002D8F86 /* ca_move_to_targets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B552D92A108694BB002D8F86 /* ca_move_to_targets.cpp */; };
|
||||
B552D92F108694BB002D8F86 /* ca_move_to_targets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B552D92A108694BB002D8F86 /* ca_move_to_targets.cpp */; };
|
||||
B553B6BA12189C5900CC8C58 /* utility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B553B6B812189C5900CC8C58 /* utility.cpp */; };
|
||||
B553B6BB12189C5900CC8C58 /* utility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B553B6B812189C5900CC8C58 /* utility.cpp */; };
|
||||
B559986C0EC616B3008DD061 /* SDLMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = B559986B0EC616B3008DD061 /* SDLMain.mm */; settings = {COMPILER_FLAGS = "-w"; }; };
|
||||
|
@ -1515,8 +1515,8 @@
|
|||
B54AC6FD0FEA9FA5006F6FBD /* window_private.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = window_private.hpp; sourceTree = "<group>"; };
|
||||
B552D92210869477002D8F86 /* distributor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = distributor.cpp; sourceTree = "<group>"; };
|
||||
B552D92310869477002D8F86 /* distributor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = distributor.hpp; sourceTree = "<group>"; };
|
||||
B552D92A108694BB002D8F86 /* ca_testing_move_to_targets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ca_testing_move_to_targets.cpp; sourceTree = "<group>"; };
|
||||
B552D92B108694BB002D8F86 /* ca_testing_move_to_targets.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ca_testing_move_to_targets.hpp; sourceTree = "<group>"; };
|
||||
B552D92A108694BB002D8F86 /* ca_move_to_targets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ca_move_to_targets.cpp; sourceTree = "<group>"; };
|
||||
B552D92B108694BB002D8F86 /* ca_move_to_targets.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ca_move_to_targets.hpp; sourceTree = "<group>"; };
|
||||
B553B6B812189C5900CC8C58 /* utility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = utility.cpp; sourceTree = "<group>"; };
|
||||
B553B6B912189C5900CC8C58 /* utility.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = utility.hpp; sourceTree = "<group>"; };
|
||||
B559986A0EC616B3008DD061 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLMain.h; path = "Mac Sources/SDLMain.h"; sourceTree = "<group>"; };
|
||||
|
@ -3484,6 +3484,8 @@
|
|||
B54AC6AB0FEA9EB5006F6FBD /* engine_cpp.hpp */,
|
||||
EC48D74B17F3148300DE80BF /* recruitment.cpp */,
|
||||
EC48D74C17F3148300DE80BF /* recruitment.hpp */,
|
||||
B552D92A108694BB002D8F86 /* ca_move_to_targets.cpp */,
|
||||
B552D92B108694BB002D8F86 /* ca_move_to_targets.hpp */,
|
||||
B54AC6C50FEA9EB5006F6FBD /* stage_rca.cpp */,
|
||||
B54AC6C60FEA9EB5006F6FBD /* stage_rca.hpp */,
|
||||
);
|
||||
|
@ -3514,8 +3516,6 @@
|
|||
B54AC6C00FEA9EB5006F6FBD /* testing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B552D92A108694BB002D8F86 /* ca_testing_move_to_targets.cpp */,
|
||||
B552D92B108694BB002D8F86 /* ca_testing_move_to_targets.hpp */,
|
||||
EC4E3B1E19B2D8480049CBD7 /* stage_sf_with_rca.cpp */,
|
||||
EC4E3B1F19B2D8480049CBD7 /* stage_sf_with_rca.hpp */,
|
||||
);
|
||||
|
@ -4344,7 +4344,7 @@
|
|||
62D24F2D1519982500350848 /* brush.cpp in Sources */,
|
||||
B5599AD40EC62181008DD061 /* button.cpp in Sources */,
|
||||
B5A9BD5B0ECA805A002BE442 /* button.cpp in Sources */,
|
||||
B552D92D108694BB002D8F86 /* ca_testing_move_to_targets.cpp in Sources */,
|
||||
B552D92D108694BB002D8F86 /* ca_move_to_targets.cpp in Sources */,
|
||||
B54AC6E60FEA9EB5006F6FBD /* ca.cpp in Sources */,
|
||||
B5599B810EC62181008DD061 /* callable_objects.cpp in Sources */,
|
||||
B5951A9B1013BB5A00C10B66 /* callable_objects.cpp in Sources */,
|
||||
|
@ -4864,7 +4864,7 @@
|
|||
B597C5600FACD6CA00CE81F5 /* binary_or_text.cpp in Sources */,
|
||||
B597C5690FACD6CA00CE81F5 /* button.cpp in Sources */,
|
||||
B597C65A0FACDDE800CE81F5 /* button.cpp in Sources */,
|
||||
B552D92F108694BB002D8F86 /* ca_testing_move_to_targets.cpp in Sources */,
|
||||
B552D92F108694BB002D8F86 /* ca_move_to_targets.cpp in Sources */,
|
||||
B54AC6D50FEA9EB5006F6FBD /* ca.cpp in Sources */,
|
||||
B597C5310FACD6CA00CE81F5 /* callable_objects.cpp in Sources */,
|
||||
B5951A9D1013BB5A00C10B66 /* callable_objects.cpp in Sources */,
|
||||
|
|
|
@ -698,6 +698,7 @@ set(wesnoth-main_SRC
|
|||
ai/default/aspect_attacks.cpp
|
||||
ai/default/attack.cpp
|
||||
ai/default/ca.cpp
|
||||
ai/default/ca_move_to_targets.cpp
|
||||
ai/default/contexts.cpp
|
||||
ai/default/engine_cpp.cpp
|
||||
ai/default/recruitment.cpp
|
||||
|
@ -719,7 +720,6 @@ set(wesnoth-main_SRC
|
|||
ai/registry.cpp
|
||||
ai/simulated_actions.cpp
|
||||
ai/testing.cpp
|
||||
ai/testing/ca_testing_move_to_targets.cpp
|
||||
ai/testing/stage_sf_with_rca.cpp
|
||||
animated_game.cpp
|
||||
attack_prediction.cpp
|
||||
|
|
|
@ -223,6 +223,7 @@ wesnoth_sources = Split("""
|
|||
ai/default/aspect_attacks.cpp
|
||||
ai/default/attack.cpp
|
||||
ai/default/ca.cpp
|
||||
ai/default/ca_move_to_targets.cpp
|
||||
ai/default/contexts.cpp
|
||||
ai/default/engine_cpp.cpp
|
||||
ai/default/recruitment.cpp
|
||||
|
@ -244,7 +245,6 @@ wesnoth_sources = Split("""
|
|||
ai/registry.cpp
|
||||
ai/simulated_actions.cpp
|
||||
ai/testing.cpp
|
||||
ai/testing/ca_testing_move_to_targets.cpp
|
||||
ai/testing/stage_sf_with_rca.cpp
|
||||
animated_game.cpp
|
||||
attack_prediction.cpp
|
||||
|
|
|
@ -1549,77 +1549,6 @@ bool retreat_phase::should_retreat(const map_location& loc, const unit_map::cons
|
|||
}
|
||||
|
||||
|
||||
//==============================================================
|
||||
|
||||
simple_move_and_targeting_phase::simple_move_and_targeting_phase(
|
||||
rca_context &context, const config &cfg)
|
||||
: candidate_action(context,cfg)
|
||||
, move_()
|
||||
{
|
||||
}
|
||||
|
||||
simple_move_and_targeting_phase::~simple_move_and_targeting_phase()
|
||||
{
|
||||
}
|
||||
|
||||
double simple_move_and_targeting_phase::evaluate()
|
||||
{
|
||||
// Pick first enemy leader, move all units as close to
|
||||
// enemy leader as possible.
|
||||
// Own leader should not be moved.
|
||||
// Code does not support multiple leaders per side.
|
||||
// Do it fast even if there is a lot of units present.
|
||||
unit_map &units_ = *resources::units;
|
||||
|
||||
unit_map::const_iterator leader = units_.find_leader(get_side());
|
||||
map_location my_leader_loc = map_location::null_location();
|
||||
if (leader.valid()) {
|
||||
my_leader_loc = leader->get_location();
|
||||
}
|
||||
|
||||
for(leader = units_.begin(); leader != units_.end(); ++leader) {
|
||||
if(leader->can_recruit() && current_team().is_enemy(leader->side())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(leader == units_.end()) {
|
||||
return BAD_SCORE;
|
||||
}
|
||||
|
||||
int closest_distance = -1;
|
||||
std::pair<map_location,map_location> closest_move;
|
||||
|
||||
for(move_map::const_iterator i = get_dstsrc().begin(); i != get_dstsrc().end(); ++i) {
|
||||
if(my_leader_loc == i->second){// Do not move leaders.
|
||||
continue;
|
||||
}
|
||||
const int distance = distance_between(i->first, leader->get_location());
|
||||
if(closest_distance == -1 || distance < closest_distance) {
|
||||
closest_distance = distance;
|
||||
closest_move = *i;
|
||||
}
|
||||
}
|
||||
|
||||
if(closest_distance != -1) {
|
||||
move_ = check_move_action(closest_move.second,closest_move.first,true);
|
||||
if (move_->is_ok()){
|
||||
return get_score();
|
||||
}
|
||||
}
|
||||
|
||||
return BAD_SCORE;
|
||||
}
|
||||
|
||||
void simple_move_and_targeting_phase::execute()
|
||||
{
|
||||
move_->execute();
|
||||
if (!move_->is_ok()){
|
||||
LOG_AI_TESTING_AI_DEFAULT << get_name() << "::execute not ok" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==============================================================
|
||||
|
||||
leader_control_phase::leader_control_phase( rca_context &context, const config &cfg )
|
||||
|
|
|
@ -237,24 +237,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
|
||||
class simple_move_and_targeting_phase : public candidate_action {
|
||||
public:
|
||||
|
||||
simple_move_and_targeting_phase( rca_context &context, const config &cfg );
|
||||
|
||||
virtual ~simple_move_and_targeting_phase();
|
||||
|
||||
virtual double evaluate();
|
||||
|
||||
virtual void execute();
|
||||
|
||||
private:
|
||||
|
||||
move_result_ptr move_;
|
||||
};
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Strategic movement routine, taken from default AI
|
||||
*/
|
||||
|
||||
#include "ai/testing/ca_testing_move_to_targets.hpp"
|
||||
#include "ai/default/ca_move_to_targets.hpp"
|
||||
|
||||
#include "ai/composite/ai.hpp"
|
||||
#include "ai/actions.hpp"
|
||||
|
@ -33,13 +33,13 @@
|
|||
|
||||
namespace ai {
|
||||
|
||||
namespace testing_ai_default {
|
||||
namespace ai_default_rca {
|
||||
|
||||
static lg::log_domain log_ai_testing_ca_testing_move_to_targets("ai/ca/testing_move_to_targets");
|
||||
#define DBG_AI LOG_STREAM(debug, log_ai_testing_ca_testing_move_to_targets)
|
||||
#define LOG_AI LOG_STREAM(info, log_ai_testing_ca_testing_move_to_targets)
|
||||
#define WRN_AI LOG_STREAM(warn, log_ai_testing_ca_testing_move_to_targets)
|
||||
#define ERR_AI LOG_STREAM(err, log_ai_testing_ca_testing_move_to_targets)
|
||||
static lg::log_domain log_ai_testing_ca_move_to_targets("ai/ca/move_to_targets");
|
||||
#define DBG_AI LOG_STREAM(debug, log_ai_testing_ca_move_to_targets)
|
||||
#define LOG_AI LOG_STREAM(info, log_ai_testing_ca_move_to_targets)
|
||||
#define WRN_AI LOG_STREAM(warn, log_ai_testing_ca_move_to_targets)
|
||||
#define ERR_AI LOG_STREAM(err, log_ai_testing_ca_move_to_targets)
|
||||
|
||||
|
||||
|
||||
|
@ -116,24 +116,24 @@ private:
|
|||
|
||||
};
|
||||
|
||||
testing_move_to_targets_phase::testing_move_to_targets_phase( rca_context &context, const config &cfg )
|
||||
move_to_targets_phase::move_to_targets_phase( rca_context &context, const config &cfg )
|
||||
: candidate_action(context,cfg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
testing_move_to_targets_phase::~testing_move_to_targets_phase()
|
||||
move_to_targets_phase::~move_to_targets_phase()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
double testing_move_to_targets_phase::evaluate()
|
||||
double move_to_targets_phase::evaluate()
|
||||
{
|
||||
return get_score();
|
||||
}
|
||||
|
||||
|
||||
void testing_move_to_targets_phase::execute()
|
||||
void move_to_targets_phase::execute()
|
||||
{
|
||||
unit_map::const_iterator leader = resources::units->find_leader(get_side());
|
||||
LOG_AI << "finding targets...\n";
|
||||
|
@ -202,7 +202,7 @@ struct rated_target_comparer {
|
|||
};
|
||||
|
||||
|
||||
double testing_move_to_targets_phase::rate_target(const target& tg, const unit_map::iterator& u,
|
||||
double move_to_targets_phase::rate_target(const target& tg, const unit_map::iterator& u,
|
||||
const move_map& dstsrc, const move_map& enemy_dstsrc,
|
||||
const pathfind::plain_route& rt)
|
||||
{
|
||||
|
@ -268,9 +268,9 @@ double testing_move_to_targets_phase::rate_target(const target& tg, const unit_m
|
|||
|
||||
|
||||
|
||||
std::pair<map_location,map_location> testing_move_to_targets_phase::choose_move(std::vector<target>& targets, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_dstsrc)
|
||||
std::pair<map_location,map_location> move_to_targets_phase::choose_move(std::vector<target>& targets, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_dstsrc)
|
||||
{
|
||||
log_scope2(log_ai_testing_ca_testing_move_to_targets, "choosing move");
|
||||
log_scope2(log_ai_testing_ca_move_to_targets, "choosing move");
|
||||
|
||||
raise_user_interact();
|
||||
unit_map &units_ = *resources::units;
|
||||
|
@ -618,7 +618,7 @@ std::pair<map_location,map_location> testing_move_to_targets_phase::choose_move(
|
|||
return std::pair<map_location,map_location>();
|
||||
}
|
||||
|
||||
void testing_move_to_targets_phase::access_points(const move_map& srcdst, const map_location& u, const map_location& dst, std::vector<map_location>& out)
|
||||
void move_to_targets_phase::access_points(const move_map& srcdst, const map_location& u, const map_location& dst, std::vector<map_location>& out)
|
||||
{
|
||||
unit_map &units_ = *resources::units;
|
||||
const gamemap &map_ = resources::gameboard->map();
|
||||
|
@ -643,7 +643,7 @@ void testing_move_to_targets_phase::access_points(const move_map& srcdst, const
|
|||
}
|
||||
|
||||
|
||||
double testing_move_to_targets_phase::compare_groups(const std::set<map_location>& our_group, const std::set<map_location>& their_group, const std::vector<map_location>& battlefield) const
|
||||
double move_to_targets_phase::compare_groups(const std::set<map_location>& our_group, const std::set<map_location>& their_group, const std::vector<map_location>& battlefield) const
|
||||
{
|
||||
const double a = rate_group(our_group,battlefield);
|
||||
const double b = std::max<double>(rate_group(their_group,battlefield),0.01);
|
||||
|
@ -651,7 +651,7 @@ double testing_move_to_targets_phase::compare_groups(const std::set<map_location
|
|||
}
|
||||
|
||||
|
||||
void testing_move_to_targets_phase::enemies_along_path(const std::vector<map_location>& route, const move_map& dstsrc, std::set<map_location>& res)
|
||||
void move_to_targets_phase::enemies_along_path(const std::vector<map_location>& route, const move_map& dstsrc, std::set<map_location>& res)
|
||||
{
|
||||
for(std::vector<map_location>::const_iterator i = route.begin(); i != route.end(); ++i) {
|
||||
map_location adj[6];
|
||||
|
@ -666,7 +666,7 @@ void testing_move_to_targets_phase::enemies_along_path(const std::vector<map_loc
|
|||
}
|
||||
|
||||
|
||||
map_location testing_move_to_targets_phase::form_group(const std::vector<map_location>& route, const move_map& dstsrc, std::set<map_location>& res)
|
||||
map_location move_to_targets_phase::form_group(const std::vector<map_location>& route, const move_map& dstsrc, std::set<map_location>& res)
|
||||
{
|
||||
unit_map &units_ = *resources::units;
|
||||
if(route.empty()) {
|
||||
|
@ -709,7 +709,7 @@ map_location testing_move_to_targets_phase::form_group(const std::vector<map_loc
|
|||
}
|
||||
|
||||
|
||||
bool testing_move_to_targets_phase::move_group(const map_location& dst, const std::vector<map_location>& route, const std::set<map_location>& units)
|
||||
bool move_to_targets_phase::move_group(const map_location& dst, const std::vector<map_location>& route, const std::set<map_location>& units)
|
||||
{
|
||||
unit_map &units_ = *resources::units;
|
||||
const gamemap &map_ = resources::gameboard->map();
|
||||
|
@ -811,7 +811,7 @@ bool testing_move_to_targets_phase::move_group(const map_location& dst, const st
|
|||
}
|
||||
|
||||
|
||||
double testing_move_to_targets_phase::rate_group(const std::set<map_location>& group, const std::vector<map_location>& battlefield) const
|
||||
double move_to_targets_phase::rate_group(const std::set<map_location>& group, const std::vector<map_location>& battlefield) const
|
||||
{
|
||||
unit_map &units_ = *resources::units;
|
||||
const gamemap &map_ = resources::gameboard->map();
|
||||
|
@ -848,7 +848,7 @@ double testing_move_to_targets_phase::rate_group(const std::set<map_location>& g
|
|||
|
||||
|
||||
|
||||
bool testing_move_to_targets_phase::should_retreat(const map_location& loc, const unit_map::const_iterator& un,
|
||||
bool move_to_targets_phase::should_retreat(const map_location& loc, const unit_map::const_iterator& un,
|
||||
const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_dstsrc,
|
||||
double caution)
|
||||
{
|
||||
|
@ -870,6 +870,6 @@ bool testing_move_to_targets_phase::should_retreat(const map_location& loc, cons
|
|||
return caution*their_power*(1.0+exposure) > our_power;
|
||||
}
|
||||
|
||||
} // end of namespace testing_ai_default
|
||||
} // end of namespace ai_default_rca
|
||||
|
||||
} // end of namespace ai
|
|
@ -38,14 +38,14 @@ struct plain_route;
|
|||
|
||||
namespace ai {
|
||||
|
||||
namespace testing_ai_default {
|
||||
namespace ai_default_rca {
|
||||
|
||||
class testing_move_to_targets_phase : public candidate_action {
|
||||
class move_to_targets_phase : public candidate_action {
|
||||
public:
|
||||
|
||||
testing_move_to_targets_phase( rca_context &context, const config &cfg );
|
||||
move_to_targets_phase( rca_context &context, const config &cfg );
|
||||
|
||||
virtual ~testing_move_to_targets_phase();
|
||||
virtual ~move_to_targets_phase();
|
||||
|
||||
virtual double evaluate();
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
#include "ai/default/recruitment.hpp" // for recruitment
|
||||
#include "ai/default/aspect_attacks.hpp" // for aspect_attacks
|
||||
#include "ai/default/ca.hpp" // for leader_shares_keep_phase, etc
|
||||
#include "ai/testing/ca_testing_move_to_targets.hpp"
|
||||
#include "ai/default/ca_move_to_targets.hpp"
|
||||
#include "ai/testing/stage_sf_with_rca.hpp"
|
||||
#include "ai/default/stage_rca.hpp"
|
||||
|
||||
|
@ -101,10 +101,7 @@ static register_candidate_action_factory<ai_default_rca::get_healing_phase>
|
|||
static register_candidate_action_factory<ai_default_rca::retreat_phase>
|
||||
retreat_phase_factory("ai_default_rca::retreat_phase");
|
||||
|
||||
static register_candidate_action_factory<ai_default_rca::simple_move_and_targeting_phase>
|
||||
simple_move_and_targeting_phase_factory("ai_default_rca::simple_move_and_targeting_phase");
|
||||
|
||||
static register_candidate_action_factory<testing_ai_default::testing_move_to_targets_phase>
|
||||
static register_candidate_action_factory<ai_default_rca::move_to_targets_phase>
|
||||
default_move_to_targets_phase_factory("ai_default_rca::move_to_targets_phase");
|
||||
|
||||
static register_candidate_action_factory<ai_default_rca::leader_control_phase>
|
||||
|
@ -142,13 +139,10 @@ static register_candidate_action_factory<ai_default_rca::get_healing_phase>
|
|||
static register_candidate_action_factory<ai_default_rca::retreat_phase>
|
||||
old_retreat_phase_factory("testing_ai_default::retreat_phase");
|
||||
|
||||
static register_candidate_action_factory<ai_default_rca::simple_move_and_targeting_phase>
|
||||
old_simple_move_and_targeting_phase_factory("testing_ai_default::simple_move_and_targeting_phase");
|
||||
|
||||
static register_candidate_action_factory<testing_ai_default::testing_move_to_targets_phase>
|
||||
static register_candidate_action_factory<ai_default_rca::move_to_targets_phase>
|
||||
old_default_move_to_targets_phase_factory("testing_ai_default::default_move_to_targets_phase");
|
||||
|
||||
static register_candidate_action_factory<testing_ai_default::testing_move_to_targets_phase>
|
||||
static register_candidate_action_factory<ai_default_rca::move_to_targets_phase>
|
||||
old_testing_move_to_targets_phase_factory("testing_ai_default::testing_move_to_targets_phase");
|
||||
|
||||
static register_candidate_action_factory<ai_default_rca::leader_control_phase>
|
||||
|
|
Loading…
Add table
Reference in a new issue