1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

CArtifactInstance::putAt, CArtifactInstance::removeFrom, CArtifactInstance::move interface unified. Small optimization.

This commit is contained in:
SoundSSGood 2023-06-24 18:14:56 +03:00
parent 20d86edbd1
commit 8751d9ab8b
4 changed files with 8 additions and 8 deletions

View File

@ -849,12 +849,12 @@ bool CArtifactInstance::canBePutAt(const ArtifactLocation & al, bool assumeDestR
return artType->canBePutAt(al.getHolderArtSet(), al.slot, assumeDestRemoved);
}
void CArtifactInstance::putAt(ArtifactLocation al)
void CArtifactInstance::putAt(const ArtifactLocation & al)
{
al.getHolderArtSet()->putArtifact(al.slot, this);
}
void CArtifactInstance::removeFrom(ArtifactLocation al)
void CArtifactInstance::removeFrom(const ArtifactLocation & al)
{
al.getHolderArtSet()->removeArtifact(al.slot);
}
@ -917,7 +917,7 @@ void CCombinedArtifactInstance::addAsConstituent(CArtifactInstance * art, const
attachTo(*art);
}
void CCombinedArtifactInstance::removeFrom(ArtifactLocation al)
void CCombinedArtifactInstance::removeFrom(const ArtifactLocation & al)
{
CArtifactInstance::removeFrom(al);
for(auto & part : constituentsInfo)

View File

@ -162,8 +162,8 @@ public:
/// of itself, additionally truth is returned for constituents of combined arts
virtual bool isPart(const CArtifactInstance *supposedPart) const;
virtual void putAt(ArtifactLocation al);
virtual void removeFrom(ArtifactLocation al);
virtual void putAt(const ArtifactLocation & al);
virtual void removeFrom(const ArtifactLocation & al);
virtual void move(const ArtifactLocation & src, const ArtifactLocation & dst);
template <typename Handler> void serialize(Handler &h, const int version)
@ -198,7 +198,7 @@ public:
bool isPart(const CArtifactInstance *supposedPart) const override;
void createConstituents();
void addAsConstituent(CArtifactInstance * art, const ArtifactPosition & slot);
void removeFrom(ArtifactLocation al) override;
void removeFrom(const ArtifactLocation & al) override;
CCombinedArtifactInstance() = default;

View File

@ -192,7 +192,7 @@ struct ArtifactLocation
DLL_LINKAGE PlayerColor owningPlayer() const;
DLL_LINKAGE CArtifactSet *getHolderArtSet();
DLL_LINKAGE CBonusSystemNode *getHolderNode();
DLL_LINKAGE const CArtifactSet *getHolderArtSet() const;
DLL_LINKAGE CArtifactSet *getHolderArtSet() const;
DLL_LINKAGE const CBonusSystemNode *getHolderNode() const;
DLL_LINKAGE const CArtifactInstance *getArt() const;

View File

@ -1620,7 +1620,7 @@ const CArtifactInstance *ArtifactLocation::getArt() const
return nullptr;
}
const CArtifactSet * ArtifactLocation::getHolderArtSet() const
CArtifactSet * ArtifactLocation::getHolderArtSet() const
{
auto * t = const_cast<ArtifactLocation *>(this);
return t->getHolderArtSet();