Introduce hwengine-future library, use Land allocated in it transitional_engine
authorunC0Rr
Mon, 02 Jan 2023 15:59:26 +0100
branchtransitional_engine
changeset 15900 128ace913837
parent 15899 73cdc306888f
child 15901 f39f0f614dbf
Introduce hwengine-future library, use Land allocated in it
CMakeLists.txt
hedgewars/SDLh.pas
hedgewars/options.inc
hedgewars/uAIAmmoTests.pas
hedgewars/uAIMisc.pas
hedgewars/uChat.pas
hedgewars/uCollisions.pas
hedgewars/uCommandHandlers.pas
hedgewars/uCommands.pas
hedgewars/uDebug.pas
hedgewars/uFloat.pas
hedgewars/uGearsHandlers.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHandlersRope.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsRender.pas
hedgewars/uGearsUtils.pas
hedgewars/uInputHandler.pas
hedgewars/uLand.pas
hedgewars/uLandGenMaze.pas
hedgewars/uLandGenPerlin.pas
hedgewars/uLandGenTemplateBased.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uLandOutline.pas
hedgewars/uLandTexture.pas
hedgewars/uLandUtils.pas
hedgewars/uMisc.pas
hedgewars/uRandom.pas
hedgewars/uRender.pas
hedgewars/uRenderUtils.pas
hedgewars/uScript.pas
hedgewars/uStore.pas
hedgewars/uTouch.pas
hedgewars/uTypes.pas
hedgewars/uUtils.pas
hedgewars/uVariables.pas
hedgewars/uVisualGears.pas
hedgewars/uVisualGearsHandlers.pas
hedgewars/uVisualGearsList.pas
hedgewars/uWorld.pas
rust/land2d/Cargo.toml
rust/lib-hwengine-future/Cargo.toml
rust/lib-hwengine-future/src/lib.rs
--- a/CMakeLists.txt	Tue Dec 13 21:21:55 2022 +0100
+++ b/CMakeLists.txt	Mon Jan 02 15:59:26 2023 +0100
@@ -139,10 +139,10 @@
     add_flag_append(CMAKE_CXX_FLAGS_DEBUG "/Od")    
 else()
     add_flag_append(CMAKE_C_FLAGS "-Wall -pipe")
-    add_flag_append(CMAKE_C_FLAGS_RELEASE "-O2")
+    add_flag_append(CMAKE_C_FLAGS_RELEASE "-O3")
     add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0")
     add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe")
-    add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-O2")
+    add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-O3")
     add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")    
 endif()       
 
--- a/hedgewars/SDLh.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/SDLh.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -1142,7 +1142,7 @@
 procedure SDL_SetEventFilter(filter: TSDL_EventFilter); cdecl; external SDLLibName;
 
 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
-procedure SDL_WarpMouse(x, y: Word); inline;
+procedure SDL_WarpMouse(x, y: Word); 
 
 function  SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
 
@@ -1297,7 +1297,7 @@
 // for sdl2 we provide a SDL_WarpMouse() which calls the right SDL_WarpMouseInWindow() function
 // this has the advantage of reducing 'uses' and 'ifdef' statements
 // (SDLwindow is a private member of uStore module)
-procedure SDL_WarpMouse(x, y: Word); inline;
+procedure SDL_WarpMouse(x, y: Word); 
 begin
     WarpMouse(x, y);
 end;
--- a/hedgewars/options.inc	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/options.inc	Mon Jan 02 15:59:26 2023 +0100
@@ -65,6 +65,8 @@
 {$DEFINE _S:=}
 {$DEFINE _P:=}
 
+{$optimization autoInline}
+
 //{$DEFINE TRACEAIACTIONS}
 //{$DEFINE COUNTTICKS}
 
--- a/hedgewars/uAIAmmoTests.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uAIAmmoTests.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -25,7 +25,7 @@
     amtest_Rare            = $00000001; // check only several positions
     amtest_NoTarget        = $00000002; // each pos, but no targetting
     amtest_MultipleAttacks = $00000004; // test could result in multiple attacks, set AttacksNum
-    amtest_NoTrackFall     = $00000008; // skip fall tracing.  
+    amtest_NoTrackFall     = $00000008; // skip fall tracing.
     amtest_LaserSight      = $00000010; // supports laser sighting
     amtest_NoVampiric      = $00000020; // don't use vampirism with this ammo
     amtest_NoInvulnerable  = $00000040; // don't use invulnerable with this with ammo
@@ -151,9 +151,9 @@
             );
 
 implementation
-uses uVariables, uUtils, uGearsHandlers;
+uses uVariables, uUtils, uGearsHandlers, uLandUtils;
 
-function Metric(x1, y1, x2, y2: LongInt): LongInt; inline;
+function Metric(x1, y1, x2, y2: LongInt): LongInt;
 begin
 Metric:= abs(x1 - x2) + abs(y1 - y2)
 end;
@@ -1081,7 +1081,7 @@
 
 if ((ix and LAND_WIDTH_MASK) = 0) and ((iy and LAND_HEIGHT_MASK) = 0) then
     repeat
-        if Land[iy, ix] <> 0 then
+        if LandGet(iy, ix) <> 0 then
             inc(d);
         x:= x + vX;
         y:= y + vY;
@@ -1137,7 +1137,7 @@
     x:= x + vX;
     y:= y + vY;
     if ((trunc(x) and LAND_WIDTH_MASK) = 0)and((trunc(y) and LAND_HEIGHT_MASK) = 0)
-    and (Land[trunc(y), trunc(x)] <> 0) then
+    and (LandGet(trunc(y), trunc(x)) <> 0) then
         inc(d);
 until (Abs(Targ.Point.X - trunc(x)) + Abs(Targ.Point.Y - trunc(y)) < 4)
     or (x < 0)
--- a/hedgewars/uAIMisc.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uAIMisc.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -71,20 +71,20 @@
 procedure freeModule;
 
 procedure FillTargets;
-procedure ResetTargets; inline;
-procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt); inline;
+procedure ResetTargets;
+procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt);
 procedure FillBonuses(isAfterAttack: boolean);
-procedure AwareOfExplosion(x, y, r: LongInt); inline;
+procedure AwareOfExplosion(x, y, r: LongInt);
 
 function  RatePlace(Gear: PGear): LongInt;
-function  CheckWrap(x: real): real; inline;
-function  TestColl(x, y, r: LongInt): boolean; inline;
-function  TestCollHogsOrObjects(x, y, r: LongInt): boolean; inline;
-function  TestCollExcludingObjects(x, y, r: LongInt): boolean; inline;
-function  TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
+function  CheckWrap(x: real): real;
+function  TestColl(x, y, r: LongInt): boolean;
+function  TestCollHogsOrObjects(x, y, r: LongInt): boolean;
+function  TestCollExcludingObjects(x, y, r: LongInt): boolean;
+function  TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean;
 
-function  RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline;
-function  RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; inline;
+function  RateExplosion(Me: PGear; x, y, r: LongInt): LongInt;
+function  RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;
 function  RealRateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;
 function  RateShove(Me: PGear; x, y, r, power, kick: LongInt; gdX, gdY: real; Flags: LongWord): LongInt;
 function  RateShotgun(Me: PGear; gdX, gdY: real; x, y: LongInt): LongInt;
@@ -93,8 +93,8 @@
 function  RateHammer(Me: PGear): LongInt;
 
 function  HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean;
-function  AIrndSign(num: LongInt): LongInt; inline;
-function  AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline;
+function  AIrndSign(num: LongInt): LongInt;
+function  AIrndOffset(targ: TTarget; Level: LongWord): LongInt;
 
 var ThinkingHH: PGear;
     Targets: TTargets;
@@ -109,14 +109,14 @@
 var dmgMod: real = 1.0;
 
 implementation
-uses uCollisions, uVariables, uUtils, uGearsUtils, uAIAmmoTests;
+uses uCollisions, uVariables, uUtils, uGearsUtils, uAIAmmoTests, uLandUtils;
 
 var
     KnownExplosion: record
         X, Y, Radius: LongInt
         end = (X: 0; Y: 0; Radius: 0);
 
-procedure ResetTargets; inline;
+procedure ResetTargets;
 var i: LongWord;
 begin
 if Targets.reset then
@@ -200,7 +200,7 @@
 else friendlyfactor:= max(30, 300 - f * 80 div max(1,e))
 end;
 
-procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt); inline;
+procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt);
 begin
 if(bonuses.Count < MAXBONUS) then
     begin
@@ -212,7 +212,7 @@
     end;
 end;
 
-procedure AddWalkBonus(x, y: LongInt; r: Longword; s: LongInt); inline;
+procedure AddWalkBonus(x, y: LongInt; r: Longword; s: LongInt);
 begin
 if(walkbonuses.Count < MAXBONUS div 8) then
     begin
@@ -334,7 +334,7 @@
     end;
 end;
 
-procedure AwareOfExplosion(x, y, r: LongInt); inline;
+procedure AwareOfExplosion(x, y, r: LongInt);
 begin
     KnownExplosion.X:= x;
     KnownExplosion.Y:= y;
@@ -363,17 +363,17 @@
     RatePlace:= rate;
 end;
 
-function CheckWrap(x: real): real; inline;
+function CheckWrap(x: real): real;
 begin
     if WorldEdge = weWrap then
         if (x < leftX) then
              x:= x + (rightX - leftX)
-        else if x > rightX then    
+        else if x > rightX then
              x:= x - (rightX - leftX);
     CheckWrap:= x;
 end;
 
-function CheckBounds(x, y, r: Longint): boolean; inline;
+function CheckBounds(x, y, r: Longint): boolean;
 begin
     CheckBounds := (((x-r) and LAND_WIDTH_MASK) = 0) and
         (((x+r) and LAND_WIDTH_MASK) = 0) and
@@ -383,60 +383,60 @@
 
 
 // Check for collision with anything
-function TestCollWithEverything(x, y, r: LongInt): boolean; inline;
+function TestCollWithEverything(x, y, r: LongInt): boolean;
 begin
     if not CheckBounds(x, y, r) then
         exit(false);
 
-    if (Land[y-r, x-r] <> 0) or
-       (Land[y+r, x-r] <> 0) or
-       (Land[y-r, x+r] <> 0) or
-       (Land[y+r, x+r] <> 0) then
+    if (LandGet(y-r, x-r) <> 0) or
+       (LandGet(y+r, x-r) <> 0) or
+       (LandGet(y-r, x+r) <> 0) or
+       (LandGet(y+r, x+r) <> 0) then
        exit(true);
 
     TestCollWithEverything := false;
 end;
 
 // Check for collision with non-objects
-function TestCollExcludingObjects(x, y, r: LongInt): boolean; inline;
+function TestCollExcludingObjects(x, y, r: LongInt): boolean;
 begin
     if not CheckBounds(x, y, r) then
         exit(false);
 
-    if (Land[y-r, x-r] > lfAllObjMask) or
-       (Land[y+r, x-r] > lfAllObjMask) or
-       (Land[y-r, x+r] > lfAllObjMask) or
-       (Land[y+r, x+r] > lfAllObjMask) then
+    if (LandGet(y-r, x-r) > lfAllObjMask) or
+       (LandGet(y+r, x-r) > lfAllObjMask) or
+       (LandGet(y-r, x+r) > lfAllObjMask) or
+       (LandGet(y+r, x+r) > lfAllObjMask) then
        exit(true);
 
     TestCollExcludingObjects:= false;
 end;
 
 // Check for collision with something other than current hedgehog or crate
-function TestColl(x, y, r: LongInt): boolean; inline;
+function TestColl(x, y, r: LongInt): boolean;
 begin
     if not CheckBounds(x, y, r) then
         exit(false);
 
-    if (Land[y-r, x-r] and lfNotCurHogCrate <> 0) or
-       (Land[y+r, x-r] and lfNotCurHogCrate <> 0) or
-       (Land[y-r, x+r] and lfNotCurHogCrate <> 0) or
-       (Land[y+r, x+r] and lfNotCurHogCrate <> 0) then
+    if (LandGet(y-r, x-r) and lfNotCurHogCrate <> 0) or
+       (LandGet(y+r, x-r) and lfNotCurHogCrate <> 0) or
+       (LandGet(y-r, x+r) and lfNotCurHogCrate <> 0) or
+       (LandGet(y+r, x+r) and lfNotCurHogCrate <> 0) then
        exit(true);
 
     TestColl:= false;
 end;
 
 // Check for collision with hedgehog or object
-function TestCollHogsOrObjects(x, y, r: LongInt): boolean; inline;
+function TestCollHogsOrObjects(x, y, r: LongInt): boolean;
 begin
     if not CheckBounds(x, y, r) then
         exit(false);
 
-    if (Land[y-r, x-r] and lfAllObjMask <> 0) or
-       (Land[y+r, x-r] and lfAllObjMask <> 0) or
-       (Land[y-r, x+r] and lfAllObjMask <> 0) or
-       (Land[y+r, x+r] and lfAllObjMask <> 0) then
+    if (LandGet(y-r, x-r) and lfAllObjMask <> 0) or
+       (LandGet(y+r, x-r) and lfAllObjMask <> 0) or
+       (LandGet(y-r, x+r) and lfAllObjMask <> 0) or
+       (LandGet(y+r, x+r) and lfAllObjMask <> 0) then
        exit(true);
 
     TestCollHogsOrObjects:= false;
@@ -445,7 +445,7 @@
 // Check for collision with something other than the given "Me" gear.
 // Wrapper to test various approaches.  If it works reasonably, will just replace.
 // Right now, converting to hwFloat is a tad inefficient since the x/y were hwFloat to begin with...
-function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean; inline;
+function TestCollExcludingMe(Me: PGear; x, y, r: LongInt): boolean;
 var MeX, MeY: LongInt;
 begin
     if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
@@ -453,7 +453,7 @@
         MeX:= hwRound(Me^.X);
         MeY:= hwRound(Me^.Y);
         // We are still inside the hog. Skip radius test
-        if ((sqr(x-MeX) + sqr(y-MeY)) < 256) and (Land[y, x] and lfObjMask = 0) then
+        if ((sqr(x-MeX) + sqr(y-MeY)) < 256) and (LandGet(y, x) and lfObjMask = 0) then
             exit(false);
     end;
     TestCollExcludingMe:= TestCollWithEverything(x, y, r)
@@ -566,12 +566,12 @@
     end;
 end;
 
-function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt; inline;
+function RateExplosion(Me: PGear; x, y, r: LongInt): LongInt;
 begin
     RateExplosion:= RealRateExplosion(Me, x, y, r, 0);
     ResetTargets;
 end;
-function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt; inline;
+function RateExplosion(Me: PGear; x, y, r: LongInt; Flags: LongWord): LongInt;
 begin
     RateExplosion:= RealRateExplosion(Me, x, y, r, Flags);
     ResetTargets;
@@ -637,7 +637,7 @@
                     if pY - y < 0 then dY:= -dY;
 
                     if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and
-                       (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then
+                       (LandGet(y+cHHRadius+2, x) and lfIndestructible <> 0) then
                          fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, 0, Targets.ar[i]) * dmgMod)
                     else fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, erasure, Targets.ar[i]) * dmgMod)
                     end;
@@ -831,7 +831,7 @@
                         ((abs(dY) < 0.15) and (abs(dX) < 0.15))) then
                        dX:= 0;
                     if (x and LAND_WIDTH_MASK = 0) and ((y+cHHRadius+2) and LAND_HEIGHT_MASK = 0) and
-                       (Land[y+cHHRadius+2, x] and lfIndestructible <> 0) then
+                       (LandGet(y+cHHRadius+2, x) and lfIndestructible <> 0) then
                          fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, 0, Targets.ar[i]) * dmgMod)
                     else fallDmg:= trunc(TraceFall(x, y, pX, pY, dX, dY, erasure, Targets.ar[i]) * dmgMod)
                     end;
@@ -1206,7 +1206,7 @@
 HHJump(AltGear, jmpHJump, GoInfo);
 end;
 
-function AIrndSign(num: LongInt): LongInt; inline;
+function AIrndSign(num: LongInt): LongInt;
 begin
 if random(2) = 0 then
     AIrndSign:=   num
@@ -1214,7 +1214,7 @@
     AIrndSign:= - num
 end;
 
-function AIrndOffset(targ: TTarget; Level: LongWord): LongInt; inline;
+function AIrndOffset(targ: TTarget; Level: LongWord): LongInt;
 begin
 if Level <> 1 then exit(0);
 // at present level 2 doesn't track falls on most things
--- a/hedgewars/uChat.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uChat.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -105,7 +105,7 @@
 procedure UpdateCursorCoords(); forward;
 
 // relevant for UTF-8 handling
-function IsFirstCharByte(c: char): boolean; inline;
+function IsFirstCharByte(c: char): boolean; 
 begin
     // based on https://en.wikipedia.org/wiki/UTF-8#Description
     IsFirstCharByte:= (byte(c) and $C0) <> $80;
--- a/hedgewars/uCollisions.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uCollisions.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -70,11 +70,11 @@
 function  CheckGearsLineCollision(Gear: PGear; oX, oY, tX, tY: hwFloat): PGearArray;
 function  CheckAllGearsLineCollision(SourceGear: PGear; oX, oY, tX, tY: hwFloat): PGearArray;
 
-function  UpdateHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
-function  UpdateHitOrder(Gear: PGear; Order: LongInt; Global: boolean): boolean; inline;
-function  UpdateGlobalHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
-procedure ClearHitOrderLeq(MinOrder: LongInt); inline;
-procedure ClearGlobalHitOrderLeq(MinOrder: LongInt); inline;
+function  UpdateHitOrder(Gear: PGear; Order: LongInt): boolean;
+function  UpdateHitOrder(Gear: PGear; Order: LongInt; Global: boolean): boolean;
+function  UpdateGlobalHitOrder(Gear: PGear; Order: LongInt): boolean;
+procedure ClearHitOrderLeq(MinOrder: LongInt);
+procedure ClearGlobalHitOrderLeq(MinOrder: LongInt);
 procedure ClearHitOrder();
 
 procedure RefillProximityCache(SourceGear: PGear; radius: LongInt);
@@ -84,16 +84,16 @@
 function  TestCollisionXImpl(centerX, centerY, radius, direction: LongInt; collisionMask: Word): Word;
 function  TestCollisionYImpl(centerX, centerY, radius, direction: LongInt; collisionMask: Word): Word;
 
-function  TestCollisionXwithGear(Gear: PGear; Dir: LongInt): Word; inline;
-function  TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word; inline;
+function  TestCollisionXwithGear(Gear: PGear; Dir: LongInt): Word;
+function  TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word;
 
-function  TestCollisionX(Gear: PGear; Dir: LongInt): Word; inline;
-function  TestCollisionY(Gear: PGear; Dir: LongInt): Word; inline;
+function  TestCollisionX(Gear: PGear; Dir: LongInt): Word;
+function  TestCollisionY(Gear: PGear; Dir: LongInt): Word;
 
-function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): Word; inline;
-function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word; inline;
-function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): Word; inline;
-function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word; inline;
+function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): Word;
+function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word;
+function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): Word;
+function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word;
 
 function  TestCollisionXKickImpl(centerX, centerY, radius, direction: LongInt; collisionMask, kickMask: Word): TKickTest;
 function  TestCollisionYKickImpl(centerX, centerY, radius, direction: LongInt; collisionMask, kickMask: Word): TKickTest;
@@ -103,7 +103,7 @@
 
 function  TestRectangleForObstacle(x1, y1, x2, y2: LongInt; landOnly: boolean): boolean;
 
-function  CheckCoordInWater(X, Y: LongInt): boolean; inline;
+function  CheckCoordInWater(X, Y: LongInt): boolean;
 
 // returns: negative sign if going downhill to left, value is steepness (noslope/error = _0, 45 = _0_5)
 function  CalcSlopeBelowGear(Gear: PGear): hwFloat;
@@ -113,7 +113,7 @@
 function CheckGearsUnderSprite(Sprite: TSprite; sprX, sprY, Frame: LongInt): boolean;
 
 implementation
-uses uConsts, uLandGraphics, uVariables, SDLh, uLandTexture, uDebug;
+uses uConsts, uLandGraphics, uVariables, SDLh, uLandTexture, uDebug, uLandUtils;
 
 type TCollisionEntry = record
     X, Y, Radius: LongInt;
@@ -159,7 +159,7 @@
     end;
 end;
 
-function CheckCoordInWater(X, Y: LongInt): boolean; inline;
+function CheckCoordInWater(X, Y: LongInt): boolean;
 begin
     CheckCoordInWater:= (Y > cWaterLine)
         or ((WorldEdge = weSea) and ((X < leftX) or (X > rightX)));
@@ -221,7 +221,7 @@
 
 function LineCollisionTest(oX, oY, dirX, dirY, dirNormSqr, dirNormBound: hwFloat;
         width: LongInt; Gear: PGear):
-    TLineCollision; inline;
+    TLineCollision;
 var toCenterX, toCenterY, r,
     b, bSqr, c, desc, t: hwFloat;
     realT: extended;
@@ -367,12 +367,12 @@
     end
 end;
 
-function UpdateHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
+function UpdateHitOrder(Gear: PGear; Order: LongInt): boolean;
 begin
     UpdateHitOrder := UpdateHitOrderImpl(@ordera, Gear, Order);
 end;
 
-function UpdateHitOrder(Gear: PGear; Order: LongInt; Global: boolean): boolean; inline;
+function UpdateHitOrder(Gear: PGear; Order: LongInt; Global: boolean): boolean;
 begin
     if Global then
         UpdateHitOrder := UpdateHitOrderImpl(@globalordera, Gear, Order)
@@ -380,7 +380,7 @@
         UpdateHitOrder := UpdateHitOrderImpl(@ordera, Gear, Order)
 end;
 
-function UpdateGlobalHitOrder(Gear: PGear; Order: LongInt): boolean; inline;
+function UpdateGlobalHitOrder(Gear: PGear; Order: LongInt): boolean;
 begin
     UpdateGlobalHitOrder := UpdateHitOrderImpl(@globalordera, Gear, Order);
 end;
@@ -408,12 +408,12 @@
     end
 end;
 
-procedure ClearHitOrderLeq(MinOrder: LongInt); inline;
+procedure ClearHitOrderLeq(MinOrder: LongInt);
 begin
     ClearHitOrderLeqImpl(@ordera, MinOrder);
 end;
 
-procedure ClearGlobalHitOrderLeq(MinOrder: LongInt); inline;
+procedure ClearGlobalHitOrderLeq(MinOrder: LongInt);
 begin
     ClearHitOrderLeqImpl(@globalordera, MinOrder);
 end;
@@ -480,8 +480,8 @@
         minY := max(centerY - radius + 1, 0);
         maxY := min(centerY + radius - 1, LAND_HEIGHT - 1);
         for y := minY to maxY do
-            if Land[y, x] and collisionMask <> 0 then
-                exit(Land[y, x] and collisionMask);
+            if LandGet(y, x) and collisionMask <> 0 then
+                exit(LandGet(y, x) and collisionMask);
     end;
     TestCollisionXImpl := 0;
 end;
@@ -499,18 +499,18 @@
         minX := max(centerX - radius + 1, 0);
         maxX := min(centerX + radius - 1, LAND_WIDTH - 1);
         for x := minX to maxX do
-            if Land[y, x] and collisionMask <> 0 then
-                exit(Land[y, x] and collisionMask);
+            if LandGet(y, x) and collisionMask <> 0 then
+                exit(LandGet(y, x) and collisionMask);
     end;
     TestCollisionYImpl := 0;
 end;
 
-function TestCollisionX(Gear: PGear; Dir: LongInt): Word; inline;
+function TestCollisionX(Gear: PGear; Dir: LongInt): Word;
 begin
     TestCollisionX := TestCollisionXImpl(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, Dir, Gear^.CollisionMask and lfLandMask);
 end;
 
-function TestCollisionY(Gear: PGear; Dir: LongInt): Word; inline;
+function TestCollisionY(Gear: PGear; Dir: LongInt): Word;
 begin
     TestCollisionY := TestCollisionYImpl(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, Dir, Gear^.CollisionMask and lfLandMask);
 end;
@@ -533,19 +533,19 @@
         Gear^.CollisionMask:= lfAll;
 end;
 
-function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): Word; inline;
+function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): Word;
 begin
     LegacyFixupX(Gear);
     TestCollisionXwithGear:= TestCollisionXImpl(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, Dir, Gear^.CollisionMask);
 end;
 
-function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word; inline;
+function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): Word;
 begin
     LegacyFixupY(Gear);
     TestCollisionYwithGear:= TestCollisionYImpl(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Radius, Dir, Gear^.CollisionMask);
 end;
 
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word; inline;
+function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word;
 var collisionMask: Word;
 begin
     if withGear then
@@ -559,7 +559,7 @@
     TestCollisionXwithXYShift := TestCollisionXImpl(hwRound(Gear^.X + ShiftX), hwRound(Gear^.Y) + ShiftY, Gear^.Radius, Dir, collisionMask)
 end;
 
-function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word; inline;
+function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word;
 var collisionMask: Word;
 begin
     if withGear then
@@ -573,12 +573,12 @@
     TestCollisionYwithXYShift := TestCollisionYImpl(hwRound(Gear^.X) + ShiftX, hwRound(Gear^.Y) + ShiftY, Gear^.Radius, Dir, collisionMask)
 end;
 
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): Word; inline;
+function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): Word;
 begin
     TestCollisionXwithXYShift:= TestCollisionXwithXYShift(Gear, ShiftX, ShiftY, Dir, true);
 end;
 
-function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): Word; inline;
+function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): Word;
 begin
     TestCollisionYwithXYShift:= TestCollisionYwithXYShift(Gear, ShiftX, ShiftY, Dir, true);
 end;
@@ -599,16 +599,16 @@
         minY := max(centerY - radius + 1, 0);
         maxY := min(centerY + radius - 1, LAND_HEIGHT - 1);
         for y := minY to maxY do
-            if Land[y, x] and collisionMask <> 0 then
+            if LandGet(y, x) and collisionMask <> 0 then
             begin
                 TestCollisionXKickImpl.kick := false;
-                TestCollisionXKickImpl.collisionMask := Land[y, x] and collisionMask;
+                TestCollisionXKickImpl.collisionMask := LandGet(y, x) and collisionMask;
                 exit
             end
-            else if Land[y, x] and kickMask <> 0 then
+            else if LandGet(y, x) and kickMask <> 0 then
             begin
                 TestCollisionXKickImpl.kick := true;
-                TestCollisionXKickImpl.collisionMask := Land[y, x] and kickMask;
+                TestCollisionXKickImpl.collisionMask := LandGet(y, x) and kickMask;
             end;
     end;
 end;
@@ -629,16 +629,16 @@
         minX := max(centerX - radius + 1, 0);
         maxX := min(centerX + radius - 1, LAND_WIDTH - 1);
         for x := minX to maxX do
-            if Land[y, x] and collisionMask <> 0 then
+            if LandGet(y, x) and collisionMask <> 0 then
             begin
                 TestCollisionYKickImpl.kick := false;
-                TestCollisionYKickImpl.collisionMask := Land[y, x] and collisionMask;
+                TestCollisionYKickImpl.collisionMask := LandGet(y, x) and collisionMask;
                 exit
             end
-            else if Land[y, x] and kickMask <> 0 then
+            else if LandGet(y, x) and kickMask <> 0 then
             begin
                 TestCollisionYKickImpl.kick := true;
-                TestCollisionYKickImpl.collisionMask := Land[y, x] and kickMask;
+                TestCollisionYKickImpl.collisionMask := LandGet(y, x) and kickMask;
             end;
     end;
 end;
@@ -767,7 +767,7 @@
 
 for y := y1 to y2 do
     for x := x1 to x2 do
-        if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] > TestWord) then
+        if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (LandGet(y, x) > TestWord) then
             exit;
 
 TestRectangleForObstacle:= false
@@ -816,7 +816,7 @@
             tmpy:= collisionY + k * my;
 
             if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK) = 0) then
-                if (Land[tmpy,tmpx] > TestWord) then
+                if (LandGet(tmpy,tmpx) > TestWord) then
                     begin
                     // remember the index belonging to the first and last collision (if in 1st half)
                     if (i <> 0) then
@@ -867,7 +867,7 @@
                 tmpx:= ldx + k * offset[tmpo,0];
                 tmpy:= ldy + k * offset[tmpo,1];
                 if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK)  = 0)
-                and (Land[tmpy,tmpx] > TestWord) then
+                and (LandGet(tmpy,tmpx) > TestWord) then
                     begin
                     ldx:= tmpx;
                     ldy:= tmpy;
@@ -891,7 +891,7 @@
                 tmpx:= rdx + k * offset[tmpo,0];
                 tmpy:= rdy + k * offset[tmpo,1];
                 if (((tmpy) and LAND_HEIGHT_MASK) = 0) and (((tmpx) and LAND_WIDTH_MASK)  = 0)
-                and (Land[tmpy,tmpx] > TestWord) then
+                and (LandGet(tmpy,tmpx) > TestWord) then
                     begin
                     rdx:= tmpx;
                     rdy:= tmpy;
@@ -934,7 +934,7 @@
         i:= x + Gear^.Radius * 2 - 2;
         repeat
         if (x and LAND_WIDTH_MASK) = 0 then
-            if Land[y, x] <> 0 then
+            if LandGet(y, x) <> 0 then
                 if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
                     begin
                     isColl:= true;
@@ -957,7 +957,7 @@
         i:= y + Gear^.Radius * 2 - 2;
         repeat
         if (y and LAND_HEIGHT_MASK) = 0 then
-            if Land[y, x] <> 0 then
+            if LandGet(y, x) <> 0 then
                 if (not isColl) or (abs(y-gy) < abs(collY-gy)) then
                     begin
                     isColl:= true;
@@ -1026,7 +1026,7 @@
     i:= x + Gear^.Radius * 2 - 2;
     repeat
     if (x and LAND_WIDTH_MASK) = 0 then
-        if (Land[y, x] and lfLandMask) <> 0 then
+        if (LandGet(y, x) and lfLandMask) <> 0 then
             if (not isColl) or (abs(x-gx) < abs(collX-gx)) then
                 begin
                 isColl:= true;
--- a/hedgewars/uCommandHandlers.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uCommandHandlers.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -586,7 +586,7 @@
 
             if bShowAmmoMenu then
                 bShowAmmoMenu:= false
-            else if not(CurrentTeam^.Extdriven) and ((Gear = nil) or ((Gear^.State and (gstAttacking or gstAttacked)) <> 0)
+            else if ((Gear = nil) or ((Gear^.State and (gstAttacking or gstAttacked)) <> 0)
             or ((Gear^.State and gstHHDriven) = 0)) then
                 begin
                 end
--- a/hedgewars/uCommands.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uCommands.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -30,7 +30,7 @@
 procedure freeModule;
 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean; Rand: boolean);
 procedure RegisterVariable(Name: shortstring; p: TCommandHandler; Trusted: boolean);
-procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); inline;
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); 
 procedure ParseCommand(CmdStr: shortstring; TrustedSource, ExternalSource: boolean);
 procedure ParseTeamCommand(s: shortstring);
 procedure StopMessages(Message: Longword);
@@ -76,7 +76,7 @@
 end;
 
 
-procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); inline;
+procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean); 
 begin
     ParseCommand(CmdStr, TrustedSource, false)
 end;
--- a/hedgewars/uDebug.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uDebug.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -23,7 +23,7 @@
 interface
 
 procedure OutError(Msg: shortstring; isFatalError: boolean);
-//procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); inline;
+//procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); 
 function checkFails(Assert: boolean; Msg: shortstring; isFatal: boolean): boolean;
 function SDLCheck(Assert: boolean; Msg: shortstring; isFatal: boolean): boolean;
 
--- a/hedgewars/uFloat.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uFloat.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -56,45 +56,45 @@
 {$ENDIF}
 
 // Returns an hwFloat that represents the value of integer parameter i
-function int2hwFloat (const i: LongInt) : hwFloat; inline;
-function hwFloat2Float (const i: hwFloat) : extended; inline;
+function int2hwFloat (const i: LongInt) : hwFloat; 
+function hwFloat2Float (const i: hwFloat) : extended; 
 
 // The implemented operators
 
-operator = (const z1, z2: hwFloat) z : boolean; inline;
+operator = (const z1, z2: hwFloat) z : boolean; 
 {$IFDEF PAS2C}
-operator <> (const z1, z2: hwFloat) z : boolean; inline;
+operator <> (const z1, z2: hwFloat) z : boolean; 
 {$ENDIF}
-operator + (const z1, z2: hwFloat) z : hwFloat; inline;
-operator - (const z1, z2: hwFloat) z : hwFloat; inline;
-operator - (const z1: hwFloat) z : hwFloat; inline;
+operator + (const z1, z2: hwFloat) z : hwFloat; 
+operator - (const z1, z2: hwFloat) z : hwFloat; 
+operator - (const z1: hwFloat) z : hwFloat; 
 
-operator * (const z1, z2: hwFloat) z : hwFloat; inline;
-operator * (const z1: hwFloat; const z2: LongInt) z : hwFloat; inline;
-operator / (const z1: hwFloat; z2: hwFloat) z : hwFloat; inline;
-operator / (const z1: hwFloat; const z2: LongInt) z : hwFloat; inline;
+operator * (const z1, z2: hwFloat) z : hwFloat; 
+operator * (const z1: hwFloat; const z2: LongInt) z : hwFloat; 
+operator / (const z1: hwFloat; z2: hwFloat) z : hwFloat; 
+operator / (const z1: hwFloat; const z2: LongInt) z : hwFloat; 
 
-operator < (const z1, z2: hwFloat) b : boolean; inline;
-operator > (const z1, z2: hwFloat) b : boolean; inline;
+operator < (const z1, z2: hwFloat) b : boolean; 
+operator > (const z1, z2: hwFloat) b : boolean; 
 
 
 // Various functions for hwFloat (some are inlined in the resulting code for better performance)
 
 function cstr(const z: hwFloat): shortstring; // Returns a shortstring representations of the hwFloat.
-function hwRound(const t: hwFloat): LongInt; inline; // Does NOT really round but returns the integer representation of the hwFloat without fractional digits. (-_0_9 -> -0, _1_5 -> _1)
-function hwAbs(const t: hwFloat): hwFloat; inline; // Returns the value of t with positive sign.
-function hwSqr(const t: hwFloat): hwFloat; inline; // Returns the square value of parameter t.
-function hwSqrt1(const t: hwFloat): hwFloat; inline; // Returns the the positive square root of parameter t.
-function hwSqrt(const x: hwFloat): hwFloat; inline; // Returns the the positive square root of parameter t.
+function hwRound(const t: hwFloat): LongInt;  // Does NOT really round but returns the integer representation of the hwFloat without fractional digits. (-_0_9 -> -0, _1_5 -> _1)
+function hwAbs(const t: hwFloat): hwFloat;  // Returns the value of t with positive sign.
+function hwSqr(const t: hwFloat): hwFloat;  // Returns the square value of parameter t.
+function hwSqrt1(const t: hwFloat): hwFloat;  // Returns the the positive square root of parameter t.
+function hwSqrt(const x: hwFloat): hwFloat;  // Returns the the positive square root of parameter t.
 function Distance(const dx, dy: hwFloat): hwFloat; // Returns the distance between two points in 2-dimensional space, of which the parameters are the horizontal and vertical distance.
 function DistanceI(const dx, dy: LongInt): hwFloat; // Same as above for integer parameters.
 function AngleSin(const Angle: Longword): hwFloat;
 function AngleCos(const Angle: Longword): hwFloat;
 function vector2Angle(const x, y: hwFloat): LongInt;
-function SignAs(const num, signum: hwFloat): hwFloat; inline; // Returns an hwFloat with the value of parameter num and the sign of signum.
-function hwSign(r: hwFloat): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
-function hwSignf(r: real): LongInt; inline; // Returns an integer with value 1 and sign of parameter r.
-function isZero(const z: hwFloat): boolean; inline;
+function SignAs(const num, signum: hwFloat): hwFloat;  // Returns an hwFloat with the value of parameter num and the sign of signum.
+function hwSign(r: hwFloat): LongInt;  // Returns an integer with value 1 and sign of parameter r.
+function hwSignf(r: real): LongInt;  // Returns an integer with value 1 and sign of parameter r.
+function isZero(const z: hwFloat): boolean; 
 
 {$WARNINGS OFF}
 // some hwFloat constants
@@ -195,33 +195,33 @@
 uses uSinTable;
 
 
-function int2hwFloat (const i: LongInt) : hwFloat; inline;
+function int2hwFloat (const i: LongInt) : hwFloat; 
 begin
 int2hwFloat.isNegative:= i < 0;
 int2hwFloat.Round:= abs(i);
 int2hwFloat.Frac:= 0
 end;
 
-function hwFloat2Float (const i: hwFloat) : extended; inline;
+function hwFloat2Float (const i: hwFloat) : extended; 
 begin
 hwFloat2Float:= i.Frac / $100000000 + i.Round;
 if i.isNegative then
     hwFloat2Float:= -hwFloat2Float;
 end;
 
-operator = (const z1, z2: hwFloat) z : boolean; inline;
+operator = (const z1, z2: hwFloat) z : boolean; 
 begin
     z:= (z1.isNegative = z2.isNegative) and (z1.QWordValue = z2.QWordValue);
 end;
 
 {$IFDEF PAS2C}
-operator <> (const z1, z2: hwFloat) z : boolean; inline;
+operator <> (const z1, z2: hwFloat) z : boolean; 
 begin
     z:= (z1.isNegative <> z2.isNegative) or (z1.QWordValue <> z2.QWordValue);
 end;
 {$ENDIF}
 
-operator + (const z1, z2: hwFloat) z : hwFloat; inline;
+operator + (const z1, z2: hwFloat) z : hwFloat; 
 begin
 if z1.isNegative = z2.isNegative then
     begin
@@ -241,7 +241,7 @@
         end
 end;
 
-operator - (const z1, z2: hwFloat) z : hwFloat; inline;
+operator - (const z1, z2: hwFloat) z : hwFloat; 
 begin
 if z1.isNegative = z2.isNegative then
     if z1.QWordValue > z2.QWordValue then
@@ -261,12 +261,12 @@
     end
 end;
 
-function isZero(const z: hwFloat): boolean; inline;
+function isZero(const z: hwFloat): boolean; 
 begin
 isZero := z.QWordValue = 0;
 end;
 
-operator < (const z1, z2: hwFloat) b : boolean; inline;
+operator < (const z1, z2: hwFloat) b : boolean; 
 begin
 if z1.isNegative xor z2.isNegative then
     b:= z1.isNegative
@@ -277,7 +277,7 @@
         b:= (z2.QWordValue < z1.QWordValue) = z1.isNegative
 end;
 
-operator > (const z1, z2: hwFloat) b : boolean; inline;
+operator > (const z1, z2: hwFloat) b : boolean; 
 begin
 if z1.isNegative xor z2.isNegative then
     b:= z2.isNegative
@@ -288,14 +288,14 @@
         b:= (z1.QWordValue > z2.QWordValue) <> z2.isNegative
 end;
 
-operator - (const z1: hwFloat) z : hwFloat; inline;
+operator - (const z1: hwFloat) z : hwFloat; 
 begin
     z:= z1;
     z.isNegative:= not z.isNegative
 end;
 
 
-operator * (const z1, z2: hwFloat) z : hwFloat; inline;
+operator * (const z1, z2: hwFloat) z : hwFloat; 
 begin
     z.isNegative:= z1.isNegative xor z2.isNegative;
     
@@ -310,13 +310,13 @@
     end
 end;
 
-operator * (const z1: hwFloat; const z2: LongInt) z : hwFloat; inline;
+operator * (const z1: hwFloat; const z2: LongInt) z : hwFloat; 
 begin
     z.isNegative:= z1.isNegative xor (z2 < 0);
     z.QWordValue:= z1.QWordValue * abs(z2)
 end;
 
-operator / (const z1: hwFloat; z2: hwFloat) z : hwFloat; inline;
+operator / (const z1: hwFloat; z2: hwFloat) z : hwFloat; 
 var t: QWord;
 begin
     z.isNegative:= z1.isNegative xor z2.isNegative;
@@ -337,7 +337,7 @@
         end
 end;
 
-operator / (const z1: hwFloat; const z2: LongInt) z : hwFloat; inline;
+operator / (const z1: hwFloat; const z2: LongInt) z : hwFloat; 
 begin
     z.isNegative:= z1.isNegative xor (z2 < 0);
     z.QWordValue:= z1.QWordValue div abs(z2)
@@ -371,7 +371,7 @@
     hwAbs.isNegative:= false
 end;
 
-function hwSqr(const t: hwFloat): hwFloat; inline;
+function hwSqr(const t: hwFloat): hwFloat; 
 begin
     hwSqr.isNegative:= false;
     hwSqr.QWordValue:= ((QWord(t.Round) * t.Round) shl 32) + QWord(t.Round) * t.Frac * 2 + ((QWord(t.Frac) * t.Frac) shr 32);
--- a/hedgewars/uGearsHandlers.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsHandlers.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -36,13 +36,13 @@
                                      (x: 0;  y:  1),
                                      (x: -1; y:  0));
 
-procedure PrevAngle(Gear: PGear; dA: LongInt); inline;
+procedure PrevAngle(Gear: PGear; dA: LongInt); 
 begin
     inc(Gear^.WDTimer);
     Gear^.Angle := (LongInt(Gear^.Angle) - dA) and 3
 end;
 
-procedure NextAngle(Gear: PGear; dA: LongInt); inline;
+procedure NextAngle(Gear: PGear; dA: LongInt); 
 begin
     inc(Gear^.WDTimer);
     Gear^.Angle := (LongInt(Gear^.Angle) + dA) and 3
--- a/hedgewars/uGearsHandlersMess.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -152,7 +152,7 @@
 uses uConsts, uVariables, uVisualGearsList, uRandom, uCollisions, uGearsList, uUtils, uSound
     , SDLh, uScript, uGearsHedgehog, uGearsUtils, uIO, uCaptions, uLandGraphics
     , uGearsHandlers, uTextures, uRenderUtils, uAmmos, uTeams, uLandTexture
-    , uStore, uAI, uStats, uLocale;
+    , uStore, uAI, uStats, uLocale, uLandUtils;
 
 procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean);
 var
@@ -527,7 +527,7 @@
             end
         else if (collV < 0) and (collH < 0) and tdX.isNegative and tdY.isNegative then
             Gear^.dX.isNegative := false;
-       
+
         isFalling := false;
         Gear^.AdvBounce := 10;
         end;
@@ -883,45 +883,45 @@
         else if (cGravity.isNegative) and (yy < LAND_HEIGHT-1200) then
             move:=true
         // Solid pixel encountered
-        else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then
-            begin
-            lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible);
+        else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (LandGet(yy, xx) <> 0) then
+            begin
+            lf:= LandGet(yy, xx) and (lfObject or lfBasic or lfIndestructible);
             if lf = 0 then lf:= lfObject;
             // If there's room below keep falling
-            if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then
+            if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (LandGet(yy-1, xx) = 0) then
                 begin
                 X:= X - cWindSpeed * 1600 - dX;
                 end
             // If there's room below, on the sides, fill the gaps
-            else if (((yy-1) and LAND_HEIGHT_MASK) = 0) then 
+            else if (((yy-1) and LAND_HEIGHT_MASK) = 0) then
 		    begin
-		    if (((xx - 1) and LAND_WIDTH_MASK) = 0) and (Land[yy - 1, (xx - 1)] = 0) then
+		    if (((xx - 1) and LAND_WIDTH_MASK) = 0) and (LandGet(yy - 1, (xx - 1)) = 0) then
 		        begin
 		        X:= X - _0_8;
 		        Y:= oldY;
 		        end
-		    else if (((xx - 2) and LAND_WIDTH_MASK) = 0) and (Land[yy - 1, (xx - 2)] = 0) then
+		    else if (((xx - 2) and LAND_WIDTH_MASK) = 0) and (LandGet(yy - 1, (xx - 2)) = 0) then
 		        begin
 		        X:= X - _1_6;
 		        Y:= oldY;
 		        end
-		    else if (((xx + 1) and LAND_WIDTH_MASK) = 0) and (Land[yy - 1, (xx + 1)] = 0) then
+		    else if (((xx + 1) and LAND_WIDTH_MASK) = 0) and (LandGet(yy - 1, (xx + 1)) = 0) then
 		        begin
 		        X:= X + _0_8;
 		        Y:= oldY;
 		        end
-		    else if (((xx + 2) and LAND_WIDTH_MASK) = 0) and (Land[yy - 1, (xx + 2)] = 0) then
+		    else if (((xx + 2) and LAND_WIDTH_MASK) = 0) and (LandGet(yy - 1, (xx + 2)) = 0) then
 		        begin
 		        X:= X + _1_6;
 		        Y:= oldY;
 		        end else
-		    if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((Land[yy + 1, xx] and $FF) <> 0)) then 
-		       move:=true 
-		    else 
+		    if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((LandGet(yy + 1, xx) and $FF) <> 0)) then
+		       move:=true
+		    else
 		       draw:= true
 		    end
             // if there's an hog/object below do nothing
-            else if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((Land[yy+1, xx] and $FF) <> 0))
+            else if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((LandGet(yy+1, xx) and $FF) <> 0))
                 then move:=true
             else draw:= true
             end
@@ -948,7 +948,7 @@
                 for px:= 0 to Pred(s^.w) do
                     begin
                     lx:=xx + px; ly:=yy + py;
-                    if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then
+                    if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (LandGet(ly, lx) and $FF = 0) then
                         begin
                         rx:= lx;
                         ry:= ly;
@@ -956,19 +956,19 @@
                             begin
                             rx:= rx div 2;ry:= ry div 2;
                             end;
-                        if Land[yy + py, xx + px] <= lfAllObjMask then
+                        if LandGet(yy + py, xx + px) <= lfAllObjMask then
                             if gun then
                                 begin
                                 LandDirty[yy div 32, xx div 32]:= 1;
                                 if LandPixels[ry, rx] = 0 then
-                                    Land[ly, lx]:=  lfDamaged or lfObject
-                                else Land[ly, lx]:=  lfDamaged or lfBasic
+                                    LandSet(ly, lx, lfDamaged or lfObject)
+                                else LandSet(ly, lx, lfDamaged or lfBasic)
                                 end
-                            else Land[ly, lx]:= lf;
+                            else LandSet(ly, lx, lf);
                         if gun then
-                             LandPixels[ry, rx]:= (Gear^.Tint shr 24         shl RShift) or 
-                                                  (Gear^.Tint shr 16 and $FF shl GShift) or 
-                                                  (Gear^.Tint shr  8 and $FF shl BShift) or 
+                             LandPixels[ry, rx]:= (Gear^.Tint shr 24         shl RShift) or
+                                                  (Gear^.Tint shr 16 and $FF shl GShift) or
+                                                  (Gear^.Tint shr  8 and $FF shl BShift) or
                                                   (p^[px] and AMask)
                         else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]);
                         end
@@ -1519,7 +1519,7 @@
 
         if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then
         begin
-            LandFlags:= Land[y, x];
+            LandFlags:= LandGet(y, x);
             if LandFlags <> 0 then inc(Gear^.Damage);
             isDigging:= (LandFlags and lfLandMask) <> 0;
         end;
@@ -1761,7 +1761,7 @@
     if (Gear^.Timer mod 47) = 0 then
         begin
         // ok. this was an attempt to turn off dust if not actually drilling land.  I have no idea why it isn't working as expected
-        if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then
+        if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (LandGet(y + 12, x) > 255) then
             for i:= 0 to 1 do
                 AddVisualGear(x - 5 + Random(10), y + 12, vgtDust);
 
@@ -2193,7 +2193,7 @@
 
     // If in ready timer, or after turn, or in first 5 seconds of turn (really a window due to extra time utility)
     // or hunting is disabled due to seek radius of 0 then we aren't hunting
-    if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or 
+    if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or
         ((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or
         (Gear^.Angle = 0) then
         gear^.State:= gear^.State and (not gstChooseTarget)
@@ -3451,7 +3451,7 @@
     begin
         DeleteGear(Gear);
         exit
-    end; 
+    end;
 
     valid:= false;
 
@@ -4245,8 +4245,8 @@
         dec(playWidth, 2);
         for i:= 0 to LAND_HEIGHT - 1 do
             begin
-            Land[i, leftX] := 0;
-            Land[i, rightX] := 0;
+            LandSet(i, leftX, 0);
+            LandSet(i, rightX, 0);
             end;
         end;
 
@@ -4254,7 +4254,7 @@
         begin
         dec(cWaterLine);
         for i:= 0 to LAND_WIDTH - 1 do
-            Land[cWaterLine, i] := 0;
+            LandSet(cWaterLine, i, 0);
         SetAllToActive
         end;
 
@@ -5038,8 +5038,8 @@
     doPortalColorSwitch();
 
     // destroy portal if ground it was attached too is gone
-    if (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] <= lfAllObjMask)
-    or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] and lfBouncy <> 0)
+    if (LandGet(hwRound(Gear^.Y), hwRound(Gear^.X)) <= lfAllObjMask)
+    or (LandGet(hwRound(Gear^.Y), hwRound(Gear^.X)) and lfBouncy <> 0)
     or (Gear^.Timer < 1)
     or (Gear^.Hedgehog^.Team <> CurrentHedgehog^.Team)
     or CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
@@ -5406,12 +5406,12 @@
     ty := 0;
     // avoid compiler hints
 
-    if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] > 255) then
+    if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (LandGet(y, x) > 255) then
         begin
         Gear^.State := Gear^.State or gstCollision;
         Gear^.State := Gear^.State and (not gstMoving);
 
-        if (Land[y, x] and lfBouncy <> 0)
+        if (LandGet(y, x) and lfBouncy <> 0)
         or (not CalcSlopeTangent(Gear, x, y, tx, ty, 255))
         or (DistanceI(tx,ty) < _12) then // reject shots at too irregular terrain
             begin
@@ -5772,9 +5772,9 @@
             if (not CheckCoordInWater(rX, rY)) or (not CheckCoordInWater(x, y)) then
                 begin
                 if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0)
-                    and (Land[y, x] <> 0) then
+                    and (LandGet(y, x) <> 0) then
                         begin
-                        if ((GameFlags and gfSolidLand) <> 0) and (Land[y, x] > 255) then
+                        if ((GameFlags and gfSolidLand) <> 0) and (LandGet(y, x) > 255) then
                             Gear^.Damage := initHealth
                         else if justCollided then
                             begin
@@ -6652,7 +6652,7 @@
         ndY:= -AngleCos(HHGear^.Angle) * _4;
         if (ndX <> dX) or (ndY <> dY) or (Gear^.Message and (gmUp or gmDown) <> 0) or
            (((Target.X <> NoPointX) and (Target.X and LAND_WIDTH_MASK = 0) and
-             (Target.Y and LAND_HEIGHT_MASK = 0) and ((Land[Target.Y, Target.X] = 0)) and
+             (Target.Y and LAND_HEIGHT_MASK = 0) and ((LandGet(Target.Y, Target.X) = 0)) and
              (not CheckCoordInWater(Target.X, Target.Y))) and (CheckGearNear(gtAirMine, int2hwFloat(Target.X),int2hwFloat(Target.Y), Gear^.Radius*3, Gear^.Radius*3) = nil) and
              (not ((WorldEdge = weBounce) and ((Target.X > rightX) or (Target.X < leftX))))) then
             begin
@@ -6686,7 +6686,7 @@
                 else if CheckCoordInWater(Target.X, Target.Y) or
                         ((Target.X and LAND_WIDTH_MASK  = 0) and
                          (Target.Y and LAND_HEIGHT_MASK = 0) and
-                         (Land[Target.Y, Target.X] = lfIce) and
+                         (LandGet(Target.Y, Target.X) = lfIce) and
                          ((Target.Y+iceHeight+5 > cWaterLine) or
                           ((WorldEdge = weSea) and
                            ((Target.X+iceHeight+5 > rightX) or
@@ -6768,13 +6768,13 @@
                                 begin
                                 iter^.Damage:= 0;
                                 iter^.State:= iter^.State or gstFrozen;
-                                if (hwRound(iter^.X) < RightX-16) and (hwRound(iter^.X) > LeftX+16) and 
+                                if (hwRound(iter^.X) < RightX-16) and (hwRound(iter^.X) > LeftX+16) and
                                     (hwRound(iter^.Y) > topY+16) and (hwRound(iter^.Y) < LAND_HEIGHT-16) then
                                     begin
                                     AddCI(iter);
                                     iter^.X:= int2hwFloat(min(RightX-16,max(hwRound(iter^.X), LeftX+16)));
                                     iter^.Y:= int2hwFloat(min(LAND_HEIGHT-16,max(hwRound(iter^.Y),TopY+16)));
-                                    ForcePlaceOnLand(hwRound(iter^.X)-16, hwRound(iter^.Y)-16, sprFrozenAirMine, 0, lfIce, $FFFFFFFF, false, false, false);    
+                                    ForcePlaceOnLand(hwRound(iter^.X)-16, hwRound(iter^.Y)-16, sprFrozenAirMine, 0, lfIce, $FFFFFFFF, false, false, false);
                                     iter^.State:= iter^.State or gstInvisible
                                     end
                                 else
@@ -6834,7 +6834,7 @@
                 end
             else if (t > 400) and (CheckCoordInWater(gX, gY) or
                     (((gX and LAND_WIDTH_MASK = 0) and (gY and LAND_HEIGHT_MASK = 0))
-                        and (Land[gY, gX] <> 0))) then
+                        and (LandGet(gY, gX) <> 0))) then
                 begin
                 Target.X:= gX;
                 Target.Y:= gY;
@@ -6857,7 +6857,7 @@
                     Target.Y:= gY;
                     X:= HHGear^.X;
                     Y:= HHGear^.Y
-                    end 
+                    end
                 end;
         end
     end;
@@ -6965,7 +6965,7 @@
         tX:=Gear^.X-targ^.X;
         tY:=Gear^.Y-targ^.Y;
         // allow escaping - should maybe flag this too
-        if (GameTicks > Gear^.FlightTime+10000) or 
+        if (GameTicks > Gear^.FlightTime+10000) or
             ((tX.Round+tY.Round > Gear^.Angle*6) and
             (hwRound(hwSqr(tX) + hwSqr(tY)) > sqr(Gear^.Angle*6))) then
             targ:= nil
@@ -6974,7 +6974,7 @@
     // If in ready timer, or after turn, or in first 5 seconds of turn (really a window due to extra time utility)
     // or mine is inactive due to lack of gsttmpflag or hunting is disabled due to seek radius of 0
     // then we aren't hunting
-    if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or 
+    if (ReadyTimeLeft > 0) or (TurnTimeLeft = 0) or
         ((TurnTimeLeft < cHedgehogTurnTime) and (cHedgehogTurnTime-TurnTimeLeft < 5000)) or
         (Gear^.State and gsttmpFlag = 0) or
         (Gear^.Angle = 0) then
@@ -7238,7 +7238,7 @@
         MakeSentryStep := true
     end
 end;
-    
+
 function MakeSentryJump(Sentry: PGear; maxXStep, maxYStep: LongInt): Boolean;
 var x, y, offsetX, offsetY, direction: LongInt;
     jumpTime: hwFloat;
@@ -7291,7 +7291,7 @@
 
     for i := 0 to count - 1 do
     begin
-        if (Land[hwRound(fromY), hwRound(fromX)] and mask) <> 0 then
+        if (LandGet(hwRound(fromY), hwRound(fromX)) and mask) <> 0 then
             Inc(TraceAttackPath);
         fromX := fromX + distX;
         fromY := fromY + distY;
--- a/hedgewars/uGearsHandlersRope.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsHandlersRope.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -26,7 +26,7 @@
 
 implementation
 uses uConsts, uFloat, uCollisions, uVariables, uGearsList, uSound, uGearsUtils,
-    uAmmos, uDebug, uUtils, uGearsHedgehog, uGearsRender;
+    uAmmos, uDebug, uUtils, uGearsHedgehog, uGearsRender, uLandUtils;
 
 const
     IsNilHHFatal = false;
@@ -241,7 +241,7 @@
         begin
         lx := hwRound(nx);
         ly := hwRound(ny);
-        if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] > lfAllObjMask) then
+        if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (LandGet(ly, lx) > lfAllObjMask) then
             begin
             tx := _1 / Distance(ropeDx, ropeDy);
             // old rope pos
@@ -358,7 +358,7 @@
         HHGear^.dY := HHGear^.dY * len;
         end;
 
-    haveCollision:= ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) and ((Land[hwRound(Gear^.Y), hwRound(Gear^.X)]) <> 0);
+    haveCollision:= ((hwRound(Gear^.Y) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X) and LAND_WIDTH_MASK) = 0) and ((LandGet(hwRound(Gear^.Y), hwRound(Gear^.X))) <> 0);
 
     if not haveCollision then
         begin
@@ -474,7 +474,7 @@
         ty := _0;
         while tt > _20 do
             begin
-            if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and (Land[hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)] > lfAllObjMask) then
+            if ((hwRound(Gear^.Y+ty) and LAND_HEIGHT_MASK) = 0) and ((hwRound(Gear^.X+tx) and LAND_WIDTH_MASK) = 0) and (LandGet(hwRound(Gear^.Y+ty), hwRound(Gear^.X+tx)) > lfAllObjMask) then
                 begin
                 Gear^.X := Gear^.X + tx;
                 Gear^.Y := Gear^.Y + ty;
--- a/hedgewars/uGearsHedgehog.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsHedgehog.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -29,7 +29,7 @@
 procedure HedgehogChAngle(HHGear: PGear);
 procedure PickUp(HH, Gear: PGear);
 procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord);
-procedure CheckIce(Gear: PGear); inline;
+procedure CheckIce(Gear: PGear); 
 procedure PlayTaunt(taunt: Longword);
 function HHGetTimer(Gear: PGear): LongWord;
 function HHGetTimerMsg(Gear: PGear): LongWord;
@@ -1529,7 +1529,7 @@
 AllInactive:= false
 end;
 
-procedure CheckIce(Gear: PGear); inline;
+procedure CheckIce(Gear: PGear); 
 (*
 var x,y,tx,ty: LongInt;
     tdX, tdY, slope: hwFloat;
--- a/hedgewars/uGearsRender.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsRender.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -56,7 +56,7 @@
                 end;
 
 implementation
-uses uRender, uRenderUtils, uGearsUtils, uUtils, uVariables, uAmmos, Math, uVisualGearsList;
+uses uRender, uRenderUtils, uGearsUtils, uUtils, uVariables, uAmmos, Math, uVisualGearsList, uLandUtils;
 
 procedure DrawRopeLinesRQ(Gear: PGear);
 var n: LongInt;
@@ -72,7 +72,7 @@
 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
     begin
     EnableTexture(false);
-    
+
     Tint(Gear^.Tint shr 24 div 3, Gear^.Tint shr 16 and $FF div 3, Gear^.Tint shr 8 and $FF div 3, Gear^.Tint and $FF);
 
     n:= RopePoints.Count + 2;
@@ -541,7 +541,7 @@
                 hy:= ty;
                 wraps:= 0;
                 inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
-                while (inWorldBounds and ((Land[ty, tx] and lfAll) = 0)) or (not inWorldBounds) do
+                while (inWorldBounds and ((LandGet(ty, tx) and lfAll) = 0)) or (not inWorldBounds) do
                     begin
                     if wraps > cMaxLaserSightWraps then
                         break;
@@ -1049,7 +1049,7 @@
                 ty:= hwRound(Gear^.Y) + cHHRadius + 2;
                 if ((tx and LAND_WIDTH_MASK) = 0) and
                     ((ty and LAND_HEIGHT_MASK) = 0) and
-                        (Land[ty, tx] <> 0) then
+                        (LandGet(ty, tx) <> 0) then
                             AddVisualGear(tx - 2 + Random(4), ty - 8, vgtDust);
                 end;
 
@@ -1417,7 +1417,7 @@
                        DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
                     else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
                     end;
-         gtAirMine: 
+         gtAirMine:
                     // render air mine based on its state:
                     // frozen
                     if (Gear^.State and gstFrozen <> 0) then
--- a/hedgewars/uGearsUtils.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uGearsUtils.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -22,7 +22,7 @@
 interface
 uses uTypes, uFloat;
 
-procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline;
+procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword);
 procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
 procedure AddSplashForGear(Gear: PGear; justSkipping: boolean);
 procedure AddBounceEffectForGear(Gear: PGear; imageScale: Single);
@@ -39,7 +39,7 @@
 procedure CalcRotationDirAngle(Gear: PGear);
 procedure ResurrectHedgehog(var gear: PGear);
 
-procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); inline;
+procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt);
 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity, deleteOnFail: boolean);
 function CountLand(x, y, r, c: LongInt; mask, antimask: LongWord): LongInt;
@@ -47,8 +47,8 @@
 function  CheckGearNear(Kind: TGearType; X, Y: hwFloat; rX, rY: LongInt): PGear;
 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
 function  CheckGearDrowning(var Gear: PGear): boolean;
-procedure CheckCollision(Gear: PGear); inline;
-procedure CheckCollisionWithLand(Gear: PGear); inline;
+procedure CheckCollision(Gear: PGear);
+procedure CheckCollisionWithLand(Gear: PGear);
 
 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt);
 procedure AmmoShoveCache(Ammo: PGear; Damage, Power: LongInt);
