"""Exercise production terrain selection with engine world boundaries doubled.""" from policy_harness import ROOT, body, run p = ROOT / 'addons/core/Scripts/Game/ERR/00_Core/ERR_Telemetry.c' method = body(p, 'protected string Terrain(') for a, b in [('protected ', ''), ('GetGame().', 'GetGame()->'), ('GetWorld().', 'GetWorld()->'), ('ERR_TerrainDisplayName.Resolve', 'Resolve')]: method = method.replace(a, b) run(r''' #include #include struct string:std::string {using std::string::string;bool IsEmpty(){return empty();}}; struct World { string root="$armareforger:Worlds/Eden/Eden.ent";int count=1; int GetNumSubScenes(){return count;} string GetSubSceneName(int index){assert(index==0);return root;} } world; struct Game { World* loaded=&world;string scenario="$armareforger:Worlds/GameMaster/GameMaster.ent"; World* GetWorld(){return loaded;}string GetWorldFile(){return scenario;} } game; Game* GetGame(){return &game;} // The existing mission-title resolver is a separate native resource boundary. string Resolve(string resource){ if(resource=="$armareforger:Worlds/Eden/Eden.ent")return "Everon"; if(resource=="$custom:Worlds/Nogova.ent")return "Nogova"; return resource; } struct Telemetry { ''' + method + r''' }; int main(){ Telemetry service; assert(service.Terrain()=="Everon"); // Same generic scenario name, different underlying island. world.root="$custom:Worlds/Nogova.ent"; assert(service.Terrain()=="Nogova"); // Follow the loaded scene, even while scenario metadata is stale. game.scenario="$armareforger:Worlds/GameMaster/GM_Eden.ent"; assert(service.Terrain()=="Nogova"); world.count=0;assert(service.Terrain()==game.scenario); world.count=1;world.root="";assert(service.Terrain()==game.scenario); game.loaded=nullptr;assert(service.Terrain()==game.scenario); } ''') print('PASS: telemetry uses the loaded island beneath scenario wrappers and handles unavailable roots')