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
54 lines
1.9 KiB
C++
54 lines
1.9 KiB
C++
/**
|
|
* @file
|
|
* @author feynman (bears-pit.com)
|
|
*/
|
|
#include "../include/LegacyAIPlanFactory.h"
|
|
#include "../include/LegacyAIPlan.h"
|
|
#include "../include/LegacyCreaturePlan.h"
|
|
#include "../include/LegacyZombiePlan.h"
|
|
#include "../include/CrowPlan.h"
|
|
#include "../include/PlanList.h"
|
|
|
|
#include "../../TacticalAI/AIInternals.h" // DEBUGAIMSG
|
|
#include "../../Tactical/Soldier Control.h" // For SOLDIERTYPE definition
|
|
#include "../../Tactical/Animation Data.h" // For the definition of, wait for it... BLOODCAT!
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
namespace AI
|
|
{
|
|
namespace tactical
|
|
{
|
|
Plan* LegacyAIPlanFactory::create_plan(SOLDIERTYPE* npc, const AIInputData& input)
|
|
{
|
|
DEBUGAIMSG("Planning for "<<(int)npc->ubID);
|
|
if((npc->flags.uiStatusFlags & SOLDIER_MONSTER) || npc->ubBodyType == BLOODCAT )
|
|
return new LegacyCreaturePlan(npc);
|
|
if(npc->ubBodyType == CROW)
|
|
{
|
|
PlanList* find_supper = new PlanList(npc);
|
|
CrowSeekCorpsePlan* seek_corpse = new CrowSeekCorpsePlan(npc);
|
|
CrowPeckPlan* peck = new CrowPeckPlan(npc, seek_corpse->get_corpse_grid());
|
|
find_supper->add_subplan(seek_corpse);
|
|
find_supper->add_subplan(peck);
|
|
return find_supper;
|
|
}
|
|
#ifdef ENABLE_ZOMBIES
|
|
if(npc->IsZombie())
|
|
return new LegacyZombiePlan(npc);
|
|
#endif
|
|
return new LegacyAIPlan(npc); // no special plan for other cases yet, return default legacy AI wrapper
|
|
}
|
|
|
|
|
|
void LegacyAIPlanFactory::update_plan(SOLDIERTYPE* npc, const AIInputData& input)
|
|
{
|
|
DEBUGAIMSG("Update called for "<<(int)npc->ubID<<" event: "<<input);
|
|
if(!npc->ai_masterplan_)
|
|
npc->ai_masterplan_ = create_plan(npc, input);
|
|
}
|
|
}
|
|
}
|
|
|