@@ -62,7 +62,7 @@
 
 procedure SetAllToActive;
 procedure SetAllHHToActive(Ice: boolean);
-procedure SetAllHHToActive(); inline;
+procedure SetAllHHToActive();
 
 function  GetAmmo(Hedgehog: PHedgehog): TAmmoType;
 function  GetUtility(Hedgehog: PHedgehog): TAmmoType;
@@ -83,9 +83,9 @@
     uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
     uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug,
     uGearsList, Math, uVisualGearsList, uGearsHandlersMess,
-    uGearsHedgehog;
+    uGearsHedgehog, uLandUtils;
 
-procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword); inline;
+procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword);
 begin
     doMakeExplosion(X, Y, Radius, AttackingHog, Mask, $FFFFFFFF);
 end;
@@ -872,7 +872,7 @@
 begin
     if (y and LAND_HEIGHT_MASK) = 0 then
         for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 1) do
-            if (Land[y, i] and mask <> 0) and (Land[y, i] and antimask = 0) then
+            if (LandGet(y, i) and mask <> 0) and (LandGet(y, i) and antimask = 0) then
                 begin
                 inc(count);
                 if count = c then
@@ -894,8 +894,8 @@
     begin
         for i:= r - c + 2 to r do
         begin
-            if (Land[y, x - i] and mask <> 0) then inc(cnt);
-            if (Land[y, x + i] and mask <> 0) then inc(cnt);
+            if (LandGet(y, x - i) and mask <> 0) then inc(cnt);
+            if (LandGet(y, x + i) and mask <> 0) then inc(cnt);
 
             if cnt >= c then
             begin
@@ -924,12 +924,12 @@
 NoGearsToAvoid:= true
 end;
 
-procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); inline;
+procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt);
 begin
     FindPlace(Gear, withFall, Left, Right, false, true);
 end;
 
-procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean); inline;
+procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean);
 begin
     FindPlace(Gear, withFall, Left, Right, skipProximity, true);
 end;
@@ -959,7 +959,7 @@
     repeat
         if GetRandom(2) = 0 then dir:= -1 else dir:= 1;
         x:= max(LAND_WIDTH div 2048, LongInt(GetRandom(Delta)));
-        if dir = 1 then x:= Left + x else x:= Right - x; 
+        if dir = 1 then x:= Left + x else x:= Right - x;
         repeat
             cnt:= 0;
             y:= min(1024, topY) - Gear^.Radius shl 1;
@@ -976,9 +976,9 @@
                 repeat
                     inc(y);
                 until (y >= cWaterLine) or
-                        (ignoreOverlap and 
+                        (ignoreOverlap and
                                 (CountLand(x, y, Gear^.Radius - 1, 1, lfAll, 0) <> 0)) or
-                        (not ignoreOverlap and 
+                        (not ignoreOverlap and
                             (CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, 0) <> 0));
 
                 if (y - sy > Gear^.Radius * 2) and (y < cWaterLine)
@@ -1166,7 +1166,7 @@
     CheckGearNear := CheckGearNearImpl(Kind, Gear^.X, Gear^.Y, rX, rY, Gear);
 end;
 
-procedure CheckCollision(Gear: PGear); inline;
+procedure CheckCollision(Gear: PGear);
 begin
     if (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) <> 0)
     or (TestCollisionYwithGear(Gear, hwSign(Gear^.dY)) <> 0) then
@@ -1175,7 +1175,7 @@
         Gear^.State := Gear^.State and (not gstCollision)
 end;
 
-procedure CheckCollisionWithLand(Gear: PGear); inline;
+procedure CheckCollisionWithLand(Gear: PGear);
 begin
     if (TestCollisionX(Gear, hwSign(Gear^.dX)) <> 0)
     or (TestCollisionY(Gear, hwSign(Gear^.dY)) <> 0) then
@@ -1407,8 +1407,8 @@
                        gtFirePunch, gtKamikaze, gtWhip, gtShover])
         and (((Ammo^.Data <> nil) and (PGear(Ammo^.Data) = Gear))
             or (not UpdateHitOrder(
-                    Gear, 
-                    Ammo^.WDTimer, 
+                    Gear,
+                    Ammo^.WDTimer,
                     (Ammo^.Kind = gtMinigunBullet) and (Ammo^.Pos <> 0)))) then
         continue;
 
@@ -1496,10 +1496,10 @@
             else if ((Ammo^.Kind <> gtFlame) or (Gear^.Kind = gtHedgehog)) and (Power <> 0) then
                 begin
                 if (Ammo^.Kind in [gtMinigunBullet]) then
-                    begin    
+                    begin
                     Gear^.dX:= Gear^.dX + Ammo^.dX * Power * _0_01;
                     Gear^.dY:= Gear^.dY + Ammo^.dY * Power * _0_01
-                    end 
+                    end
                 else
                     begin
                     Gear^.dX:= Ammo^.dX * Power * _0_01;
@@ -1585,7 +1585,7 @@
     end
 end;
 
-procedure SetAllHHToActive; inline;
+procedure SetAllHHToActive;
 begin
 SetAllHHToActive(true)
 end;
--- a/hedgewars/uInputHandler.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uInputHandler.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -25,7 +25,7 @@
 procedure initModule;
 procedure freeModule;
 
-function  KeyNameToCode(name: shortstring): LongInt; inline;
+function  KeyNameToCode(name: shortstring): LongInt; 
 function  KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
 
 function  KeyBindToCode(bind: shortstring): LongInt;
@@ -36,7 +36,7 @@
 procedure ProcessMouseMotion(xrel, yrel: LongInt);
 //procedure ProcessMouseWheel(x, y: LongInt);
 procedure ProcessMouseWheel(y: LongInt);
-procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
+procedure ProcessKey(event: TSDL_KeyboardEvent); 
 procedure ProcessKey(code: LongInt; KeyDown: boolean);
 
 {$IFDEF USE_AM_NUMCOLUMN}
@@ -84,7 +84,7 @@
     //ControllerHats: array[0..5] of array[0..19] of Byte;
     //ControllerButtons: array[0..5] of array[0..19] of Byte;
 
-function  KeyNameToCode(name: shortstring): LongInt; inline;
+function  KeyNameToCode(name: shortstring): LongInt; 
 begin
     KeyNameToCode:= KeyNameToCode(name, '');
 end;
@@ -294,7 +294,7 @@
     end
 end;
 
-procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
+procedure ProcessKey(event: TSDL_KeyboardEvent); 
 var code: LongInt;
 begin
     // TODO
--- a/hedgewars/uLand.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLand.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -38,7 +38,6 @@
 var digest: shortstring;
     maskOnly: boolean;
 
-
 procedure PrettifyLandAlpha();
 begin
     if (cReducedQuality and rqBlurryLand) <> 0 then
@@ -64,18 +63,18 @@
     begin
         yd:= LAND_HEIGHT - 1;
         repeat
-            while (yd > 0) and ((Land[yd, x] and targetMask) = 0) do dec(yd);
+            while (yd > 0) and ((LandGet(yd, x) and targetMask) = 0) do dec(yd);
 
             if (yd < 0) then
                 yd:= 0;
 
-            while (yd < LAND_HEIGHT) and ((Land[yd, x] and targetMask) <> 0) do
+            while (yd < LAND_HEIGHT) and ((LandGet(yd, x) and targetMask) <> 0) do
                 inc(yd);
             dec(yd);
             yu:= yd;
 
-            while (yu > 0  ) and ((Land[yu, x] and targetMask) <> 0) do dec(yu);
-            while (yu < yd ) and ((Land[yu, x] and targetMask) =  0) do inc(yu);
+            while (yu > 0  ) and ((LandGet(yu, x) and targetMask) <> 0) do dec(yu);
+            while (yu < yd ) and ((LandGet(yu, x) and targetMask) =  0) do inc(yu);
 
             if (yd < LAND_HEIGHT - 1) and ((yd - yu) >= 16) then
                 copyToXYFromRect(tmpsurf, Surface, x mod tmpsurf^.w, 16, 1, 16, x, yd - 15);
@@ -100,7 +99,7 @@
 
     for x:= 0 to LAND_WIDTH - 1 do
         for y:= 0 to LAND_HEIGHT - 1 do
-            if Land[y, x] = 0 then
+            if LandGet(y, x) = 0 then
                 if s < y then
                     begin
                     for i:= max(s, y - 8) to y - 1 do
@@ -134,7 +133,7 @@
 
     for y:= 0 to LAND_HEIGHT - 1 do
         for x:= 0 to LAND_WIDTH - 1 do
-            if Land[y, x] = 0 then
+            if LandGet(y, x) = 0 then
                 if s < x then
                     begin
                     for i:= max(s, x - 8) to x - 1 do
@@ -405,7 +404,7 @@
 for y:= 0 to LAND_HEIGHT - 1 do
     begin
     for x:= 0 to LAND_WIDTH - 1 do
-    if Land[y, x] <> 0 then
+    if LandGet(y, x) <> 0 then
         if (cReducedQuality and rqBlurryLand) = 0 then
             LandPixels[y, x]:= p^[x]// or AMask
         else
@@ -439,38 +438,38 @@
 
     for x:= LongWord(leftX+2) to LongWord(rightX-2) do
         for y:= LongWord(topY+2) to LAND_HEIGHT-3 do
-            if (Land[y, x] = 0) and
-               (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or
-               ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then
+            if (LandGet(y, x) = 0) and
+               (((LandGet(y, x-1) = lfBasic) and ((LandGet(y+1,x) = lfBasic)) or (LandGet(y-1,x) = lfBasic)) or
+               ((LandGet(y, x+1) = lfBasic) and ((LandGet(y-1,x) = lfBasic) or (LandGet(y+1,x) = lfBasic)))) then
             begin
                 if (cReducedQuality and rqBlurryLand) = 0 then
                     begin
-                    if (Land[y, x-1] = lfBasic) and (LandPixels[y, x-1] and AMask <> 0) then
+                    if (LandGet(y, x-1) = lfBasic) and (LandPixels[y, x-1] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y, x-1]
 
-                    else if (Land[y, x+1] = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then
+                    else if (LandGet(y, x+1) = lfBasic) and (LandPixels[y, x+1] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y, x+1]
 
-                    else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then
+                    else if (LandGet(y-1, x) = lfBasic) and (LandPixels[y-1, x] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y-1, x]
 
-                    else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then
+                    else if (LandGet(y+1, x) = lfBasic) and (LandPixels[y+1, x] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y+1, x];
 
                     if (((LandPixels[y,x] and AMask) shr AShift) > 10) then
                         LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (128 shl AShift)
                     end;
-                Land[y,x]:= lfObject
+                LandSet(y, x, lfObject)
             end
-            else if (Land[y, x] = 0) and
-                    (((Land[y, x-1] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y+2,x] = lfBasic)) or
-                    ((Land[y, x-1] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y-2,x] = lfBasic)) or
-                    ((Land[y, x+1] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y+2,x] = lfBasic)) or
-                    ((Land[y, x+1] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y-2,x] = lfBasic)) or
-                    ((Land[y+1, x] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or
-                    ((Land[y-1, x] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or
-                    ((Land[y+1, x] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic)) or
-                    ((Land[y-1, x] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic))) then
+            else if (LandGet(y, x) = 0) and
+                    (((LandGet(y, x-1) = lfBasic) and (LandGet(y+1,x-1) = lfBasic) and (LandGet(y+2,x) = lfBasic)) or
+                    ((LandGet(y, x-1) = lfBasic) and (LandGet(y-1,x-1) = lfBasic) and (LandGet(y-2,x) = lfBasic)) or
+                    ((LandGet(y, x+1) = lfBasic) and (LandGet(y+1,x+1) = lfBasic) and (LandGet(y+2,x) = lfBasic)) or
+                    ((LandGet(y, x+1) = lfBasic) and (LandGet(y-1,x+1) = lfBasic) and (LandGet(y-2,x) = lfBasic)) or
+                    ((LandGet(y+1, x) = lfBasic) and (LandGet(y+1,x+1) = lfBasic) and (LandGet(y,x+2) = lfBasic)) or
+                    ((LandGet(y-1, x) = lfBasic) and (LandGet(y-1,x+1) = lfBasic) and (LandGet(y,x+2) = lfBasic)) or
+                    ((LandGet(y+1, x) = lfBasic) and (LandGet(y+1,x-1) = lfBasic) and (LandGet(y,x-2) = lfBasic)) or
+                    ((LandGet(y-1, x) = lfBasic) and (LandGet(y-1,x-1) = lfBasic) and (LandGet(y,x-2) = lfBasic))) then
 
                 begin
 
@@ -478,22 +477,22 @@
 
                     begin
 
-                    if (Land[y, x-1] = lfBasic) and (LandPixels[y,x-1] and AMask <> 0) then
+                    if (LandGet(y, x-1) = lfBasic) and (LandPixels[y,x-1] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y, x-1]
 
-                    else if (Land[y, x+1] = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then
+                    else if (LandGet(y, x+1) = lfBasic) and (LandPixels[y,x+1] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y, x+1]
 
-                    else if (Land[y+1, x] = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then
+                    else if (LandGet(y+1, x) = lfBasic) and (LandPixels[y+1,x] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y+1, x]
 
-                    else if (Land[y-1, x] = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then
+                    else if (LandGet(y-1, x) = lfBasic) and (LandPixels[y-1,x] and AMask <> 0) then
                         LandPixels[y, x]:= LandPixels[y-1, x];
 
                     if (((LandPixels[y,x] and AMask) shr AShift) > 10) then
                         LandPixels[y,x]:= (LandPixels[y,x] and (not AMask)) or (64 shl AShift)
                     end;
-                Land[y,x]:= lfObject
+                LandSet(y, x, lfObject)
             end;
 
     AddProgress();
@@ -527,8 +526,8 @@
             begin
             if (y <= wbm) and ((x - w1) mod (bmWidth * 2) >= bmWidth) then
                 continue;
-            Land[y,x]:= lfBasic;
-            Land[y,lastX-x]:= lfBasic;
+            LandSet(y, x, lfBasic);
+            LandSet(y, lastX - x, lfBasic);
             end;
         end;
 
@@ -545,8 +544,8 @@
             // align battlement on inner edge, because real outer edge could be offscreen
             if (y <= wbm) and ((LAND_WIDTH + x - bmref) mod (bmWidth * 2) >= bmWidth) then
                 continue;
-            Land[y,x]:= lfBasic;
-            Land[y,lastX-x]:= lfBasic;
+            LandSet(y, x, lfBasic);
+            LandSet(y, lastX - x, lfBasic);
             end;
         end;
 end;
@@ -691,7 +690,7 @@
         for y:= 0 to Pred(tmpsurf^.h) do
             begin
             for x:= 0 to Pred(tmpsurf^.w) do
-                SetLand(Land[cpY + y, cpX + x], p^[x]);
+                SetLand(cpY + y, cpX + x, p^[x]);
             p:= PLongwordArray(@(p^[tmpsurf^.pitch div 4]));
             end;
 
@@ -756,7 +755,7 @@
     for x:= LongWord(leftX) to LongWord(rightX) do
         begin
         y:= Longword(cWaterLine) - 1 - w;
-        Land[y, x]:= lfIndestructible;
+        LandSet(y, x, lfIndestructible);
         if (x + y) mod 32 < 16 then
             c:= AMask
         else
@@ -815,7 +814,7 @@
 else
     for y:= LongWord(topY) to LongWord(topY + 5) do
         for x:= LongWord(leftX) to LongWord(rightX) do
-            if Land[y, x] <> 0 then
+            if LandGet(y, x) <> 0 then
                 begin
                 inc(c);
                 if c > LongWord((LAND_WIDTH div 2)) then // avoid accidental triggering
@@ -834,13 +833,13 @@
         for y:= 0 to LAND_HEIGHT - 1 do
             for x:= 0 to LAND_WIDTH - 1 do
                 if (y < LongWord(topY)) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then
-                    Land[y, x]:= lfIndestructible;
+                    LandSet(y, x, lfIndestructible);
         end
     else if topY > 0 then
         begin
         for y:= 0 to LongWord(topY - 1) do
             for x:= 0 to LAND_WIDTH - 1 do
-                Land[y, x]:= lfIndestructible;
+                LandSet(y, x, lfIndestructible);
         end;
     // Render map border
     for w:= 0 to (cBorderWidth-1) do
@@ -850,8 +849,8 @@
             for y:= LongWord(topY) to LAND_HEIGHT - 1 do
                     begin
                     // set land flags
-                    Land[y, leftX + w]:= lfIndestructible;
-                    Land[y, rightX - w]:= lfIndestructible;
+                    LandSet(y, leftX + w, lfIndestructible);
+                    LandSet(y, rightX - w, lfIndestructible);
 
                     // paint black and yellow stripes
                     if (y + leftX + w) mod 32 < 16 then
@@ -878,7 +877,7 @@
         // Top border
         for x:= LongWord(leftX) to LongWord(rightX) do
             begin
-            Land[topY + w, x]:= lfIndestructible;
+            LandSet(topY + w, x, lfIndestructible);
             if (topY + x + w) mod 32 < 16 then
                 c:= AMask // black
             else
@@ -994,7 +993,7 @@
                 for yy:= y * lh to y * lh + 7 do
                     for xx:= x * lw + cbit to x * lw + cbit + 7 do
                         if ((yy-oy) and LAND_HEIGHT_MASK = 0) and ((xx-ox) and LAND_WIDTH_MASK = 0)
-                           and (Land[yy-oy, xx-ox] <> 0) then
+                           and (LandGet(yy-oy, xx-ox) <> 0) then
                             inc(t);
                 if t > 8 then
                     Preview[y, x]:= Preview[y, x] or ($80 shr bit);
@@ -1052,7 +1051,7 @@
             for yy:= y * lh - oy to y * lh + lh - 1 - oy do
                 for xx:= x * lw - ox to x * lw + lw - 1 - ox do
                     if (yy and LAND_HEIGHT_MASK = 0) and (xx and LAND_WIDTH_MASK = 0)
-                        and (Land[yy, xx] <> 0) then
+                        and (LandGet(yy, xx) <> 0) then
                         inc(t);
 
             Preview[y, x]:= t * 255 div (lh * lw);
@@ -1073,8 +1072,8 @@
     landPixelDigest  : LongInt;
 begin
     landPixelDigest:= 1;
-    for i:= 0 to LAND_HEIGHT-1 do
-        landPixelDigest:= Adler32Update(landPixelDigest, @Land[i,0], LAND_WIDTH*2);
+//    for i:= 0 to LAND_HEIGHT-1 do
+//        landPixelDigest:= Adler32Update(landPixelDigest, @LandGet(i,x), 2);
     s:= 'M' + IntToStr(syncedPixelDigest)+'|'+IntToStr(landPixelDigest);
 
     ScriptSetString('LandDigest',IntToStr(landPixelDigest));
@@ -1093,20 +1092,11 @@
     maskOnly:= false;
     LAND_WIDTH:= 0;
     LAND_HEIGHT:= 0;
-(*
-    if (cReducedQuality and rqBlurryLand) = 0 then
-        SetLength(LandPixels, LAND_HEIGHT, LAND_WIDTH)
-    else
-        SetLength(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2);
-
-    SetLength(Land, LAND_HEIGHT, LAND_WIDTH);
-    SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32));
-*)
 end;
 
 procedure freeModule;
 begin
-    SetLength(Land, 0, 0);
+    DisposeLand;
     SetLength(LandPixels, 0, 0);
     SetLength(LandDirty, 0, 0);
 end;
--- a/hedgewars/uLandGenMaze.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandGenMaze.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -8,7 +8,8 @@
 
 implementation
 
-uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts, uLandGenTemplateBased, uUtils;
+uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts,
+     uLandGenTemplateBased, uUtils, uLandUtils;
 
 type direction = record x, y: LongInt; end;
 const DIR_N: direction = (x: 0; y: -1);
@@ -403,11 +404,11 @@
 
 for x := 0 to playWidth do
     for y := 0 to off_y - 1 do
-        Land[y, x] := 0;
+        LandSet(y, x, 0);
 
 for x := 0 to playWidth do
     for y := off_y to LAND_HEIGHT - 1 do
-        Land[y, x] := lfBasic;
+        LandSet(y, x, lfBasic);
 
 for y := 0 to num_cells_y - 1 do
     for x := 0 to num_cells_x - 1 do
@@ -527,9 +528,9 @@
 else
     begin
     x := 0;
-    while Land[cellsize div 2 + cellsize + off_y, x] = lfBasic do
+    while LandGet(cellsize div 2 + cellsize + off_y, x) = lfBasic do
         x := x + 1;
-    while Land[cellsize div 2 + cellsize + off_y, x] = 0 do
+    while LandGet(cellsize div 2 + cellsize + off_y, x) = 0 do
         x := x + 1;
     FillLand(x+1, cellsize div 2 + cellsize + off_y, 0, 0);
     end;
--- a/hedgewars/uLandGenPerlin.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandGenPerlin.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -11,6 +11,7 @@
     , uRandom
     , uLandOutline // FillLand
     , uUtils
+    , uLandUtils
     ;
 
 var p: array[0..511] of LongInt;
@@ -39,7 +40,7 @@
 4086, 4088, 4089, 4091, 4092, 4092, 4093, 4094, 4094, 4095, 4095,
 4095, 4095, 4095, 4095, 4095);
 
-function fade(t: LongInt) : LongInt; inline;
+function fade(t: LongInt) : LongInt;
 var t0, t1: LongInt;
 begin
     t0:= fadear[t shr 8];
@@ -53,13 +54,13 @@
 end;
 
 
-function lerp(t, a, b: LongInt) : LongInt; inline;
+function lerp(t, a, b: LongInt) : LongInt;
 begin
     lerp:= a + ((Int64(b) - a) * t shr 12)
 end;
 
 
-function grad(hash, x, y: LongInt) : LongInt; inline;
+function grad(hash, x, y: LongInt) : LongInt;
 var h, v, u: LongInt;
 begin
     h:= hash and 15;
@@ -74,7 +75,7 @@
 end;
 
 
-function inoise(x, y: LongInt) : LongInt; inline;
+function inoise(x, y: LongInt) : LongInt;
 const N = $10000;
 var xx, yy, u, v, A, AA, AB, B, BA, BB: LongInt;
 begin
@@ -205,24 +206,24 @@
             }
 
             if r < rCutoff then
-                Land[y, x]:= 0
+                LandSet(y, x, 0)
             else if param1 = 0 then
-                Land[y, x]:= lfObjMask
+                LandSet(y, x, lfObjMask)
             else
-                Land[y, x]:= lfBasic
+                LandSet(y, x, lfBasic)
         end;
     end;
 
     if param1 = 0 then
         begin
         for x:= 0 to width do
-            if Land[height - 1, x] = lfObjMask then FillLand(x, height - 1, 0, lfBasic);
+            if LandGet(height - 1, x) = lfObjMask then FillLand(x, height - 1, 0, lfBasic);
 
         // strip all lfObjMask pixels
         for y:= minY to LAND_HEIGHT - 1 do
             for x:= 0 to LAND_WIDTH - 1 do
-                if Land[y, x] = lfObjMask then
-                    Land[y, x]:= 0;
+                if LandGet(y, x) = lfObjMask then
+                    LandSet(y, x, 0);
         end;
 
     playWidth:= width;
--- a/hedgewars/uLandGenTemplateBased.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandGenTemplateBased.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -330,7 +330,7 @@
     ResizeLand(Template.TemplateWidth, Template.TemplateHeight);
     for y:= 0 to LAND_HEIGHT - 1 do
         for x:= 0 to LAND_WIDTH - 1 do
-            Land[y, x]:= lfBasic;
+            LandSet(y, x, lfBasic);
 
     minDistance:= sqr(cFeatureSize) div 8 + 10;
     //dabDiv:= getRandom(41)+60;
@@ -368,13 +368,13 @@
         for y:= 0 to LAND_HEIGHT - 1 do
             for x:= 0 to LAND_WIDTH - 1 do
                 if (y < LongWord(topY)) or (x < LongWord(leftX)) or (x > LongWord(rightX)) then
-                    Land[y, x]:= 0
+                    LandSet(y, x, 0)
                 else
                     begin
-                    if Land[y, x] = 0 then
-                        Land[y, x]:= lfBasic
-                    else if Land[y, x] = lfBasic then
-                        Land[y, x]:= 0;
+                    if LandGet(y, x) = 0 then
+                        LandSet(y, x, lfBasic)
+                    else if LandGet(y, x) = lfBasic then
+                        LandSet(y, x, 0);
                     end;
         end;
 end;
--- a/hedgewars/uLandGraphics.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandGraphics.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -47,19 +47,19 @@
 function  DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword): Longword;
 procedure DumpLandToLog(x, y, r: LongInt);
 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint);
