Files
firestorm/Gameleap/code/mw4/Code/MW4/AI_RadioSquad.cpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

100 lines
2.2 KiB
C++

#include "MW4Headers.hpp"
#include "AI_RadioSquad.hpp"
#include "ai.hpp"
using namespace MW4AI;
using namespace MW4AI::Squad;
using namespace MechWarrior4;
const Stuff::Scalar isshot_propagation_delay = 2.0f;
RadioSquad::RadioSquad()
{
}
RadioSquad::~RadioSquad()
{
}
ID RadioSquad::GetID() const
{
return (GROUPAI_RADIOSQUAD);
}
void RadioSquad::Update(MechWarrior4::Group& group, MechWarrior4::CombatAI& combat_ai)
{
UpdateIsShotCommunications(group);
}
void RadioSquad::NotifyShot(MechWarrior4::Group& group, Adept::ObjectID id)
{
is_shot_notifier n(id,gos_GetElapsedTime() + isshot_propagation_delay);
is_shot_notifier_list::iterator found = m_IsShotNotifiers.find(n.first);
if ((found == m_IsShotNotifiers.end()) ||
((*found).second > n.second))
{
if (found != m_IsShotNotifiers.end())
{
m_IsShotNotifiers.erase(found);
}
m_IsShotNotifiers.insert(n);
}
}
void RadioSquad::NotifyShotFired(MechWarrior4::Group& group, const Stuff::Line3D& line, MechWarrior4::MWObject& at_who, MechWarrior4::MWObject& shooter)
{
}
void RadioSquad::UpdateIsShotCommunications(const Group& group)
{
{for (is_shot_notifier_list::iterator i = m_IsShotNotifiers.begin();
i != m_IsShotNotifiers.end();
++i)
{
if ((*i).second < gos_GetElapsedTime())
{
{for (Group::element_list::const_iterator i_group = group.GetElements().begin();
i_group != group.GetElements().end();
++i_group)
{
Adept::Entity* entity = group.IDToEntity(*i_group);
if ((entity != 0) &&
(entity->IsDerivedFrom(MWObject::DefaultData) == true))
{
MWObject* mwobject = Cast_Object(MWObject*,entity);
if (mwobject->GetAI() != 0)
{
mwobject->GetAI()->NotifyShot((*i).first,false);
}
}
}}
m_IsShotNotifiers.erase(i);
UpdateIsShotCommunications(group);
return;
}
}}
}
void RadioSquad::NotifyMemberAdded(MechWarrior4::Group& group, MechWarrior4::MWObject& who)
{
}
void RadioSquad::NotifyMemberRemoved(MechWarrior4::Group& group, MechWarrior4::MWObject& who)
{
}
void RadioSquad::SetEntityToIgnore(Adept::ObjectID objectid)
{
}