Make Clone functions const.
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
84a14cff2b
commit
2b1a1792bf
|
@ -68,7 +68,7 @@ namespace CreatureLib::Battling {
|
|||
return {};
|
||||
}
|
||||
|
||||
void CloneOnto(HistoryHolder& other) {
|
||||
void CloneOnto(HistoryHolder& other) const {
|
||||
if (other._top != nullptr) {
|
||||
other._top->Clear();
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ BattleScript* Battle::AddVolatileScript(BattleScript* script) { return _volatile
|
|||
void Battle::RemoveVolatileScript(BattleScript* script) { _volatile.Remove(script->GetName()); }
|
||||
void Battle::DisplayText(const ArbUt::StringView& text) { TriggerEventListener<DisplayTextEvent>(text); }
|
||||
|
||||
Battle* Battle::Clone() {
|
||||
Battle* Battle::Clone() const {
|
||||
auto parties = ArbUt::List<BattleParty*>(_parties.Count());
|
||||
for (auto* party : _parties) {
|
||||
parties.Append(party->Clone());
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace CreatureLib::Battling {
|
|||
}
|
||||
}
|
||||
|
||||
Battle* Clone();
|
||||
virtual Battle* Clone() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace CreatureLib::Battling {
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual BattleParty* Clone() { return new BattleParty(_party->Clone(), _responsibleIndices); }
|
||||
virtual BattleParty* Clone() const { return new BattleParty(_party->Clone(), _responsibleIndices); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ bool BattleSide::SwapPositions(u8 a, u8 b) {
|
|||
_battle->TriggerEventListener<SwapEvent>(_index, a, b);
|
||||
return true;
|
||||
}
|
||||
BattleSide* BattleSide::CloneWithoutCreatures() {
|
||||
BattleSide* BattleSide::CloneWithoutCreatures() const {
|
||||
auto* side = new BattleSide(_index, _battle, _creaturesPerSide);
|
||||
side->_choicesSet = _choicesSet;
|
||||
_volatile.Clone(side->_volatile);
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace CreatureLib::Battling {
|
|||
|
||||
bool SwapPositions(u8 a, u8 b);
|
||||
|
||||
BattleSide* CloneWithoutCreatures();
|
||||
BattleSide* CloneWithoutCreatures() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ namespace CreatureLib::Battling {
|
|||
_attacks.Set(index, attack);
|
||||
}
|
||||
|
||||
Creature* Creature::Clone() {
|
||||
Creature* Creature::Clone() const {
|
||||
auto attacks = std::vector<LearnedAttack*>(_attacks.Count());
|
||||
auto i = 0;
|
||||
for (auto* attack : _attacks) {
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace CreatureLib::Battling {
|
|||
|
||||
// endregion
|
||||
|
||||
virtual Creature* Clone();
|
||||
virtual Creature* Clone() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace CreatureLib::Battling {
|
|||
}
|
||||
}
|
||||
|
||||
virtual CreatureParty* Clone() {
|
||||
virtual CreatureParty* Clone() const {
|
||||
auto party = new CreatureParty(_party.Count());
|
||||
auto i = 0;
|
||||
for (auto c : _party) {
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace CreatureLib::Battling {
|
|||
virtual void RestoreUses(uint8_t amount) noexcept;
|
||||
virtual void RestoreAllUses() noexcept;
|
||||
|
||||
virtual LearnedAttack* Clone() {
|
||||
virtual LearnedAttack* Clone() const {
|
||||
auto* attack = new LearnedAttack(_attack, _maxUses, _learnMethod);
|
||||
attack->_remainingUses = _remainingUses;
|
||||
return attack;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace CreatureLib::Battling {
|
|||
static constexpr size_t defaultCapacity = 8;
|
||||
ScriptSet() : _scripts(defaultCapacity), _lookup(defaultCapacity){};
|
||||
|
||||
void Clone(ScriptSet& s) {
|
||||
void Clone(ScriptSet& s) const {
|
||||
for (auto* script : _scripts) {
|
||||
s.Add(script->Clone());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue