mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
cleanup
This commit is contained in:
parent
f6bfba0ced
commit
b6368e23ab
@ -251,12 +251,6 @@ int BonusList::valOfBonuses(const CSelector &select) const
|
|||||||
return ret.totalValue();
|
return ret.totalValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// void BonusList::limit(const CBonusSystemNode &node)
|
|
||||||
// {
|
|
||||||
// remove_if(std::bind(&CBonusSystemNode::isLimitedOnUs, std::ref(node), _1));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
void BonusList::eliminateDuplicates()
|
void BonusList::eliminateDuplicates()
|
||||||
{
|
{
|
||||||
sort( bonuses.begin(), bonuses.end() );
|
sort( bonuses.begin(), bonuses.end() );
|
||||||
@ -1345,21 +1339,11 @@ IPropagator::~IPropagator()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CBonusSystemNode * IPropagator::getDestNode(CBonusSystemNode *source, CBonusSystemNode *redParent, CBonusSystemNode *redChild)
|
|
||||||
// {
|
|
||||||
// return source;
|
|
||||||
// }
|
|
||||||
|
|
||||||
bool IPropagator::shouldBeAttached(CBonusSystemNode *dest)
|
bool IPropagator::shouldBeAttached(CBonusSystemNode *dest)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CBonusSystemNode * CPropagatorNodeType::getDestNode(CBonusSystemNode *source, CBonusSystemNode *redParent, CBonusSystemNode *redChild)
|
|
||||||
// {
|
|
||||||
// return nullptr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
CPropagatorNodeType::CPropagatorNodeType()
|
CPropagatorNodeType::CPropagatorNodeType()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1478,14 +1462,6 @@ StackOwnerLimiter::StackOwnerLimiter(PlayerColor Owner)
|
|||||||
: owner(Owner)
|
: owner(Owner)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// int Bonus::limit(const BonusLimitationContext &context) const
|
|
||||||
// 1162 {
|
|
||||||
// 1163 if (limiter)
|
|
||||||
// 1164 return limiter->callNext(context);
|
|
||||||
// 1165 else
|
|
||||||
// 1166 return ILimiter::ACCEPT; //accept if there's no limiter
|
|
||||||
// 1167 }
|
|
||||||
//1168
|
|
||||||
|
|
||||||
int LimiterList::limit( const BonusLimitationContext &context ) const
|
int LimiterList::limit( const BonusLimitationContext &context ) const
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,6 @@ public:
|
|||||||
|
|
||||||
CSelector(std::nullptr_t)
|
CSelector(std::nullptr_t)
|
||||||
{}
|
{}
|
||||||
//CSelector(std::function<bool(const Bonus*)> f) : std::function<bool(const Bonus*)>(std::move(f)) {}
|
|
||||||
|
|
||||||
CSelector And(CSelector rhs) const
|
CSelector And(CSelector rhs) const
|
||||||
{
|
{
|
||||||
@ -317,18 +316,6 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
|
|||||||
Bonus();
|
Bonus();
|
||||||
~Bonus();
|
~Bonus();
|
||||||
|
|
||||||
// //comparison
|
|
||||||
// bool operator==(const HeroBonus &other)
|
|
||||||
// {
|
|
||||||
// return &other == this;
|
|
||||||
// //TODO: what is best logic for that?
|
|
||||||
// }
|
|
||||||
// bool operator<(const HeroBonus &other)
|
|
||||||
// {
|
|
||||||
// return &other < this;
|
|
||||||
// //TODO: what is best logic for that?
|
|
||||||
// }
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & duration & type & subtype & source & val & sid & description & additionalInfo & turnsRemain & valType & effectRange & limiter & propagator;
|
h & duration & type & subtype & source & val & sid & description & additionalInfo & turnsRemain & valType & effectRange & limiter & propagator;
|
||||||
@ -459,7 +446,6 @@ public:
|
|||||||
const std::shared_ptr<Bonus> getFirst(const CSelector &select) const;
|
const std::shared_ptr<Bonus> getFirst(const CSelector &select) const;
|
||||||
int valOfBonuses(const CSelector &select) const;
|
int valOfBonuses(const CSelector &select) const;
|
||||||
|
|
||||||
//void limit(const CBonusSystemNode &node); //erases bonuses using limitor
|
|
||||||
void eliminateDuplicates();
|
void eliminateDuplicates();
|
||||||
|
|
||||||
// remove_if implementation for STL vector types
|
// remove_if implementation for STL vector types
|
||||||
@ -529,7 +515,6 @@ class DLL_LINKAGE IPropagator
|
|||||||
public:
|
public:
|
||||||
virtual ~IPropagator();
|
virtual ~IPropagator();
|
||||||
virtual bool shouldBeAttached(CBonusSystemNode *dest);
|
virtual bool shouldBeAttached(CBonusSystemNode *dest);
|
||||||
//virtual CBonusSystemNode *getDestNode(CBonusSystemNode *source, CBonusSystemNode *redParent, CBonusSystemNode *redChild); //called when red relation between parent-childrem is established / removed
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{}
|
{}
|
||||||
@ -542,7 +527,6 @@ public:
|
|||||||
CPropagatorNodeType();
|
CPropagatorNodeType();
|
||||||
CPropagatorNodeType(int NodeType);
|
CPropagatorNodeType(int NodeType);
|
||||||
bool shouldBeAttached(CBonusSystemNode *dest) override;
|
bool shouldBeAttached(CBonusSystemNode *dest) override;
|
||||||
//CBonusSystemNode *getDestNode(CBonusSystemNode *source, CBonusSystemNode *redParent, CBonusSystemNode *redChild) override;
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
@ -670,7 +654,6 @@ public:
|
|||||||
void childDetached(CBonusSystemNode *child);
|
void childDetached(CBonusSystemNode *child);
|
||||||
void propagateBonus(std::shared_ptr<Bonus> b);
|
void propagateBonus(std::shared_ptr<Bonus> b);
|
||||||
void unpropagateBonus(std::shared_ptr<Bonus> b);
|
void unpropagateBonus(std::shared_ptr<Bonus> b);
|
||||||
//void addNewBonus(const Bonus &b); //b will copied
|
|
||||||
void removeBonus(const std::shared_ptr<Bonus>& b);
|
void removeBonus(const std::shared_ptr<Bonus>& b);
|
||||||
void newRedDescendant(CBonusSystemNode *descendant); //propagation needed
|
void newRedDescendant(CBonusSystemNode *descendant); //propagation needed
|
||||||
void removedRedDescendant(CBonusSystemNode *descendant); //de-propagation needed
|
void removedRedDescendant(CBonusSystemNode *descendant); //de-propagation needed
|
||||||
@ -678,7 +661,6 @@ public:
|
|||||||
|
|
||||||
bool isIndependentNode() const; //node is independent when it has no parents nor children
|
bool isIndependentNode() const; //node is independent when it has no parents nor children
|
||||||
bool actsAsBonusSourceOnly() const;
|
bool actsAsBonusSourceOnly() const;
|
||||||
//bool isLimitedOnUs(std::shared_ptr<Bonus>b) const; //if bonus should be removed from list acquired from this node
|
|
||||||
|
|
||||||
void popBonuses(const CSelector &s);
|
void popBonuses(const CSelector &s);
|
||||||
void updateBonuses(const CSelector &s);
|
void updateBonuses(const CSelector &s);
|
||||||
|
Loading…
Reference in New Issue
Block a user