mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Remove pointers from artifacts
This commit is contained in:
@@ -254,6 +254,7 @@ int CGHeroInstance::movementPointsLimitCached(bool onLand, const TurnInfo * ti)
|
||||
|
||||
CGHeroInstance::CGHeroInstance(IGameCallback * cb)
|
||||
: CArmedInstance(cb),
|
||||
CArtifactSet(cb),
|
||||
tacticFormationEnabled(false),
|
||||
inTownGarrison(false),
|
||||
moveDir(4),
|
||||
|
||||
@@ -74,6 +74,8 @@ private:
|
||||
ui32 movement; //remaining movement points
|
||||
bool inTownGarrison; // if hero is in town garrison
|
||||
|
||||
IGameCallback * getCallback() const final { return cb; }
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//format: 123
|
||||
|
||||
@@ -77,8 +77,9 @@ std::set<EMarketMode> CGMarket::availableModes() const
|
||||
return getMarketHandler()->availableModes();
|
||||
}
|
||||
|
||||
CGMarket::CGMarket(IGameCallback *cb):
|
||||
CGObjectInstance(cb)
|
||||
CGMarket::CGMarket(IGameCallback *cb)
|
||||
: IMarket(cb)
|
||||
, CGObjectInstance(cb)
|
||||
{}
|
||||
|
||||
std::vector<TradeItemBuy> CGBlackMarket::availableItemsIds(EMarketMode mode) const
|
||||
|
||||
@@ -264,6 +264,7 @@ TownFortifications CGTownInstance::fortificationsLevel() const
|
||||
}
|
||||
|
||||
CGTownInstance::CGTownInstance(IGameCallback *cb):
|
||||
IMarket(cb),
|
||||
CGDwelling(cb),
|
||||
built(0),
|
||||
destroyed(0),
|
||||
|
||||
@@ -164,8 +164,8 @@ void CQuest::completeQuest(IGameCallback * cb, const CGHeroInstance *h) const
|
||||
// Disassemble this backpack artifact
|
||||
for(const auto & ci : parts)
|
||||
{
|
||||
if(ci.art->getTypeId() != elem)
|
||||
cb->giveHeroNewArtifact(h, ci.art->getTypeId(), ArtifactPosition::BACKPACK_START);
|
||||
if(ci.getArtifact()->getTypeId() != elem)
|
||||
cb->giveHeroNewArtifact(h, ci.getArtifact()->getTypeId(), ArtifactPosition::BACKPACK_START);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
@@ -140,8 +140,8 @@ int IMarket::availableUnits(const EMarketMode mode, const int marketItemSerial)
|
||||
}
|
||||
}
|
||||
|
||||
IMarket::IMarket()
|
||||
:altarArtifactsStorage(std::make_unique<CArtifactSetAltar>())
|
||||
IMarket::IMarket(IGameCallback *cb)
|
||||
:altarArtifactsStorage(std::make_unique<CArtifactSetAltar>(cb))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,19 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
class DLL_LINKAGE IMarket : public virtual Serializeable, boost::noncopyable
|
||||
{
|
||||
public:
|
||||
IMarket();
|
||||
explicit IMarket(IGameCallback *cb);
|
||||
~IMarket();
|
||||
|
||||
class CArtifactSetAltar : public CArtifactSet
|
||||
{
|
||||
IGameCallback *cb;
|
||||
public:
|
||||
CArtifactSetAltar(IGameCallback *cb)
|
||||
: CArtifactSet(cb)
|
||||
, cb(cb)
|
||||
{}
|
||||
|
||||
IGameCallback * getCallback() const override {return cb;};
|
||||
ArtBearer::ArtBearer bearerType() const override {return ArtBearer::ALTAR;};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user