mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6017 3b4a5df2-a311-0410-b5c6-a8a6f20db521
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
/**
|
|
* @file
|
|
* @author feynman (bears-pit.com)
|
|
*/
|
|
|
|
#ifndef PLAN_FACTORY_LIBRARY_H_
|
|
#define PLAN_FACTORY_LIBRARY_H_
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <deque>
|
|
|
|
class SOLDIERTYPE;
|
|
|
|
namespace AI
|
|
{
|
|
namespace tactical
|
|
{
|
|
// forward declarations
|
|
class AbstractPlanFactory;
|
|
class Plan;
|
|
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, SOLDIERTYPE* npc, const AIInputData& input) const;
|
|
void update_plan(size_t intdex, SOLDIERTYPE* npc, const AIInputData& input) const;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|