- Many type fixes
authorunc0rr
Fri, 11 Aug 2006 16:17:50 +0000
changeset 107 b08ce0293a51
parent 106 98cb6606bf67
child 108 08f1fe6f21f8
- Many type fixes - Get rid of all pointer<->integer typecasts
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/SDLh.pas
hedgewars/uAIAmmoTests.pas
hedgewars/uCollisions.pas
hedgewars/uConsole.pas
hedgewars/uGears.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uLandTemplates.pas
hedgewars/uMisc.pas
hedgewars/uRandom.pas
hedgewars/uStore.pas
hedgewars/uWorld.pas
--- a/hedgewars/GSHandlers.inc	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Aug 11 16:17:50 2006 +0000
@@ -59,7 +59,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 procedure CalcRotationDirAngle(Gear: PGear);
-var dAngle: real;
+var dAngle: Double;
 begin
 dAngle:= (abs(Gear.dX) + abs(Gear.dY))*0.1;
 if Gear.dX >= 0 then Gear.DirAngle:= Gear.DirAngle + dAngle
@@ -224,7 +224,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepUFOWork(Gear: PGear);
-var t: real;
+var t: Double;
 begin
 AllInactive:= false;
 t:= sqrt(sqr(Gear.dX) + sqr(Gear.dY));
@@ -301,7 +301,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepDEagleShot(Gear: PGear);
 var i, x, y: LongWord;
-    oX, oY: real;
+    oX, oY: Double;
 begin
 AllInactive:= false;
 i:= 80;
@@ -428,7 +428,7 @@
 procedure doStepRopeWork(Gear: PGear);
 const flCheck: boolean = false;
 var HHGear: PGear;
-    len, cs, cc, tx, ty: real;
+    len, cs, cc, tx, ty: Double;
     lx, ly: integer;
 
     procedure DeleteMe;
@@ -543,7 +543,7 @@
 
 procedure doStepRopeAttach(Gear: PGear);
 var HHGear: PGear;
-    tx, ty, tt: real;
+    tx, ty, tt: Double;
 begin
 Gear.X:= Gear.X + Gear.dX;
 Gear.Y:= Gear.Y + Gear.dY;
--- a/hedgewars/HHHandlers.inc	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Fri Aug 11 16:17:50 2006 +0000
@@ -33,7 +33,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure Attack(Gear: PGear);
-var xx, yy: real;
+var xx, yy: Double;
 begin
 with Gear^,
      PHedgehog(Gear.Hedgehog)^ do
--- a/hedgewars/SDLh.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/SDLh.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -117,7 +117,7 @@
                     w, h  : integer;
                     pitch : Word;
                     pixels: Pointer;
-                    offset: LongInt;
+                    offset: integer;
                     end;
 
      PSDL_Color = ^TSDL_Color;
@@ -192,46 +192,46 @@
      PSDL_Thread = Pointer;
      PSDL_mutex = Pointer;
 
-function  SDL_Init(flags: Longword): LongInt; cdecl; external SDLLibName;
+function  SDL_Init(flags: Longword): integer; cdecl; external SDLLibName;
 procedure SDL_Quit; cdecl; external SDLLibName;
 
 procedure SDL_Delay(msec: Longword); cdecl; external SDLLibName;
 function  SDL_GetTicks: Longword; cdecl; external SDLLibName;
 
 function  SDL_MustLock(Surface: PSDL_Surface): Boolean;
-function  SDL_LockSurface(Surface: PSDL_Surface): LongInt; cdecl; external SDLLibName;
+function  SDL_LockSurface(Surface: PSDL_Surface): integer; cdecl; external SDLLibName;
 procedure SDL_UnlockSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
 
 function  SDL_GetError: PChar; cdecl; external SDLLibName;
 
