Integrate faction and random settings menus, generated objectives, scouts, convoys, air support, mortar stations and body-intel recovery. Add identified-body aggression, finite hunter UAZ deployment, dedicated objective defence and maximum AI skill with separate reduced aim accuracy. Include policy tests, native probes, evidence and documentation.
56 lines
2.8 KiB
Python
56 lines
2.8 KiB
Python
"""Execute production air-resupply reservation and native-operation quarantine rules."""
|
|
from policy_harness import ROOT, body, run
|
|
|
|
reserve = body(ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_AirfieldSupport.c', 'bool ReserveAirAmmo(')
|
|
reserve = reserve.replace('ERR_HQUnit unit', 'ERR_HQUnit* unit').replace('unit.', 'unit->').replace('Replication.', 'Replication::')
|
|
pending = body(ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_AirAmmoMission.c', 'bool PendingNative(')
|
|
pending = pending.replace('foreach (', 'for (').replace('ERR_ConvoyCargoCallback loading', 'ERR_ConvoyCargoCallback* loading').replace('ERR_InfantryAmmoTransfer operation', 'ERR_InfantryAmmoTransfer* operation').replace('loading.', 'loading->').replace('operation.', 'operation->')
|
|
run(r'''
|
|
#include <cassert>
|
|
#include <vector>
|
|
struct Replication {inline static bool server=true;static bool IsServer(){return server;}};
|
|
struct ERR_HQUnit {
|
|
bool eligible=true,HomeGuard=false,Radio=true,PendingOrder=false,Downlink=false,fighting=false;
|
|
int LogisticsReservation=0,Assignment=42;
|
|
bool Eligible(int){return eligible&&LogisticsReservation==0;}
|
|
};
|
|
struct HQ {
|
|
int m_Mode=0;bool active=true;
|
|
bool MissionActive(){return active;}
|
|
bool Fighting(ERR_HQUnit* unit){return unit->fighting;}
|
|
'''+reserve+r'''
|
|
};
|
|
struct ERR_ConvoyCargoCallback {bool Finished=false;};
|
|
struct ERR_InfantryAmmoTransfer {bool unresolved=false;bool Unresolved(){return unresolved;}};
|
|
struct Mission {
|
|
std::vector<ERR_ConvoyCargoCallback*> m_Loads;
|
|
std::vector<ERR_InfantryAmmoTransfer*> m_Operations;
|
|
'''+pending+r'''
|
|
};
|
|
int main(){
|
|
HQ hq;ERR_HQUnit unit;
|
|
// A quiet unit may be reserved while retaining its existing delivered search.
|
|
assert(hq.ReserveAirAmmo(&unit,200001));assert(unit.LogisticsReservation==200001&&unit.Assignment==42);
|
|
assert(!hq.ReserveAirAmmo(&unit,200002));
|
|
for(int invalid=0;invalid<9;invalid++){
|
|
unit={};hq.active=true;Replication::server=true;
|
|
if(invalid==0)Replication::server=false;
|
|
if(invalid==1)hq.active=false;
|
|
if(invalid==2)unit.eligible=false;
|
|
if(invalid==3)unit.HomeGuard=true;
|
|
if(invalid==4)unit.Radio=false;
|
|
if(invalid==5)unit.PendingOrder=true;
|
|
if(invalid==6)unit.Downlink=true;
|
|
if(invalid==7)unit.fighting=true;
|
|
int token=invalid==8?0:200001;
|
|
assert(!hq.ReserveAirAmmo(&unit,token)&&unit.Assignment==42&&unit.LogisticsReservation==0);
|
|
}
|
|
assert(!hq.ReserveAirAmmo(nullptr,200001));
|
|
Mission mission;ERR_ConvoyCargoCallback loading;ERR_InfantryAmmoTransfer move;
|
|
mission.m_Loads={&loading};mission.m_Operations={&move};
|
|
assert(mission.PendingNative());loading.Finished=true;assert(!mission.PendingNative());
|
|
move.unresolved=true;assert(mission.PendingNative());move.unresolved=false;assert(!mission.PendingNative());
|
|
}
|
|
''')
|
|
print('PASS: air logistics reservation preserves delivered search until radio handoff, excludes guards/combat/in-flight orders, and quarantines unresolved native loads/moves')
|