Fix convoy coordination, AI combat and spectator recovery

This commit is contained in:
2026-09-27 22:28:07 +02:00
parent 2551d171b3
commit c5629f7f4f
108 changed files with 4337 additions and 282 deletions
+10 -1
View File
@@ -35,7 +35,7 @@ struct Group{int GetFaction(){return 1;}};
struct Entity{Vec GetOrigin(){return {};}};
struct Waypoint{bool complete=false;bool IsWithinCompletionRadius(Group*){return complete;}};
struct Route{};
struct ERR_HunterVehicle{float NextOrder=99999,LastContact=-1,NextContactOrder=0;Route* Downlink=nullptr;int SourceMessage=0;Vec Destination;string Source="hunter";struct Group* Group=nullptr;struct Entity* Entity=nullptr;struct Waypoint* Waypoint=nullptr;};
struct ERR_HunterVehicle{float NextOrder=99999,LastContact=-1,NextContactOrder=0;Route* Downlink=nullptr;int SourceMessage=0;Vec Destination,ContactPosition,DeliveredContactPosition;bool DeliveredContact=false;string Source="hunter";struct Group* Group=nullptr;struct Entity* Entity=nullptr;struct Waypoint* Waypoint=nullptr;};
struct ERR_HQReport{int Target=1;};
struct ERR_HQBelief{bool actionable=true;float ObservedAt=10,Confidence=1;int MessageId=7;Vec PredictedPosition={1000,0,2000};bool Actionable(){return actionable;}};
struct Memory{ERR_HQBelief belief;ERR_HQBelief* Get(int){return &belief;}};
@@ -72,6 +72,15 @@ int main(){
unit.Downlink=nullptr;service.QueueDestination(&unit,&hq,7000);assert(hq.requests==2); // no repeated order for same report
ERR_HunterVehicle disconnected;hq.connected=false;service.QueueDestination(&disconnected,&hq,10000);
assert(!disconnected.Downlink&&disconnected.LastContact==-1);
// Repeated/new reports in an already delivered area must not churn routing.
Waypoint route;unit.Waypoint=&route;unit.DeliveredContact=true;unit.DeliveredContactPosition={1000,0,2000};
unit.Downlink=nullptr;unit.NextOrder=0;unit.NextContactOrder=0;
int kept=hq.requests;int projections=ERR_SupplyConvoySystem::calls;
hq.memory.belief.ObservedAt=12;service.QueueDestination(&unit,&hq,12000);
assert(hq.requests==kept&&ERR_SupplyConvoySystem::calls==projections&&unit.LastContact==12);
hq.memory.belief.PredictedPosition.x=1100;hq.memory.belief.ObservedAt=13;
service.QueueDestination(&unit,&hq,18000);assert(hq.requests==kept+1); // Material displacement redirects.
hq.memory.belief.ObservedAt=11;
int requests=hq.requests;service.QueueDestination(&disconnected,&hq,11000);assert(hq.requests==requests);
hq.connected=true;service.QueueDestination(&disconnected,&hq,15000);assert(disconnected.Downlink&&disconnected.LastContact==11);
}