Added missing from ModularizedTacticalAI :/

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6019 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
feynman
2013-04-18 21:14:34 +00:00
parent 26383d83a8
commit aa5bed7850
10 changed files with 439 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
/**
* @file
* @author feynman (bears-pit.com)
*/
#ifndef CROW_PLAN_H_
#define CROW_PLAN_H_
#include "Plan.h"
namespace AI
{
namespace tactical
{
/**@class CrowSeekCorpsePlan
* @brief Component/Concrete Product. Let a crow seek a corpse within 4 tiles radius, and go towards it.
*/
class CrowSeekCorpsePlan : public Plan
{
private:
/// The location of the corpse the crow shall go to
int corpse_grid_;
public:
CrowSeekCorpsePlan(SOLDIERTYPE* npc);
virtual void execute(PlanInputData& environment);
/// The plan is marked as 'done' when the 'sweet spot' near the corpse is reached
virtual bool done() const;
int get_corpse_grid() const;
};
/**@class CrowPeckPlan
* @brief Component/Concrete Product. Let a crow sitting next to a corpse peck.
*/
class CrowPeckPlan : public Plan
{
private:
int corpse_grid_;
public:
CrowPeckPlan(SOLDIERTYPE* npc, int corpse_grid);
virtual void execute(PlanInputData& environment);
/// The plan never ends without interrupt/plan update, pecking can take forever
virtual bool done() const {return false;}
};
/**@class CrowFlyAwayPlan
* @brief Component/Concrete Product. Let a crow leave the tactical screen.
*/
class CrowFlyAwayPlan : public Plan
{
private:
public:
CrowFlyAwayPlan(SOLDIERTYPE* npc);
virtual void execute(PlanInputData& environment);
/// The plan is deleted with the crow once it leaves; 'done' is meaningless, flying away cannot be interrupted
virtual bool done() const {return false;}
};
}
}
#endif
@@ -0,0 +1,34 @@
/**
* @file
* @author feynman (bears-pit.com)
*/
#ifndef LEGACY_CREATURE_PLAN_H_
#define LEGACY_CREATURE_PLAN_H_
#include "Plan.h"
namespace AI
{
namespace tactical
{
/**@class LegacyCreaturePlan
* @brief Component/Concrete Product. Wrapper/Re-Write of CreatureDecideAction()
*
* This plan began as a simple forwarding object for CreatureDecideAction(), and will, in the course of the AI redesign,
* be split into elementary NPC actions. It is as such only a intermediate product used to bring structure where
* the is currently none.
*/
class LegacyCreaturePlan: public Plan
{
private:
public:
LegacyCreaturePlan(SOLDIERTYPE* npc);
virtual void execute(PlanInputData& environment);
virtual bool done() const {return false;}
};
}
}
#endif
@@ -0,0 +1,34 @@
/**
* @file
* @author feynman (bears-pit.com)
*/
#ifndef LEGACY_ZOMBIE_PLAN_H_
#define LEGACY_ZOMBIE_PLAN_H_
#include "Plan.h"
namespace AI
{
namespace tactical
{
/**@class LegacyZombiePlan
* @brief Component/Concrete Product. Wrapper/Re-Write of ZombieDecideAction()
*
* This plan began as a simple forwarding object for ZombieDecideAction(), and will, in the course of the AI redesign,
* be split into elementary NPC actions. It is as such only a intermediate product used to bring structure where
* the is currently none.
*/
class LegacyZombiePlan: public Plan
{
private:
public:
LegacyZombiePlan(SOLDIERTYPE* npc);
virtual void execute(PlanInputData& environment);
virtual bool done() const {return false;}
};
}
}
#endif
+36
View File
@@ -0,0 +1,36 @@
#ifndef PLAN_LIST_H_
#define PLAN_LIST_H_
#include "Plan.h"
#include <deque>
namespace AI
{
namespace tactical
{
/**@class PlanList
* @brief Composition/Abstract Product. Used to concatenate plans.
*
* Plan lists can comprise an arbitrary number of sub-plans, executed in the order they were added via
* add_subplan(), and switched to the next one once the done()-flag of a sub-plan becomes true.
*/
class PlanList : public Plan
{
private:
/// The sub-plan sequence
std::deque<Plan*> subplans_;
public:
PlanList(SOLDIERTYPE* npc);
/// Add a plan to the list of sub-plans
virtual void add_subplan(Plan* P);
/// Execute the next plan in the list
virtual void execute(PlanInputData& environment);
/// Done will be set once the last plan is marked as done()
virtual bool done() const;
virtual ~PlanList();
};
}
}
#endif