Embed RHS 1.9 compatibility; record Workshop 0.0.141
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-11-05 16:39:35 +01:00
parent 9418b6950a
commit 9caed3f12d
325 changed files with 76722 additions and 25 deletions
+9 -4
View File
@@ -1,6 +1,8 @@
"""Delivered ammo gates new tasks without becoming active-order cancellation."""
from policy_harness import ROOT, body, run
H=ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_HQ.c'
from pathlib import Path
import os
H=Path(os.environ.get('ERR_HQ_SOURCE',ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_HQ.c'))
for method in ('protected void Investigate(', 'protected void Retask(', 'protected void Assign('):
s=body(H,method)
assert 'if (m_Watch.ArmedSearchBlocked(unit.ForceSourceId, now)) continue;' in s
@@ -8,20 +10,23 @@ for method in ('protected void Investigate(', 'protected void Retask(', 'protect
s=body(H,'protected void DeliverOrder(')
s=s[:s.index(' if (task.Investigation())')]+' admitted++;\n }'
s=s.replace('protected ','').replace('null','nullptr').replace('.IsEmpty()', '.empty()').replace('ERR_HQUnit unit','ERR_HQUnit* unit').replace('ERR_HQOperationRole.','ERR_HQOperationRole::')
s=s.replace('ERR_HQSquadJudgment squad', 'ERR_HQSquadJudgment* squad').replace('squad.', 'squad->')
s=s.replace('ERR_HQReport order','ERR_HQReport* order').replace('ERR_HQTask task','ERR_HQTask* task')
for name in ('unit','task','order'):s=s.replace(name+'.',name+'->')
run(r'''
#include <cassert>
#include <string>
struct ERR_HQReport{};
enum class ERR_HQOperationRole{SEARCH,WITHDRAW};
enum class ERR_HQOperationRole{SEARCH,WITHDRAW,RESERVE};
struct ERR_HQSquadJudgment{bool Recovering=false;};
struct Operations{ERR_HQSquadJudgment* squad=nullptr;ERR_HQSquadJudgment* Judgment(int id){assert(id==1);return squad;}};
struct ERR_HQTask{int OperationId=0;ERR_HQOperationRole OperationRole=ERR_HQOperationRole::SEARCH;std::string SecuritySite;float ExpiresAt=100000;bool ReleaseOnly=false;ERR_HQTask* ReplacesTask=nullptr;};
struct ERR_HQUnit{ERR_HQReport* PendingOrder=nullptr;ERR_HQTask* PendingTask=nullptr;ERR_HQTask* Task=nullptr;
std::string ForceSourceId="original-1";bool eligible=true;int cancellations=0;
int Id=1;std::string ForceSourceId="original-1";bool eligible=true;int cancellations=0;
bool Eligible(void*){return eligible;}void CancelPending(){cancellations++;PendingOrder=nullptr;PendingTask=nullptr;}};
struct Watch {bool empty=false;int calls=0;bool ArmedSearchBlocked(std::string s,float){assert(s=="original-1");calls++;return empty;}};
struct Journal {void Write(std::string,std::string){}};
struct HQ{Watch m_Watch;Journal m_Journal;void* m_Mode=nullptr;int admitted=0,lost=0,released=0;
struct HQ{bool m_Coordinated=false;Operations m_Operations;Watch m_Watch;Journal m_Journal;void* m_Mode=nullptr;int admitted=0,lost=0,released=0;
void LostOrder(ERR_HQUnit* u,float){lost++;u->CancelPending();}void ReleaseUnit(ERR_HQUnit* u,float){released++;u->Task=nullptr;u->CancelPending();}
'''+s+r'''
};