#include "pch.h"
#include "ShipSeesObjectCondition.h"
#include "TypeIDTarget.h"
namespace Training
{
ShipSeesObjectCondition::ShipSeesObjectCondition (IshipIGC* pShip, ImodelIGC* pTarget) :
m_pShip (new TypeIDTarget (pShip->GetObjectType (), pShip->GetObjectID ())),
m_pTarget (new TypeIDTarget (pTarget->GetObjectType (), pTarget->GetObjectID ()))
{
}
ShipSeesObjectCondition::ShipSeesObjectCondition (IshipIGC* pShip, ObjectType targetType, ObjectID targetID) :
m_pShip (new TypeIDTarget (pShip->GetObjectType (), pShip->GetObjectID ())),
m_pTarget (new TypeIDTarget (targetType, targetID))
{
}
ShipSeesObjectCondition::ShipSeesObjectCondition (ObjectID shipID, ObjectType targetType, ObjectID targetID) :
m_pShip (new TypeIDTarget (OT_ship, shipID)),
m_pTarget (new TypeIDTarget (targetType, targetID))
{
}
ShipSeesObjectCondition::~ShipSeesObjectCondition (void)
{
delete m_pShip;
delete m_pTarget;
}
bool ShipSeesObjectCondition::Evaluate (void)
{
IshipIGC* pShip = static_cast<IshipIGC*> (static_cast<ImodelIGC*> (*m_pShip));
if (pShip)
return pShip->InScannerRange (*m_pTarget);
return false;
}
}