mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-30 01:41:40 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user