From e0d9e224ec0922a8dca5605b98a775a529407162 Mon Sep 17 00:00:00 2001 From: johns <> Date: Thu, 8 Jun 2000 07:32:57 +0000 Subject: [PATCH] Fixed bug: out of bound access. --- src/map/map_draw.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/map/map_draw.cpp b/src/map/map_draw.cpp index 5bf733de2..a7df7d238 100644 --- a/src/map/map_draw.cpp +++ b/src/map/map_draw.cpp @@ -1272,12 +1272,15 @@ global void MapColorCycle(void) } #endif - // - // Convert 16 bit pixel table into two 32 bit tables. - // - for( i=0; i<256; ++i ) { - PixelsLow[i]=((VMemType16*)TheMap.TileData->Pixels)[i]&0xFFFF; - PixelsHigh[i]=(((VMemType16*)TheMap.TileData->Pixels)[i]&0xFFFF)<<16; + if( VideoDepth==15 || VideoDepth==16 ) { + // + // Convert 16 bit pixel table into two 32 bit tables. + // + for( i=0; i<256; ++i ) { + PixelsLow[i]=((VMemType16*)TheMap.TileData->Pixels)[i]&0xFFFF; + PixelsHigh[i]=(((VMemType16*)TheMap.TileData->Pixels)[i]&0xFFFF) + <<16; + } } }