-function  SDL_SetVideoMode(width, height, bpp: LongInt; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
-function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
-function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: LongInt; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
+function  SDL_SetVideoMode(width, height, bpp: integer; flags: Longword): PSDL_Surface; cdecl; external SDLLibName;
+function  SDL_CreateRGBSurface(flags: Longword; Width, Height, Depth: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
+function  SDL_CreateRGBSurfaceFrom(pixels: Pointer; width, height, depth, pitch: integer; RMask, GMask, BMask, AMask: Longword): PSDL_Surface; cdecl; external SDLLibName;
 procedure SDL_FreeSurface(Surface: PSDL_Surface); cdecl; external SDLLibName;
 function  SDL_SetColorKey(surface: PSDL_Surface; flag, key: Longword): LongInt; cdecl; external SDLLibName;
 
 function  SDL_UpperBlit(src: PSDL_Surface; srcrect: PSDL_Rect; dst: PSDL_Surface; dstrect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
 function  SDL_FillRect(dst: PSDL_Surface; dstrect: PSDL_Rect; color: Longword): LongInt; cdecl; external SDLLibName;
 procedure SDL_UpdateRect(Screen: PSDL_Surface; x, y: LongInt; w, h: Longword); cdecl; external SDLLibName;
-function  SDL_Flip(Screen: PSDL_Surface): LongInt; cdecl; external SDLLibName;
+function  SDL_Flip(Screen: PSDL_Surface): integer; cdecl; external SDLLibName;
 
 procedure SDL_GetRGB(pixel: Longword; fmt: PSDL_PixelFormat; r, g, b: PByte); cdecl; external SDLLibName;
-function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): LongInt; cdecl; external SDLLibName;
+function  SDL_MapRGB(format: PSDL_PixelFormat; r, g, b: Byte): Longword; cdecl; external SDLLibName;
 
 function  SDL_DisplayFormat(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
 function  SDL_DisplayFormatAlpha(Surface: PSDL_Surface): PSDL_Surface; cdecl; external SDLLibName;
 
 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
-function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
+function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: integer): integer; cdecl; external SDLLibName;
 
 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
-function  SDL_GetMouseState(x, y: PLongInt): Byte; cdecl; external SDLLibName;
+function  SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName;
 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
 
-function  SDL_PollEvent(event: PSDL_Event): LongInt; cdecl; external SDLLibName;
+function  SDL_PollEvent(event: PSDL_Event): integer; cdecl; external SDLLibName;
 
-function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
+function  SDL_ShowCursor(toggle: integer): integer; cdecl; external SDLLibName;
 
 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
 
@@ -239,8 +239,8 @@
 procedure SDL_WaitThread(thread: PSDL_Thread; status: PLongInt); cdecl; external SDLLibName;
 function  SDL_CreateMutex: PSDL_mutex; cdecl; external SDLLibName;
 procedure SDL_DestroyMutex(mutex: PSDL_mutex); cdecl; external SDLLibName;
-function  SDL_LockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexP';
-function  SDL_UnlockMutex(mutex: PSDL_mutex): LongInt; cdecl; external SDLLibName name 'SDL_mutexV';
+function  SDL_LockMutex(mutex: PSDL_mutex): integer; cdecl; external SDLLibName name 'SDL_mutexP';
+function  SDL_UnlockMutex(mutex: PSDL_mutex): integer; cdecl; external SDLLibName name 'SDL_mutexV';
 
 (*  TTF  *)
 
@@ -260,10 +260,10 @@
 procedure TTF_Quit; cdecl; external SDL_TTFLibName;
 
 
-function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: LongInt): LongInt; cdecl; external SDL_TTFLibName;
+function TTF_SizeUTF8(font : PTTF_Font; const text: PChar; var w, h: integer): LongInt; cdecl; external SDL_TTFLibName;
 function TTF_RenderUTF8_Solid(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
 function TTF_RenderUTF8_Blended(font : PTTF_Font; const text: PChar; fg: TSDL_Color): PSDL_Surface; cdecl; external SDL_TTFLibName;
-function TTF_OpenFont(const filename: Pchar; size: LongInt): PTTF_Font; cdecl; external SDL_TTFLibName;
+function TTF_OpenFont(const filename: Pchar; size: integer): PTTF_Font; cdecl; external SDL_TTFLibName;
 
 (*  SDL_mixer *)
 
--- a/hedgewars/uAIAmmoTests.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -70,12 +70,12 @@
 end;
 
 function TestBazooka(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
-var Vx, Vy, r: real;
-    rTime: real;
+var Vx, Vy, r: Double;
+    rTime: Double;
     Score, EX, EY: integer;
 
     function CheckTrace: integer;
-    var x, y, dX, dY: real;
+    var x, y, dX, dY: Double;
         t: integer;
     begin
     x:= Me.X;
@@ -125,12 +125,12 @@
 
 function TestGrenade(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
 const tDelta = 24;
-var Vx, Vy, r: real;
+var Vx, Vy, r: Double;
     Score, EX, EY: integer;
     TestTime: Longword;
 
     function CheckTrace: integer;
-    var x, y, dY: real;
+    var x, y, dY: Double;
         t: integer;
     begin
     x:= Me.X;
@@ -177,7 +177,7 @@
 end;
 
 function TestShotgun(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
-var Vx, Vy, x, y: real;
+var Vx, Vy, x, y: Double;
 begin
 ExplR:= 0;
 if Metric(round(Me.X), round(Me.Y), Targ.X, Targ.Y) < 80 then
@@ -206,7 +206,7 @@
 end;
 
 function TestDesertEagle(Me: PGear; Targ: TPoint; out Time: Longword; out Angle, Power: integer; out ExplX, ExplY, ExplR: integer): integer;
-var Vx, Vy, x, y, t: real;
+var Vx, Vy, x, y, t: Double;
     d: Longword;
 begin
 ExplR:= 0;
--- a/hedgewars/uCollisions.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uCollisions.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -49,7 +49,7 @@
 function TestCollisionXwithGear(Gear: PGear; Dir: integer): boolean;
 function TestCollisionYwithGear(Gear: PGear; Dir: integer): boolean;
 function TestCollisionY(Gear: PGear; Dir: integer): boolean;
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: real; Dir: integer): boolean;
+function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: Double; Dir: integer): boolean;
 function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
 
 implementation
@@ -131,7 +131,7 @@
    end
 end;
 
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: real; Dir: integer): boolean;
+function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: Double; Dir: integer): boolean;
 begin
 Gear.X:= Gear.X + ShiftX;
 Gear.Y:= Gear.Y + ShiftY;
--- a/hedgewars/uConsole.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uConsole.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -163,7 +163,7 @@
 end;
 
 procedure ParseCommand(CmdStr: shortstring);
-type PReal = ^real;
+type PReal = ^Double;
 var i, ii: integer;
     s: shortstring;
     t: PVariable;
--- a/hedgewars/uGears.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uGears.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -52,7 +52,7 @@
              doStep: TGearStepProcedure;
              Radius: integer;
              Angle, Power : Cardinal;
-             DirAngle: real;
+             DirAngle: Double;
              Timer : LongWord;
              Elasticity: Real;
              Friction  : Real;
@@ -64,7 +64,7 @@
              Surf: PSDL_Surface;
              end;
 
-function  AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
+function  AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: Double=0.0; dY: Double=0.0; Timer: LongWord=0): PGear;
 procedure ProcessGears;
 procedure SetAllToActive;
 procedure SetAllHHToActive;
