Validate profession scenes and fix native workstation and area targeting
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s

This commit is contained in:
Nico committed 2026-10-27 18:01:03 +01:00
1 parent 722b513ee0
commit 440c53acd7
17 files changed
+425 -13

No files matched your search

@@ -0,0 +1,39 @@
"""Area destinations select a reachable native graph node inside the area."""
from pathlib import Path
import subprocess,tempfile
root=Path(__file__).resolve().parents[2]
s=(root/'src/server/game/World/AdventureBehaviorMgr.cpp').read_text()
a=s.index('std::string AdventureBehaviorMgr::AreaNode(');b=s.index('\nvoid AdventureBehaviorMgr::Begin',a)
code=r'''
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <vector>
#include <cstdint>
using uint32=uint32_t;
struct Position {float x=0;void Relocate(float a,float,float){x=a;}float GetPositionX(){return x;}float GetPositionY(){return 0;}};
struct Player{int map=0;int GetPhaseShift(){return 0;}int GetMapId(){return map;}float GetExactDist(Position p){return p.x;}};
struct AdventureLocation{struct{int MapId=0;float X=0,Y=0;}Point;uint32 AreaId=12;};
struct Field{float value=0;std::string text;float GetFloat(){return value;}std::string GetString(){return text;}};
struct Rows{std::vector<std::vector<Field>> data;unsigned row=0;operator bool(){return !data.empty();}Rows* operator->(){return this;}Field* Fetch(){return data[row].data();}bool NextRow(){return ++row<data.size();}};
struct Database{Rows rows;Rows PQuery(char const*,int){return rows;}}WorldDatabase;
struct Terrain{void GetZoneAndAreaId(int,int,uint32&zone,uint32&area,Position p){zone=p.x==1?99:12;area=zone;}}terrain;
struct TerrainMgr{bool available=true;Terrain* LoadTerrain(int){return available?&terrain:nullptr;}}sTerrainMgr;
struct ClientlessTravelRouteStep{};
struct Graph{std::vector<std::string> tried;bool PlanAdaptiveRoute(Player*,std::string const&key,int,int,std::vector<ClientlessTravelRouteStep>&,bool& complete,std::string&,std::string&){tried.push_back(key);complete=key=="reachable";return true;}}graph;auto sClientlessTravelGraphMgr=&graph;
struct AdventureBehaviorMgr{std::string AreaNode(Player*,AdventureLocation const&);};
'''+s[a:b]+r'''
int main(){
WorldDatabase.rows.data={{{0,"outside"},{1,""},{},{}},{{0,"blocked"},{2,""},{},{}},{{0,"reachable"},{3,""},{},{}}};
Player p;AdventureLocation l;AdventureBehaviorMgr mgr;
assert(mgr.AreaNode(&p,l)=="reachable");assert((graph.tried==std::vector<std::string>{"blocked","reachable"}));
sTerrainMgr.available=false;assert(mgr.AreaNode(&p,l).empty());sTerrainMgr.available=true;
l.AreaId=42;graph.tried.clear();assert(mgr.AreaNode(&p,l).empty()&&graph.tried.empty());
}
'''
with tempfile.TemporaryDirectory(prefix='vcore-area-node-') as folder:
cpp=Path(folder)/'test.cpp';binary=Path(folder)/'test';cpp.write_text(code)
subprocess.run(['c++','-std=c++17',str(cpp),'-o',str(binary)],check=True)
subprocess.run([str(binary)],check=True)
print('Production area destination excludes outside and unreachable graph nodes.')