Skip to content

Commit c251536

Browse files
committed
Improve door json output
- put location in a group, as done with other 3D coords - added double door flag - ignore empty doors
1 parent f2ecf21 commit c251536

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/MAP.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,15 @@ nlohmann::ordered_json MapFile::to_json()
298298
{
299299
for (auto i = 0; i < 6; i++)
300300
{
301-
json["door"][i]["model_id"] = entry.doors->modelId[i];
302-
json["door"][i]["x"] = entry.doors->posX[i];
303-
json["door"][i]["y"] = entry.doors->posY[i];
304-
json["door"][i]["z"] = entry.doors->posZ[i];
305-
json["door"][i]["rotation"] = entry.doors->rotation[i];
301+
// ignore empty entires
302+
if(entry.doors->modelId[i] == 255)
303+
continue;
304+
json["door"][i]["model_id"] = entry.doors->modelId[i];
305+
json["door"][i]["position"]["x"] = entry.doors->posX[i];
306+
json["door"][i]["position"]["y"] = entry.doors->posY[i];
307+
json["door"][i]["position"]["z"] = entry.doors->posZ[i];
308+
json["door"][i]["rotation"] = entry.doors->rotation[i];
309+
json["door"][i]["is_double_door"] = entry.doors->modelId[i] == 10;
306310
}
307311
}
308312

0 commit comments

Comments
 (0)