From 7bbad2738ac447f0d91c194017dfa8acbf9c3783 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 25 Jun 2009 23:04:21 +0000 Subject: Store palettes in a Common::Array instead of a fixed size array. svn-id: r41891 --- engines/kyra/screen.cpp | 11 ++++------- engines/kyra/screen.h | 3 ++- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'engines/kyra') 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]; } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index bbc06a7021..b6e64bd5ca 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -29,6 +29,7 @@ #include "common/util.h" #include "common/func.h" #include "common/list.h" +#include "common/array.h" #include "common/rect.h" #include "common/stream.h" @@ -374,7 +375,7 @@ protected: uint8 _sjisInvisibleColor; Palette *_screenPalette; - Palette *_palettes[12]; + Common::Array _palettes; Palette *_internFadePalette; Font _fonts[FID_NUM]; -- cgit v1.2.3