Index: client/UIFramework/SDL_Extensions.h
===================================================================
--- client/UIFramework/SDL_Extensions.h	(revision 2686)
+++ client/UIFramework/SDL_Extensions.h	(working copy)
@@ -117,7 +117,6 @@
 {
 	void blitSurface(SDL_Surface * src, SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect);
 	void fillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
-	extern SDL_Surface * std32bppSurface;
 
 	void SDL_PutPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255);
 	void SDL_PutPixelWithoutRefreshIfInSurf(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255);
@@ -171,6 +170,8 @@
 	std::string processStr(std::string str, std::vector<std::string> & tor); //replaces %s in string
 	SDL_Surface * newSurface(int w, int h, SDL_Surface * mod=screen); //creates new surface, with flags/format same as in surface given
 	SDL_Surface * copySurface(SDL_Surface * mod); //returns copy of given surface
+	template<int bpp>
+	SDL_Surface * createSurfaceWithBpp(int width, int height); //create surface with give bits per pixels value
 	void VflipSurf(SDL_Surface * surf); //fluipis given surface by vertical axis
 
 	template<int bpp>
Index: client/UIFramework/SDL_Extensions.cpp
===================================================================
--- client/UIFramework/SDL_Extensions.cpp	(revision 2686)
+++ client/UIFramework/SDL_Extensions.cpp	(working copy)
@@ -35,6 +35,19 @@
 	return SDL_ConvertSurface(mod, mod->format, mod->flags);
 }
 
+template<int bpp>
+SDL_Surface * CSDL_Ext::createSurfaceWithBpp(int width, int height)
+{
+	int rMask = 0, gMask = 0, bMask = 0, aMask = 0;
+
+	Channels::px<bpp>::r.set((Uint8*)&rMask, 255);
+	Channels::px<bpp>::g.set((Uint8*)&gMask, 255);
+	Channels::px<bpp>::b.set((Uint8*)&bMask, 255);
+	Channels::px<bpp>::a.set((Uint8*)&aMask, 255);
+
+	return SDL_CreateRGBSurface( SDL_SWSURFACE | SDL_SRCALPHA, width, height, bpp * 8, rMask, gMask, bMask, aMask);
+}
+
 bool isItIn(const SDL_Rect * rect, int x, int y)
 {
 	return (x>rect->x && x<rect->x+rect->w) && (y>rect->y && y<rect->y+rect->h);
@@ -1135,4 +1156,6 @@
 	return text;
 }
 
-SDL_Surface * CSDL_Ext::std32bppSurface = NULL;
+template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<2>(int, int);
+template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<3>(int, int);
+template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<4>(int, int);
\ No newline at end of file
Index: client/CMT.cpp
===================================================================
--- client/CMT.cpp	(revision 2686)
+++ client/CMT.cpp	(working copy)
@@ -116,12 +116,6 @@
 void init()
 {
 	CStopWatch tmh, pomtime;
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-	int rmask = 0xff000000;int gmask = 0x00ff0000;int bmask = 0x0000ff00;int amask = 0x000000ff;
-#else
-	int rmask = 0x000000ff;	int gmask = 0x0000ff00;	int bmask = 0x00ff0000;	int amask = 0xff000000;
-#endif
-	CSDL_Ext::std32bppSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, rmask, gmask, bmask, amask);
 	tlog0 << "\tInitializing minors: " << pomtime.getDiff() << std::endl;
 
 	//initializing audio
Index: client/CAdvmapInterface.cpp
===================================================================
--- client/CAdvmapInterface.cpp	(revision 2686)
+++ client/CAdvmapInterface.cpp	(working copy)
@@ -216,12 +216,6 @@
 
 void CMinimapSurfacesRef::initFoW(int level)
 {
-	/*for(int g=0; g<FoW.size(); ++g)
-	{
-		SDL_FreeSurface(FoW[g]);
-	}
-	FoW.clear();*/
-
 	const Rect &minimap_pos = adventureInt->minimap.pos;
 	int3 mapSizes = LOCPLINT->cb->getMapSize();
 	int mw = map_[0]->w, mh = map_[0]->h;//,
@@ -230,7 +224,7 @@
 	{
 		if(level>=0 && d!=level)
 			continue;
-		SDL_Surface * pt = CSDL_Ext::newSurface(minimap_pos.w, minimap_pos.h, CSDL_Ext::std32bppSurface);
+		SDL_Surface * pt = CSDL_Ext::createSurfaceWithBpp<4>(minimap_pos.w, minimap_pos.h);
 		for (int i=0; i<mw; i++)
 		{
 			for (int j=0; j<mh; j++)
@@ -261,7 +255,7 @@
 	{
 		if(level>=0 && d!=level)
 			continue;
-		SDL_Surface * pt = CSDL_Ext::newSurface(minimap_pos.w, minimap_pos.h, CSDL_Ext::std32bppSurface);
+		SDL_Surface * pt = CSDL_Ext::createSurfaceWithBpp<4>(minimap_pos.w, minimap_pos.h);
 		for (int i=0; i<mw; i++)
 		{
 			for (int j=0; j<mh; j++)

