mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-14 07:47:13 +00:00
Every live save had <mnt a="..."/>, which LWOMountControlComponent::LoadFromSaveData (0x00bf99c0) reads as the character's mount item (0 on the 450 saves looked at). The server wrote no such element. MountControlComponent now writes it: the item of the mount being ridden, 0 on foot. The saved value is read and kept; nothing is mounted from it, as riding does not go on over a world change. A save from before gains <mnt a="0"/> and nothing else in it changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
24 lines
799 B
C++
24 lines
799 B
C++
#include "MountControlComponent.h"
|
|
|
|
#include "Entity.h"
|
|
#include "PossessorComponent.h"
|
|
|
|
#include "tinyxml2.h"
|
|
|
|
void MountControlComponent::LoadFromSaveData(const tinyxml2::XMLDocument& doc) {
|
|
const auto* const obj = doc.FirstChildElement("obj");
|
|
const auto* const mount = obj ? obj->FirstChildElement("mnt") : nullptr;
|
|
if (mount) mount->QueryInt64Attribute("a", &m_SavedMountItemID);
|
|
}
|
|
|
|
void MountControlComponent::WriteSaveData(tinyxml2::XMLDocument& doc) {
|
|
auto* const obj = doc.FirstChildElement("obj");
|
|
if (!obj) return;
|
|
|
|
auto* mount = obj->FirstChildElement("mnt");
|
|
if (!mount) mount = obj->InsertNewChildElement("mnt");
|
|
|
|
const auto* const possessor = m_Parent->GetComponent<PossessorComponent>();
|
|
mount->SetAttribute("a", possessor ? possessor->GetMountItemID() : LWOOBJID_EMPTY);
|
|
}
|