mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 10:21:09 +00:00
Keep an AiWanderStorage when cloning an actor (bug #5267)
This commit is contained in:
parent
d9f147272c
commit
9f27a0d095
@ -28,6 +28,10 @@ void AiSequence::copy (const AiSequence& sequence)
|
||||
for (std::list<AiPackage *>::const_iterator iter (sequence.mPackages.begin());
|
||||
iter!=sequence.mPackages.end(); ++iter)
|
||||
mPackages.push_back ((*iter)->clone());
|
||||
|
||||
// We need to keep an AiWander storage, if present - it has a state machine.
|
||||
// Not sure about another temporary storages
|
||||
sequence.mAiState.copy<AiWanderStorage>(mAiState);
|
||||
}
|
||||
|
||||
AiSequence::AiSequence() : mDone (false), mRepeat(false), mLastAiPackage(-1) {}
|
||||
|
@ -38,6 +38,14 @@ namespace MWMechanics
|
||||
//return a reference to the (new allocated) object
|
||||
return *result;
|
||||
}
|
||||
|
||||
template< class Derived >
|
||||
void copy(DerivedClassStorage& destination) const
|
||||
{
|
||||
Derived* result = dynamic_cast<Derived*>(mStorage);
|
||||
if (result != nullptr)
|
||||
destination.store<Derived>(*result);
|
||||
}
|
||||
|
||||
template< class Derived >
|
||||
void store( const Derived& payload )
|
||||
|
Loading…
x
Reference in New Issue
Block a user