mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Cleanup: use only CBonusSystemNode::treeHasChanged() when changing treeChanged
This commit is contained in:
parent
6cf82ceab5
commit
5b29e800f7
@ -273,13 +273,13 @@ void BonusList::push_back(Bonus* const &x)
|
|||||||
bonuses.push_back(x);
|
bonuses.push_back(x);
|
||||||
|
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Bonus*>::iterator BonusList::erase(const int position)
|
std::vector<Bonus*>::iterator BonusList::erase(const int position)
|
||||||
{
|
{
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
return bonuses.erase(bonuses.begin() + position);
|
return bonuses.erase(bonuses.begin() + position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ void BonusList::clear()
|
|||||||
bonuses.clear();
|
bonuses.clear();
|
||||||
|
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<BonusList*>::size_type BonusList::operator-=(Bonus* const &i)
|
std::vector<BonusList*>::size_type BonusList::operator-=(Bonus* const &i)
|
||||||
@ -299,7 +299,7 @@ std::vector<BonusList*>::size_type BonusList::operator-=(Bonus* const &i)
|
|||||||
bonuses.erase(itr);
|
bonuses.erase(itr);
|
||||||
|
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ void BonusList::resize(std::vector<Bonus*>::size_type sz, Bonus* c )
|
|||||||
bonuses.resize(sz, c);
|
bonuses.resize(sz, c);
|
||||||
|
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BonusList::insert(std::vector<Bonus*>::iterator position, std::vector<Bonus*>::size_type n, Bonus* const &x)
|
void BonusList::insert(std::vector<Bonus*>::iterator position, std::vector<Bonus*>::size_type n, Bonus* const &x)
|
||||||
@ -316,7 +316,7 @@ void BonusList::insert(std::vector<Bonus*>::iterator position, std::vector<Bonus
|
|||||||
bonuses.insert(position, n, x);
|
bonuses.insert(position, n, x);
|
||||||
|
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
int IBonusBearer::valOfBonuses(Bonus::BonusType type, const CSelector &selector) const
|
int IBonusBearer::valOfBonuses(Bonus::BonusType type, const CSelector &selector) const
|
||||||
@ -754,7 +754,7 @@ void CBonusSystemNode::attachTo(CBonusSystemNode *parent)
|
|||||||
newRedDescendant(parent);
|
newRedDescendant(parent);
|
||||||
|
|
||||||
parent->newChildAttached(this);
|
parent->newChildAttached(this);
|
||||||
CBonusSystemNode::treeChanged++;
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::detachFrom(CBonusSystemNode *parent)
|
void CBonusSystemNode::detachFrom(CBonusSystemNode *parent)
|
||||||
@ -768,7 +768,7 @@ void CBonusSystemNode::detachFrom(CBonusSystemNode *parent)
|
|||||||
|
|
||||||
parents -= parent;
|
parents -= parent;
|
||||||
parent->childDetached(this);
|
parent->childDetached(this);
|
||||||
CBonusSystemNode::treeChanged++;
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::popBonuses(const CSelector &s)
|
void CBonusSystemNode::popBonuses(const CSelector &s)
|
||||||
@ -792,7 +792,7 @@ void CBonusSystemNode::addNewBonus(Bonus *b)
|
|||||||
assert(!vstd::contains(exportedBonuses,b));
|
assert(!vstd::contains(exportedBonuses,b));
|
||||||
exportedBonuses.push_back(b);
|
exportedBonuses.push_back(b);
|
||||||
exportBonus(b);
|
exportBonus(b);
|
||||||
CBonusSystemNode::treeChanged++;
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::accumulateBonus(Bonus &b)
|
void CBonusSystemNode::accumulateBonus(Bonus &b)
|
||||||
@ -812,7 +812,7 @@ void CBonusSystemNode::removeBonus(Bonus *b)
|
|||||||
else
|
else
|
||||||
bonuses -= b;
|
bonuses -= b;
|
||||||
vstd::clear_pointer(b);
|
vstd::clear_pointer(b);
|
||||||
CBonusSystemNode::treeChanged++;
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBonusSystemNode::actsAsBonusSourceOnly() const
|
bool CBonusSystemNode::actsAsBonusSourceOnly() const
|
||||||
@ -995,7 +995,7 @@ void CBonusSystemNode::exportBonus(Bonus * b)
|
|||||||
else
|
else
|
||||||
bonuses.push_back(b);
|
bonuses.push_back(b);
|
||||||
|
|
||||||
CBonusSystemNode::treeChanged++;
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::exportBonuses()
|
void CBonusSystemNode::exportBonuses()
|
||||||
@ -1049,11 +1049,6 @@ void CBonusSystemNode::setDescription(const std::string &description)
|
|||||||
this->description = description;
|
this->description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::incrementTreeChangedNum()
|
|
||||||
{
|
|
||||||
treeChanged++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBonusSystemNode::limitBonuses(const BonusList &allBonuses, BonusList &out) const
|
void CBonusSystemNode::limitBonuses(const BonusList &allBonuses, BonusList &out) const
|
||||||
{
|
{
|
||||||
assert(&allBonuses != &out); //todo should it work in-place?
|
assert(&allBonuses != &out); //todo should it work in-place?
|
||||||
|
@ -683,7 +683,6 @@ public:
|
|||||||
void exportBonus(Bonus * b);
|
void exportBonus(Bonus * b);
|
||||||
void exportBonuses();
|
void exportBonuses();
|
||||||
|
|
||||||
static void incrementTreeChangedNum();
|
|
||||||
BonusList &getBonusList();
|
BonusList &getBonusList();
|
||||||
const BonusList &getBonusList() const;
|
const BonusList &getBonusList() const;
|
||||||
BonusList &getExportedBonusList();
|
BonusList &getExportedBonusList();
|
||||||
@ -981,7 +980,7 @@ void BonusList::insert(const int position, InputIterator first, InputIterator la
|
|||||||
bonuses.insert(bonuses.begin() + position, first, last);
|
bonuses.insert(bonuses.begin() + position, first, last);
|
||||||
|
|
||||||
if (belongsToTree)
|
if (belongsToTree)
|
||||||
CBonusSystemNode::incrementTreeChangedNum();
|
CBonusSystemNode::treeHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extensions for BOOST_FOREACH to enable iterating of BonusList objects
|
// Extensions for BOOST_FOREACH to enable iterating of BonusList objects
|
||||||
|
Loading…
Reference in New Issue
Block a user