38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
// One newer observation in transit for one existing physical firing order.
|
|
// The report's observed time survives both radio legs unchanged.
|
|
class ERR_MortarRefresh
|
|
{
|
|
IEntity Gun;
|
|
SCR_AIGroup Group;
|
|
int OrderId;
|
|
int RadioId;
|
|
ref ERR_HQReport Report;
|
|
ref ERR_HQRoute Route;
|
|
|
|
void ERR_MortarRefresh(ERR_MortarBattery battery, ERR_HQReport report, ERR_HQRoute route)
|
|
{
|
|
Gun = battery.Gun;
|
|
Group = battery.Group;
|
|
OrderId = battery.OrderId;
|
|
RadioId = route.MessageId;
|
|
Report = report.Snapshot();
|
|
Route = route;
|
|
}
|
|
bool Owns(ERR_MortarBattery battery)
|
|
{
|
|
return battery && Gun && Group && Gun == battery.Gun && Group == battery.Group && OrderId == battery.OrderId;
|
|
}
|
|
bool DeliveredFor(ERR_MortarBattery battery, ERR_HQReport report)
|
|
{
|
|
return !Route && Report && Report == report && Owns(battery);
|
|
}
|
|
}
|
|
|
|
class ERR_MortarRefreshRules
|
|
{
|
|
static bool Newer(ERR_HQReport current, ERR_HQReport incoming, float now)
|
|
{
|
|
return current && incoming && current.Target && incoming.Target == current.Target && incoming.MessageId > 0 && incoming.MessageId != current.MessageId && incoming.ObservedAt > current.ObservedAt && ERR_MortarPrediction.Fresh(incoming, now);
|
|
}
|
|
}
|