mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use std::byte for generic buffers.
parent
02082a0211
commit
518a34c286
|
@ -73,8 +73,9 @@ Sprite *Blitter_8bppSimple::Encode(SpriteType, const SpriteLoader::SpriteCollect
|
||||||
dest_sprite->y_offs = root_sprite.y_offs;
|
dest_sprite->y_offs = root_sprite.y_offs;
|
||||||
|
|
||||||
/* Copy over only the 'remap' channel, as that is what we care about in 8bpp */
|
/* Copy over only the 'remap' channel, as that is what we care about in 8bpp */
|
||||||
|
uint8_t *dst = reinterpret_cast<uint8_t *>(dest_sprite->data);
|
||||||
for (int i = 0; i < root_sprite.height * root_sprite.width; i++) {
|
for (int i = 0; i < root_sprite.height * root_sprite.width; i++) {
|
||||||
dest_sprite->data[i] = root_sprite.data[i].m;
|
dst[i] = root_sprite.data[i].m;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dest_sprite;
|
return dest_sprite;
|
||||||
|
|
|
@ -836,7 +836,7 @@ static void GenerateTerrain(int type, uint flag)
|
||||||
|
|
||||||
if (DiagDirToAxis(direction) == AXIS_Y) std::swap(w, h);
|
if (DiagDirToAxis(direction) == AXIS_Y) std::swap(w, h);
|
||||||
|
|
||||||
const uint8_t *p = templ->data;
|
const uint8_t *p = reinterpret_cast<const uint8_t *>(templ->data);
|
||||||
|
|
||||||
if ((flag & 4) != 0) {
|
if ((flag & 4) != 0) {
|
||||||
/* This is only executed in secondary/tertiary loops to generate the terrain for arctic and tropic.
|
/* This is only executed in secondary/tertiary loops to generate the terrain for arctic and tropic.
|
||||||
|
|
|
@ -526,7 +526,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
|
||||||
s->y_offs = root_sprite.y_offs;
|
s->y_offs = root_sprite.y_offs;
|
||||||
|
|
||||||
SpriteLoader::CommonPixel *src = root_sprite.data;
|
SpriteLoader::CommonPixel *src = root_sprite.data;
|
||||||
uint8_t *dest = s->data;
|
uint8_t *dest = reinterpret_cast<uint8_t *>(s->data);
|
||||||
while (num-- > 0) {
|
while (num-- > 0) {
|
||||||
*dest++ = src->m;
|
*dest++ = src->m;
|
||||||
src++;
|
src++;
|
||||||
|
|
|
@ -19,7 +19,7 @@ struct Sprite {
|
||||||
uint16_t width; ///< Width of the sprite.
|
uint16_t width; ///< Width of the sprite.
|
||||||
int16_t x_offs; ///< Number of pixels to shift the sprite to the right.
|
int16_t x_offs; ///< Number of pixels to shift the sprite to the right.
|
||||||
int16_t y_offs; ///< Number of pixels to shift the sprite downwards.
|
int16_t y_offs; ///< Number of pixels to shift the sprite downwards.
|
||||||
uint8_t data[]; ///< Sprite data.
|
std::byte data[]; ///< Sprite data.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SpriteCacheCtrlFlags : uint8_t {
|
enum SpriteCacheCtrlFlags : uint8_t {
|
||||||
|
|
Loading…
Reference in New Issue