"""Verify delayed dynamic bridge rejection blocks only its directed connection.""" from pathlib import Path import subprocess, tempfile root = Path(__file__).resolve().parents[2] source = (root / "src/server/game/World/ClientlessActionExecutorMgr.cpp").read_text() start = source.index(' if (!failedEdgeDatabaseId && reason.rfind("route-local-", 0) == 0 &&') end = source.index(' // A failed initial local approach', start) code = r''' #include #include #include #include struct Step {std::string NodeKey,EdgeType;}; struct Record {unsigned RouteStep;std::vector Route;std::unordered_set FailedBridgeKeys;}; void reject(Record& record,unsigned failedEdgeDatabaseId,std::string reason){ ''' + source[start:end] + r''' } int main(){Record r{1,{{"taxi_2","start"},{"stormwind_tradecenter","local_bridge"}}, {}}; reject(r,0,"route-local-PathRejected");assert(r.FailedBridgeKeys.count("taxi_2->stormwind_tradecenter")); assert(!r.FailedBridgeKeys.count("stormwind_tradecenter->taxi_2")); r.FailedBridgeKeys.clear();reject(r,15,"route-local-PathRejected");assert(r.FailedBridgeKeys.empty()); r.RouteStep=0;reject(r,0,"route-local-PathRejected");assert(r.FailedBridgeKeys.empty()); r.RouteStep=1;r.Route[1].EdgeType="free_flight";reject(r,0,"route-local-PathRejected");assert(r.FailedBridgeKeys.empty());} ''' with tempfile.TemporaryDirectory(prefix="vcore-dynamic-bridge-") as directory: path=Path(directory) (path/"test.cpp").write_text(code) subprocess.run(["c++","-std=c++17",str(path/"test.cpp"),"-o",str(path/"test")],check=True) subprocess.run([str(path/"test")],check=True) print("Delayed bridge rejection, direction, persistent edges and non-bridge exclusions PASS")