Further refinement of new ModularizedTacticalAI architecture; added plans for Crows

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6017 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
feynman
2013-04-18 20:02:54 +00:00
parent 52cb4ff424
commit 26383d83a8
22 changed files with 451 additions and 490 deletions
@@ -10,6 +10,8 @@
#include <map>
#include <deque>
class SOLDIERTYPE;
namespace AI
{
namespace tactical
@@ -17,23 +19,29 @@ namespace AI
// forward declarations
class AbstractPlanFactory;
class Plan;
struct AIInputData;
class AIInputData;
/**@class PlanFactoryLibrary
* @brief Singleton. A "library" containing all available PlanFactories, accessible via the strings returned by
* their get_name() function.
*
* Used as one "entry point" for the new AI system within the legacy code (the other being the 'execute()' methods of Plan)
* Handles the mapping of a SOLDIERTYPE's bAIIndex to a concrete plan factory instantiation.
*/
class PlanFactoryLibrary
{
private:
/// Only instance, required for singleton pattern implementation
static PlanFactoryLibrary* instance_;
/// A mapping of factory names to pointers of said factories
std::map<std::string, AbstractPlanFactory*> registred_factories_;
/// A mapping of bAIIndex to factory pointers
std::deque<AbstractPlanFactory*> ai_index_to_factory_mapping_;
PlanFactoryLibrary();
public:
static PlanFactoryLibrary* instance();
Plan* create_plan(size_t index, AIInputData& input) const;
Plan* create_plan(size_t index, SOLDIERTYPE* npc, const AIInputData& input) const;
void update_plan(size_t intdex, SOLDIERTYPE* npc, const AIInputData& input) const;
};
}
}