hedgewars/uStore.pas
changeset 107 b08ce0293a51
parent 105 e7cb9bb4a9de
child 108 08f1fe6f21f8
--- a/hedgewars/uStore.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uStore.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -233,15 +233,15 @@
     end;
 
     procedure GetSkyColor;
-    var p: Longword;
+    var p: PByteArray;
     begin
     if SDL_MustLock(SpritesData[sprSky].Surface) then
        SDLTry(SDL_LockSurface(SpritesData[sprSky].Surface) >= 0, true);
-    p:= Longword(SpritesData[sprSky].Surface.pixels);
+    p:= SpritesData[sprSky].Surface.pixels;
     case SpritesData[sprSky].Surface.format.BytesPerPixel of
          1: cSkyColor:= PByte(p)^;
          2: cSkyColor:= PWord(p)^;
-         3: cSkyColor:= (PByte(p)^) or (PByte(p + 1)^ shl 8) or (PByte(p + 2)^ shl 16);
+         3: cSkyColor:= (p^[0]) or (p^[1] shl 8) or (p^[2] shl 16);
          4: cSkyColor:= PLongword(p)^;
          end;
     if SDL_MustLock(SpritesData[sprSky].Surface) then
@@ -449,6 +449,7 @@
 begin
 TTF_SizeUTF8(Fontz[font].Handle, PChar(String(s)), w, h);
 Result:= SDL_CreateRGBSurface(SDL_HWSURFACE, w + 6, h + 2, cBits, PixelFormat.RMask, PixelFormat.GMask, PixelFormat.BMask, 0);
+TryDo(Result <> nil, 'RenderString: fail to create surface', true);
 WriteInRoundRect(Result, 0, 0, Color, font, s);
 TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY or SDL_RLEACCEL, 0) = 0, errmsgTransparentSet, true)
 end;