2025-04-29 12:10:19 +03:00
|
|
|
/*
|
|
|
|
* ArtSlotInfo.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CArtifactInstance.h"
|
|
|
|
|
|
|
|
#include "../../constants/EntityIdentifiers.h"
|
2025-05-11 11:58:09 +03:00
|
|
|
#include "../../callback/GameCallbackHolder.h"
|
2025-04-29 12:10:19 +03:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
struct DLL_LINKAGE ArtSlotInfo : public GameCallbackHolder
|
|
|
|
{
|
|
|
|
ArtifactInstanceID artifactID;
|
|
|
|
bool locked = false; //if locked, then artifact points to the combined artifact
|
|
|
|
|
2025-05-14 15:50:13 +03:00
|
|
|
explicit ArtSlotInfo(IGameInfoCallback * cb);
|
2025-04-29 12:10:19 +03:00
|
|
|
ArtSlotInfo(const CArtifactInstance * artifact, bool locked);
|
|
|
|
|
|
|
|
const CArtifactInstance * getArt() const;
|
|
|
|
ArtifactInstanceID getID() const;
|
|
|
|
|
|
|
|
template<typename Handler>
|
|
|
|
void serialize(Handler & h)
|
|
|
|
{
|
|
|
|
if(h.saving || h.hasFeature(Handler::Version::NO_RAW_POINTERS_IN_SERIALIZER))
|
|
|
|
{
|
|
|
|
h & artifactID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::shared_ptr<CArtifactInstance> pointer;
|
|
|
|
h & pointer;
|
|
|
|
if(pointer->getId() == ArtifactInstanceID())
|
|
|
|
CArtifactInstance::saveCompatibilityFixArtifactID(pointer);
|
|
|
|
artifactID = pointer->getId();
|
|
|
|
}
|
|
|
|
h & locked;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|