- SW: only check valid sectors for SecUser entries.

This commit is contained in:
Christoph Oelckers 2021-11-11 00:55:42 +01:00
parent 6bd239c5b7
commit 75e2d801a7
2 changed files with 10 additions and 5 deletions

View file

@ -1703,6 +1703,11 @@ public:
{
memset(&bytes[0], 0, bytes.Size());
}
TArray<uint8_t> &Storage()
{
return bytes;
}
};

View file

@ -819,24 +819,24 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SECT_USER& w, SECT
void SerializeSectUser(FSerializer& arc)
{
FixedBitArray<MAXSECTORS> hitlist;
BitArray hitlist(numsectors);
if (arc.isWriting())
{
for (int i = 0; i < MAXSECTORS; i++)
for (int i = 0; i < numsectors; i++)
{
hitlist.Set(i, !!SectUser[i].Data());
}
}
else
{
for (int i = 0; i < MAXSECTORS; i++)
for (int i = 0; i < numsectors; i++)
{
SectUser[i].Clear();
}
}
arc("sectusermap", hitlist);
arc.SparseArray("sectuser", SectUser, MAXSECTORS, hitlist);
arc.SerializeMemory("sectusermap", hitlist.Storage().Data(), hitlist.Storage().Size());
arc.SparseArray("sectuser", SectUser, numsectors, hitlist);
}
//---------------------------------------------------------------------------