Pass battle pointer along with clone for battleside.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
parent
8baa647940
commit
8a9a6af0af
|
@ -178,7 +178,7 @@ Battle* Battle::Clone() const {
|
|||
auto* battle = new Battle(_library, parties, _canFlee, _numberOfSides, _creaturesPerSide);
|
||||
|
||||
for (int i = 0; i < _numberOfSides; ++i) {
|
||||
battle->_sides.Set(i, _sides[i]->CloneWithoutCreatures());
|
||||
battle->_sides.Set(i, _sides[i]->CloneWithoutCreatures(battle));
|
||||
// FIXME: This is horrible code to translate the creature from the old battle into the same creature in the
|
||||
// new battle. This needs to be cleaned up, as it's ugly and slow.
|
||||
for (int creatureIndex = 0; creatureIndex < _creaturesPerSide; ++creatureIndex) {
|
||||
|
|
|
@ -123,8 +123,9 @@ bool BattleSide::SwapPositions(u8 a, u8 b) {
|
|||
_battle->TriggerEventListener<SwapEvent>(_index, a, b);
|
||||
return true;
|
||||
}
|
||||
BattleSide* BattleSide::CloneWithoutCreatures() const {
|
||||
auto* side = new BattleSide(_index, _battle, _creaturesPerSide);
|
||||
|
||||
BattleSide *BattleSide::CloneWithoutCreatures(ArbUt::BorrowedPtr<Battle> battle) const {
|
||||
auto *side = new BattleSide(_index, battle, _creaturesPerSide);
|
||||
side->_choicesSet = _choicesSet;
|
||||
_volatile.Clone(side->_volatile);
|
||||
side->_hasFled = _hasFled;
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace CreatureLib::Battling {
|
|||
|
||||
bool SwapPositions(u8 a, u8 b);
|
||||
|
||||
BattleSide* CloneWithoutCreatures() const;
|
||||
BattleSide *CloneWithoutCreatures(ArbUt::BorrowedPtr<Battle> battle) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue