mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-09 17:08:06 +00:00
Address feedback form Emo in doscord
This commit is contained in:
@@ -244,17 +244,6 @@ std::vector<Lxfml::Result> Lxfml::Split(const std::string_view data, const NiPoi
|
||||
std::unordered_set<std::string> usedBrickRefs;
|
||||
std::unordered_set<tinyxml2::XMLElement*> usedRigidSystems;
|
||||
|
||||
auto splitListAttr = [](const char* attr) {
|
||||
std::vector<std::string> out;
|
||||
if (!attr) return out;
|
||||
std::stringstream ss(attr);
|
||||
std::string token;
|
||||
while (std::getline(ss, token, ',')) {
|
||||
if (!token.empty()) out.push_back(token);
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
// Helper to create output document from sets of brick refs and rigidsystem pointers
|
||||
auto makeOutput = [&](const std::unordered_set<std::string>& bricksToInclude, const std::vector<tinyxml2::XMLElement*>& rigidSystemsToInclude, const std::vector<tinyxml2::XMLElement*>& groupsToInclude = {}) {
|
||||
tinyxml2::XMLDocument outDoc;
|
||||
@@ -307,7 +296,7 @@ std::vector<Lxfml::Result> Lxfml::Split(const std::string_view data, const NiPoi
|
||||
if (!g) return;
|
||||
const char* partAttr = g->Attribute("partRefs");
|
||||
if (partAttr) {
|
||||
for (auto& tok : splitListAttr(partAttr)) partRefs.insert(tok);
|
||||
for (auto& tok : GeneralUtils::SplitString(partAttr, ',')) partRefs.insert(tok);
|
||||
}
|
||||
for (auto* child = g->FirstChildElement("Group"); child; child = child->NextSiblingElement("Group")) collectParts(child);
|
||||
};
|
||||
@@ -345,7 +334,7 @@ std::vector<Lxfml::Result> Lxfml::Split(const std::string_view data, const NiPoi
|
||||
for (auto* rigid = rs->FirstChildElement("Rigid"); rigid; rigid = rigid->NextSiblingElement("Rigid")) {
|
||||
const char* battr = rigid->Attribute("boneRefs");
|
||||
if (!battr) continue;
|
||||
for (auto& tok : splitListAttr(battr)) {
|
||||
for (auto& tok : GeneralUtils::SplitString(battr, ',')) {
|
||||
rsBoneRefs.push_back(tok);
|
||||
if (boneRefsIncluded.find(tok) != boneRefsIncluded.end()) intersects = true;
|
||||
}
|
||||
@@ -366,7 +355,6 @@ std::vector<Lxfml::Result> Lxfml::Split(const std::string_view data, const NiPoi
|
||||
}
|
||||
}
|
||||
}
|
||||
// also include bricks for any newly discovered parts
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,7 +375,7 @@ std::vector<Lxfml::Result> Lxfml::Split(const std::string_view data, const NiPoi
|
||||
for (auto* rigid = rs->FirstChildElement("Rigid"); rigid; rigid = rigid->NextSiblingElement("Rigid")) {
|
||||
const char* battr = rigid->Attribute("boneRefs");
|
||||
if (!battr) continue;
|
||||
for (auto& tok : splitListAttr(battr)) {
|
||||
for (auto& tok : GeneralUtils::SplitString(battr, ',')) {
|
||||
auto bpIt = boneRefToPartRef.find(tok);
|
||||
if (bpIt != boneRefToPartRef.end()) {
|
||||
auto partRef = bpIt->second;
|
||||
|
@@ -2640,7 +2640,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
||||
model.id = newID;
|
||||
model.ugcId = blueprintID;
|
||||
model.position = splitLxfmls[i].center;
|
||||
model.rotation = NiQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
model.rotation = QuatUtils::IDENTITY;
|
||||
model.lot = 14;
|
||||
Database::Get()->InsertNewPropertyModel(propertyId, model, "Objects_14_name");
|
||||
|
||||
@@ -2681,7 +2681,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream& inStream, Entity* ent
|
||||
EntityInfo info;
|
||||
info.lot = 14;
|
||||
info.pos = splitLxfmls[i].center;
|
||||
info.rot = {};
|
||||
info.rot = QuatUtils::IDENTITY;
|
||||
info.spawner = nullptr;
|
||||
info.spawnerID = entity->GetObjectID();
|
||||
info.spawnerNodeID = 0;
|
||||
|
@@ -10,7 +10,7 @@ set(DCOMMONTEST_SOURCES
|
||||
"TestLUString.cpp"
|
||||
"TestLUWString.cpp"
|
||||
"dCommonDependencies.cpp"
|
||||
"lxfml_split_tests.cpp"
|
||||
"LxfmlSplitTests.cpp"
|
||||
)
|
||||
|
||||
add_subdirectory(dEnumsTests)
|
||||
|
@@ -21,7 +21,10 @@ TEST(LxfmlSplitTests, SplitUsesAllBricksAndNoDuplicates) {
|
||||
// Read the sample test.lxfml included in tests. Resolve path relative to this source file.
|
||||
std::filesystem::path srcDir = std::filesystem::path(__FILE__).parent_path();
|
||||
std::filesystem::path filePath = srcDir / "test.lxfml";
|
||||
std::string data = ReadFile(filePath.string());
|
||||
std::ifstream in(filePath, std::ios::in | std::ios::binary);
|
||||
std::ostringstream ss;
|
||||
ss << in.rdbuf();
|
||||
std::string data = ss.str();
|
||||
ASSERT_FALSE(data.empty()) << "Failed to read " << filePath.string();
|
||||
|
||||
|
Reference in New Issue
Block a user