@@ -84,8 +84,8 @@
                 Count: Longword;
                 HookAngle: integer;
                 ar: array[0..300] of record
-                                  X, Y: real;
-                                  dLen: real;
+                                  X, Y: Double;
+                                  dLen: Double;
                                   b: boolean;
                                   end;
                  end;
@@ -130,7 +130,7 @@
                                                                doStepActionTimer
                                                                );
 
-function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
+function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: Double=0.0; dY: Double=0.0; Timer: LongWord=0): PGear;
 const Counter: Longword = 0;
 begin
 inc(Counter);
@@ -411,12 +411,12 @@
 procedure DrawGears(Surface: PSDL_Surface);
 var Gear: PGear;
     i: Longword;
-    roplen: real;
+    roplen: Double;
 
     procedure DrawRopeLine(X1, Y1, X2, Y2: integer);
     const nodlen = 5;
     var i, x, y: integer;
-        t, k, ladd: real;
+        t, k, ladd: Double;
     begin
     if (X1 = X2) and (Y1 = Y2) then
        begin
--- a/hedgewars/uLand.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uLand.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -66,9 +66,9 @@
 
 procedure DrawBezierEdge(var pa: TPixAr; Color: Longword);
 var x, y, i: integer;
-    tx, ty, vx, vy, vlen, t: real;
-    r1, r2, r3, r4: real;
-    x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: real;
+    tx, ty, vx, vy, vlen, t: Double;
+    r1, r2, r3, r4: Double;
+    x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: Double;
 begin
 vx:= 0;
 vy:= 0;
@@ -126,11 +126,11 @@
     end;
 end;
 
-procedure BezierizeEdge(var pa: TPixAr; Delta: real);
+procedure BezierizeEdge(var pa: TPixAr; Delta: Double);
 var x, y, i: integer;
-    tx, ty, vx, vy, vlen, t: real;
-    r1, r2, r3, r4: real;
-    x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: real;
+    tx, ty, vx, vy, vlen, t: Double;
+    r1, r2, r3, r4: Double;
+    x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: Double;
     opa: TPixAr;
 begin
 opa:= pa;
@@ -327,9 +327,9 @@
 
 procedure PointWave(var Template: TEdgeTemplate; var pa: TPixAr);
 const MAXPASSES = 32;
-var ar: array[0..MAXPASSES, 0..5] of real;
+var ar: array[0..MAXPASSES, 0..5] of Double;
     i, k: integer;
-    rx, ry, oy: real;
+    rx, ry, oy: Double;
     PassesNum: Longword;
 begin
 with Template do
