@@ -43,8 +43,11 @@ void ZPathfinding::Scale::writeJson(std::ostream &f) const {
4343}
4444
4545void ZPathfinding::Entity::readJson (simdjson::ondemand::object json) {
46- id = std::string{std::string_view (json[" id" ])};
47- auto result = json[" name" ];
46+ auto result = json[" id" ];
47+ if (result.error () == simdjson::SUCCESS) {
48+ id = std::string{std::string_view (json[" id" ])};
49+ }
50+ result = json[" name" ];
4851 if (result.error () == simdjson::SUCCESS) {
4952 name = std::string{std::string_view (json[" name" ])};
5053 }
@@ -79,11 +82,11 @@ void ZPathfinding::HashesAndEntity::readJson(simdjson::ondemand::object json) {
7982
8083void ZPathfinding::Mesh::writeJson (std::ostream &f) const {
8184 f << R"( {"alocHash":")" << alocHash <<
82- R"( { "primHash":")" << primHash <<
83- R"( { "roomName":")" << roomName <<
84- R"( { "roomFolderName":")" << roomFolderName <<
85+ R"( ", "primHash":")" << primHash <<
86+ R"( ", "roomName":")" << roomName <<
87+ R"( ", "roomFolderName":")" << roomFolderName <<
8588 R"( ","entity":{"id":")" << id <<
86- R"( ","name": ")" << name <<
89+ R"( ","name":")" << name <<
8790 R"( ","tblu":")" << tblu << R"( ",)" ;
8891 pos.writeJson (f);
8992 f << " ," ;
@@ -106,7 +109,7 @@ std::vector<ZPathfinding::Mesh> ZPathfinding::Meshes::readMeshes() const {
106109 for (const HashesAndEntity &hashAndEntity: hashesAndEntities) {
107110 Mesh mesh;
108111 mesh.alocHash = hashAndEntity.alocHash ;
109- mesh.primHash = hashAndEntity.alocHash ;
112+ mesh.primHash = hashAndEntity.primHash ;
110113 mesh.roomName = hashAndEntity.roomName ;
111114 mesh.roomFolderName = hashAndEntity.roomFolderName ;
112115 mesh.id = hashAndEntity.entity .id ;
@@ -121,8 +124,8 @@ std::vector<ZPathfinding::Mesh> ZPathfinding::Meshes::readMeshes() const {
121124}
122125
123126void ZPathfinding::PfBox::writeJson (std::ostream &f) const {
124- f << R"( {"hash":"00724CDE424AFE76","entity":{" id":")" << id <<
125- R"( ","name": ")" << name <<
127+ f << R"( {"id":")" << id <<
128+ R"( ","name":")" << name <<
126129 R"( ","tblu":")" << tblu << R"( ",)" ;
127130 pos.writeJson (f);
128131 f << " ," ;
@@ -132,7 +135,7 @@ void ZPathfinding::PfBox::writeJson(std::ostream &f) const {
132135 f << " ," ;
133136 Scale scaleJson (" SVector3" , scale);
134137 scaleJson.writeJson (f);
135- f << " }} " ;
138+ f << " }" ;
136139}
137140
138141ZPathfinding::PfBoxes::PfBoxes (simdjson::ondemand::array pfBoxes) {
@@ -186,13 +189,13 @@ void ZPathfinding::PfBoxes::readPathfindingBBoxes() {
186189}
187190
188191void ZPathfinding::PfSeedPoint::writeJson (std::ostream &f) const {
189- f << R"( {"hash":"00280B8C4462FAC8","entity":{" id":")" << id <<
190- R"( ","name": ")" << name <<
192+ f << R"( {"id":")" << id <<
193+ R"( ","name":")" << name <<
191194 R"( ","tblu":")" << tblu << R"( ",)" ;
192195 pos.writeJson (f);
193196 f << " ," ;
194197 rotation.writeJson (f);
195- f << " }} " ;
198+ f << " }" ;
196199}
197200
198201ZPathfinding::PfSeedPoints::PfSeedPoints (simdjson::ondemand::array pfSeedPoints) {
0 commit comments