diff options
author | tron <tron@openttd.org> | 2005-07-29 10:16:49 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-07-29 10:16:49 +0000 |
commit | 0432a02054de225552e83f217613078148ac5bde (patch) | |
tree | a126e6b3c9706a270d3f1083acf79a1de200345c | |
parent | 30a5f299f8a54ca8dffeb31c41de0b474ecc7aed (diff) | |
download | openttd-0432a02054de225552e83f217613078148ac5bde.tar.xz |
(svn r2746) -Fix: SDL_SetColors() has the number of palette entries to change as parameter, not one beyond the last entry to change
-rw-r--r-- | video/sdl_v.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/video/sdl_v.c b/video/sdl_v.c index 2c7aa8ad7..129fddd67 100644 --- a/video/sdl_v.c +++ b/video/sdl_v.c @@ -34,20 +34,19 @@ static void SdlVideoMakeDirty(int left, int top, int width, int height) _num_dirty_rects++; } -static SDL_Color pal[256]; - -static void UpdatePalette(uint start, uint end) +static void UpdatePalette(uint start, uint count) { + SDL_Color pal[256]; uint i; - for (i = start; i != end; i++) { - pal[i].r = _cur_palette[i].r; - pal[i].g = _cur_palette[i].g; - pal[i].b = _cur_palette[i].b; + for (i = 0; i != count; i++) { + pal[i].r = _cur_palette[start + i].r; + pal[i].g = _cur_palette[start + i].g; + pal[i].b = _cur_palette[start + i].b; pal[i].unused = 0; } - SDL_CALL SDL_SetColors(_sdl_screen, pal, start, end); + SDL_CALL SDL_SetColors(_sdl_screen, pal, start, count); } static void InitPalette(void) @@ -57,8 +56,8 @@ static void InitPalette(void) static void CheckPaletteAnim(void) { - if(_pal_last_dirty != -1) { - UpdatePalette(_pal_first_dirty, _pal_last_dirty + 1); + if (_pal_last_dirty != -1) { + UpdatePalette(_pal_first_dirty, _pal_last_dirty - _pal_first_dirty + 1); _pal_last_dirty = -1; } } |