mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 00:35:27 +00:00
feat: save the mount item as live did
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>
This commit is contained in:
23
dGame/dComponents/Character/MountControlComponent.cpp
Normal file
23
dGame/dComponents/Character/MountControlComponent.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user