mirror of https://github.com/OpenRCT2/OpenRCT2.git
Try combine _freelists when freeing to reduce chance of running out of images.
This commit is contained in:
parent
1e1546d87c
commit
5426b655fe
|
@ -100,6 +100,21 @@ static void FreeImageList(uint32 baseImageId, uint32 count)
|
||||||
Guard::Assert(contains);
|
Guard::Assert(contains);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (auto it = _freeLists.begin(); it != _freeLists.end(); it++)
|
||||||
|
{
|
||||||
|
if (it->BaseId + count == baseImageId)
|
||||||
|
{
|
||||||
|
it->Count += count;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (baseImageId + count == it->BaseId)
|
||||||
|
{
|
||||||
|
it->BaseId = baseImageId;
|
||||||
|
it->Count += count;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO validate that this was an allocated list
|
// TODO validate that this was an allocated list
|
||||||
_freeLists.push_back({ baseImageId, count });
|
_freeLists.push_back({ baseImageId, count });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue