test: waypoint actions through a whole zone file; include order

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-27 20:10:09 -06:00
parent ce4f557c81
commit b5ead35a79
2 changed files with 12 additions and 16 deletions

View File

@@ -101,22 +101,18 @@ 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
// A waypoint keeps every name / value pair as the file has it, in order (names with their spaces), also on a
// spawner path, whose pairs are LDF config
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);
std::istringstream stream(SampleZone());
ZoneFile zone;
zone.Read(stream);
ASSERT_EQ(zone.paths.size(), 3u);
const std::vector<std::pair<std::string, std::string>> patrol{ { "de lay", " 2 " } };
EXPECT_EQ(zone.paths[0].pathWaypoints.at(0).actions, patrol);
const std::vector<std::pair<std::string, std::string>> spawner{ { "spawner_node_id", "1:4" } };
EXPECT_EQ(zone.paths[1].pathWaypoints.at(0).actions, spawner);
EXPECT_TRUE(zone.paths[2].pathWaypoints.at(0).actions.empty());
}
TEST(ZoneFileTests, ReadsZoneBoundaries) {

View File

@@ -7,7 +7,6 @@
#include <glm/gtc/quaternion.hpp>
#include "ScriptedActivityComponent.h"
#include "BitStream.h"
#include "CDClientDatabase.h"
#include "Entity.h"
@@ -20,6 +19,7 @@
#include "ai/MINIGAME/SG_GF/SERVER/SGCannon.h"
#include "ai/MINIGAME/SG_GF/SERVER/SgTarget.h"
#include "ScriptComponent.h"
#include "ScriptedActivityComponent.h"
#include "SimplePhysicsComponent.h"
#include "Zone.h"
#include "dZoneManager.h"