diff --git a/projectfiles/CodeBlocks-SCons/wesnoth.cbp b/projectfiles/CodeBlocks-SCons/wesnoth.cbp index 63d8f6ccbe4..785d628d072 100644 --- a/projectfiles/CodeBlocks-SCons/wesnoth.cbp +++ b/projectfiles/CodeBlocks-SCons/wesnoth.cbp @@ -110,6 +110,8 @@ + + diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 1c231ca20a5..efe0e951983 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -140,6 +140,8 @@ + + diff --git a/projectfiles/VC9/wesnoth.vcproj b/projectfiles/VC9/wesnoth.vcproj index da0af1a9c20..9366063078f 100644 --- a/projectfiles/VC9/wesnoth.vcproj +++ b/projectfiles/VC9/wesnoth.vcproj @@ -1,4 +1,4 @@ - + + + + + + + + + + + + @@ -8093,6 +8121,10 @@ RelativePath="..\..\src\ai\testing\ca.hpp" > + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ae70ee8efa9..17e66ca7f7d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -317,6 +317,7 @@ set(wesnoth-main_SRC ai/registry.cpp ai/testing/aspect_attacks.cpp ai/testing/ca.cpp + ai/testing/ca_global_fallback.cpp ai/testing/ca_testing_move_to_targets.cpp ai/testing/ca_testing_recruitment.cpp ai/testing/stage_rca.cpp diff --git a/src/SConscript b/src/SConscript index 26a37b395be..17b5b5a2c21 100644 --- a/src/SConscript +++ b/src/SConscript @@ -188,6 +188,7 @@ wesnoth_sources = Split(""" ai/registry.cpp ai/testing/aspect_attacks.cpp ai/testing/ca.cpp + ai/testing/ca_global_fallback.cpp ai/testing/ca_testing_move_to_targets.cpp ai/testing/ca_testing_recruitment.cpp ai/testing/stage_rca.cpp diff --git a/src/ai/registry.cpp b/src/ai/registry.cpp index 48c62a22eda..f65b8ecc37c 100644 --- a/src/ai/registry.cpp +++ b/src/ai/registry.cpp @@ -31,6 +31,7 @@ #include "testing/ca.hpp" #include "testing/ca_testing_move_to_targets.hpp" #include "testing/ca_testing_recruitment.hpp" +#include "testing/ca_global_fallback.hpp" #include "testing/stage_rca.hpp" #include "testing/stage_fallback.hpp" @@ -123,6 +124,9 @@ static register_candidate_action_factory passive_leader_shares_keep_phase_factory("testing_ai_default::passive_leader_shares_keep_phase"); +static register_candidate_action_factory + global_fallback_phase_factory("testing_ai_default::global_fallback_phase"); + // ======================================================================= // Goals // ======================================================================= diff --git a/src/ai/testing/ca_global_fallback.cpp b/src/ai/testing/ca_global_fallback.cpp new file mode 100644 index 00000000000..5ed0ddffdf7 --- /dev/null +++ b/src/ai/testing/ca_global_fallback.cpp @@ -0,0 +1,72 @@ +/* $Id$ */ +/* + Copyright (C) 2009 - 2011 by Yurii Chernyi + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + +/** + * @file + * Defensive fallback, to be used during unfavourable conditions + */ + +#include "ca_global_fallback.hpp" + +#include "../composite/ai.hpp" + +#include "../../log.hpp" + +/* +#include "../actions.hpp" +#include "../../foreach.hpp" +#include "../../map.hpp" +#include "../../resources.hpp" +#include "../../team.hpp" + +#include +*/ + +namespace ai { + +namespace testing_ai_default { + +static lg::log_domain log_ai_testing_ca_global_fallback("ai/ca/global_fallback"); +#define DBG_AI LOG_STREAM(debug, log_ai_testing_ca_global_fallback) +#define LOG_AI LOG_STREAM(info, log_ai_testing_ca_global_fallback) +#define WRN_AI LOG_STREAM(warn, log_ai_testing_ca_global_fallback) +#define ERR_AI LOG_STREAM(err, log_ai_testing_ca_global_fallback) + + +global_fallback_phase::global_fallback_phase( rca_context &context, const config &cfg ) + : candidate_action(context,cfg) +{ +} + + +global_fallback_phase::~global_fallback_phase() +{ +} + + +double global_fallback_phase::evaluate() +{ + return get_score(); +} + + +void global_fallback_phase::execute() +{ + //@todo: implement +} + +} // end of namespace testing_ai_default + +} // end of namespace ai diff --git a/src/ai/testing/ca_global_fallback.hpp b/src/ai/testing/ca_global_fallback.hpp new file mode 100644 index 00000000000..656a50f8336 --- /dev/null +++ b/src/ai/testing/ca_global_fallback.hpp @@ -0,0 +1,60 @@ +/* $Id$ */ +/* + Copyright (C) 2009 - 2011 by Yurii Chernyi + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + +/** + * @file + * Strategic movement routine, for experimentation + */ + +#ifndef AI_TESTING_CA_TESTING_GLOBAL_FALLBACK_HPP_INCLUDED +#define AI_TESTING_CA_TESTING_GLOBAL_FALLBACK_HPP_INCLUDED + +#include "../composite/rca.hpp" + +#include "../../unit_map.hpp" + +#ifdef _MSC_VER +#pragma warning(push) +//silence "inherits via dominance" warnings +#pragma warning(disable:4250) +#endif + +namespace ai { + +namespace testing_ai_default { + +class global_fallback_phase : public candidate_action { +public: + + global_fallback_phase( rca_context &context, const config &cfg ); + + virtual ~global_fallback_phase(); + + virtual double evaluate(); + + virtual void execute(); + +protected: +}; + +} // of namespace testing_ai_default + +} // of namespace ai + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif