Fix faction ammunition resupply and settings recovery

Wait for both convoy cargo phases and use actual magazine stock. Resolve empty primary weapon ammunition from muzzle metadata and recover cleanly from failed initial settings saves.

Update native fixtures, scoped cleanup guards, packaging evidence and validation documentation. Make reviewed fixture tests checkout-relative. All repository checks pass against the isolated staged tree; native resupply completion and multiplayer qualification remain outstanding.
This commit is contained in:
2026-09-30 14:34:46 +02:00
parent c5629f7f4f
commit a951a96edc
158 changed files with 39131 additions and 69 deletions
+60 -3
View File
@@ -1,7 +1,7 @@
"""Actual native-fixture startup/deadline gate, engine boundaries doubled."""
import os,sys
import os,sys,re
from pathlib import Path
REPO=Path(os.environ.get('ERR_REPO','/home/jakub/devel/escapistsrereintroduced'))
REPO=Path(os.environ.get('ERR_REPO', Path(__file__).resolve().parents[1]))
sys.path.insert(0,str(REPO/'tests'))
from policy_harness import body,run
p=Path(os.environ.get('ERR_MEMORY_PROBE_SOURCE',REPO/'addons/core/Scripts/Game/ERR/40_Chat/ERR_NativeHQMemoryProbe.c'))
@@ -31,4 +31,61 @@ int main(){ERR_HQ hq;
smoke=Path(os.environ.get('ERR_SMOKE_SOURCE',REPO/'addons/core/Scripts/Game/ERR/40_Chat/ERR_NativeSmoke.c')).read_text()
assert 'if (m_ERRTestHQMemory) m_ERRSmokeDeadline = GetWorld().GetWorldTime() + 360000;' in smoke
assert 'if (m_ERRTestHQBody) m_ERRSmokeDeadline = GetWorld().GetWorldTime() + 240000;' in smoke
print('PASS: bounded150s startup followed by exactly one120s memory window; only HQ-memory outer deadline extended')
# Execute the actual startup selector, so enlarged full-route budgets cannot
# accidentally extend a death/radio test or shorten an existing specialized run.
start=smoke.index('m_ERRTestLostHelicopter = System.GetCLIParam(')
end=smoke.index('OnStop().Insert(ERR_StopHQPatrol);',start)
selector=smoke[start:end].replace('System.GetCLIParam("errSmokeOutcome", outcome) && ', '')
selector=selector.replace('GetWorld().GetWorldTime()', 'now').replace('ERR_NativeConvoyCoverProbe.Enabled()', 'cover')
flags=sorted(set(re.findall(r'\bm_ERRTest\w+',selector)))
run(r'''
#include <cassert>
#include <string>
using string = std::string;
float deadline(string outcome,float now,bool cover=false){
[[maybe_unused]] bool DECLARATIONS;
float m_ERRSmokeDeadline=0;
SELECTOR
return m_ERRSmokeDeadline;
}
int main(){
for(float now : {0.0f, 42000.0f}) {
for(string outcome : {"", "victory", "lost-helicopter"}) assert(deadline(outcome,now)==now+300000);
for(string outcome : {"escape-route", "player-death", "radio-network", "hq-response", "map-ownership"}) assert(deadline(outcome,now)==now+150000);
assert(deadline("hq-memory",now)==now+360000);
assert(deadline("hq-body",now)==now+240000);
assert(deadline("convoy",now)==now+540000);
assert(deadline("supply-convoys",now)==now+840000);
assert(deadline("convoy",now,true)==now+840000);
}
}
'''.replace('DECLARATIONS', ','.join(flag+'=false' for flag in flags)).replace('SELECTOR',selector))
print('PASS: bounded HQ startup/memory windows and outcome-specific full-route deadlines')
# The new route diagnostic must leave the original administrator/reroll stress
# intact and may skip only those extras, never clue or radio progression gates.
route=body(Path(os.environ.get('ERR_SMOKE_SOURCE',REPO/'addons/core/Scripts/Game/ERR/40_Chat/ERR_NativeSmoke.c')), 'bool ERR_CheckRouteExtras(float now)')
run(r'''
#include <cassert>
#include <string>
struct Probe {
bool m_ERRTestEscapeRoute=false,rerollReady=false;
int adminResult=0,adminCalls=0,rerollCalls=0,failures=0;
int ERR_ProbeAdminMenu(float){adminCalls++;return adminResult;}
bool ERR_Check(bool result,std::string){if(!result)failures++;return result;}
bool ERR_CheckIntelReroll(float){rerollCalls++;return rerollReady;}
METHOD
};
int main(){
Probe route;route.m_ERRTestEscapeRoute=true;assert(route.ERR_CheckRouteExtras(100));
assert(route.adminCalls==0&&route.rerollCalls==0&&route.failures==0);
Probe full;assert(!full.ERR_CheckRouteExtras(100)&&full.adminCalls==1&&full.rerollCalls==0);
full.adminResult=-1;assert(!full.ERR_CheckRouteExtras(200)&&full.failures==1&&full.rerollCalls==0);
full.adminResult=1;assert(!full.ERR_CheckRouteExtras(300)&&full.rerollCalls==1);
full.rerollReady=true;assert(full.ERR_CheckRouteExtras(400)&&full.rerollCalls==2);
}
'''.replace('METHOD',route))
assert 'if (!ERR_CheckRouteExtras(now)) return;' in smoke
assert 'if (!ERR_Check(m_ERRSmokeRadio.Knowledge() == 2,' in smoke
assert 'if (!ERR_Check(Phase() == ERR_Phase.EXTRACTION,' in smoke
print('PASS: explicit escape-route skips only administrator stress, preserving original full-fixture wait/failure paths')