Added RNG snapshotting for predicting
Allows RNG seeds to be played back in a predictive way paving the road for predictive behaviors that rely on RNG.
This commit is contained in:
parent
597b06ae52
commit
a1a4a97dcd
4 changed files with 26 additions and 4 deletions
|
|
@ -388,6 +388,21 @@ FRandom *FRandom::StaticFindRNG (const char *name, bool client)
|
|||
return probe;
|
||||
}
|
||||
|
||||
void FRandom::SaveRNGState(TArray<FRandom>& backups)
|
||||
{
|
||||
for (auto cur = RNGList; cur != nullptr; cur = cur->Next)
|
||||
backups.Push(*cur);
|
||||
}
|
||||
|
||||
void FRandom::RestoreRNGState(TArray<FRandom>& backups)
|
||||
{
|
||||
unsigned int i = 0u;
|
||||
for (auto cur = RNGList; cur != nullptr; cur = cur->Next)
|
||||
*cur = backups[i++];
|
||||
|
||||
backups.Clear();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FRandom :: StaticPrintSeeds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue