chore: cleanup pointer management for LDF data (#1995)

* change network settings from vector to LwoNameValue

* move settings on Entity to managed memory

* Migrate more members

* chore: remove pointer leakage from raw ldf pointers

* feedback

* fix ci
This commit is contained in:
David Markowitz
2026-06-14 20:54:52 -07:00
committed by GitHub
parent 90db1ac699
commit 0101933f5c
67 changed files with 676 additions and 754 deletions

View File

@@ -97,17 +97,14 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
info.pos = objectPosition;
info.rot = rotation;
info.spawnerID = self->GetObjectID();
info.settings = {
new LDFData<std::string>(u"rebuild_activators",
info.settings.Insert<std::string>(u"rebuild_activators",
std::to_string(objectPosition.x + forward.x) + "\x1f" +
std::to_string(objectPosition.y) + "\x1f" +
std::to_string(objectPosition.z + forward.z)
),
new LDFData<int32_t>(u"respawn", 100000),
new LDFData<float>(u"rebuild_reset_time", 15),
new LDFData<bool>(u"no_timed_spawn", true),
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
};
std::to_string(objectPosition.z + forward.z));
info.settings.Insert<int32_t>(u"respawn", 100000);
info.settings.Insert<float>(u"rebuild_reset_time", 15);
info.settings.Insert<bool>(u"no_timed_spawn", true);
info.settings.Insert<LWOOBJID>(u"Dragon", self->GetObjectID());
auto* golemObject = Game::entityManager->CreateEntity(info);

View File

@@ -113,17 +113,14 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
info.pos = objectPosition;
info.rot = rotation;
info.spawnerID = self->GetObjectID();
info.settings = {
new LDFData<std::string>(u"rebuild_activators",
info.settings.Insert<std::string>(u"rebuild_activators",
std::to_string(objectPosition.x + forward.x) + "\x1f" +
std::to_string(objectPosition.y) + "\x1f" +
std::to_string(objectPosition.z + forward.z)
),
new LDFData<int32_t>(u"respawn", 100000),
new LDFData<float>(u"rebuild_reset_time", 15),
new LDFData<bool>(u"no_timed_spawn", true),
new LDFData<LWOOBJID>(u"Dragon", self->GetObjectID())
};
std::to_string(objectPosition.z + forward.z));
info.settings.Insert<int32_t>(u"respawn", 100000);
info.settings.Insert<float>(u"rebuild_reset_time", 15);
info.settings.Insert<bool>(u"no_timed_spawn", true);
info.settings.Insert<LWOOBJID>(u"Dragon", self->GetObjectID());
auto* golemObject = Game::entityManager->CreateEntity(info);

View File

@@ -82,15 +82,12 @@ void BaseEnemyApe::OnTimerDone(Entity* self, std::string timerName) {
entityInfo.spawnerID = self->GetObjectID();
entityInfo.lot = self->GetVar<LOT>(u"QuickbuildAnchorLOT") != 0
? self->GetVar<LOT>(u"QuickbuildAnchorLOT") : 7549;
entityInfo.settings = {
new LDFData<std::string>(u"rebuild_activators",
entityInfo.settings.Insert<std::string>(u"rebuild_activators",
std::to_string(objectPosition.GetX()) + "\x1f" +
std::to_string(objectPosition.GetY()) + "\x1f" +
std::to_string(objectPosition.GetZ())
),
new LDFData<bool>(u"no_timed_spawn", true),
new LDFData<LWOOBJID>(u"ape", self->GetObjectID())
};
std::to_string(objectPosition.GetZ()));
entityInfo.settings.Insert<bool>(u"no_timed_spawn", true);
entityInfo.settings.Insert<LWOOBJID>(u"ape", self->GetObjectID());
auto* anchor = Game::entityManager->CreateEntity(entityInfo, nullptr, self);
Game::entityManager->ConstructEntity(anchor);

View File

@@ -23,7 +23,7 @@ void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
NiPoint3 newLoc = { controlPhys->GetPosition().x, dpWorld::GetNavMesh()->GetHeightAtPoint(controlPhys->GetPosition()), controlPhys->GetPosition().z };
EntityInfo info = EntityInfo();
std::vector<LDFBaseData*> cfg;
LwoNameValue cfg;
std::u16string activatorPosStr;
activatorPosStr += (GeneralUtils::to_u16string(controlPhys->GetPosition().x));
activatorPosStr.push_back(0x1f);
@@ -31,8 +31,7 @@ void BaseEnemyMech::OnDie(Entity* self, Entity* killer) {
activatorPosStr.push_back(0x1f);
activatorPosStr += (GeneralUtils::to_u16string(controlPhys->GetPosition().z));
LDFBaseData* activatorPos = new LDFData<std::u16string>(u"rebuild_activators", activatorPosStr);
cfg.push_back(activatorPos);
cfg.Insert<std::u16string>(u"rebuild_activators", activatorPosStr);
info.lot = qbTurretLOT;
info.pos = newLoc;
info.rot = controlPhys->GetRotation();