Files
DarkflameServer/dGame/dComponents/Character/MountControlComponent.h
Aaron Kimbrell 1056ca0025 fix: a character's mount save is written as 0, as live did
All 450 live saves looked at had <mnt a="0"/>. The server wrote the item
of the mount being ridden, a value live never showed and the client
would start with although nobody rides after a load.

<mnt a="0"/> is now always written, riding or not. A save that holds
another value, or one that is not a number, is still read without
failing and gets 0 at the next save.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 16:13:42 -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 writes the mount element of the character's save as live did: <mnt a="0"/> in
* all 450 live saves looked at, so always 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="0"/>, as live did, also while a mount is ridden
void WriteSaveData(tinyxml2::XMLDocument& doc) override;
// The mount item the save named (a save may hold one that is not 0). Nothing is mounted from it.
LWOOBJID GetSavedMountItemID() const { return m_SavedMountItemID; }
private:
LWOOBJID m_SavedMountItemID = LWOOBJID_EMPTY;
};
#endif // MOUNTCONTROLCOMPONENT_H