[Scummvm-cvs-logs] SF.net SVN: scummvm:[41891] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Jun 26 01:04:21 CEST 2009


Revision: 41891
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41891&view=rev
Author:   lordhoto
Date:     2009-06-25 23:04:21 +0000 (Thu, 25 Jun 2009)

Log Message:
-----------
Store palettes in a Common::Array instead of a fixed size array.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/screen.h

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2009-06-25 23:04:08 UTC (rev 41890)
+++ scummvm/trunk/engines/kyra/screen.cpp	2009-06-25 23:04:21 UTC (rev 41891)
@@ -57,10 +57,8 @@
 	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 @@
 
 	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 @@
 }
 
 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];
 }
 

Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h	2009-06-25 23:04:08 UTC (rev 41890)
+++ scummvm/trunk/engines/kyra/screen.h	2009-06-25 23:04:21 UTC (rev 41891)
@@ -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 @@
 	uint8 _sjisInvisibleColor;
 
 	Palette *_screenPalette;
-	Palette *_palettes[12];
+	Common::Array<Palette *> _palettes;
 	Palette *_internFadePalette;
 
 	Font _fonts[FID_NUM];


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list