-function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline;
-function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; inline;
-function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean; inline;
+function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean;
+function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean;
+function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean;
 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force, behind, flipHoriz, flipVert: boolean; LandFlags: Word; Tint: LongWord): boolean;
 procedure EraseLandRectRaw(X, Y, width, height: LongWord);
 procedure EraseLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert: boolean);
 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture;
 
 implementation
-uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug, uScript;
+uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug, uScript, uLandUtils;
 
 
-procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); inline;
+procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint);
 begin
 if (cReducedQuality and rqBlurryLand) = 0 then
     begin
@@ -73,33 +73,33 @@
     end;
 end;
 
-function drawPixelBG(landX, landY, pixelX, pixelY: Longint): Longword; inline;
+function drawPixelBG(landX, landY, pixelX, pixelY: Longint): Longword;
 begin
 drawPixelBG := 0;
-if (Land[LandY, landX] and lfIndestructible) = 0 then
+if (LandGet(LandY, landX) and lfIndestructible) = 0 then
     begin
-        if ((Land[landY, landX] and lfBasic) <> 0) and (((LandPixels[pixelY, pixelX] and AMask) shr AShift) = 255) and (not disableLandBack) then
+        if ((LandGet(landY, landX) and lfBasic) <> 0) and (((LandPixels[pixelY, pixelX] and AMask) shr AShift) = 255) and (not disableLandBack) then
         begin
             LandPixels[pixelY, pixelX]:= LandBackPixel(landX, landY);
             inc(drawPixelBG);
         end
-        else if ((Land[landY, landX] and lfObject) <> 0) or (((LandPixels[pixelY, pixelX] and AMask) shr AShift) < 255) then
+        else if ((LandGet(landY, landX) and lfObject) <> 0) or (((LandPixels[pixelY, pixelX] and AMask) shr AShift) < 255) then
             LandPixels[pixelY, pixelX]:= ExplosionBorderColorNoA
     end;
 end;
 
-procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint); inline;
+procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint);
 begin
-if (Land[landY, landX] and lfIndestructible = 0) and 
-    (((Land[landY, landX] and lfBasic) <> 0) or ((Land[landY, landX] and lfObject) <> 0)) then
+if (LandGet(landY, landX) and lfIndestructible = 0) and
+    (((LandGet(landY, landX) and lfBasic) <> 0) or ((LandGet(landY, landX) and lfObject) <> 0)) then
     begin
     LandPixels[pixelY, pixelX]:= ExplosionBorderColor;
-    Land[landY, landX]:= (Land[landY, landX] or lfDamaged) and (not lfIce);
+    LandSet(landY, landX, (LandGet(landY, landX) or lfDamaged) and (not lfIce));
     LandDirty[landY div 32, landX div 32]:= 1;
     end;
 end;
 
-function isLandscapeEdge(weight:Longint):boolean; inline;
+function isLandscapeEdge(weight:Longint):boolean;
 begin
 isLandscapeEdge := (weight < 8) and (weight >= 2);
 end;
@@ -118,7 +118,7 @@
        (j > LAND_HEIGHT -1) then
        exit(9);
 
-    if Land[j, i] and lfLandMask and (not lfIce) = 0 then
+    if LandGet(j, i) and lfLandMask and (not lfIce) = 0 then
        inc(r)
     end;
 
@@ -126,7 +126,7 @@
 end;
 
 
-procedure fillPixelFromIceSprite(pixelX, pixelY:Longint); inline;
+procedure fillPixelFromIceSprite(pixelX, pixelY:Longint);
 var
     iceSurface: PSDL_Surface;
     icePixels: PLongwordArray;
@@ -159,22 +159,22 @@
 end;
 
 
-procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint); inline;
+procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint);
 begin
-if ((Land[landY, landX] and lfIce) <> 0) then exit;
+if ((LandGet(landY, landX) and lfIce) <> 0) then exit;
 if (pixelX < LeftX) or (pixelX > RightX) or (pixelY < TopY) then exit;
 if isLandscapeEdge(getPixelWeight(landX, landY)) then
     begin
     if (LandPixels[pixelY, pixelX] and AMask < 255) and (LandPixels[pixelY, pixelX] and AMask > 0) then
         LandPixels[pixelY, pixelX] := (IceEdgeColor and (not AMask)) or (LandPixels[pixelY, pixelX] and AMask)
-    else if (LandPixels[pixelY, pixelX] and AMask < 255) or (Land[landY, landX] > 255) then
+    else if (LandPixels[pixelY, pixelX] and AMask < 255) or (LandGet(landY, landX) > 255) then
         LandPixels[pixelY, pixelX] := IceEdgeColor
     end
-else if Land[landY, landX] > 255 then
+else if LandGet(landY, landX) > 255 then
     begin
         fillPixelFromIceSprite(pixelX, pixelY);
     end;
-if Land[landY, landX] > 255 then Land[landY, landX] := Land[landY, landX] or lfIce and (not lfDamaged);
+if LandGet(landY, landX) > 255 then LandSet(landY, landX, LandGet(landY, landX) or lfIce and (not lfDamaged));
 end;
 
 
@@ -202,7 +202,7 @@
         for i:= fromPix to toPix do
             begin
             calculatePixelsCoordinates(i, y, px, py);
-            if ((Land[y, i] and lfIndestructible) = 0) and (not disableLandBack or (Land[y, i] > 255))  then
+            if ((LandGet(y, i) and lfIndestructible) = 0) and (not disableLandBack or (LandGet(y, i) > 255))  then
                 LandPixels[py, px]:= ExplosionBorderColorNoA;
             end;
     icePixel:
@@ -214,41 +214,41 @@
     addNotHHObj:
         for i:= fromPix to toPix do
             begin
-            if Land[y, i] and lfNotHHObjMask shr lfNotHHObjShift < lfNotHHObjSize then
-                Land[y, i]:= (Land[y, i] and (not lfNotHHObjMask)) or ((Land[y, i] and lfNotHHObjMask shr lfNotHHObjShift + 1) shl lfNotHHObjShift);
+            if LandGet(y, i) and lfNotHHObjMask shr lfNotHHObjShift < lfNotHHObjSize then
+                LandSet(y, i, (LandGet(y, i) and (not lfNotHHObjMask)) or ((LandGet(y, i) and lfNotHHObjMask shr lfNotHHObjShift + 1) shl lfNotHHObjShift));
             end;
     removeNotHHObj:
         for i:= fromPix to toPix do
             begin
-            if Land[y, i] and lfNotHHObjMask <> 0 then
-                Land[y, i]:= (Land[y, i] and (not lfNotHHObjMask)) or ((Land[y, i] and lfNotHHObjMask shr lfNotHHObjShift - 1) shl lfNotHHObjShift);
+            if LandGet(y, i) and lfNotHHObjMask <> 0 then
+                LandSet(y, i, (LandGet(y, i) and (not lfNotHHObjMask)) or ((LandGet(y, i) and lfNotHHObjMask shr lfNotHHObjShift - 1) shl lfNotHHObjShift));
             end;
     addHH:
         for i:= fromPix to toPix do
             begin
-            if Land[y, i] and lfHHMask < lfHHMask then
-                Land[y, i]:= Land[y, i] + 1
+            if LandGet(y, i) and lfHHMask < lfHHMask then
+                LandSet(y, i, LandGet(y, i) + 1)
             end;
     removeHH:
         for i:= fromPix to toPix do
             begin
-            if Land[y, i] and lfHHMask > 0 then
-                Land[y, i]:= Land[y, i] - 1;
+            if LandGet(y, i) and lfHHMask > 0 then
+                LandSet(y, i, LandGet(y, i) - 1);
             end;
     setCurrentHog:
         for i:= fromPix to toPix do
             begin
-            Land[y, i]:= Land[y, i] or lfCurHogCrate
+            LandSet(y, i, LandGet(y, i) or lfCurHogCrate)
             end;
     removeCurrentHog:
         for i:= fromPix to toPix do
             begin
-            Land[y, i]:= Land[y, i] and lfNotCurHogCrate;
+            LandSet(y, i, LandGet(y, i) and lfNotCurHogCrate);
             end;
     end;
 end;
 
-function FillLandCircleSegmentFT(x, y, dx, dy: LongInt; fill : fillType): Longword; inline;
+function FillLandCircleSegmentFT(x, y, dx, dy: LongInt; fill : fillType): Longword;
 begin
     FillLandCircleSegmentFT := 0;
 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
@@ -261,7 +261,7 @@
     inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y - dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill));
 end;
 
-function FillRoundInLandFT(X, Y, Radius: LongInt; fill: fillType): Longword; inline;
+function FillRoundInLandFT(X, Y, Radius: LongInt; fill: fillType): Longword;
 var dx, dy, d: LongInt;
 begin
 dx:= 0;
@@ -323,31 +323,31 @@
 
     if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-            if (Land[y + dy, i] and lfIndestructible) = 0 then
+            if (LandGet(y + dy, i) and lfIndestructible) = 0 then
             begin
-                if Land[y + dy, i] <> Value then inc(FillCircleLines);
-                Land[y + dy, i]:= Value;
+                if LandGet(y + dy, i) <> Value then inc(FillCircleLines);
+                LandSet(y + dy, i, Value);
             end;
     if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-            if (Land[y - dy, i] and lfIndestructible) = 0 then
+            if (LandGet(y - dy, i) and lfIndestructible) = 0 then
             begin
-                if Land[y - dy, i] <> Value then inc(FillCircleLines);
-                Land[y - dy, i]:= Value;
+                if LandGet(y - dy, i) <> Value then inc(FillCircleLines);
+                LandSet(y - dy, i, Value);
             end;
     if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-            if (Land[y + dx, i] and lfIndestructible) = 0 then
+            if (LandGet(y + dx, i) and lfIndestructible) = 0 then
             begin
-                if Land[y + dx, i] <> Value then inc(FillCircleLines);
-                Land[y + dx, i]:= Value;
+                if LandGet(y + dx, i) <> Value then inc(FillCircleLines);
+                LandSet(y + dx, i, Value);
             end;
     if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
         for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-            if (Land[y - dx, i] and lfIndestructible) = 0 then
+            if (LandGet(y - dx, i) and lfIndestructible) = 0 then
             begin
-                if Land[y - dx, i] <> Value then inc(FillCircleLines);
-                Land[y - dx, i]:= Value;
+                if LandGet(y - dx, i) <> Value then inc(FillCircleLines);
+                LandSet(y - dx, i, Value);
             end;
 end;
 
@@ -435,9 +435,9 @@
     begin
     for j := iceT to iceB do
         begin
-        if Land[j, i] = 0 then
+        if LandGet(j, i) = 0 then
             begin
-            Land[j, i] := lfIce;
+            LandSet(j, i, lfIce);
             if (cReducedQuality and rqBlurryLand) = 0 then
                 fillPixelFromIceSprite(i, j)
             else
@@ -478,7 +478,7 @@
     for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do
         for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do
             begin
-            if (Land[ty, tx] and lfIndestructible) = 0 then
+            if (LandGet(ty, tx) and lfIndestructible) = 0 then
                 begin
                 if (cReducedQuality and rqBlurryLand) = 0 then
                     begin
@@ -488,9 +488,9 @@
                     begin
                     by:= ty div 2; bx:= tx div 2;
                     end;
-                if ((Land[ty, tx] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then
+                if ((LandGet(ty, tx) and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then
                     LandPixels[by, bx]:= LandBackPixel(tx, ty)
-                else if ((Land[ty, tx] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then
+                else if ((LandGet(ty, tx) and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then
                     LandPixels[by, bx]:= LandPixels[by, bx] and (not AMASK)
                 end
             end;
@@ -504,14 +504,14 @@
     begin
     for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do
         for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do
-            if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
+            if ((LandGet(ty, tx) and lfBasic) <> 0) or ((LandGet(ty, tx) and lfObject) <> 0) then
                 begin
                  if (cReducedQuality and rqBlurryLand) = 0 then
                     LandPixels[ty, tx]:= ExplosionBorderColor
                 else
                     LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor;
 
-                Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and (not lfIce);
+                LandSet(ty, tx, (LandGet(ty, tx) or lfDamaged) and (not lfIce));
                 LandDirty[ty div 32, tx div 32]:= 1;
                 end;
     inc(y, dY)
@@ -533,10 +533,10 @@
     Y:= Y + dY;
     tx:= hwRound(X);
     ty:= hwRound(Y);
-    if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0)
-    or ((Land[ty, tx] and lfObject) <> 0)) then
+    if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((LandGet(ty, tx) and lfBasic) <> 0)
+    or ((LandGet(ty, tx) and lfObject) <> 0)) then
         begin
-        Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and (not lfIce);
+        LandSet(ty, tx, (LandGet(ty, tx) or lfDamaged) and (not lfIce));
         if despeckle then
             LandDirty[ty div 32, tx div 32]:= 1;
         if (cReducedQuality and rqBlurryLand) = 0 then
@@ -581,12 +581,12 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0)
     and ((tx and LAND_WIDTH_MASK) = 0)
-    and (((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0)) then
+    and (((LandGet(ty, tx) and lfBasic) <> 0) or ((LandGet(ty, tx) and lfObject) <> 0)) then
         begin
-        Land[ty, tx]:= Land[ty, tx] and (not lfIce);
+        LandSet(ty, tx, LandGet(ty, tx) and (not lfIce));
         if despeckle then
             begin
-            Land[ty, tx]:= Land[ty, tx] or lfDamaged;
+            LandSet(ty, tx, LandGet(ty, tx) or lfDamaged);
             LandDirty[ty div 32, tx div 32]:= 1
             end;
         if (cReducedQuality and rqBlurryLand) = 0 then
@@ -612,7 +612,7 @@
         Y:= Y + dY;
         tx:= hwRound(X);
         ty:= hwRound(Y);
-        if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and lfIndestructible) = 0) then
+        if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((LandGet(ty, tx) and lfIndestructible) = 0) then
             begin
             if (cReducedQuality and rqBlurryLand) = 0 then
                 begin
@@ -622,11 +622,11 @@
                 begin
                 by:= ty div 2; bx:= tx div 2;
                 end;
-            if ((Land[ty, tx] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then
+            if ((LandGet(ty, tx) and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then
                 LandPixels[by, bx]:= LandBackPixel(tx, ty)
-            else if ((Land[ty, tx] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then
+            else if ((LandGet(ty, tx) and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then
                 LandPixels[by, bx]:= LandPixels[by, bx] and (not AMASK);
-            Land[ty, tx]:= 0;
+            LandSet(ty, tx, 0);
             end
         end;
     DrawExplosionBorder(X, Y, dx, dy, despeckle);
@@ -644,10 +644,10 @@
     Y:= Y + dY;
     tx:= hwRound(X);
     ty:= hwRound(Y);
-    if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0)
-    or ((Land[ty, tx] and lfObject) <> 0)) then
+    if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((LandGet(ty, tx) and lfBasic) <> 0)
+    or ((LandGet(ty, tx) and lfObject) <> 0)) then
         begin
-        Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and (not lfIce);
+        LandSet(ty, tx, (LandGet(ty, tx) or lfDamaged) and (not lfIce));
         if despeckle then
             LandDirty[ty div 32, tx div 32]:= 1;
         if (cReducedQuality and rqBlurryLand) = 0 then
@@ -692,7 +692,7 @@
     end;
 end;
 
-function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline;
+function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean;
 var lf: Word;
 begin
 if indestructible then
@@ -702,12 +702,12 @@
 TryPlaceOnLandSimple:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, false, false, false, false, lf, $FFFFFFFF);
 end;
 
-function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; inline;
+function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean;
 begin
 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, false, false, false, false, LandFlags, $FFFFFFFF);
 end;
 
-function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean; inline;
+function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean;
 begin
     ForcePlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, true, false, true, behind, flipHoriz, flipVert, LandFlags, Tint)
 end;
@@ -752,12 +752,12 @@
                 if (outOfMap and
                    ((cpY + y) < LAND_HEIGHT) and ((cpY + y) >= 0) and
                    ((cpX + x) < LAND_WIDTH) and ((cpX + x) >= 0) and
-                   ((not force) and (Land[cpY + y, cpX + x] <> 0))) or
+                   ((not force) and (LandGet(cpY + y, cpX + x) <> 0))) or
 
                    (not outOfMap and
                        (((cpY + y) <= topY) or ((cpY + y) >= LAND_HEIGHT) or
                        ((cpX + x) <= leftX) or ((cpX + x) >= rightX) or
-                       ((not force) and (Land[cpY + y, cpX + x] <> 0)))) then
+                       ((not force) and (LandGet(cpY + y, cpX + x) <> 0)))) then
                    begin
                    if SDL_MustLock(Image) then
                        SDL_UnlockSurface(Image);
@@ -793,24 +793,24 @@
                     gX:= (cpX + x) div 2;
                     gY:= (cpY + y) div 2;
                     end;
-                if (not behind) or (Land[cpY + y, cpX + x] and lfLandMask = 0) then
+                if (not behind) or (LandGet(cpY + y, cpX + x) and lfLandMask = 0) then
                     begin
-                    if (LandFlags and lfBasic <> 0) or 
+                    if (LandFlags and lfBasic <> 0) or
                        ((LandPixels[gY, gX] and AMask shr AShift > 128) and  // This test assumes lfBasic and lfObject differ only graphically
                          (LandFlags and (lfObject or lfIce) = 0)) then
-                         Land[cpY + y, cpX + x]:= lfBasic or LandFlags
+                         LandSet(cpY + y, cpX + x, lfBasic or LandFlags)
                     else if (LandFlags and lfIce = 0) then
-						 Land[cpY + y, cpX + x]:= lfObject or LandFlags
-					else Land[cpY + y, cpX + x]:= LandFlags
+						 LandSet(cpY + y, cpX + x, lfObject or LandFlags)
+					else LandSet(cpY + y, cpX + x, LandFlags)
                     end;
                 if (not behind) or (LandPixels[gY, gX] = 0) then
                     begin
                     if tint = $FFFFFFFF then
                         LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^
-                    else 
+                    else
                         begin
                         pixel:= PLongword(@(p^[x * 4]))^;
-                        LandPixels[gY, gX]:= 
+                        LandPixels[gY, gX]:=
                            ceil((pixel shr RShift and $FF) * ((tint shr 24) / 255)) shl RShift or
                            ceil((pixel shr GShift and $FF) * ((tint shr 16 and $ff) / 255)) shl GShift or
                            ceil((pixel shr BShift and $FF) * ((tint shr  8 and $ff) / 255)) shl BShift or
@@ -848,7 +848,7 @@
     for tx:= 0 to width - 1 do
         begin
         LandPixels[ty, tx]:= 0;
-        Land[Y + ty, X + tx]:= 0;
+        LandSet(Y + ty, X + tx, 0);
         end;
 end;
 
@@ -913,15 +913,15 @@
                     gX:= (cpX + x) div 2;
                     gY:= (cpY + y) div 2;
                     end;
-                if (not eraseOnLFMatch or (Land[cpY + y, cpX + x] and LandFlags <> 0)) and
+                if (not eraseOnLFMatch or (LandGet(cpY + y, cpX + x) and LandFlags <> 0)) and
                     ((PLongword(@(p^[x * 4]))^) and AMask <> 0) then
                     begin
                     if not onlyEraseLF then
                         begin
                         LandPixels[gY, gX]:= 0;
-                        Land[cpY + y, cpX + x]:= 0
+                        LandSet(cpY + y, cpX + x, 0)
                         end
-                    else Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] and (not LandFlags)
+                    else LandSet(cpY + y, cpX + x, LandGet(cpY + y, cpX + x) and (not LandFlags))
                     end
                 end;
         p:= PByteArray(@(p^[Image^.pitch]));
@@ -990,7 +990,7 @@
     for x:= 0 to Pred(w) do
         if ((p^[x] and AMask) <> 0)
             and (((cpY + y) < topY) or ((cpY + y) >= LAND_HEIGHT) or
-            ((cpX + x) < leftX) or ((cpX + x) > rightX) or (Land[cpY + y, cpX + x] <> 0)) then
+            ((cpX + x) < leftX) or ((cpX + x) > rightX) or (LandGet(cpY + y, cpX + x) <> 0)) then
                 pt^[x]:= cWhiteColor
         else
             (pt^[x]):= cWhiteColor and (not AMask);
@@ -1028,8 +1028,8 @@
         yy:= Y div 2;
     end;
 
-    pixelsweep:= (Land[Y, X] <= lfAllObjMask) and ((LandPixels[yy, xx] and AMask) <> 0);
-    if (((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then
+    pixelsweep:= (LandGet(Y, X) <= lfAllObjMask) and ((LandPixels[yy, xx] and AMask) <> 0);
+    if (((LandGet(Y, X) and lfDamaged) <> 0) and ((LandGet(Y, X) and lfIndestructible) = 0)) or pixelsweep then
     begin
         c:= 0;
         for i:= -1 to 1 do
@@ -1053,21 +1053,21 @@
                             else if (LandPixels[ny, nx] and AMASK)  <> 0 then
                                     inc(c);
                         end
-                    else if Land[ny, nx] > 255 then
+                    else if LandGet(ny, nx) > 255 then
                         inc(c);
                     end
                 end;
 
         if c < 4 then // 0-3 neighbours
         begin
-            if ((Land[Y, X] and lfBasic) <> 0) and (not disableLandBack) then
+            if ((LandGet(Y, X) and lfBasic) <> 0) and (not disableLandBack) then
                 LandPixels[yy, xx]:= LandBackPixel(X, Y)
             else
                 LandPixels[yy, xx]:= LandPixels[yy, xx] and (not AMASK);
 
             if not pixelsweep then
             begin
-                Land[Y, X]:= 0;
+                LandSet(Y, X, 0);
                 exit
             end
         end;
@@ -1083,7 +1083,7 @@
 begin
 
 // only AA inwards
-if (Land[Y, X] and lfDamaged) = 0 then
+if (LandGet(Y, X) and lfDamaged) = 0 then
     exit;
 
 // check location
@@ -1104,7 +1104,7 @@
 for nx:= X-1 to X+1 do
     for ny:= Y-1 to Y+1 do
         // only consider undamaged neighbors (also leads to skipping itself)
-        if (Land[ny, nx] and lfDamaged) = 0 then
+        if (LandGet(ny, nx) and lfDamaged) = 0 then
             begin
             pixel:= LandPixels[ny, nx];
             inc(r, (pixel and RMask) shr RShift);
@@ -1139,11 +1139,11 @@
 procedure Smooth_oldImpl(X, Y: LongInt);
 begin
 // a bit of AA for explosions
-if (Land[Y, X] = 0) and (Y > topY + 1) and
+if (LandGet(Y, X) = 0) and (Y > topY + 1) and
     (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then
     begin
-    if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0))
-    or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then
+    if ((((LandGet(y, x-1) and lfDamaged) <> 0) and (((LandGet(y+1,x) and lfDamaged) <> 0)) or ((LandGet(y-1,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x+1) and lfDamaged) <> 0) and (((LandGet(y-1,x) and lfDamaged) <> 0) or ((LandGet(y+1,x) and lfDamaged) <> 0)))) then
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
@@ -1156,22 +1156,22 @@
                                 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
             end;
 {
-        if (Land[y, x-1] = lfObject) then
-            Land[y,x]:= lfObject
-        else if (Land[y, x+1] = lfObject) then
-            Land[y,x]:= lfObject
+        if (LandGet(y, x-1) = lfObject) then
+            LandGet(y,x):= lfObject
+        else if (LandGet(y, x+1) = lfObject) then
+            LandGet(y,x):= lfObject
         else
-            Land[y,x]:= lfBasic;
+            LandGet(y,x):= lfBasic;
 }
         end
-    else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0))
-    or (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0))
-    or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0))
-    or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0))
-    or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0))
-    or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0))
-    or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))
-    or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then
+    else if ((((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0))
+    or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0))
+    or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0))
+    or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0))
+    or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0))) then
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
@@ -1184,38 +1184,38 @@
                                 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)
             end;
 {
-        if (Land[y, x-1] = lfObject) then
-            Land[y, x]:= lfObject
-        else if (Land[y, x+1] = lfObject) then
-            Land[y, x]:= lfObject
-        else if (Land[y+1, x] = lfObject) then
-            Land[y, x]:= lfObject
-        else if (Land[y-1, x] = lfObject) then
-        Land[y, x]:= lfObject
-        else Land[y,x]:= lfBasic
+        if (LandGet(y, x-1) = lfObject) then
+            LandGet(y, x):= lfObject
+        else if (LandGet(y, x+1) = lfObject) then
+            LandGet(y, x):= lfObject
+        else if (LandGet(y+1, x) = lfObject) then
+            LandGet(y, x):= lfObject
+        else if (LandGet(y-1, x) = lfObject) then
+        LandGet(y, x):= lfObject
+        else LandGet(y,x):= lfBasic
 }
         end
     end
 else if ((cReducedQuality and rqBlurryLand) = 0) and ((LandPixels[Y, X] and AMask) = AMask)
-and (Land[Y, X] and (lfDamaged or lfBasic) = lfBasic)
+and (LandGet(Y, X) and (lfDamaged or lfBasic) = lfBasic)
 and (Y > topY + 1) and (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then
     begin
-    if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0))
-    or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then
+    if ((((LandGet(y, x-1) and lfDamaged) <> 0) and (((LandGet(y+1,x) and lfDamaged) <> 0)) or ((LandGet(y-1,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x+1) and lfDamaged) <> 0) and (((LandGet(y-1,x) and lfDamaged) <> 0) or ((LandGet(y+1,x) and lfDamaged) <> 0)))) then
         begin
         LandPixels[y,x]:=
                         (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
                         (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
                         (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
         end
-    else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0))
-    or (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0))
-    or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0))
-    or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0))
-    or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0))
-    or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0))
-    or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))
-    or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then
+    else if ((((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0))
+    or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0))
+    or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0))
+    or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0))
+    or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0))
+    or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0))) then
         begin
         LandPixels[y,x]:=
                         (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
@@ -1308,12 +1308,12 @@
 
 
 // Return true if outside of land or not the value tested, used right now for some X/Y movement that does not use normal hedgehog movement in GSHandlers.inc
-function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean; inline;
+function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean;
 begin
-    CheckLandValue:= ((X and LAND_WIDTH_MASK <> 0) or (Y and LAND_HEIGHT_MASK <> 0)) or ((Land[Y, X] and LandFlag) = 0)
+    CheckLandValue:= ((X and LAND_WIDTH_MASK <> 0) or (Y and LAND_HEIGHT_MASK <> 0)) or ((LandGet(Y, X) and LandFlag) = 0)
 end;
 
-function LandBackPixel(x, y: LongInt): LongWord; inline;
+function LandBackPixel(x, y: LongInt): LongWord;
 var p: PLongWordArray;
 begin
     if LandBackSurface = nil then
@@ -1382,30 +1382,30 @@
         end;
 
     if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then
-        Land[y, x]:= Color;
+        LandSet(y, x, Color);
     end
 end;
 
-function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword; inline;
+function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword;
 begin
     DrawDots:= 0;
 
-    if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x + xx] <> Color) then
-        begin inc(DrawDots); Land[y + yy, x + xx]:= Color; end;
-    if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x + xx] <> Color) then
-        begin inc(DrawDots); Land[y - yy, x + xx]:= Color; end;
-    if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x - xx] <> Color) then
-        begin inc(DrawDots); Land[y + yy, x - xx]:= Color; end;
-    if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x - xx] <> Color) then
-        begin inc(DrawDots); Land[y - yy, x - xx]:= Color; end;
-    if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x + yy] <> Color) then
-        begin inc(DrawDots); Land[y + xx, x + yy]:= Color; end;
-    if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x + yy] <> Color) then
-        begin inc(DrawDots); Land[y - xx, x + yy]:= Color; end;
-    if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x - yy] <> Color) then
-        begin inc(DrawDots); Land[y + xx, x - yy]:= Color; end;
-    if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x - yy] <> Color) then
-        begin inc(DrawDots); Land[y - xx, x - yy]:= Color; end;
+    if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + yy, x + xx) <> Color) then
+        begin inc(DrawDots); LandSet(y + yy, x + xx, Color); end;
+    if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - yy, x + xx) <> Color) then
+        begin inc(DrawDots); LandSet(y - yy, x + xx, Color); end;
+    if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + yy, x - xx) <> Color) then
+        begin inc(DrawDots); LandSet(y + yy, x - xx, Color); end;
+    if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - yy, x - xx) <> Color) then
+        begin inc(DrawDots); LandSet(y - yy, x - xx, Color); end;
+    if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + xx, x + yy) <> Color) then
+        begin inc(DrawDots); LandSet(y + xx, x + yy, Color); end;
+    if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - xx, x + yy) <> Color) then
+        begin inc(DrawDots); LandSet(y - xx, x + yy, Color); end;
+    if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + xx, x - yy) <> Color) then
+        begin inc(DrawDots); LandSet(y + xx, x - yy, Color); end;
+    if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - xx, x - yy) <> Color) then
+        begin inc(DrawDots); LandSet(y - xx, x - yy, Color); end;
 end;
 
 function DrawLines(X1, Y1, X2, Y2, XX, YY: LongInt; color: Longword): Longword;
@@ -1512,9 +1512,9 @@
             xx:= dx - r + x;
             if (xx = x) and (yy = y) then
                 s[dx + 1]:= 'X'
-            else if Land[yy, xx] > 255 then
+            else if LandGet(yy, xx) > 255 then
                 s[dx + 1]:= 'O'
-            else if Land[yy, xx] > 0 then
+            else if LandGet(yy, xx) > 0 then
                 s[dx + 1]:= '*'
             else
                 s[dx + 1]:= '.'
--- a/hedgewars/uLandObjects.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandObjects.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -25,18 +25,18 @@
 procedure AddObjects();
 procedure FreeLandObjects();
 procedure LoadThemeConfig;
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline;
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); inline;
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface);
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word);
 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word; Flip: boolean);
 procedure BlitOverlayAndGenerateCollisionInfo(cpX, cpY: Longword; Image: PSDL_Surface);
 procedure BlitImageUsingMask(cpX, cpY: Longword;  Image, Mask: PSDL_Surface);
 procedure AddOnLandObjects(Surface: PSDL_Surface);
-procedure SetLand(var LandWord: Word; Pixel: LongWord); inline;
+procedure SetLand(y, x: LongInt; Pixel: LongWord);
 
 implementation
 uses uStore, uConsts, uConsole, uRandom, uSound
      , uTypes, uVariables, uDebug, uUtils
-     , uPhysFSLayer, uRenderUtils;
+     , uPhysFSLayer, uRenderUtils, uLandUtils;
 
 const MaxRects = 512;
       MAXOBJECTRECTS = 16;
@@ -84,37 +84,37 @@
     ThemeObjects: TThemeObjects;
     SprayObjects: TSprayObjects;
 
-procedure SetLand(var LandWord: Word; Pixel: LongWord); inline;
+procedure SetLand(y, x: LongInt; Pixel: LongWord);
 begin
     // this an if instead of masking colours to avoid confusing map creators
     if ((AMask and Pixel) = 0) then
-        LandWord:= 0
+        LandSet(y, x, 0)
     else if (Pixel and AMask > 0) and (Pixel and RMask > 0) and (Pixel and GMask > 0) and (Pixel and BMask > 0) then // whiteish
-        LandWord:= lfObject
+        LandSet(y, x, lfObject)
     else if (Pixel and AMask > 0) and (Pixel and RMask = 0) and (Pixel and GMask = 0) and (Pixel and BMask = 0) then // blackish
         begin
-        LandWord:= lfBasic;
+        LandSet(y, x, lfBasic);
         disableLandBack:= false
         end
     else if (Pixel and AMask > 0) and (Pixel and RMask > 0) and (Pixel and GMask = 0) and (Pixel and BMask = 0) then // reddish
-        LandWord:= lfIndestructible
+        LandSet(y, x, lfIndestructible)
     else if (Pixel and AMask > 0) and (Pixel and RMask = 0) and (Pixel and GMask = 0) and (Pixel and BMask > 0) then // blueish
-        LandWord:= lfObject or lfIce
+        LandSet(y, x, lfObject or lfIce)
     else if (Pixel and AMask > 0) and (Pixel and RMask = 0) and (Pixel and GMask > 0) and (Pixel and BMask = 0) then // greenish
-        LandWord:= lfObject or lfBouncy
+        LandSet(y, x, lfObject or lfBouncy)
 end;
 
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline;
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface);
 begin
     BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, 0, false);
 end;
 
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); inline;
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word);
 begin
     BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, LandFlags, false);
 end;
 
-function LerpByte(src, dst: Byte; l: LongWord): LongWord; inline;
+function LerpByte(src, dst: Byte; l: LongWord): LongWord;
 begin
     LerpByte:= ((255 - l) * src + l * dst) div 255;
 end;
@@ -173,8 +173,8 @@
 
             end;
 
-        if ((color and AMask) <> 0) and (Land[cpY + y, cpX + x] <= lfAllObjMask) then
-            Land[cpY + y, cpX + x]:= lfObject or LandFlags
+        if ((color and AMask) <> 0) and (LandGet(cpY + y, cpX + x) <= lfAllObjMask) then
+            LandSet(cpY + y, cpX + x, lfObject or LandFlags)
         end;
     p:= PLongwordArray(@(p^[Image^.pitch shr 2]))
     end;
@@ -224,8 +224,8 @@
                 end;
             pLandColor^:= color;
 
-            if Land[cpY + y, cpX + x] <= lfAllObjMask then
-                Land[cpY + y, cpX + x]:= lfObject
+            if LandGet(cpY + y, cpX + x) <= lfAllObjMask then
+                LandSet(cpY + y, cpX + x, lfObject)
             end;
         end;
     p:= PLongwordArray(@(p^[Image^.pitch shr 2]))
@@ -282,8 +282,8 @@
                    or (LerpByte(alpha, 255, (color and AMask) shr AShift) shl AShift);
         end;
 
-        if (Land[cpY + y, cpX + x] <= lfAllObjMask) or (Land[cpY + y, cpX + x] and lfObject <> 0)  then
-            SetLand(Land[cpY + y, cpX + x], mp^[x]);
+        if (LandGet(cpY + y, cpX + x) <= lfAllObjMask) or (LandGet(cpY + y, cpX + x) and lfObject <> 0)  then
+            SetLand(cpY + y, cpX + x, mp^[x]);
         end;
 
     p:= PLongwordArray(@(p^[Image^.pitch shr 2]));
@@ -341,7 +341,7 @@
 begin
     lRes:= 0;
     for i:= y to Pred(y + h) do
-        if Land[i, x] <> 0 then
+        if LandGet(i, x) <> 0 then
             inc(lRes);
     CountNonZeroz:= lRes;
 end;
@@ -425,8 +425,8 @@
     begin
     bRes:= ((rect.y and LAND_HEIGHT_MASK) = 0) and ((by and LAND_HEIGHT_MASK) = 0)
     and ((tmpx and LAND_WIDTH_MASK) = 0) and ((tmpx2 and LAND_WIDTH_MASK) = 0)
-    and (Land[rect.y, tmpx] = Color) and (Land[by, tmpx] = Color)
-    and (Land[rect.y, tmpx2] = Color) and (Land[by, tmpx2] = Color);
+    and (LandGet(rect.y, tmpx) = Color) and (LandGet(by, tmpx) = Color)
+    and (LandGet(rect.y, tmpx2) = Color) and (LandGet(by, tmpx2) = Color);
     inc(tmpx);
     dec(tmpx2)
     end;
@@ -436,8 +436,8 @@
     begin
     bRes:= ((tmpy and LAND_HEIGHT_MASK) = 0) and ((tmpy2 and LAND_HEIGHT_MASK) = 0)
     and ((rect.x and LAND_WIDTH_MASK) = 0) and ((bx and LAND_WIDTH_MASK) = 0)
-    and (Land[tmpy, rect.x] = Color) and (Land[tmpy, bx] = Color)
-    and (Land[tmpy2, rect.x] = Color) and (Land[tmpy2, bx] = Color);
+    and (LandGet(tmpy, rect.x) = Color) and (LandGet(tmpy, bx) = Color)
+    and (LandGet(tmpy2, rect.x) = Color) and (LandGet(tmpy2, bx) = Color);
     inc(tmpy);
     dec(tmpy2)
     end;
@@ -459,7 +459,7 @@
     begin
         for tmpx := rect.x to bx do
         begin
-            if (((Land[rect.y, tmpx] and LandType) or (Land[by, tmpx] and LandType)) <> 0) then
+            if (((LandGet(rect.y, tmpx) and LandType) or (LandGet(by, tmpx) and LandType)) <> 0) then
             begin
                 CheckLandAny := true;
                 exit;
@@ -467,7 +467,7 @@
         end;
         for tmpy := rect.y to by do
         begin
