1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Use CompoundMapObjectID in ObjectInfo

This commit is contained in:
Tomasz Zieliński
2024-09-14 09:23:28 +02:00
parent 9591ce1ab4
commit 4d4538a48d
5 changed files with 54 additions and 47 deletions

View File

@ -18,15 +18,24 @@
VCMI_LIB_NAMESPACE_BEGIN
ObjectInfo::ObjectInfo():
ObjectInfo::ObjectInfo(si32 ID, si32 subID):
primaryID(ID),
secondaryID(subID),
destroyObject([](CGObjectInstance * obj){}),
maxPerZone(std::numeric_limits<ui32>::max())
{
}
ObjectInfo::ObjectInfo(CompoundMapObjectID id):
ObjectInfo(id.primaryID, id.secondaryID)
{
}
ObjectInfo::ObjectInfo(const ObjectInfo & other)
{
templates = other.templates;
primaryID = other.primaryID;
secondaryID = other.secondaryID;
value = other.value;
probability = other.probability;
maxPerZone = other.maxPerZone;
@ -40,6 +49,8 @@ ObjectInfo & ObjectInfo::operator=(const ObjectInfo & other)
return *this;
templates = other.templates;
primaryID = other.primaryID;
secondaryID = other.secondaryID;
value = other.value;
probability = other.probability;
maxPerZone = other.maxPerZone;
@ -66,4 +77,9 @@ void ObjectInfo::setTemplates(MapObjectID type, MapObjectSubID subtype, TerrainI
templates = templHandler->getTemplates(terrainType);
}
CompoundMapObjectID ObjectInfo::getCompoundID() const
{
return CompoundMapObjectID(primaryID, secondaryID);
}
VCMI_LIB_NAMESPACE_END