mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
debug logs and spacing
This commit is contained in:
parent
387c37505c
commit
b3548de7da
@ -21,9 +21,11 @@ void ModelComponent::LoadBehaviors() {
|
|||||||
auto behaviors = GeneralUtils::SplitString(m_Parent->GetVar<std::string>(u"userModelBehaviors"), ',');
|
auto behaviors = GeneralUtils::SplitString(m_Parent->GetVar<std::string>(u"userModelBehaviors"), ',');
|
||||||
for (const auto& behavior : behaviors) {
|
for (const auto& behavior : behaviors) {
|
||||||
if (behavior.empty()) continue;
|
if (behavior.empty()) continue;
|
||||||
|
|
||||||
const auto behaviorId = GeneralUtils::TryParse<int32_t>(behavior);
|
const auto behaviorId = GeneralUtils::TryParse<int32_t>(behavior);
|
||||||
if (!behaviorId.has_value() || behaviorId.value() == 0) continue;
|
if (!behaviorId.has_value() || behaviorId.value() == 0) continue;
|
||||||
LOG("Loading behavior %d", behaviorId.value());
|
|
||||||
|
LOG_DEBUG("Loading behavior %d", behaviorId.value());
|
||||||
auto& inserted = m_Behaviors.emplace_back();
|
auto& inserted = m_Behaviors.emplace_back();
|
||||||
inserted.SetBehaviorId(*behaviorId);
|
inserted.SetBehaviorId(*behaviorId);
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ void ModelComponent::LoadBehaviors() {
|
|||||||
|
|
||||||
tinyxml2::XMLDocument behaviorXml;
|
tinyxml2::XMLDocument behaviorXml;
|
||||||
auto res = behaviorXml.Parse(behaviorStr.c_str(), behaviorStr.size());
|
auto res = behaviorXml.Parse(behaviorStr.c_str(), behaviorStr.size());
|
||||||
LOG("Behavior %i %d: %s", res, behaviorId.value(), behaviorStr.c_str());
|
LOG_DEBUG("Behavior %i %d: %s", res, behaviorId.value(), behaviorStr.c_str());
|
||||||
|
|
||||||
const auto* const behaviorRoot = behaviorXml.FirstChildElement("Behavior");
|
const auto* const behaviorRoot = behaviorXml.FirstChildElement("Behavior");
|
||||||
if (!behaviorRoot) {
|
if (!behaviorRoot) {
|
||||||
@ -108,6 +110,7 @@ std::array<std::pair<int32_t, std::string>, 5> ModelComponent::GetBehaviorsForSa
|
|||||||
if (behavior.GetBehaviorId() == -1) continue;
|
if (behavior.GetBehaviorId() == -1) continue;
|
||||||
auto& [id, behaviorData] = toReturn[i];
|
auto& [id, behaviorData] = toReturn[i];
|
||||||
id = behavior.GetBehaviorId();
|
id = behavior.GetBehaviorId();
|
||||||
|
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
auto* root = doc.NewElement("Behavior");
|
auto* root = doc.NewElement("Behavior");
|
||||||
behavior.Serialize(*root);
|
behavior.Serialize(*root);
|
||||||
|
@ -597,8 +597,11 @@ void PropertyManagementComponent::Load() {
|
|||||||
|
|
||||||
std::ostringstream userModelBehavior;
|
std::ostringstream userModelBehavior;
|
||||||
bool firstAdded = false;
|
bool firstAdded = false;
|
||||||
for (const auto& behavior : databaseModel.behaviors) {
|
for (auto behavior : databaseModel.behaviors) {
|
||||||
if (behavior == LWOOBJID_EMPTY) continue;
|
if (behavior < 0) {
|
||||||
|
LOG("Invalid behavior ID: %d, removing behavior reference from model", behavior);
|
||||||
|
behavior = 0;
|
||||||
|
}
|
||||||
if (firstAdded) userModelBehavior << ",";
|
if (firstAdded) userModelBehavior << ",";
|
||||||
userModelBehavior << behavior;
|
userModelBehavior << behavior;
|
||||||
firstAdded = true;
|
firstAdded = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user