-            if (((Land[tmpy, rect.x] and LandType) or (Land[tmpy, bx] and LandType)) <> 0) then
+            if (((LandGet(tmpy, rect.x) and LandType) or (LandGet(tmpy, bx) and LandType)) <> 0) then
             begin
                 CheckLandAny := true;
                 exit;
--- a/hedgewars/uLandOutline.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandOutline.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -10,12 +10,11 @@
               end;
 
 procedure DrawEdge(var pa: TPixAr; value: Word);
-procedure FillLand(x, y: LongInt; border, value: Word);
 procedure BezierizeEdge(var pa: TPixAr; Delta: hwFloat);
 
 implementation
 
-uses uLandGraphics, uDebug, uVariables, uLandTemplates;
+uses uLandGraphics, uDebug, uVariables, uLandTemplates, uLandUtils;
 
 
 var Stack: record
@@ -54,41 +53,6 @@
         end
 end;
 
-procedure FillLand(x, y: LongInt; border, value: Word);
-var xl, xr, dir: LongInt;
-begin
-    Stack.Count:= 0;
-    xl:= x - 1;
-    xr:= x;
-    Push(xl, xr, y, -1);
-    Push(xl, xr, y,  1);
-    dir:= 0;
-    while Stack.Count > 0 do
-        begin
-        Pop(xl, xr, y, dir);
-        while (xl > 0) and (Land[y, xl] <> border) and (Land[y, xl] <> value) do
-            dec(xl);
-        while (xr < LAND_WIDTH - 1) and (Land[y, xr] <> border) and (Land[y, xr] <> value) do
-            inc(xr);
-        while (xl < xr) do
-            begin
-            while (xl <= xr) and ((Land[y, xl] = border) or (Land[y, xl] = value)) do
-                inc(xl);
-            x:= xl;
-            while (xl <= xr) and (Land[y, xl] <> border) and (Land[y, xl] <> value) do
-                begin
-                Land[y, xl]:= value;
-                inc(xl)
-                end;
-            if x < xl then
-                begin
-                Push(x, Pred(xl), y, dir);
-                Push(x, Pred(xl), y,-dir);
-                end;
-            end;
-        end;
-end;
-
 procedure DrawEdge(var pa: TPixAr; value: Word);
 var i: LongInt;
 begin
--- a/hedgewars/uLandTexture.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandTexture.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -30,7 +30,7 @@
 procedure SetLandTexture;
 
 implementation
-uses uConsts, GLunit, uTypes, uVariables, uTextures, uDebug, uRender, uUtils;
+uses uConsts, GLunit, uTypes, uVariables, uTextures, uDebug, uRender, uUtils, uLandUtils;
 
 const TEXSIZE = 128;
       // in avoid tile borders stretch the blurry texture by 1 pixel more
@@ -60,7 +60,7 @@
 begin
 for ty:= 0 to TEXSIZE - 1 do
     for tx:= 0 to TEXSIZE - 1 do
-        tmpPixels[ty, tx]:= Land[y * TEXSIZE + ty, x * TEXSIZE + tx] or AMask;
+        tmpPixels[ty, tx]:= LandGet(y * TEXSIZE + ty, x * TEXSIZE + tx) or AMask;
 
 Pixels2:= @tmpPixels
 end;
--- a/hedgewars/uLandUtils.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uLandUtils.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -2,11 +2,41 @@
 interface
 
 procedure ResizeLand(width, height: LongWord);
+procedure DisposeLand();
 procedure InitWorldEdges();
 
+function  LandGet(y, x: LongInt): Word;
+procedure LandSet(y, x: LongInt; value: Word);
+
+procedure FillLand(x, y: LongInt; border, value: Word);
+
 implementation
 uses uUtils, uConsts, uVariables, uTypes;
 
+const LibFutureName = 'hwengine_future';
+function  create_game_field(width, height: Longword): pointer; cdecl; external LibFutureName;
+procedure dispose_game_field(game_field: pointer); cdecl; external LibFutureName;
+function  land_get(game_field: pointer; x, y: LongInt): Word; cdecl; external LibFutureName;
+procedure land_set(game_field: pointer; x, y: LongInt; value: Word); cdecl; external LibFutureName;
+procedure land_fill(game_field: pointer; x, y: LongInt; border, fill: Word); cdecl; external LibFutureName;
+
+var gameField: pointer;
+
+function  LandGet(y, x: LongInt): Word;
+begin
+    LandGet:= land_get(gameField, x, y)
+end;
+
+procedure LandSet(y, x: LongInt; value: Word);
+begin
+    land_set(gameField, x, y, value)
+end;
+
+procedure FillLand(x, y: LongInt; border, value: Word);
+begin
+    land_fill(gameField, x, y, border, value)
+end;
+
 procedure ResizeLand(width, height: LongWord);
 var potW, potH: LongInt;
 begin
@@ -24,7 +54,7 @@
     else
         SetLength(LandPixels, LAND_HEIGHT div 2, LAND_WIDTH div 2);
 
-    SetLength(Land, LAND_HEIGHT, LAND_WIDTH);
+    gameField:= create_game_field(LAND_WIDTH, LAND_HEIGHT);
     SetLength(LandDirty, (LAND_HEIGHT div 32), (LAND_WIDTH div 32));
     // 0.5 is already approaching on unplayable
     if (width div 4096 >= 2) or (height div 2048 >= 2) then cMaxZoomLevel:= cMaxZoomLevel/2;
@@ -33,6 +63,11 @@
 initScreenSpaceVars();
 end;
 
+procedure DisposeLand();
+begin
+    dispose_game_field(gameField)
+end;
+
 procedure InitWorldEdges();
 var cy, cx, lx, ly: LongInt;
     found: boolean;
@@ -70,7 +105,7 @@
 for cx:= 0 to lx do
     begin
     for cy:= ly downto 0 do
-        if Land[cy, cx] <> 0 then
+        if LandGet(cy, cx) <> 0 then
             begin
             leftX:= max(0, cx - cWorldEdgeDist);
             // break out of both loops
@@ -85,7 +120,7 @@
 for cx:= lx downto 0 do
     begin
     for cy:= ly downto 0 do
-        if Land[cy, cx] <> 0 then
+        if LandGet(cy, cx) <> 0 then
             begin
             rightX:= min(lx, cx + cWorldEdgeDist);
             // break out of both loops
--- a/hedgewars/uMisc.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uMisc.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -29,10 +29,10 @@
 function  doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
 function MakeScreenshot(filename: shortstring; k: LongInt; dump: LongWord): boolean;
 function  GetTeamStatString(p: PTeam): shortstring;
-function  SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline;
+function  SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect;
 
 implementation
-uses uVariables, uUtils
+uses uVariables, uUtils, uLandUtils
      {$IFDEF PNG_SCREENSHOTS}, PNGh, png {$ENDIF};
 
 type PScreenshot = ^TScreenshot;
@@ -291,15 +291,15 @@
                 PLongWordArray(p)^[y*LAND_WIDTH+x]:= LandPixels[LAND_HEIGHT-1-y, x]
             else
                 begin
-                if Land[LAND_HEIGHT-1-y, x] and lfIndestructible = lfIndestructible then
+                if LandGet(LAND_HEIGHT-1-y, x) and lfIndestructible = lfIndestructible then
                     PLongWordArray(p)^[y*LAND_WIDTH+x]:= (AMask or RMask)
-                else if Land[LAND_HEIGHT-1-y, x] and lfIce = lfIce then
+                else if LandGet(LAND_HEIGHT-1-y, x) and lfIce = lfIce then
                     PLongWordArray(p)^[y*LAND_WIDTH+x]:= (AMask or BMask)
-                else if Land[LAND_HEIGHT-1-y, x] and lfBouncy = lfBouncy then
+                else if LandGet(LAND_HEIGHT-1-y, x) and lfBouncy = lfBouncy then
                     PLongWordArray(p)^[y*LAND_WIDTH+x]:= (AMask or GMask)
-                else if Land[LAND_HEIGHT-1-y, x] and lfObject = lfObject then
+                else if LandGet(LAND_HEIGHT-1-y, x) and lfObject = lfObject then
                     PLongWordArray(p)^[y*LAND_WIDTH+x]:= $FFFFFFFF
-                else if Land[LAND_HEIGHT-1-y, x] and lfBasic = lfBasic then
+                else if LandGet(LAND_HEIGHT-1-y, x) and lfBasic = lfBasic then
                     PLongWordArray(p)^[y*LAND_WIDTH+x]:= AMask
                 else
                     PLongWordArray(p)^[y*LAND_WIDTH+x]:= 0
@@ -353,7 +353,7 @@
     end;
 end;
 
-function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect; inline;
+function SDL_RectMake(x, y, width, height: LongInt): TSDL_Rect;
 begin
     SDL_RectMake.x:= x;
     SDL_RectMake.y:= y;
--- a/hedgewars/uRandom.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uRandom.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -32,8 +32,8 @@
 
 procedure SetRandomSeed(Seed: shortstring; dropAdditionalPart: boolean); // Sets the seed that should be used for generating pseudo-random values.
 function  GetRandomf: hwFloat; // Returns a pseudo-random hwFloat.
-function  GetRandom(m: LongWord): LongWord; inline; // Returns a positive pseudo-random integer smaller than m.
-procedure AddRandomness(r: LongWord); inline;
+function  GetRandom(m: LongWord): LongWord;  // Returns a positive pseudo-random integer smaller than m.
+procedure AddRandomness(r: LongWord); 
 function  rndSign(num: hwFloat): hwFloat; // Returns num with a random chance of having a inverted sign.
 
 
@@ -42,13 +42,13 @@
 var cirbuf: array[0..63] of Longword;
     n: byte;
 
-procedure AddRandomness(r: LongWord); inline;
+procedure AddRandomness(r: LongWord); 
 begin
 n:= (n + 1) and $3F;
    cirbuf[n]:= cirbuf[n] xor r;
 end;
 
-function GetNext: Longword; inline;
+function GetNext: Longword; 
 begin
     n:= (n + 1) and $3F;
     cirbuf[n]:=
@@ -90,7 +90,7 @@
 GetRandomf.QWordValue:= GetNext
 end;
 
-function GetRandom(m: LongWord): LongWord; inline;
+function GetRandom(m: LongWord): LongWord; 
 begin
 GetNext;
 GetRandom:= GetNext mod m
--- a/hedgewars/uRender.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uRender.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -30,18 +30,18 @@
 
 procedure DrawSprite            (Sprite: TSprite; X, Y, Frame: LongInt);
 procedure DrawSprite            (Sprite: TSprite; X, Y, FrameX, FrameY: LongInt);
-procedure DrawSpriteFromRect    (Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); inline;
+procedure DrawSpriteFromRect    (Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); 
 procedure DrawSpriteClipped     (Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt);
 procedure DrawSpriteRotated     (Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
 procedure DrawSpriteRotatedF    (Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
 procedure DrawSpriteRotatedFReal(Sprite: TSprite; X, Y: Real; Frame, Dir: LongInt; Angle: real);
 procedure DrawSpritePivotedF(Sprite: TSprite; X, Y, Frame, Dir, PivotX, PivotY: LongInt; Angle: real);
 
-procedure DrawTexture           (X, Y: LongInt; Texture: PTexture); inline;
+procedure DrawTexture           (X, Y: LongInt; Texture: PTexture); 
 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture; Scale: GLfloat);
 procedure DrawTexture2          (X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat);
-procedure DrawTextureFromRect   (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
-procedure DrawTextureFromRect   (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
+procedure DrawTextureFromRect   (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); 
+procedure DrawTextureFromRect   (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); 
 procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture; Dir: LongInt);
 procedure DrawTextureCentered   (X, Top: LongInt; Source: PTexture);
 procedure DrawTextureF          (Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
@@ -53,9 +53,9 @@
 procedure DrawCircle            (X, Y, Radius, Width: LongInt; color: LongWord);
 procedure DrawCircleFilled      (X, Y, Radius: LongInt; r, g, b, a: Byte);
 
-procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; color: LongWord); inline;
+procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; color: LongWord); 
 procedure DrawLine              (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
-procedure DrawLineWrapped       (X0, Y0, X1, Y1, Width: Single; goesLeft: boolean; Wraps: LongWord; color: LongWord); inline;
+procedure DrawLineWrapped       (X0, Y0, X1, Y1, Width: Single; goesLeft: boolean; Wraps: LongWord; color: LongWord); 
 procedure DrawLineWrapped       (X0, Y0, X1, Y1, Width: Single; goesLeft: boolean; Wraps: LongWord; r, g, b, a: Byte);
 procedure DrawLineOnScreen      (X0, Y0, X1, Y1, Width: Single; r, g, b, a: Byte);
 procedure DrawRect              (rect: TSDL_Rect; r, g, b, a: Byte; Fill: boolean);
@@ -70,19 +70,19 @@
 {$ENDIF}
 procedure RenderSetClearColor   (r, g, b, a: real);
 procedure Tint                  (r, g, b, a: Byte);
-procedure Tint                  (c: Longword); inline;
-procedure untint(); inline;
-procedure setTintAdd            (enable: boolean); inline;
+procedure Tint                  (c: Longword); 
+procedure untint(); 
+procedure setTintAdd            (enable: boolean); 
 
 // call this to finish the rendering of current frame
 procedure FinishRender();
 
-function isAreaOffscreen(X, Y, Width, Height: LongInt): boolean; inline;
-function isCircleOffscreen(X, Y, RadiusSquared: LongInt): boolean; inline;
+function isAreaOffscreen(X, Y, Width, Height: LongInt): boolean; 
+function isCircleOffscreen(X, Y, RadiusSquared: LongInt): boolean; 
 
 // 0 => not offscreen, <0 => left/top of screen >0 => right/below of screen
-function isDxAreaOffscreen(X, Width: LongInt): LongInt; inline;
-function isDyAreaOffscreen(Y, Height: LongInt): LongInt; inline;
+function isDxAreaOffscreen(X, Width: LongInt): LongInt; 
+function isDyAreaOffscreen(Y, Height: LongInt): LongInt; 
 
 procedure SetScale(f: GLfloat);
 procedure UpdateViewLimits();
@@ -97,15 +97,15 @@
 
 procedure EnableTexture(enable:Boolean);
 
-procedure SetTexCoordPointer(p: Pointer;n: Integer); inline;
-procedure SetVertexPointer(p: Pointer;n: Integer); inline;
-procedure SetColorPointer(p: Pointer;n: Integer); inline;
+procedure SetTexCoordPointer(p: Pointer;n: Integer); 
+procedure SetVertexPointer(p: Pointer;n: Integer); 
+procedure SetColorPointer(p: Pointer;n: Integer); 
 
-procedure UpdateModelviewProjection(); inline;
+procedure UpdateModelviewProjection(); 
 
-procedure openglPushMatrix      (); inline;
-procedure openglPopMatrix       (); inline;
-procedure openglTranslatef      (X, Y, Z: GLfloat); inline;
+procedure openglPushMatrix      (); 
+procedure openglPopMatrix       (); 
+procedure openglTranslatef      (X, Y, Z: GLfloat); 
 
 
 implementation
@@ -147,12 +147,12 @@
 procedure DeleteFramebuffer(var frame, depth, tex: GLuint); forward;
 {$ENDIF}
 
-function isAreaOffscreen(X, Y, Width, Height: LongInt): boolean; inline;
+function isAreaOffscreen(X, Y, Width, Height: LongInt): boolean; 
 begin
     isAreaOffscreen:= (isDxAreaOffscreen(X, Width) <> 0) or (isDyAreaOffscreen(Y, Height) <> 0);
 end;
 
-function isCircleOffscreen(X, Y, RadiusSquared: LongInt): boolean; inline;
+function isCircleOffscreen(X, Y, RadiusSquared: LongInt): boolean; 
 var dRightX, dBottomY, dLeftX, dTopY: LongInt;
 begin
     dRightX:= (X - ViewRightX);
@@ -166,14 +166,14 @@
         ((dTopY > 0) and (sqr(dTopY) > RadiusSquared))
 end;
 
-function isDxAreaOffscreen(X, Width: LongInt): LongInt; inline;
+function isDxAreaOffscreen(X, Width: LongInt): LongInt; 
 begin
     if X > ViewRightX then exit(1);
     if X + Width < ViewLeftX then exit(-1);
     isDxAreaOffscreen:= 0;
 end;
 
-function isDyAreaOffscreen(Y, Height: LongInt): LongInt; inline;
+function isDyAreaOffscreen(Y, Height: LongInt): LongInt; 
 begin
     if Y > ViewBottomY then exit(1);
     if Y + Height < ViewTopY then exit(-1);
@@ -658,7 +658,7 @@
     // disable/lower perspective correction (will not need it anyway)
 end;
 
-procedure openglLoadIdentity(); inline;
+procedure openglLoadIdentity(); 
 begin
 {$IFDEF GL2}
     hglLoadIdentity();
@@ -667,7 +667,7 @@
 {$ENDIF}
 end;
 
-procedure openglTranslProjMatrix(X, Y, Z: GLfloat); inline;
+procedure openglTranslProjMatrix(X, Y, Z: GLfloat); 
 begin
 {$IFDEF GL2}
     hglMatrixMode(MATRIX_PROJECTION);
@@ -680,7 +680,7 @@
 {$ENDIF}
 end;
 
-procedure openglPushMatrix(); inline;
+procedure openglPushMatrix(); 
 begin
 {$IFDEF GL2}
     hglPushMatrix();
@@ -689,7 +689,7 @@
 {$ENDIF}
 end;
 
-procedure openglPopMatrix(); inline;
+procedure openglPopMatrix(); 
 begin
 {$IFDEF GL2}
     hglPopMatrix();
@@ -698,7 +698,7 @@
 {$ENDIF}
 end;
 
-procedure openglTranslatef(X, Y, Z: GLfloat); inline;
+procedure openglTranslatef(X, Y, Z: GLfloat); 
 begin
 {$IFDEF GL2}
     hglTranslatef(X, Y, Z);
@@ -707,7 +707,7 @@
 {$ENDIF}
 end;
 
-procedure openglScalef(ScaleX, ScaleY, ScaleZ: GLfloat); inline;
+procedure openglScalef(ScaleX, ScaleY, ScaleZ: GLfloat); 
 begin
 {$IFDEF GL2}
     hglScalef(ScaleX, ScaleY, ScaleZ);
@@ -716,7 +716,7 @@
 {$ENDIF}
 end;
 
-procedure openglRotatef(RotX, RotY, RotZ: GLfloat; dir: LongInt); inline;
+procedure openglRotatef(RotX, RotY, RotZ: GLfloat; dir: LongInt); 
 { workaround for pascal bug https://bugs.freepascal.org/view.php?id=27222 }
 var tmpdir: LongInt;
 begin
@@ -728,7 +728,7 @@
 {$ENDIF}
 end;
 
-procedure openglUseColorOnly(b :boolean); inline;
+procedure openglUseColorOnly(b :boolean); 
 begin
     if b then
         begin
@@ -755,7 +755,7 @@
     EnableTexture(not b);
 end;
 
-procedure UpdateModelviewProjection(); inline;
+procedure UpdateModelviewProjection(); 
 {$IFDEF GL2}
 var
     mvp: TMatrix4x4f;
@@ -770,7 +770,7 @@
 {$ENDIF}
 end;
 
-procedure SetTexCoordPointer(p: Pointer; n: Integer); inline;
+procedure SetTexCoordPointer(p: Pointer; n: Integer); 
 begin
 {$IFDEF GL2}
     glBindBuffer(GL_ARRAY_BUFFER, tBuffer);
@@ -786,7 +786,7 @@
 {$ENDIF}
 end;
 
-procedure SetVertexPointer(p: Pointer; n: Integer); inline;
+procedure SetVertexPointer(p: Pointer; n: Integer); 
 begin
 {$IFDEF GL2}
     glBindBuffer(GL_ARRAY_BUFFER, vBuffer);
@@ -802,7 +802,7 @@
 {$ENDIF}
 end;
 
-procedure SetColorPointer(p: Pointer; n: Integer); inline;
+procedure SetColorPointer(p: Pointer; n: Integer); 
 begin
 {$IFDEF GL2}
     glBindBuffer(GL_ARRAY_BUFFER, cBuffer);
@@ -887,19 +887,19 @@
     UpdateModelviewProjection;
 end;
 
-procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); inline;
+procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); 
 begin
 r.y:= r.y + Height * Position;
 r.h:= Height;
 DrawTextureFromRect(X, Y, @r, SpritesData[Sprite].Texture)
 end;
 
-procedure DrawTextureFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
+procedure DrawTextureFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); 
 begin
 DrawTextureFromRectDir(X, Y, r^.w, r^.h, r, SourceTexture, 1)
 end;
 
