mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
Merge pull request #2718 from akortunov/storage
Keep an AiWanderStorage when cloning an actor
This commit is contained in:
commit
b1ed7a433e
2 changed files with 12 additions and 0 deletions
|
@ -28,6 +28,10 @@ void AiSequence::copy (const AiSequence& sequence)
|
||||||
for (std::list<AiPackage *>::const_iterator iter (sequence.mPackages.begin());
|
for (std::list<AiPackage *>::const_iterator iter (sequence.mPackages.begin());
|
||||||
iter!=sequence.mPackages.end(); ++iter)
|
iter!=sequence.mPackages.end(); ++iter)
|
||||||
mPackages.push_back ((*iter)->clone());
|
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) {}
|
AiSequence::AiSequence() : mDone (false), mRepeat(false), mLastAiPackage(-1) {}
|
||||||
|
|
|
@ -39,6 +39,14 @@ namespace MWMechanics
|
||||||
return *result;
|
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 >
|
template< class Derived >
|
||||||
void store( const Derived& payload )
|
void store( const Derived& payload )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue