Skip to content

Commit f1246d9

Browse files
committed
Removed pathsize as an explicit JSON param
1 parent 51d9c95 commit f1246d9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

external/ParseInputFile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ void validateParameters(rapidjson::Document& jsonDoc) {
44
std::string missingParameters = "";
55

66
if (!jsonDoc.HasMember("config")) missingParameters += "config ";
7-
if (!jsonDoc.HasMember("environment")) missingParameters += "environment ";
7+
if (!jsonDoc.HasMember("room")) missingParameters += "room ";
88
if (!jsonDoc.HasMember("actors")) missingParameters += "actors ";
99

1010
if (missingParameters != "") {
@@ -19,12 +19,12 @@ void validateParameters(rapidjson::Document& jsonDoc) {
1919
if (!config.HasMember(p)) missingParameters += std::string(p) + " ";
2020
}
2121

22-
if (!jsonDoc["environment"].HasMember("walls")) missingParameters += "walls ";
22+
if (!jsonDoc["room"].HasMember("walls")) missingParameters += "walls ";
2323

2424
if (jsonDoc["actors"].GetArray().Size() > 0) {
2525
auto actorParams = {
2626
"pos", "velocity", "desiredSpeed", "path",
27-
"pathSize", "mass", "radius", "heatmapEnabled"
27+
"mass", "radius", "heatmapEnabled"
2828
};
2929
for (auto& a : jsonDoc["actors"].GetArray()) {
3030
for (auto p : actorParams) {
@@ -60,8 +60,8 @@ void parseInputFile(std::string filename, std::vector<Actor> &actors, Room &room
6060
SCALE = config["scale"].GetInt();
6161
DELAY = config["delay"].GetInt();
6262

63-
// Environment
64-
auto jsonWalls = jsonDoc["environment"]["walls"].GetArray();
63+
// Room
64+
auto jsonWalls = jsonDoc["room"]["walls"].GetArray();
6565
std::vector<std::array<vecType, 2>> walls;
6666
for (auto& w : jsonWalls) {
6767
walls.push_back({vecType({w[0].GetFloat(), w[1].GetFloat()}), vecType({w[2].GetFloat(), w[3].GetFloat()})});
@@ -81,7 +81,7 @@ void parseInputFile(std::string filename, std::vector<Actor> &actors, Room &room
8181
path[x] = {jsonPath[x][0].GetFloat(), jsonPath[x][1].GetFloat()};
8282
}
8383

84-
int pathSize = a["pathSize"].GetInt();
84+
int pathSize = jsonPath.Size();
8585
int mass = a["mass"].GetInt();
8686
float radius = a["radius"].GetFloat();
8787
bool atDestination = a["atDestination"].GetBool();

0 commit comments

Comments
 (0)