Files
DarkflameServer/dGame/dComponents/Character/MountControlComponent.h
Aaron Kimbrell 02623be7fb 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>
2026-11-10 15:54:54 -06:00

33 lines
1.3 KiB
C++

#ifndef MOUNTCONTROLCOMPONENT_H
#define MOUNTCONTROLCOMPONENT_H
#include "Component.h"
#include "dCommonVars.h"
#include "eReplicaComponentType.h"
/**
* Mount control (111): the character's riding of mounts, as the client's LWOMountControlComponent: the client makes it (componentID -1) with every character
* (LWOCharacterComponent::Factory). It keeps the mount item in the character's save, as live did (<mnt a="item id"/>,
* 0 when not riding: all 450 live saves looked at were 0).
*/
class MountControlComponent final : public Component {
public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::MOUNT_CONTROL;
MountControlComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {}
// LWOMountControlComponent::LoadFromSaveData (0x00bf99c0): <mnt a>, the mount item of the save
void LoadFromSaveData(const tinyxml2::XMLDocument& doc) override;
// Writes <mnt a>: the item of the mount being ridden (PossessorComponent's), 0 when on foot
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
// The mount item the save named. Riding does not go on over a world change, so nothing is mounted from it.
LWOOBJID GetSavedMountItemID() const { return m_SavedMountItemID; }
private:
LWOOBJID m_SavedMountItemID = LWOOBJID_EMPTY;
};
#endif // MOUNTCONTROLCOMPONENT_H