- Fixed: Reading the RNG states from a savegame calculated the amounts of
RNGs in the savegame wrong. SVN r1508 (trunk)
This commit is contained in:
parent
7371c4a516
commit
26420a9c60
2 changed files with 9 additions and 2 deletions
|
|
@ -269,6 +269,7 @@ void FRandom::StaticWriteRNGState (FILE *file)
|
|||
// Only write those RNGs that have names
|
||||
if (rng->NameCRC != 0)
|
||||
{
|
||||
Printf("Writing RNG %s\n", rng->Name);
|
||||
arc << rng->NameCRC << rng->idx;
|
||||
for (int i = 0; i < SFMT::N32; ++i)
|
||||
{
|
||||
|
|
@ -295,7 +296,8 @@ void FRandom::StaticReadRNGState (PNGHandle *png)
|
|||
|
||||
if (len != 0)
|
||||
{
|
||||
const int rngcount = (int)((len-4) / 8);
|
||||
const size_t sizeof_rng = sizeof(rng->NameCRC) + sizeof(rng->idx) + sizeof(rng->sfmt.u);
|
||||
const int rngcount = (int)((len-4) / sizeof_rng);
|
||||
int i;
|
||||
DWORD crc;
|
||||
|
||||
|
|
@ -311,6 +313,7 @@ void FRandom::StaticReadRNGState (PNGHandle *png)
|
|||
{
|
||||
if (rng->NameCRC == crc)
|
||||
{
|
||||
Printf("Reading RNG %s\n", rng->Name);
|
||||
arc << rng->idx;
|
||||
for (int i = 0; i < SFMT::N32; ++i)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue