mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Perform simpler comparison first when checking for palette updates.
This avoids unnecessarily comparing contents of an array.
This commit is contained in:
parent
af8b8c2cfc
commit
4ecc107d30
10
src/gfx.cpp
10
src/gfx.cpp
|
@ -1368,12 +1368,10 @@ void DoPaletteAnimations()
|
|||
|
||||
if (blitter != nullptr && blitter->UsePaletteAnimation() == Blitter::PALETTE_ANIMATION_NONE) {
|
||||
palette_animation_counter = old_tc;
|
||||
} else {
|
||||
if (memcmp(old_val, &_cur_palette.palette[PALETTE_ANIM_START], sizeof(old_val)) != 0 && _cur_palette.count_dirty == 0) {
|
||||
/* Did we changed anything on the palette? Seems so. Mark it as dirty */
|
||||
_cur_palette.first_dirty = PALETTE_ANIM_START;
|
||||
_cur_palette.count_dirty = PALETTE_ANIM_SIZE;
|
||||
}
|
||||
} else if (_cur_palette.count_dirty == 0 && memcmp(old_val, &_cur_palette.palette[PALETTE_ANIM_START], sizeof(old_val)) != 0) {
|
||||
/* Did we changed anything on the palette? Seems so. Mark it as dirty */
|
||||
_cur_palette.first_dirty = PALETTE_ANIM_START;
|
||||
_cur_palette.count_dirty = PALETTE_ANIM_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue