Deliver local sighting handoffs and preserve unsubmitted resupply attempts
This commit is contained in:
@@ -36,6 +36,9 @@ class ERR_HQRadioNode
|
||||
class ERR_HQRoute
|
||||
{
|
||||
ref array<ref ERR_HQRadioNode> Nodes = {};
|
||||
SCR_AIGroup LocalSource;
|
||||
IEntity LocalWitness;
|
||||
ref ERR_HQStatusSampler LocalRoster;
|
||||
bool Downlink;
|
||||
bool Originated;
|
||||
float OriginDue = -1;
|
||||
@@ -68,6 +71,8 @@ class ERR_HQRoute
|
||||
{
|
||||
if (Nodes.IsEmpty() || !Nodes[0].Valid(Nodes.Count() == 1))
|
||||
return Fail(journal, "originating call lost its living owned radio carrier");
|
||||
if (LocalRoster && !ERR_HQLocalHandoff.Valid(LocalSource, LocalRoster, LocalWitness, Nodes[0]))
|
||||
return Fail(journal, "local sighting handoff lost original squad member, recipient or 100m reach");
|
||||
if (OriginDue < 0)
|
||||
{
|
||||
OriginDue = now + 3000;
|
||||
@@ -151,6 +156,7 @@ class ERR_HQNetwork
|
||||
protected ref map<IEntity, int> m_Indices = new map<IEntity, int>();
|
||||
protected ref map<string, ref array<int>> m_Cells = new map<string, ref array<int>>();
|
||||
bool Overflow;
|
||||
protected int m_LocalChecks;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
@@ -160,6 +166,7 @@ class ERR_HQNetwork
|
||||
m_Indices.Clear();
|
||||
m_Cells.Clear();
|
||||
Overflow = false;
|
||||
m_LocalChecks = 0;
|
||||
}
|
||||
|
||||
protected string Cell(int x, int z)
|
||||
@@ -243,6 +250,30 @@ class ERR_HQNetwork
|
||||
}
|
||||
}
|
||||
|
||||
// At most 4096 local pairs across all reports per network rebuild. Indexes
|
||||
// provide candidate routes only; current original actors/distance are checked.
|
||||
ERR_HQRoute LocalRoute(SCR_AIGroup source, ERR_HQStatusSampler roster, array<IEntity> busy)
|
||||
{
|
||||
if (Overflow || !source || !roster || !roster.OwnsRoster(source) || !busy || busy.Count() > 256) return null;
|
||||
int count = roster.InitialStrength();
|
||||
if (count < 1 || count > 32) return null;
|
||||
foreach (ERR_HQRadioNode node : m_Nodes)
|
||||
{
|
||||
if (!node || node.Group == source || busy.Contains(node.Carrier)) continue;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (++m_LocalChecks > 4096) return null;
|
||||
IEntity witness = roster.InitialMember(i);
|
||||
if (!ERR_HQLocalHandoff.Valid(source, roster, witness, node)) continue;
|
||||
ERR_HQRoute route = Route(node.Carrier);
|
||||
if (!route) continue;
|
||||
route.LocalSource = source; route.LocalWitness = witness; route.LocalRoster = roster;
|
||||
return route;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
ERR_HQRoute Route(IEntity caller, bool downlink = false)
|
||||
{
|
||||
int index;
|
||||
|
||||
Reference in New Issue
Block a user