@@ -512,7 +512,8 @@
 end;
 
 procedure LoadMap;
-var p, x, y, i: Longword;
+var x, y: Longword;
+    p: PByteArray;
 begin
 WriteLnToConsole('Loading land from file...');
 AddProgress;
@@ -522,32 +523,28 @@
 if SDL_MustLock(LandSurface) then
    SDLTry(SDL_LockSurface(LandSurface) >= 0, true);
 
-p:= Longword(LandSurface.pixels);
-i:= Longword(@Land);
+p:= LandSurface.pixels;
 case LandSurface.format.BytesPerPixel of
      1: OutError('We don''t work with 8 bit surfaces', true);
      2: for y:= 0 to 1023 do
             begin
             for x:= 0 to 2047 do
-                if PWord(p + x * 2)^ <> 0 then PLongWord(i + x * 4)^:= COLOR_LAND;
-            inc(i, 2048 * 4);
-            inc(p, LandSurface.pitch);
+                if PWord(@p[x * 2])^ <> 0 then Land[y, x]:= COLOR_LAND;
+            p:= @p[LandSurface.pitch];
             end;
      3: for y:= 0 to 1023 do
             begin
             for x:= 0 to 2047 do
-                if  (PByte(p + x * 3 + 0)^ <> 0)
-                 or (PByte(p + x * 3 + 1)^ <> 0)
-                 or (PByte(p + x * 3 + 2)^ <> 0) then PLongWord(i + x * 4)^:= COLOR_LAND;
-            inc(i, 2048 * 4);
-            inc(p, LandSurface.pitch);
+                if  (p[x * 3 + 0] <> 0)
+                 or (p[x * 3 + 1] <> 0)
+                 or (p[x * 3 + 2] <> 0) then Land[y, x]:= COLOR_LAND;
+            p:= @p[LandSurface.pitch];
             end;
      4: for y:= 0 to 1023 do
             begin
             for x:= 0 to 2047 do
-                if PLongword(p + x * 4)^ <> 0 then PLongWord(i + x * 4)^:= COLOR_LAND;
-            inc(i, 2048 * 4);
-            inc(p, LandSurface.pitch);
+                if PLongword(@p[x * 4])^ <> 0 then Land[y, x]:= COLOR_LAND;
+            p:= @p[LandSurface.pitch];
             end;
      end;
 if SDL_MustLock(LandSurface) then
--- a/hedgewars/uLandGraphics.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uLandGraphics.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -8,7 +8,7 @@
 
 procedure DrawExplosion(X, Y, Radius: integer);
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: integer; y, dY: integer; Count: Byte);
-procedure DrawTunnel(X, Y, dX, dY: real; ticks, HalfWidth: integer);
+procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
 procedure FillRoundInLand(X, Y, Radius: integer; Value: Longword);
 
 implementation
@@ -186,8 +186,8 @@
 //
 //  - (dX, dY) - direction, vector of length = 0.5
 //
-procedure DrawTunnel(X, Y, dX, dY: real; ticks, HalfWidth: integer);
-var nx, ny: real;
+procedure DrawTunnel(X, Y, dX, dY: Double; ticks, HalfWidth: integer);
+var nx, ny: Double;
     i, t, tx, ty: integer;
 begin  // (-dY, dX) is (dX, dY) turned by PI/2
 if SDL_MustLock(LandSurface) then
--- a/hedgewars/uLandObjects.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uLandObjects.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -73,7 +73,7 @@
     RectCount: Longword;
 
 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image, Surface: PSDL_Surface);
-var i, p: LongWord;
+var p: PByteArray;
     x, y: Longword;
     bpp: integer;
     r: TSDL_Rect;
@@ -88,31 +88,28 @@
 
 bpp:= Image.format.BytesPerPixel;
 WriteToConsole('('+inttostr(bpp)+') ');
-p:= LongWord(Image.pixels);
+p:= Image.pixels;
 case bpp of
      1: OutError('We don''t work with 8 bit surfaces', true);
      2: for y:= 0 to Pred(Image.h) do
             begin
-            i:= Longword(@Land[cpY + y, cpX]);
             for x:= 0 to Pred(Image.w) do
-                if PWord(p + x * 2)^ <> 0 then PLongWord(i + x * 4)^:= COLOR_LAND;
-            inc(p, Image.pitch);
+                if PWord(@p[x * 2])^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
+            p:= @p[Image.pitch];
             end;
      3: for y:= 0 to Pred(Image.h) do
             begin
-            i:= Longword(@Land[cpY + y, cpX]);
             for x:= 0 to Pred(Image.w) do
-                if  (PByte(p + x * 3 + 0)^ <> 0)
-                 or (PByte(p + x * 3 + 1)^ <> 0)
-                 or (PByte(p + x * 3 + 2)^ <> 0) then PLongWord(i + x * 4)^:= COLOR_LAND;
-            inc(p, Image.pitch);
+                if  (p[x * 3 + 0] <> 0)
+                 or (p[x * 3 + 1] <> 0)
+                 or (p[x * 3 + 2] <> 0) then Land[cpY + y, cpX + x]:= COLOR_LAND;
+            p:= @p[Image.pitch];
             end;
      4: for y:= 0 to Pred(Image.h) do
             begin
-            i:= Longword(@Land[cpY + y, cpX]);
             for x:= 0 to Pred(Image.w) do
-                if PLongword(p + x * 4)^ <> 0 then PLongWord(i + x * 4)^:= COLOR_LAND;
-            inc(p, Image.pitch);
+                if PLongword(@p[x * 4])^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
+            p:= @p[Image.pitch];
             end;
      end;
 if SDL_MustLock(Image) then
--- a/hedgewars/uLandTemplates.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uLandTemplates.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -43,8 +43,8 @@
                      BasePointsCount: Longword;
                      BezPassCnt: Longword; 
                      PassMin, PassDelta: Longword;
-                     WaveAmplMin, WaveAmplDelta: real;
-                     WaveFreqMin, WaveFreqDelta: real;
+                     WaveAmplMin, WaveAmplDelta: Double;
+                     WaveFreqMin, WaveFreqDelta: Double;
                      FillPoints: PPointArray;
                      FillPointsCount: Longword;
                      canMirror, canFlip: boolean;
--- a/hedgewars/uMisc.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uMisc.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -97,14 +97,14 @@
 
     AttackBar: integer = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
 
-function Sign(r: real): integer;
+function Sign(r: Double): integer;
 function Min(a, b: integer): integer;
 function Max(a, b: integer): integer;
 procedure OutError(Msg: String; const isFatalError: boolean=false);
 procedure TryDo(Assert: boolean; Msg: string; isFatal: boolean);
 procedure SDLTry(Assert: boolean; isFatal: boolean);
 function IntToStr(n: integer): shortstring;
-function FloatToStr(n: real): shortstring;
+function FloatToStr(n: Double): shortstring;
 function DxDy2Angle32(const _dY, _dX: Extended): integer;
 function DxDy2AttackAngle(const _dY, _dX: Extended): integer;
 procedure AdjustColor(var Color: Longword);
@@ -113,7 +113,7 @@
 function RectToStr(Rect: TSDL_Rect): shortstring;
 {$ENDIF}
 {$IFNDEF FPC}
-function arctan2(const Y, X: real): real;
+function arctan2(const Y, X: Double): Double;
 {$ENDIF}
 
 var CursorPoint: TPoint;
@@ -126,7 +126,7 @@
 {$ENDIF}
 
 
-function Sign(r: real): integer;
+function Sign(r: Double): integer;
 begin
 if r < 0 then Result:= -1 else Result:= 1
 end;
@@ -173,13 +173,13 @@
 str(n, Result)
 end;
 
-function FloatToStr(n: real): shortstring;
+function FloatToStr(n: Double): shortstring;
 begin
 str(n:5:5, Result)
 end;
 
 {$IFNDEF FPC}
-function arctan2(const Y, X: real): real;
+function arctan2(const Y, X: Double): Double;
 asm
         fld     Y
         fld     X
--- a/hedgewars/uRandom.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uRandom.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -35,7 +35,7 @@
 interface
 
 procedure SetRandomSeed(Seed: shortstring);
-function  GetRandom: real; overload;
+function  GetRandom: Double; overload;
 function  GetRandom(m: LongWord): LongWord; overload;
 
 implementation
@@ -66,7 +66,7 @@
 for i:= 0 to 1024 do GetNext;
 end;
 
-function GetRandom: real;
+function GetRandom: Double;
 begin
 Result:= frac( GetNext * 0.0007301 + GetNext * 0.003019)
 end;
--- 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;
--- a/hedgewars/uWorld.pas	Thu Aug 10 22:19:35 2006 +0000
+++ b/hedgewars/uWorld.pas	Fri Aug 11 16:17:50 2006 +0000
@@ -82,7 +82,7 @@
 var i, t: integer;
     r: TSDL_Rect;
     team: PTeam;
-    tdx, tdy: real;
+    tdx, tdy: Double;
 
     procedure DrawRepeated(spr: TSprite; Shift: integer);
     var i, w: integer;