-procedure DrawTextureFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
+procedure DrawTextureFromRect(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); 
 begin
 DrawTextureFromRectDir(X, Y, W, H, r, SourceTexture, 1)
 end;
@@ -967,7 +967,7 @@
 
 end;
 
-procedure DrawTexture(X, Y: LongInt; Texture: PTexture); inline;
+procedure DrawTexture(X, Y: LongInt; Texture: PTexture); 
 begin
     DrawTexture(X, Y, Texture, 1.0);
 end;
@@ -1375,7 +1375,7 @@
 end;
 
 // Same as below, but with color as LongWord
-procedure DrawLine(X0, Y0, X1, Y1, Width: Single; color: LongWord); inline;
+procedure DrawLine(X0, Y0, X1, Y1, Width: Single; color: LongWord); 
 begin
 DrawLine(X0, Y0, X1, Y1, Width, (color shr 24) and $FF, (color shr 16) and $FF, (color shr 8) and $FF, color and $FF)
 end;
@@ -1400,7 +1400,7 @@
 end;
 
 // Same as below, but with color as a longword
-procedure DrawLineWrapped(X0, Y0, X1, Y1, Width: Single; goesLeft: boolean; Wraps: LongWord; color: LongWord); inline;
+procedure DrawLineWrapped(X0, Y0, X1, Y1, Width: Single; goesLeft: boolean; Wraps: LongWord; color: LongWord); 
 begin
 DrawLineWrapped(X0, Y0, X1, Y1, Width, goesLeft, Wraps, (color shr 24) and $FF, (color shr 16) and $FF, (color shr 8) and $FF, color and $FF);
 end;
@@ -2073,7 +2073,7 @@
 
 end;
 
-procedure openglTint(r, g, b, a: Byte); inline;
+procedure openglTint(r, g, b, a: Byte); 
 {$IFDEF GL2}
 const
     scale:Real = 1.0/255.0;
@@ -2109,20 +2109,20 @@
     LastTint:= nc;
 end;
 
-procedure Tint(c: Longword); inline;
+procedure Tint(c: Longword); 
 begin
     if c = LastTint then exit;
     Tint(((c shr 24) and $FF), ((c shr 16) and $FF), (c shr 8) and $FF, (c and $FF))
 end;
 
-procedure untint(); inline;
+procedure untint(); 
 begin
     if cWhiteColor = LastTint then exit;
     openglTint($FF, $FF, $FF, $FF);
     LastTint:= cWhiteColor;
 end;
 
-procedure setTintAdd(enable: boolean); inline;
+procedure setTintAdd(enable: boolean); 
 begin
     {$IFDEF GL2}
         if enable then
--- a/hedgewars/uRenderUtils.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uRenderUtils.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -26,10 +26,10 @@
 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean);
 
 procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL
-procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); inline;
+procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); 
 procedure copyToXYFromRect(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt);
 
-procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); inline;
+procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); 
 procedure DrawSpriteFrame2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt; frame: LongInt);
 procedure DrawLine2Surf(dest: PSDL_Surface; x0,y0,x1,y1:LongInt; r,g,b: byte);
 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean);
@@ -38,7 +38,7 @@
 function  RenderStringTexLim(s: ansistring; Color: Longword; font: THWFont; maxLength: LongWord): PTexture;
 function  RenderSpeechBubbleTex(s: ansistring; SpeechType: Longword; font: THWFont): PTexture;
 
-function IsTooDarkToRead(TextColor: Longword): boolean; inline;
+function IsTooDarkToRead(TextColor: Longword): boolean; 
 
 implementation
 uses uVariables, uConsts, uTextures, SysUtils, uUtils, uDebug;
@@ -78,7 +78,7 @@
     WriteInRoundRect:= WriteInRoundRect(Surface, X, Y, Color, Font, s, 0);
 end;*)
 
-function IsTooDarkToRead(TextColor: LongWord): boolean; inline;
+function IsTooDarkToRead(TextColor: LongWord): boolean; 
 var clr: TSDL_Color;
 begin
     clr.r:= (TextColor shr 16) and $FF;
@@ -157,7 +157,7 @@
     SDL_UnlockSurface(Surface);
 end;
 
-procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); inline;
+procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); 
 begin
     // copy from complete src
     copyToXYFromRect(src, dest, 0, 0, src^.w, src^.h, destX, destY);
@@ -233,7 +233,7 @@
     SDL_UnlockSurface(dest);
 end;
 
-procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); inline;
+procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); 
 begin
    DrawSpriteFrame2Surf(sprite, dest, x, y, 0);
 end;
--- a/hedgewars/uScript.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uScript.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -184,14 +184,14 @@
     LuaError('-- SYNTAX: ' + call + ' ( ' + paramsyntax + ' )');
 end;
 
-procedure LuaParameterCountError(expected, call, paramsyntax: shortstring; wrongcount: LongInt); inline;
+procedure LuaParameterCountError(expected, call, paramsyntax: shortstring; wrongcount: LongInt); 
 begin
     // TODO: i18n?
     LuaCallError('Wrong number of parameters! (is: ' + inttostr(wrongcount) + ', should be: '+ expected + ')', call, paramsyntax);
 end;
 
 // compare with allowed count
-function CheckLuaParamCount(L : Plua_State; count: LongInt; call, paramsyntax: shortstring): boolean; inline;
+function CheckLuaParamCount(L : Plua_State; count: LongInt; call, paramsyntax: shortstring): boolean; 
 var c: LongInt;
 begin
     c:= lua_gettop(L);
@@ -205,7 +205,7 @@
 end;
 
 // check if is either count1 or count2
-function CheckAndFetchParamCount(L : Plua_State; count1, count2: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; inline;
+function CheckAndFetchParamCount(L : Plua_State; count1, count2: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; 
 begin
     actual:= lua_gettop(L);
     if (actual <> count1) and (actual <> count2) then
@@ -218,7 +218,7 @@
 end;
 
 // check if is in range of count1 and count2
-function CheckAndFetchParamCountRange(L : Plua_State; count1, count2: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; inline;
+function CheckAndFetchParamCountRange(L : Plua_State; count1, count2: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; 
 begin
     actual:= lua_gettop(L);
     if (actual < count1) or (actual > count2) then
@@ -231,7 +231,7 @@
 end;
 
 // check if is same or higher as minCount
-function CheckAndFetchLuaParamMinCount(L : Plua_State; minCount: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; inline;
+function CheckAndFetchLuaParamMinCount(L : Plua_State; minCount: LongInt; call, paramsyntax: shortstring; out actual: LongInt): boolean; 
 begin
     actual:= lua_gettop(L);
     if (actual < minCount) then
@@ -243,7 +243,7 @@
     CheckAndFetchLuaParamMinCount:= true;
 end;
 
-function LuaToGearTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToGearTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -256,7 +256,7 @@
         LuaToGearTypeOrd:= i;
 end;
 
-function LuaToVisualGearTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToVisualGearTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -269,7 +269,7 @@
         LuaToVisualGearTypeOrd:= i;
 end;
 
-function LuaToAmmoTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToAmmoTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -282,7 +282,7 @@
         LuaToAmmoTypeOrd:= i;
 end;
 
-function LuaToStatInfoTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToStatInfoTypeOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -295,7 +295,7 @@
         LuaToStatInfoTypeOrd:= i;
 end;
 
-function LuaToSoundOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToSoundOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -308,7 +308,7 @@
         LuaToSoundOrd:= i;
 end;
 
-function LuaToHogEffectOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToHogEffectOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -321,7 +321,7 @@
         LuaToHogEffectOrd:= i;
 end;
 
-function LuaToCapGroupOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToCapGroupOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -334,7 +334,7 @@
         LuaToCapGroupOrd:= i;
 end;
 
-function LuaToSpriteOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToSpriteOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
@@ -347,7 +347,7 @@
         LuaToSpriteOrd:= i;
 end;
 
-function LuaToMapGenOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; inline;
+function LuaToMapGenOrd(L : Plua_State; i: LongInt; call, paramsyntax: shortstring): LongInt; 
 begin
     if lua_isnoneornil(L, i) then i:= -1
     else i:= Trunc(lua_tonumber(L, i));
--- a/hedgewars/uStore.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uStore.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -59,7 +59,7 @@
 procedure InitOffscreenOpenGL;
 {$ENDIF}
 
-procedure WarpMouse(x, y: Word); inline;
+procedure WarpMouse(x, y: Word); 
 procedure SwapBuffers; {$IFDEF USE_VIDEO_RECORDING}cdecl{$ELSE}inline{$ENDIF};
 procedure SetSkyColor(r, g, b: real);
 
@@ -1363,7 +1363,7 @@
 // for sdl2 we provide a SDL_WarpMouse() which just calls this function
 // this has the advantage of reducing 'uses' and 'ifdef' statements
 // (SDLwindow is a private member of this module)
-procedure WarpMouse(x, y: Word); inline;
+procedure WarpMouse(x, y: Word); 
 begin
     SDL_WarpMouseInWindow(SDLwindow, x, y);
 end;
--- a/hedgewars/uTouch.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uTouch.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -613,7 +613,7 @@
     fingerHasMoved := trunc(sqrt(sqr(finger.X-finger.historicalX) + sqr(finger.y-finger.historicalY))) > 30;
 end;
 
-function calculateDelta(finger1, finger2: TTouch_Data): LongInt; inline;
+function calculateDelta(finger1, finger2: TTouch_Data): LongInt; 
 begin
     calculateDelta := Round(sqrt(sqr(finger2.x-finger1.x) + sqr(finger2.y-finger1.y)));
 end;
--- a/hedgewars/uTypes.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uTypes.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -99,7 +99,7 @@
 
     // Gears that interact with other Gears and/or Land
     // first row of gears (<gtExplosives) should be avoided when searching a spawn place
-    TGearType = (gtFlame, gtHedgehog, gtMine, gtCase, gtAirMine, gtExplosives, 
+    TGearType = (gtFlame, gtHedgehog, gtMine, gtCase, gtAirMine, gtExplosives,
             gtGrenade, gtShell, gtGrave, gtBee, // 9
             gtShotgunShot, gtPickHammer, gtRope,  // 12
             gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 17
@@ -546,7 +546,6 @@
 
 
     TLandArray = packed array of array of LongWord;
-    TCollisionArray = packed array of array of Word;
     TDirtyTag = packed array of array of byte;
 
     TPreview  = packed array[0..127, 0..31] of byte;
--- a/hedgewars/uUtils.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uUtils.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -48,16 +48,16 @@
 function  EnumToStr(const en : TMapGen) : shortstring; overload;
 function  EnumToStr(const en : TWorldEdge) : shortstring; overload;
 
-function  Min(a, b: LongInt): LongInt; inline;
-function  MinD(a, b: double) : double; inline;
-function  Max(a, b: LongInt): LongInt; inline;
+function  Min(a, b: LongInt): LongInt; 
+function  MinD(a, b: double) : double; 
+function  Max(a, b: LongInt): LongInt; 
 
 function  IntToStr(n: LongInt): shortstring;
 function  StrToInt(s: shortstring): LongInt;
 //function  StrToInt(s: shortstring; var success: boolean): LongInt;
 function  FloatToStr(n: hwFloat): shortstring;
 
-function  DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
+function  DxDy2Angle(const _dY, _dX: hwFloat): real; 
 function  DxDy2Angle32(const _dY, _dX: hwFloat): LongInt;
 function  DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt;
 function  DxDy2AttackAnglef(const _dY, _dX: extended): LongInt;
@@ -68,16 +68,16 @@
 function  DecodeBase64(s: shortstring): shortstring;
 
 function  isPowerOf2(i: Longword): boolean;
-function  toPowerOf2(i: Longword): Longword; inline;
+function  toPowerOf2(i: Longword): Longword; 
 
-function  endian(independent: LongWord): LongWord; inline;
+function  endian(independent: LongWord): LongWord; 
 
 function  CheckCJKFont(s: ansistring; font: THWFont): THWFont;
 
 procedure AddFileLog(s: shortstring);
 procedure AddFileLogRaw(s: pchar); cdecl;
 
-function  CheckNoTeamOrHH: boolean; inline;
+function  CheckNoTeamOrHH: boolean; 
 
 function  GetLaunchX(at: TAmmoType; dir: LongInt; angle: LongInt): LongInt;
 function  GetLaunchY(at: TAmmoType; angle: LongInt): LongInt;
@@ -97,7 +97,7 @@
 procedure SetLengthA(var s: ansistring; len: Longword);
 {$ENDIF}
 
-function  isPhone: Boolean; inline;
+function  isPhone: Boolean; 
 
 {$IFDEF IPHONEOS}
 procedure startLoadingIndicator; cdecl; external;
@@ -407,7 +407,7 @@
 end;
 
 
-function DxDy2Angle(const _dY, _dX: hwFloat): real; inline;
+function DxDy2Angle(const _dY, _dX: hwFloat): real; 
 var dY, dX: Extended;
 begin
 dY:= hwFloat2Float(_dY);
@@ -433,7 +433,7 @@
 DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI)
 end;
 
-function DxDy2AttackAnglef(const _dY, _dX: extended): LongInt; inline;
+function DxDy2AttackAnglef(const _dY, _dX: extended): LongInt; 
 begin
 DxDy2AttackAnglef:= trunc(arctan2(_dY, _dX) * (cMaxAngle/pi))
 end;
@@ -503,7 +503,7 @@
 end;
 
 
-function endian(independent: LongWord): LongWord; inline;
+function endian(independent: LongWord): LongWord; 
 begin
 {$IFDEF ENDIAN_LITTLE}
 endian:= independent;
@@ -680,7 +680,7 @@
 {$ENDIF}
 
 // this function is just to determine whether we are running on a limited screen device
-function isPhone: Boolean; inline;
+function isPhone: Boolean; 
 begin
     isPhone:= false;
 {$IFDEF IPHONEOS}
--- a/hedgewars/uVariables.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uVariables.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -303,7 +303,7 @@
 
     SDLwindow: PSDL_Window;
     SDLGLcontext: PSDL_GLContext;
-  
+
 /////////////////////////////////////
 //Buttons
 {$IFDEF USE_TOUCH_INTERFACE}
@@ -2589,7 +2589,6 @@
         );
 
 var
-    Land: TCollisionArray;
     LandPixels: TLandArray;
     LandDirty: TDirtyTag;
     hasBorder: boolean;
--- a/hedgewars/uVisualGears.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uVisualGears.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -117,7 +117,7 @@
         end
 end;
 
-function GetSprite(sprite, SDsprite: TSprite): TSprite; inline;
+function GetSprite(sprite, SDsprite: TSprite): TSprite; 
 begin
     if SuddenDeathDmg then
         exit(SDsprite)
@@ -125,7 +125,7 @@
         exit(sprite);
 end;
 
-function GetSpriteByWind(sprite, Lsprite: TSprite): TSprite; inline;
+function GetSpriteByWind(sprite, Lsprite: TSprite): TSprite; 
 begin
     if (SpritesData[Lsprite].Texture <> nil) and (cWindSpeedf<0) then
         exit(Lsprite)
@@ -133,7 +133,7 @@
         exit(sprite);
 end;
 
-function GetSpriteData(sprite, SDsprite: TSprite): PSpriteData; inline;
+function GetSpriteData(sprite, SDsprite: TSprite): PSpriteData; 
 begin
     exit(@SpritesData[GetSprite(sprite, SDsprite)]);
 end;
@@ -498,7 +498,7 @@
     end;
 end;
 
-procedure AddFlake; inline;
+procedure AddFlake; 
 begin
     AddVisualGear(cLeftScreenBorder + random(cScreenSpace), LAND_HEIGHT-cCloudOffset+ random(cCloudOffset), vgtFlake);
 end;
--- a/hedgewars/uVisualGearsHandlers.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uVisualGearsHandlers.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -71,7 +71,7 @@
 procedure doStepSmoothWindBar(Gear: PVisualGear; Steps: Longword);
 procedure doStepStraightShot(Gear: PVisualGear; Steps: Longword);
 
-function isSorterActive: boolean; inline;
+function isSorterActive: boolean; 
 procedure initModule;
 
 implementation
@@ -573,7 +573,7 @@
             end;
     currsorter: PVisualGear = nil;
 
-function isSorterActive: boolean; inline;
+function isSorterActive: boolean; 
 begin
     isSorterActive:= currsorter <> nil
 end;
--- a/hedgewars/uVisualGearsList.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uVisualGearsList.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -22,9 +22,9 @@
 interface
 uses uTypes;
 
-function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
-function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
-function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; 
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; 
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
 procedure DeleteVisualGear(Gear: PVisualGear);
 function  VisualGearByUID(uid : Longword) : PVisualGear;
@@ -39,7 +39,7 @@
 implementation
 uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers, uScript;
 
-function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
+function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; 
 begin
     // adjust some visual gear types if underwater
     if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then
@@ -48,12 +48,12 @@
     AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false, -1);
 end;
 
-function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; 
 begin
     AddVisualGear:= AddVisualGear(X, Y, Kind, State, false, -1);
 end;
 
-function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
+function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; 
 begin
     AddVisualGear:= AddVisualGear(X, Y, Kind, State, Critical, -1);
 end;
--- a/hedgewars/uWorld.pas	Tue Dec 13 21:21:55 2022 +0100
+++ b/hedgewars/uWorld.pas	Mon Jan 02 15:59:26 2023 +0100
@@ -1165,14 +1165,14 @@
 
 var preShiftWorldDx: LongInt;
 
-procedure ShiftWorld(Dir: LongInt); inline;
+procedure ShiftWorld(Dir: LongInt); 
 begin
     preShiftWorldDx:= WorldDx;
     Dir := Dir * LongInt(playWidth);
     WorldDx:= WorldDx + Dir;
 end;
 
-procedure UnshiftWorld(); inline;
+procedure UnshiftWorld(); 
 begin
     WorldDx:= preShiftWorldDx;
 end;
--- a/rust/land2d/Cargo.toml	Tue Dec 13 21:21:55 2022 +0100
+++ b/rust/land2d/Cargo.toml	Mon Jan 02 15:59:26 2023 +0100
@@ -2,7 +2,7 @@
 name = "land2d"
 version = "0.1.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
-edition = "2018"
+edition = "2021"
 
 [dependencies]
 vec2d = { path = "../vec2d" }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rust/lib-hwengine-future/Cargo.toml	Mon Jan 02 15:59:26 2023 +0100
@@ -0,0 +1,15 @@
+[package]
+name = "lib-hwengine-future"
+version = "0.1.0"
+edition = "2021"
+authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+land2d = { path = "../land2d" }
+integral-geometry = { path = "../integral-geometry" }
+
+[lib]
+name = "hwengine_future"
+crate-type = ["dylib"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rust/lib-hwengine-future/src/lib.rs	Mon Jan 02 15:59:26 2023 +0100
@@ -0,0 +1,56 @@
+use integral_geometry::{Point, Size};
+use land2d;
+
+#[repr(C)]
+pub struct GameField {
+    collision: land2d::Land2D<u16>,
+    pixels: land2d::Land2D<u32>,
+}
+
+#[no_mangle]
+pub extern "C" fn create_game_field(width: u32, height: u32) -> *mut GameField {
+    let game_field = Box::new(GameField {
+        collision: land2d::Land2D::new(Size::new(width as usize, height as usize), 0),
+        pixels: land2d::Land2D::new(Size::new(width as usize, height as usize), 0),
+    });
+
+    Box::leak(game_field)
+}
+
+#[no_mangle]
+pub extern "C" fn land_get(game_field: &mut GameField, x: i32, y: i32) -> u16 {
+    game_field.collision.map(y, x, |p| *p)
+}
+
+#[no_mangle]
+pub extern "C" fn land_fill(
+    game_field: &mut GameField,
+    x: i32,
+    y: i32,
+    border_value: u16,
+    fill_value: u16,
+) {
+    game_field
+        .collision
+        .fill(Point::new(x, y), border_value, fill_value)
+}
+
+#[no_mangle]
+pub extern "C" fn land_set(game_field: &mut GameField, x: i32, y: i32, value: u16) {
+    game_field.collision.map(y, x, |p| *p = value);
+}
+
+#[no_mangle]
+pub extern "C" fn land_pixel_get(game_field: &mut GameField, x: i32, y: i32) -> u32 {
+    game_field.pixels.map(y, x, |p| *p)
+}
+
+#[no_mangle]
+pub extern "C" fn land_pixel_set(game_field: &mut GameField, x: i32, y: i32, value: u32) {
+    game_field.pixels.map(y, x, |p| *p = value);
+}
+
+#[no_mangle]
+pub extern "C" fn dispose_game_field(game_field: *mut GameField) {
+    unsafe { drop(Box::from_raw(game_field)) };
+}