Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

GetLayerCount

Obtain static layers count for given position X, Y and world WorldNum

NB: Deprecated method, has no sense. Internally it calling ReadStaticsXY to get static count, so better to call directly ReadStaticsXY and check its field StaticCount.

Pascal Syntax:

function GetLayerCount(x : Word; y : Word; WorldNum : Byte) : Byte;

Pascal Example:


//VERY OLD STUFF!

// var List : TStringList;
// List := TStringlist.Create;

function CheckTile(x, y: word): boolean;
 var
   Tile0: TStaticCell;
   LayersCount: word;
   i: integer;

begin
  Result := false;
  LayersCount := GetLayerCount(X, Y, 1);
  if LayersCount = 0 then
    Exit;
  Tile0 := ReadStaticsXY(X, Y, 1);
  for i := 0 to LayersCount - 1 do
  begin
    if ((Tile0.Statics[i].Tile >= $053b) and (Tile0.Statics[i].Tile <= $553) and (Tile0.Statics[i].Tile <> $550)) then
    //AddToSystemJournal('Tree founded!');
    If moveXY(X,Y,false,1,true) then //means we can come nearby to the tree
    begin
      List.Add(IntToStr(Tile0.Statics[i].Tile) + ' ' + IntToStr(X) + ' ' + IntToStr(Y) +
      ' ' + IntToStr(Tile0.Statics[i].Z));
      List.SaveToFile(targetFile);
    end;
  end;
end;

Python Syntax:

def GetLayerCount(X, Y, WorldNum): --> byte