mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-26 07:59:09 +00:00
Codechange: Unnecessry ptr incrementation, max_sprite_size constant
This commit is contained in:
@@ -66,7 +66,8 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f
|
|||||||
*
|
*
|
||||||
* So, any sprite data more than 64 MiB is way larger that we would even expect; prevent allocating more memory!
|
* So, any sprite data more than 64 MiB is way larger that we would even expect; prevent allocating more memory!
|
||||||
*/
|
*/
|
||||||
if (num < 0 || num > 64 * 1024 * 1024) return WarnCorruptSprite(file, file_pos, __LINE__);
|
constexpr int64 MAX_SPRITE_SIZE = 64 * 1024 * 1024;
|
||||||
|
if (num < 0 || num > MAX_SPRITE_SIZE) return WarnCorruptSprite(file, file_pos, __LINE__);
|
||||||
|
|
||||||
std::unique_ptr<byte[]> dest_orig(new byte[num]);
|
std::unique_ptr<byte[]> dest_orig(new byte[num]);
|
||||||
byte *dest = dest_orig.get();
|
byte *dest = dest_orig.get();
|
||||||
@@ -207,7 +208,6 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f
|
|||||||
}
|
}
|
||||||
/* Magic blue. */
|
/* Magic blue. */
|
||||||
if (colour_fmt == SCC_PAL && *pixel == 0) sprite->data[i].a = 0x00;
|
if (colour_fmt == SCC_PAL && *pixel == 0) sprite->data[i].a = 0x00;
|
||||||
pixel++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user