mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #8416 from IntelOrca/required-images-extra-checks
Add extra checks in required image code
This commit is contained in:
commit
6837e29584
|
@ -55,7 +55,7 @@ namespace ObjectJsonHelpers
|
|||
{
|
||||
auto length = g1_calculate_data_size(&orig);
|
||||
g1 = orig;
|
||||
g1.offset = (uint8_t*)std::malloc(length);
|
||||
g1.offset = new uint8_t[length];
|
||||
std::memcpy(g1.offset, orig.offset, length);
|
||||
g1.flags &= ~G1_FLAG_HAS_ZOOM_SPRITE;
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ namespace ObjectJsonHelpers
|
|||
{
|
||||
auto length = g1_calculate_data_size(orig);
|
||||
g1 = *orig;
|
||||
g1.offset = (uint8_t*)std::malloc(length);
|
||||
g1.offset = new uint8_t[length];
|
||||
std::memcpy(g1.offset, orig->offset, length);
|
||||
if (g1.flags & G1_FLAG_HAS_ZOOM_SPRITE)
|
||||
if ((g1.flags & G1_FLAG_HAS_ZOOM_SPRITE) && g1.zoomed_offset != 0)
|
||||
{
|
||||
// Fetch image for next zoom level
|
||||
next_zoom = std::make_unique<RequiredImage>((uint32_t)(idx - g1.zoomed_offset), getter);
|
||||
|
@ -84,7 +84,7 @@ namespace ObjectJsonHelpers
|
|||
|
||||
~RequiredImage()
|
||||
{
|
||||
std::free(g1.offset);
|
||||
delete[] g1.offset;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue