Validate independent packed addons and complete physical mortar salvos

This commit is contained in:
2026-09-19 11:42:13 +02:00
parent 7c53b4bb81
commit dfd7cc49e2
532 changed files with 63902 additions and 96 deletions
+4 -4
View File
@@ -30,7 +30,7 @@ struct ERR_MortarPrediction {static constexpr float MAX_REPORT_AGE_MS=60000;
struct ERR_MortarAimRules {
'''+eq+'''};
struct Node;struct ERR_MortarAimSolution;
struct ERR_MortarBattery {static inline std::string SHELL="nativeHE";IEntity Gun=this;ERR_MortarAimSolution* AimSolution=nullptr;Node* AimSolver=nullptr;int OrderId=1,OrderShots=0;float AimedAt=1000; void Trace(const char*,const char*){}};
struct ERR_MortarBattery {static inline std::string SHELL="nativeHE";IEntity Gun=this;ERR_MortarAimSolution* AimSolution=nullptr;Node* AimSolver=nullptr;int OrderId=1,OrderShots=0;float AimedAt=1000,AimValidatedAt=1000; void Trace(const char*,const char*){}};
struct ERR_MortarAimSolution {IEntity Gun=nullptr;ERR_HQReport* Report=nullptr;int OrderId=1,Shot=0,Charge=0;vector GunOrigin{},Impact{500,0,0},AimTarget{500,500,0};float FlightTime=30;
'''+matches+'''};
struct ERR_MortarSystem {int rejects=0;bool Withhold(ERR_MortarBattery*,const char*){rejects++;return false;}const char* ContactFailure(ERR_MortarBattery*){return "stale";}};
@@ -46,10 +46,10 @@ struct Fixture {
bool attempt(float now=25000){return node.ERR_RevalidateAim(&battery,&system,&report,now);}
};
int main(){
Fixture stable; assert(stable.attempt()); assert(stable.node.solves==1&&stable.battery.AimedAt==25000);
Fixture stable; assert(stable.attempt()); assert(stable.node.solves==1&&stable.battery.AimedAt==1000&&stable.battery.AimValidatedAt==25000);
assert(stable.report.ObservedAt==0&&stable.battery.AimSolution==&stable.original);
assert(stable.attempt(45000)&&stable.node.solves==2); // fresh recomputation every renewal
assert(!stable.attempt(60001)&&stable.node.solves==2&&stable.battery.AimedAt==45000); // observation never renewed
assert(!stable.attempt(60001)&&stable.node.solves==2&&stable.battery.AimedAt==1000&&stable.battery.AimValidatedAt==45000); // observation never renewed
Fixture limit;assert(limit.attempt(60000));
Fixture future;future.report.ObservedAt=26000;assert(!future.attempt()&&future.node.solves==0);
Fixture gone;gone.battery.AimSolver=nullptr;assert(!gone.attempt()&&gone.node.solves==0);
@@ -76,7 +76,7 @@ source=firing.read_text();system=(r/'ERR_MortarSystem.c').read_text()
assert source.count('system.AllowShot(battery)')==2
assert 'SetVariableOut' not in body(firing,'bool ERR_RevalidateAim(')
assert 'ObservedAt =' not in source
assert 'now - battery.AimedAt > 10000' in system
assert 'now - battery.AimValidatedAt > 10000' in system
assert 'battery.AimSolver.ERR_RevalidateAim(battery, this, report, now)' in system
assert source.count('BallisticTable.GetAimHeightOfProjectileAltitudeFromSource(')==1
assert 'GetAmmoInitialSpeedCoefficients(ammo, coefficients)' in body(firing,'protected ERR_MortarAimSolution ERR_Solve(')