unit UCreateRaum; interface procedure CreateRaum(x, z: Integer); var WallProb:Real=0.31; UPWallProb:Real=0.11; DownWallProb:Real=0.11; implementation uses Unit1,UNetwork,SysUtils; const emptyMap=false; procedure CreateRaum(x,z:Integer); var C2,C3:Real; C4:TRichtung; C1,C5:Integer; found:Boolean; begin repeat Map[x,z].Walls:=[]; Map[x,z].UpWalls:=[]; Map[x,z].DownWalls:=[]; for C4:=Low(TRichtung) to High(TRichtung) do begin C2:=Random; C3:=0; C3:=C3+WallProb; if C2[]) or (Random>0.75)) and ((Map[x,z].Walls<>[px,nx,nz,pz]) or (Random>0.9)) and ((Map[x,z].UpWalls<>[px,nx,nz]) and (Map[x,z].UpWalls<>[px,nx,pz]) and (Map[x,z].UpWalls<>[px,nz,pz]) and (Map[x,z].UpWalls<>[nx,nz,pz]) or (Random>0.25)) and ((Map[x,z].DownWalls<>[px,nx,nz]) and (Map[x,z].DownWalls<>[px,nx,pz]) and (Map[x,z].DownWalls<>[px,nz,pz]) and (Map[x,z].DownWalls<>[nx,nz,pz]) or (Random>0.25)) and ((Map[x,z].Walls<>[px,nx,nz]) and (Map[x,z].Walls<>[px,nx,pz]) and (Map[x,z].Walls<>[px,nz,pz]) and (Map[x,z].Walls<>[nx,nz,pz]) or (Random>0.2)); if not emptyMap then begin Map[x,z].Inhalt.Daten:=nil; if (x=0) and (z=0) then Map[x,z].Inhalt.Sorte:=1 else begin repeat C2:=Random; C3:=0; Map[x,z].Inhalt.Sorte:=0; for C1:=1 to High(Roomtypes) do begin C3:=C3+Roomtypes[C1].Roomfrequenzy; if C3>C2 then begin Map[x,z].Inhalt.Sorte:=C1; Break; end; end; if C3C1) or (z<>C5)) then begin found:=true; Break; end; until not found or (Map[x,z].Inhalt.Sorte=0); if GetRT(x,z).TurnRandom[Up] or GetRT(x,z).TurnRandom[Down] then Map[x,z].Inhalt.Daten:=@Richtungen[ TRichtung(Random(Integer(High(TRichtung))+1))]; end; end; if Form3.ClientSocket.Active then begin Form3.ClientSocket.Socket.SendText(AnsiString( 'CreateRaum;' +IntToStr(x)+';' +IntToStr(z)+';')); end else Map[x,z].created:=true; end; end.