aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2009-06-25 23:04:21 +0000
committerJohannes Schickel2009-06-25 23:04:21 +0000
commit7bbad2738ac447f0d91c194017dfa8acbf9c3783 (patch)
tree786e430a26ab6a51ab411579a0c5161304b3ccdd /engines/kyra/screen.cpp
parentfc0d0e2323e1a1bdd8219345af1cdaf1e879d7f4 (diff)
downloadscummvm-rg350-7bbad2738ac447f0d91c194017dfa8acbf9c3783.tar.gz
scummvm-rg350-7bbad2738ac447f0d91c194017dfa8acbf9c3783.tar.bz2
scummvm-rg350-7bbad2738ac447f0d91c194017dfa8acbf9c3783.zip
Store palettes in a Common::Array instead of a fixed size array.
svn-id: r41891
Diffstat (limited to 'engines/kyra/screen.cpp')
-rw-r--r--engines/kyra/screen.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 44b3f53d1a..5b5fab4de0 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -57,10 +57,8 @@ Screen::~Screen() {
delete[] _decodeShapeBuffer;
delete[] _animBlockPtr;
- if (_vm->gameFlags().platform != Common::kPlatformAmiga) {
- for (int i = 0; i < ARRAYSIZE(_palettes); ++i)
- delete _palettes[i];
- }
+ for (uint i = 0; i < _palettes.size(); ++i)
+ delete _palettes[i];
CursorMan.popAllCursors();
}
@@ -123,14 +121,13 @@ bool Screen::init() {
memset(_shapePages, 0, sizeof(_shapePages));
- memset(_palettes, 0, sizeof(_palettes));
-
const int paletteCount = (_vm->gameFlags().platform == Common::kPlatformAmiga) ? 12 : 4;
const int numColors = (_vm->gameFlags().platform == Common::kPlatformAmiga) ? 32 : 256;
_screenPalette = new Palette(numColors);
assert(_screenPalette);
+ _palettes.resize(paletteCount);
for (int i = 0; i < paletteCount; ++i) {
_palettes[i] = new Palette(numColors);
assert(_palettes[i]);
@@ -2640,7 +2637,7 @@ void Screen::setMouseCursor(int x, int y, const byte *shape) {
}
Palette &Screen::getPalette(int num) {
- assert(num >= 0 && num < (_vm->gameFlags().platform == Common::kPlatformAmiga ? 12 : 4));
+ assert(num >= 0 && (uint)num < _palettes.size());
return *_palettes[num];
}