diff --git a/dCommon/ZoneFile.cpp b/dCommon/ZoneFile.cpp index 317eaddfd..4c71fe4e2 100644 --- a/dCommon/ZoneFile.cpp +++ b/dCommon/ZoneFile.cpp @@ -226,6 +226,7 @@ bool ZoneFile::ReadLdfConfig(std::istream& file, PathType pathType, PathWaypoint std::string value; BinaryIO::ReadString(file, value, BinaryIO::ReadType::WideString); + waypoint.actions.emplace_back(parameter, value); if (pathType != PathType::Spawner) { // cause NetDevil puts spaces in things that don't need spaces diff --git a/dCommon/ZoneFile.h b/dCommon/ZoneFile.h index df015dc31..2059e71d9 100644 --- a/dCommon/ZoneFile.h +++ b/dCommon/ZoneFile.h @@ -90,6 +90,8 @@ struct PathWaypoint { float speed{}; LwoNameValue config; std::vector commands; + // Every name / value pair of the waypoint as the file has it, in order (the Arrived message's actions) + std::vector> actions; }; enum class PathType : uint32_t { diff --git a/tests/dCommonTests/ZoneFileTests.cpp b/tests/dCommonTests/ZoneFileTests.cpp index 622def895..ed42cd0b7 100644 --- a/tests/dCommonTests/ZoneFileTests.cpp +++ b/tests/dCommonTests/ZoneFileTests.cpp @@ -101,6 +101,24 @@ TEST(ZoneFileTests, ReadsScenesAndPaths) { } // Boundary lines sit between the scenes and the terrain file's name +// A waypoint keeps every name / value pair as the file has it, in order, also the ones that are no waypoint command +TEST(ZoneFileTests, WaypointsKeepTheirActions) { + ZoneBytes w; + w.Put(3).Wide("PlayAim").Wide("idle").Wide("de lay").Wide(" 2 ").Wide("spawner_node_id").Wide("1:4"); + std::istringstream file(w.data); + PathWaypoint waypoint; + ASSERT_TRUE(ZoneFile::ReadLdfConfig(file, PathType::MovingPlatform, waypoint)); + const std::vector> expected{ { "PlayAim", "idle" }, { "de lay", " 2 " }, { "spawner_node_id", "1:4" } }; + EXPECT_EQ(waypoint.actions, expected); + ASSERT_EQ(waypoint.commands.size(), 1u); + EXPECT_EQ(waypoint.commands[0].data, "2"); + + std::istringstream again(w.data); + PathWaypoint spawner; + ASSERT_TRUE(ZoneFile::ReadLdfConfig(again, PathType::Spawner, spawner)); + EXPECT_EQ(spawner.actions, expected); +} + TEST(ZoneFileTests, ReadsZoneBoundaries) { ZoneBytes w; w.Put(41).Put(3).Put(1150);