Prepare independent successor playtest with spawn recovery and casualty feedback

This commit is contained in:
2026-09-19 22:12:52 +02:00
parent 61e165ef5b
commit 6cf989a060
266 changed files with 134064 additions and 154 deletions
+33 -1
View File
@@ -11,7 +11,7 @@ def cpp(s):
for name in ('corridor','low'):s=s.replace(name+'.',name+'->')
s=s.replace('GetGame().','GetGame()->').replace('GetWorld().','GetWorld()->').replace(', null)', ', nullptr)')
return re.sub(r'(?<![\w.])(\d+\.\d+)(?![\w.])', r'\1f', s)
run(r'''
survey_code = (r'''
#include <cassert>
#include <cmath>
#include <algorithm>
@@ -75,6 +75,24 @@ int main(){
reset();assert(Survey(a,{100.05f,10,0}));assert(SCR_TerrainHelper::samples==3772);
}
''')
run(survey_code)
# Execute the same actual Survey with WORKBENCH enabled. Native logging and
# entity metadata are boundary doubles; every terrain/trace call remains real
# to this actual-method harness. Refusal must log once without querying again.
wb = '#define WORKBENCH\n' + survey_code
wb = wb.replace('void reset(){world=World();', 'void reset(){diagnosticCount=0;world=World();')
logging = r'''
static bool diagnosticEnabled=true;static int diagnosticCount=0;
static bool SurveyDiagnostics(){return diagnosticEnabled;}
template<typename...T>void PrintFormat(const char*,T...){diagnosticCount++;}
static void SurveyTraceFailure(const char*,float fraction,TraceBox*){assert(fraction==.5f);if(diagnosticEnabled)diagnosticCount++;}
'''
wb = wb.replace('static const int MAX_TERRAIN_NODES=4096;', logging+'\nstatic const int MAX_TERRAIN_NODES=4096;')
wb = wb.replace('assert(Survey(a,b,&excluded));', 'assert(Survey(a,b,&excluded));assert(diagnosticCount==0);')
wb = wb.replace('assert(!Survey(a,b));', 'assert(!Survey(a,b));assert(diagnosticCount==1);')
wb = wb.replace('assert(!Survey(a,end));', 'assert(!Survey(a,end));assert(diagnosticCount==1);')
wb = wb.replace('reset();assert(Survey(a,{100.05f,10,0}));', 'reset();diagnosticEnabled=false;SCR_TerrainHelper::kind=1;assert(!Survey(a,b)&&diagnosticCount==0&&SCR_TerrainHelper::samples==1);reset();diagnosticEnabled=true;assert(Survey(a,{100.05f,10,0}));')
run(wb)
source=P.read_text();qualify=body(P,'static ERR_AircraftFieldEnvelope QualifyField(')
assert 'bool Claim(' not in source and 'bool ClaimedBy(' not in source
assert 'ERR_AircraftFlightEnvelope.Qualify(mode, aircraft, pilot)' in qualify
@@ -144,3 +162,17 @@ int main(){
}
''')
print('PASS: actual QualifyField preserves original identity/footprint/time, orders complete surveys before issuance, and refuses failed stages/moved body/expired or changed world; native boundaries faked')
diag=body(P,'protected static void SurveyTraceFailure(')
assert 'trace.TraceEnt' in diag and 'hit.GetPrefabData().GetPrefabName()' in diag
for mutation in ('TraceMove(', 'Set', 'Spawn(', 'Delete(', 'GetTerrainY('):assert mutation not in diag
# Exact optional scope executes separately; absent/wrong flags never log.
scope=body(P,'protected static bool SurveyDiagnostics(').replace('protected ','').replace('System.','System::').replace('string enabled','std::string enabled')
run(r'''#include <cassert>
#include <string>
struct System {static std::string smoke,outcome;static bool GetCLIParam(std::string key,std::string& out){out=key=="errSmoke"?smoke:outcome;return !out.empty();}};
std::string System::smoke="",System::outcome="";
'''+scope+r'''
int main(){assert(!SurveyDiagnostics());System::smoke="1";assert(!SurveyDiagnostics());System::outcome="aircraft-route";assert(!SurveyDiagnostics());System::outcome="aircraft-field";assert(SurveyDiagnostics());System::smoke="0";assert(!SurveyDiagnostics());}
''')
print('PASS: WORKBENCH first-refusal diagnostics preserve ordinary predicates, query order/count/budget and opt-in scope; no native logging run')