aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-05-25 19:22:28 +0000
committerTorbjörn Andersson2006-05-25 19:22:28 +0000
commit0e6831fa325ccb17952ad4cb853e477f184f6b45 (patch)
tree0e791499be71b9b0dbe16b9de87184e09549ee37
parenta49c64799fc4985b22ff01cd2aa332d0e2ddec54 (diff)
downloadscummvm-rg350-0e6831fa325ccb17952ad4cb853e477f184f6b45.tar.gz
scummvm-rg350-0e6831fa325ccb17952ad4cb853e477f184f6b45.tar.bz2
scummvm-rg350-0e6831fa325ccb17952ad4cb853e477f184f6b45.zip
Fixed stupid error in replaceCursorPalette().
svn-id: r22629
-rw-r--r--graphics/paletteman.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/graphics/paletteman.cpp b/graphics/paletteman.cpp
index 320b3b6497..23bd7534a7 100644
--- a/graphics/paletteman.cpp
+++ b/graphics/paletteman.cpp
@@ -85,12 +85,13 @@ void PaletteManager::replaceCursorPalette(const byte *colors, uint start, uint n
}
Palette *pal = _cursorPaletteStack.top();
+ uint size = 4 * num;
- if (pal->_size < 4 * num) {
+ if (pal->_size < size) {
+ // Could not re-use the old buffer. Create a new one.
delete pal->_colors;
- pal->_colors = new byte[4 * num];
- } else {
- pal->_size = 4 * num;
+ pal->_colors = new byte[size];
+ pal->_size = size;
}
pal->_start = start;