1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 08:52:40 +01:00

Codechange: use std::fill_n over memset

This commit is contained in:
Rubidium
2025-05-06 22:35:24 +02:00
committed by rubidium42
parent 92bd78dd25
commit 7981fcb297
6 changed files with 9 additions and 8 deletions

View File

@@ -448,7 +448,7 @@ static void *ReadRecolourSprite(SpriteFile &file, size_t file_pos, uint num, Spr
uint8_t *dest_tmp = new uint8_t[std::max(RECOLOUR_SPRITE_SIZE, num)];
/* Only a few recolour sprites are less than 257 bytes */
if (num < RECOLOUR_SPRITE_SIZE) memset(dest_tmp, 0, RECOLOUR_SPRITE_SIZE);
if (num < RECOLOUR_SPRITE_SIZE) std::fill_n(dest_tmp, RECOLOUR_SPRITE_SIZE, 0);
file.ReadBlock(dest_tmp, num);
/* The data of index 0 is never used; "literal 00" according to the (New)GRF specs. */