diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index 665db4a6d..9ed696df5 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -2202,7 +2202,7 @@ ui8 CGTownInstance::getPassableness() const if ( tempOwner == 255 )//neutral guarded - noone can visit return 0; - ui8 mask; + ui8 mask = 0; TeamState * ts = cb->gameState()->getPlayerTeam(tempOwner); BOOST_FOREACH(ui8 it, ts->players) mask |= 1<gameState()->getPlayerTeam(tempOwner); BOOST_FOREACH(ui8 it, ts->players) mask |= 1<format->BytesPerPixel >= 3) { - for ( int i=w-1; i>=0; i--) + for( int j=0; j=0; i--) + { + Uint16 pixel = *addr; - Uint8 *p = (Uint8 *)dst->pixels + (j+y) * dst->pitch + (i + x) * dst->format->BytesPerPixel; - p[2] = ((pixel & 0x7c00) >> 10) * 8; - p[1] = ((pixel & 0x3e0) >> 5) * 8; - p[0] = ((pixel & 0x1F)) * 8; + Uint8 *p = (Uint8 *)dst->pixels + (j+y) * dst->pitch + (i + x) * dst->format->BytesPerPixel; + p[2] = ((pixel & 0x7c00) >> 10) * 8; + p[1] = ((pixel & 0x3e0) >> 5) * 8; + p[0] = ((pixel & 0x1F)) * 8; - addr--; + addr--; + } + } + } + else if(dst->format->BytesPerPixel == 2) + { + for( int j=0; j=0; i--) + { + //convert rgb 555 to 565 + Uint16 pixel = *addr; + Uint16 *p = (Uint16 *)((Uint8 *)dst->pixels + (j+y) * dst->pitch + (i + x) * dst->format->BytesPerPixel); + *p = (pixel & 0x1F) + + ((pixel & 0x3e0) << 1) + + ((pixel & 0x7c00) << 1); + + addr--; + } } }