mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-30 01:41:40 +00:00
feat(zone): waypoints keep every name / value pair as the file has it
The Arrived message's actions are the waypoint's raw pairs in order; DLU dropped the ones that are no waypoint command (PlayAim). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -226,6 +226,7 @@ bool ZoneFile::ReadLdfConfig(std::istream& file, PathType pathType, PathWaypoint
|
||||
|
||||
std::string value;
|
||||
BinaryIO::ReadString<uint8_t>(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
|
||||
|
||||
@@ -90,6 +90,8 @@ struct PathWaypoint {
|
||||
float speed{};
|
||||
LwoNameValue config;
|
||||
std::vector<WaypointCommand> commands;
|
||||
// Every name / value pair of the waypoint as the file has it, in order (the Arrived message's actions)
|
||||
std::vector<std::pair<std::string, std::string>> actions;
|
||||
};
|
||||
|
||||
enum class PathType : uint32_t {
|
||||
|
||||
@@ -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<uint32_t>(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<std::pair<std::string, std::string>> 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<uint32_t>(41).Put<uint32_t>(3).Put<uint32_t>(1150);
|
||||
|
||||
Reference in New Issue
Block a user