unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, INIFiles, ExtCtrls, Menus, OleCtrls, SHDocVw, Buttons;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    Panel5: TPanel;
    Panel6: TPanel;
    Panel7: TPanel;
    Panel8: TPanel;
    Panel9: TPanel;
    Panel10: TPanel;
    Panel11: TPanel;
    Panel12: TPanel;
    Panel13: TPanel;
    Panel14: TPanel;
    Panel15: TPanel;
    Panel16: TPanel;
    Panel17: TPanel;
    Panel18: TPanel;
    Panel19: TPanel;
    Panel20: TPanel;
    Panel21: TPanel;
    Panel22: TPanel;
    Panel23: TPanel;
    Panel24: TPanel;
    Panel25: TPanel;
    Panel26: TPanel;
    Panel27: TPanel;
    Panel28: TPanel;
    Panel29: TPanel;
    Panel30: TPanel;
    Panel31: TPanel;
    Panel32: TPanel;
    Panel33: TPanel;
    Panel34: TPanel;
    Panel35: TPanel;
    Panel36: TPanel;
    Panel37: TPanel;
    Panel38: TPanel;
    Panel39: TPanel;
    Panel40: TPanel;
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    View1: TMenuItem;
    Fullscreen1: TMenuItem;
    open1: TMenuItem;
    SaveAs1: TMenuItem;
    Exit1: TMenuItem;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    Label19: TLabel;
    Label20: TLabel;
    Label21: TLabel;
    Label22: TLabel;
    Label23: TLabel;
    Label24: TLabel;
    Label25: TLabel;
    Label26: TLabel;
    Label27: TLabel;
    Label28: TLabel;
    Label29: TLabel;
    Label30: TLabel;
    Image1: TImage;
    Label31: TLabel;
    Label32: TLabel;
    Preferences1: TMenuItem;
    Bevel1: TBevel;
    Bevel2: TBevel;
    StaticText1: TStaticText;
    Label33: TLabel;
    Label34: TLabel;
    Label35: TLabel;
    Label36: TLabel;
    Label37: TLabel;
    Label38: TLabel;
    Label39: TLabel;
    Label40: TLabel;
    Label41: TLabel;
    Label42: TLabel;
    Label43: TLabel;
    Label44: TLabel;
    Label45: TLabel;
    Label46: TLabel;
    Panel41: TPanel;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Label51: TLabel;
    LabeledEdit1: TLabeledEdit;
    LabeledEdit2: TLabeledEdit;
    LabeledEdit3: TLabeledEdit;
    LabeledEdit4: TLabeledEdit;
    Label52: TLabel;
    Label53: TLabel;
    Label54: TLabel;
    Label55: TLabel;
    Label56: TLabel;
    Label57: TLabel;
    Label58: TLabel;
    Label59: TLabel;
    Label60: TLabel;
    Label61: TLabel;
    Label62: TLabel;
    Timer1: TTimer;
    Bevel3: TBevel;
    Button4: TBitBtn;
    Button1: TBitBtn;
    ViewonlinerulesDuits1: TMenuItem;
    about1: TMenuItem;
    Restart1: TMenuItem;
    Timer2: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Fullscreen1Click(Sender: TObject);
    procedure Exit1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure InsertMessage(one, two, three: string);
    procedure Button4Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Preferences1Click(Sender: TObject);
    procedure ViewonlinerulesDuits1Click(Sender: TObject);
    procedure about1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Restart1Click(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

type
  TStreetInfo = set of (price, build, hypo);
type
  TGameInfo = set of (sold, built, debt);
type
  TPlayerInfo = set of (posi, color, money);
type
  TMoney = integer;

const
  panelcolor: TColor = $00C5EEAE;
  bankcolor: TColor = clGray;
  playercol1 : TColor = $0088DC5A;
  playercol2 : TColor = $00F5EFA7;
  playercol3 : TColor = $00A6F7F4;
  playercol4 : TColor = $00A6AAF7;
  playercol5 : TColor = $0057B326;
  playercol6 : TColor = $00C46200;
  playercol7 : TColor = $0063F2FE;
  playercol8 : TColor = $002F2FFF;
  playercol9 : TColor = clGreen;
  playercol10 : TColor = $00804000;
  playercol11 : TColor = $0001EBFE;
  playercol12 : TColor = $000000B9;
  none = 'none';
//////////////////////////////////////////////////////////
//////////////MESSAGE HEADER//////////////////////////////
//////////////////////////////////////////////////////////
  hypotext = 'Hypotheek terug betalen?';
  hyphuis = 'Wat ga je doen?';
  huur1 = 'Huur betalen!';
  geldprobs = 'Niet genoeg geld!';
  straatkoop = 'Wil je deze straat kopen?';
  cantpay = 'Je kunt de huur niet betalen!';
  eruit = 'Je bent eruit!';
  overstart = 'Imkomst!';
  onstart = 'Voltreffer!';
  inkomst = 'Inkomsten belasting!';
  extra = 'Extra belasting!';
  vrij = 'Vrij Parkeren!';
  knast = 'Je bent gearresteerd!';
  jail = 'Gepakt!';
  winner = 'Eind van het speel!';
//////////////////////////////////////////////////////////

var
  Form1: TForm1;
  StreetNames: array[1..40] of string;
  GameInfo: array[1..40, price..hypo] of Integer;
  BrainOfTheGame: array[1..40, sold..debt] of Integer;
  Player: array[1..4, posi..money] of Integer;
  colors: array[1..12] of TColor;
  rent : array[1..40,0..5] of Integer;
  gevangen : array[1..4] of Integer;
  InGame : array[1..4] of Boolean;
  houses : array[1..40,1..5] of TImage;
  CurrentPlayer, MaxPlayer: Integer;
  RBtnUsed, DiceStartStop: boolean;
  MessageKind, pott, pasch, tryouts : Integer;
  dice1, dice2, CurrentRent, PlayerCount: Integer;

implementation

uses unit2, unit3, unit4, unit5, unit6, unit7, unit8;

{$R *.dfm}


procedure TForm1.InsertMessage(one, two, three: string);
begin
  Case MessageKind of
  0 : begin
        yesno1.label1.Caption := one;
        yesno1.label2.Caption := two;
        yesno1.label3.Caption := three;
        yesno1.Caption := straatkoop;
      end;
  1 : begin
        hypohuis.label1.Caption := one;
        hypohuis.label2.Caption := two;
        hypohuis.label3.Caption := three;
        hypohuis.Caption := hyphuis;
      end;
  2 : begin
        yesno1.label1.Caption := one;
        yesno1.label2.Caption := two;
        yesno1.label3.Caption := three;
        yesno1.Caption := hypotext;
      end;
  3 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := huur1;
      end;
  4 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := geldprobs;
      end;
  5 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := cantpay;
      end;
  6 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := eruit;
      end;
  7 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := overstart;
      end;
  8 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := onstart;
      end;
  9 : begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := inkomst;
      end;
  10: begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := extra;
      end;
  11: begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := vrij;
      end;
  12: begin
        yesno1.label1.Caption := one;
        yesno1.label2.Caption := two;
        yesno1.label3.Caption := three;
        yesno1.Caption := knast;
      end;
  13: begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := jail;
      end;
  3000: begin
        info1.label1.Caption := one;
        info1.label2.Caption := two;
        info1.label3.Caption := three;
        info1.Caption := winner;
      end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  nameINI, gameINI, optINI : TINIFile;
  huurFile : textfile;
  i, n: integer;
begin
//INITIALIZE
pasch := 0;
///////////////////////////////////////////
//////SPIELER-ANZAHL///////////////////////
///////////////////////////////////////////
  optINI := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'preferences.ini');
  MaxPlayer:=optINI.ReadInteger('Players', 'Players', 4);
case MaxPlayer of
2 : begin
      LabeledEdit1.Visible := True;
      LabeledEdit2.Visible := True;
      LabeledEdit3.Visible := False;
      LabeledEdit4.Visible := False;
      Image1.Visible := True;
      Image2.Visible := True;
      Image3.Visible := False;
      Image4.Visible := False;
    end;
3 : begin
      LabeledEdit1.Visible := True;
      LabeledEdit2.Visible := True;
      LabeledEdit3.Visible := True;
      LabeledEdit4.Visible := False;
      Image1.Visible := True;
      Image2.Visible := True;
      Image3.Visible := True;
      Image4.Visible := False;
    end;
4 : begin
      LabeledEdit1.Visible := True;
      LabeledEdit2.Visible := True;
      LabeledEdit3.Visible := True;
      LabeledEdit4.Visible := True;
      Image1.Visible := True;
      Image2.Visible := True;
      Image3.Visible := True;
      Image4.Visible := True;
    end;
end;
  For i:=1 to MaxPlayer do
  begin
  gevangen[i] := 0;
  InGame[i] := true;
  (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).EditLabel.Caption := (optINI.ReadString('Playernames', 'name'+IntToStr(i),'Speler '+IntToStr(i)));
  end;
///////////////////////////////////////////
///////SPIELERFARBEN LADEN/////////////////
///////////////////////////////////////////
  colors[1] := playercol1;
  colors[2] := playercol2;
  colors[3] := playercol3;
  colors[4] := playercol4;
  colors[5] := playercol5;
  colors[6] := playercol6;
  colors[7] := playercol7;
  colors[8] := playercol8;
  colors[9] := playercol9;
  colors[10] := playercol10;
  colors[11] := playercol11;
  colors[12] := playercol12;
  pott := 0;
  DiceStartStop := true;
  assignfile(huurfile, ExtractFilePath(Application.EXEName) + 'huur.txt');
  reset(huurfile);
  for i := 1 to 40 do for n := 0 to 5 do read(huurfile, rent[i, n]);
  for i := 1 to MaxPlayer do
  begin
    player[i,money] := 30000;
    player[i, posi] := 1;
    (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).Text := IntToStr(player[i,money]);
  end;
  CurrentPlayer := 1;
  nameINI := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'streetnames.ini');
  for i := 1 to 40 do
  begin
    StreetNames[i] := nameINI.ReadString('names', 'name'+IntToStr(i), 'foutmelding');
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Caption := StreetNames[i];
  end;
  gameINI := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'gameinfo.ini');
  for i := 1 to 40 do
  begin
    GameInfo[i, price] := gameINI.ReadInteger('values', 'street'+IntToStr(i), 0);
    GameInfo[i, build] := gameINI.ReadInteger('house', 'price'+IntToStr(i), 0);
    GameInfo[i, hypo] := gameINI.ReadInteger('hypo', 'value'+IntToStr(i), 0);
    BrainOfTheGame[i, sold] := 0;
    BrainOfTheGame[i, built] := 0;
    BrainOfTheGame[i, debt] := 0;
  end;
  timer2.Enabled := true;
end;


procedure TForm1.Fullscreen1Click(Sender: TObject);
var
  i : Integer;
  tmppanel : TPanel;
begin
  If fullscreen1.checked then
  begin
    form1.BorderStyle := bsSingle;
    form1.AutoSize := True;
  end
  else
  begin
    form1.BorderStyle := bsNone;
    form1.AutoSize := False;
    i:=(Width-ClientWidth) div 2;  { Breite Rand }
    SetBounds(-i,-i,Screen.Width+2*i,Screen.Height+2*i);
    bevel1.Left := (bevel1.Left +(Screen.Width div 2) - 310);
    bevel1.Top := (bevel1.Top + (Screen.Height div 2) - 360);
    bevel3.Left := (bevel3.Left +(Screen.Width div 2) - 310);
    bevel3.Top := (bevel3.Top + (Screen.Height div 2) - 360);
    panel41.Left := (panel41.Left +(Screen.Width div 2) - 310);
    panel41.Top := (panel41.Top + (Screen.Height div 2) - 360);
    bevel2.Left := (bevel2.Left +(Screen.Width div 2) - 310);
    bevel2.Top := (bevel2.Top + (Screen.Height div 2) - 360);
    button1.Left := (button1.Left +(Screen.Width div 2) - 310);
    button1.Top := (button1.Top + (Screen.Height div 2) - 360);
    button4.Left := (button4.Left +(Screen.Width div 2) - 310);
    button4.Top := (button4.Top + (Screen.Height div 2) - 360);
    StaticText1.Left := (StaticText1.Left +(Screen.Width div 2) - 310);
    StaticText1.Top := (StaticText1.Top + (Screen.Height div 2) - 360);
    label31.Left := (label31.Left +(Screen.Width div 2) - 310);
    label31.Top := (label31.Top + (Screen.Height div 2) - 360);
    label32.Left := (label32.Left +(Screen.Width div 2) - 310);
    label32.Top := (label32.Top + (Screen.Height div 2) - 360);
    labelededit1.Left := (labelededit1.Left +(Screen.Width div 2) - 310);
    labelededit1.Top := (labelededit1.Top + (Screen.Height div 2) - 360);
    labelededit2.Left := (labelededit2.Left +(Screen.Width div 2) - 310);
    labelededit2.Top := (labelededit2.Top + (Screen.Height div 2) - 360);
    labelededit3.Left := (labelededit3.Left +(Screen.Width div 2) - 310);
    labelededit3.Top := (labelededit3.Top + (Screen.Height div 2) - 360);
    labelededit4.Left := (labelededit4.Left +(Screen.Width div 2) - 310);
    labelededit4.Top := (labelededit4.Top + (Screen.Height div 2) - 360);
    for i:= 1 to 40 do
    begin
      tmppanel := (FindComponent('Panel'+IntToStr(i)) as TPanel);
      tmppanel.Left := (tmppanel.Left + (Screen.Width div 2) - 310);
      tmppanel.Top := (tmppanel.Top + (Screen.Height div 2) - 360);
    end;
  end;
  fullscreen1.Checked := not fullscreen1.Checked;
end;

procedure TForm1.Exit1Click(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  i, n, mitspieler: integer;
  tmppanel : TPanel;
begin
//////////////////////////////////////////////////////////////////////
////////////////////////GEFÄNGNIS/////////////////////////////////////
//////////////////////////////////////////////////////////////////////
If gevangen[CurrentPlayer] > 0 then
begin
//////////////////////////////////////////////////////////////////////
////////////////////////WÜRFELN///////////////////////////////////////
//////////////////////////////////////////////////////////////////////
  if DiceStartStop then
  begin
    timer1.Enabled := true;
    DiceStartStop := not DiceStartStop;
  end
  else
  begin
    timer1.Enabled := false;
    DiceStartStop := not DiceStartStop;
    dec(Tryouts);
    label31.Caption := IntToStr(dice1);  label32.Caption := IntToStr(dice2);
    If dice1 = dice2 then
    begin
      gevangen[CurrentPlayer] := 1;
      tryouts := 0;
      DiceStartStop := not DiceStartStop;
//////////////////////////////////////////////////////////////////////
///////////////MESSAGE: PASCH UND FREI!///////////////////////////////
//////////////////////////////////////////////////////////////////////
    end;
    if tryouts = 0 then
    begin
      button1.Enabled := false;
      button4.Enabled := true;
    end;
  end;
    dec(gevangen[CurrentPlayer]);
end;






//////////////////////////////////////////////////////////////////////
////////////////////////NORMALER ZUG//////////////////////////////////
//////////////////////////////////////////////////////////////////////

If gevangen[CurrentPlayer] = 0 then
begin
tryouts := 0;







//////////////////////////////////////////////////////////////////////
///////////WÜRFEL WIRD GEROLLT////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
  if DiceStartStop then
  begin
    timer1.Enabled := true;
    DiceStartStop := not DiceStartStop;
  end
//////////////////////////////////////////////////////////////////////
////////////////WÜRFEL WIRD GESTOPPT//////////////////////////////////
//////////////////////////////////////////////////////////////////////
  else
  begin
///////TIMER STOPP////////////////////////////////////////////////////
  timer1.Enabled := false;
  DiceStartStop := not DiceStartStop;
  label31.Caption := IntToStr(dice1);  label32.Caption := IntToStr(dice2);
  If dice1 = dice2 then
  begin
    inc(pasch);
    if pasch = 3 then
    begin
      //gefängnis
      info1.label1.Caption := 'Drie dubbel in een beurt!';
      info1.label2.Caption := 'Je moet naar het gevangenis!';
      info1.label3.Caption := '';
      info1.Caption := 'Derde Dubbel!';
      info1.ShowModal;
      Player[CurrentPlayer,posi] := 11 - dice1 - dice2;
      with (FindComponent('Image'+IntToStr(CurrentPlayer)) as TImage) do
      begin
        Parent := Panel11;
        Top := 0;
        Left := 60;
      end;
      gevangen[CurrentPlayer] := 4;
    end
    else
    begin
      info1.label1.Caption := 'Dubbel!';
      info1.label2.Caption := 'Je maag nog een keer!';
      info1.label3.Caption := '';
      info1.Caption := 'Dubbel!';
      info1.ShowModal;
    end;
  end
  else
  begin
    pasch := 0;
    button4.Enabled := true;
    button1.Enabled := false;
  end;
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
////////SPIELER VORSETZEN!////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
  Player[CurrentPlayer,posi] := Player[CurrentPlayer,posi] + dice1 + dice2;
//////////////////////////////////////////////////////////////////////
////////KOMMT DER SPIELER ÜBER LOS?///////////////////////////////////
//////////////////////////////////////////////////////////////////////
  if Player[CurrentPlayer,posi] > 41 then
  begin
    MessageKind := 7;
    InsertMessage('Je hebt het Af-veld gepasseerd.','Inkomst:', '4000 Euro!');
    info1.ShowModal;
    Player[CurrentPlayer,posi] := Player[CurrentPlayer,posi] - 40;
    Player[CurrentPlayer,money] := Player[CurrentPlayer,money] + 4000;
    (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
  end;
//////////////////////////////////////////////////////////////////////
//////////KOMMT DER SPIELER AUF LOS?//////////////////////////////////
//////////////////////////////////////////////////////////////////////
  if Player[CurrentPlayer,posi] = 41 then
  begin
    MessageKind := 8;
    InsertMessage('Voltreffer! Je staat direct op het Af-Veld!','Je inkomst bedragt daarom:', '8000 Euro!');
    info1.ShowModal;
    Player[CurrentPlayer,posi] := Player[CurrentPlayer,posi] - 40;
    Player[CurrentPlayer,money] := Player[CurrentPlayer,money] + 8000;
    (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
  end;
//////////////////////////////////////////////////////////////////////
/////////////////SPIELSTEIN VERSETZEN/////////////////////////////////
//////////////////////////////////////////////////////////////////////
  with (FindComponent('Image'+IntToStr(CurrentPlayer)) as TImage) do
  begin
  case Player[CurrentPlayer,posi] of
    1 : begin Left := 31; Top := 40; end;
    2..10 : begin Left := 21; Top := 40; end;
    11 : begin Left := 31; Top := 40; end;
    12..20 : begin Left := 0; Top := 15; end;
    21 : begin Left := 31; Top := 30; end;
    22..30 : begin Left := 21; Top := 30; end;
    31 : begin Left := 31; Top := 30; end;
    32..40 : begin Left := 31; Top := 15; end;
  end;
  for i := 1 to MaxPlayer do
  If i = CurrentPlayer then
  begin
  end
  else
  if Player[CurrentPlayer,posi] = Player[i,posi] then
  Left := Left + 18;
  end;
  tmppanel := (FindComponent('Panel'+IntToStr(Player[CurrentPlayer,posi])) as TPanel);
  (FindComponent('Image'+IntToStr(CurrentPlayer)) as TImage).Parent := tmppanel;
//DEBUG/////////////////////////////////////////////////////
//  showmessage(IntToStr(GameInfo[Player[CurrentPlayer,posi],price]));
////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////
/////////////////SPIELER KOMMT AUF EINKOMMENSTEUER////////////////////
//////////////////////////////////////////////////////////////////////
  if Player[CurrentPlayer,posi] = 5 then
  begin
    MessageKind := 9;
    InsertMessage('Verdorie','Inkomsten Belasting:', '4000 Euro!');
    info1.ShowModal;
    Player[CurrentPlayer,money] := Player[CurrentPlayer,money] - 4000;
    pott := pott + 4000;
    (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
  end;
//////////////////////////////////////////////////////////////////////
/////////////////SPIELER KOMMT AUF EXTRASTEUER////////////////////
//////////////////////////////////////////////////////////////////////
  if Player[CurrentPlayer,posi] = 39 then
  begin
    MessageKind := 10;
    InsertMessage('Verdorie','Extra Belasting:', '2000 Euro!');
    info1.ShowModal;
    Player[CurrentPlayer,money] := Player[CurrentPlayer,money] - 2000;
    pott := pott + 2000;
    (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
  end;
//////////////////////////////////////////////////////////////////////
/////////////////SPIELER KOMMT AUF FREI PARKEN////////////////////////
//////////////////////////////////////////////////////////////////////
  if Player[CurrentPlayer,posi] = 21 then
  begin
    MessageKind := 11;
    if pott > 0 then
    InsertMessage('Vrij parkeren!','Do inhoud van de pot is voor jou!', IntToStr(pott)+' Euro!');
    if pott = 0 then
    begin
      InsertMessage('Vrij parkeren!','Helaas, de pot is leeg!', '');
      info1.Label3.Caption := ''
    end;
    info1.ShowModal;
    Player[CurrentPlayer,money] := Player[CurrentPlayer,money] + pott;
    pott := 0;
    (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
  end;
//////////////////////////////////////////////////////////////////////
/////////////////GEHE INS GEFÄNGNIS!//////////////////////////////////
//////////////////////////////////////////////////////////////////////
  if Player[CurrentPlayer,posi] = 31 then
  begin
    MessageKind := 13;
    InsertMessage('','Je gaat naar het gevangenis!', '');
    info1.Label1.Caption := '';
    info1.Label3.Caption := '';
    info1.ShowModal;
    Player[CurrentPlayer,posi] := 11;
    gevangen[CurrentPlayer] := 4;
    with (FindComponent('Image'+IntToStr(CurrentPlayer)) as TImage) do
    begin
      Parent := Panel11;
      Top := 0;
      Left := 60;
    end;
  end;

////////////////////////////////////////////////////////////
///////////////WAS PASSIERT AUF DEM FELD??????//////////////
////////////////////////////////////////////////////////////
if GameInfo[Player[CurrentPlayer,posi],price] > 0 then
////////////////////////////////////////////////////////////
//////////IST DIESE STRASSE JEMALS ZU VERKAUFEN???//////////
////////////////////////////////////////////////////////////
begin
  if BrainOfTheGame[Player[CurrentPlayer,posi],sold] > 0 then
////////////////////////////////////////////////////////////
////////////////FELD IST BEREITS VERKAUFT!!!!///////////////
////////////////////////////////////////////////////////////
  begin
    for i:= 1 to MaxPlayer do
////////////////////////////////////////////////////////////
///////////////////AN WEN IST DAS FELD VERKAUFT????/////////
////////////////////////////////////////////////////////////
    begin
      if CurrentPlayer = i then
////////////////////////////////////////////////////////////
/////////////i=DER SPIELER DER AN DER REIHE IST!////////////
////////////////////////////////////////////////////////////
      begin
        If BrainOfTheGame[Player[CurrentPlayer,posi],sold] = i then
////////////////////////////////////////////////////////////
///////FELD GEHÖRT SPIELER DER AN DER REIHE IST/////////////
////////////////////////////////////////////////////////////
        if (Player[CurrentPlayer,posi] <> 6) and
        (Player[CurrentPlayer,posi] <> 13) and
        (Player[CurrentPlayer,posi] <> 16) and
        (Player[CurrentPlayer,posi] <> 26) and
        (Player[CurrentPlayer,posi] <> 29) and
        (Player[CurrentPlayer,posi] <> 39) then
        begin
          MessageKind := 1;
          InsertMessage('Deze straat is al van jou!', 'Wat ga je doen?', '');
          if BrainOfTheGame[CurrentPlayer, built] = 5 then hypohuis.BitBtn1.Enabled := false;
          if Player[CurrentPlayer, money] < GameInfo[Player[CurrentPlayer, posi],build] then hypohuis.BitBtn1.Enabled := false;
          case hypohuis.ShowModal of
          mrYes : begin
                  Player[CurrentPlayer,money] := Player[CurrentPlayer,money] - GameInfo[Player[CurrentPlayer,posi],build];
                  (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
                  Inc(BrainOfTheGame[Player[CurrentPlayer,posi], built]);
                  If BrainOfTheGame[Player[CurrentPlayer,posi], built] = 5 then
                  begin
                    houses[player[currentplayer,posi],5] := TImage.Create(Application.MainForm);
                    ((houses[player[currentplayer,posi],5]) as TImage).Parent := (FindComponent('Panel'+IntToStr(Player[CurrentPlayer,posi])) as TPanel);
                    ((houses[player[currentplayer,posi],5]) as TImage).Picture.LoadFromFile(ExtractFilePath(Application.EXEName) + 'hotel.bmp');
                    ((houses[player[currentplayer,posi],5]) as TImage).AutoSize := True;
                    for n := 1 to 4 do
                    ((houses[player[currentplayer,posi],n]) as TImage).Destroy;
                    Case player[currentplayer,posi] of
                    1..10 : begin
                             ((houses[player[currentplayer,posi],5]) as TImage).Left := 0;
                             ((houses[player[currentplayer,posi],5]) as TImage).Top := 0;
                            end;
                    11..20 : begin
                             ((houses[player[currentplayer,posi],5]) as TImage).Left := 60;
                             ((houses[player[currentplayer,posi],5]) as TImage).Top := 0;
                            end;
                    21..30 : begin
                             ((houses[player[currentplayer,posi],5]) as TImage).Left := 0;
                             ((houses[player[currentplayer,posi],5]) as TImage).Top := 60;
                            end;
                    31..40 : begin
                             ((houses[player[currentplayer,posi],5]) as TImage).Left := 0;
                             ((houses[player[currentplayer,posi],5]) as TImage).Top := 0;
                            end;
                    end;
                  end
                  else
                  begin
                    houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]] := TImage.Create(Application.MainForm);
                    ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Parent := (FindComponent('Panel'+IntToStr(Player[CurrentPlayer,posi])) as TPanel);
                    ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Picture.LoadFromFile(ExtractFilePath(Application.EXEName) + 'haus.bmp');
                    Case player[currentplayer,posi] of
                    1..10 : begin
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Left := 0 - 15 + (15 * BrainOfTheGame[Player[CurrentPlayer,posi], built]);
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Top := 0;
                            end;
                    11..20 : begin
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Left := 60;
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Top := 0 - 15 + (15 * BrainOfTheGame[Player[CurrentPlayer,posi], built]);
                            end;
                    21..30 : begin
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Left := 0 - 15 + (15 * BrainOfTheGame[Player[CurrentPlayer,posi], built]);
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Top := 60;
                            end;
                    31..40 : begin
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Left := 0;
                             ((houses[player[currentplayer,posi],brainofthegame[player[currentplayer,posi],built]]) as TImage).Top := 0 - 15 + (15 * BrainOfTheGame[Player[CurrentPlayer,posi], built]);
                            end;
                    end;
                  end;
                  end;
          mrRetry : begin
                  Player[CurrentPlayer,money] := Player[CurrentPlayer,money] + (GameInfo[Player[CurrentPlayer,posi],price] div 2);
                  (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
                  BrainOfTheGame[Player[CurrentPlayer,posi],sold] := CurrentPlayer+4;
                  (FindComponent('Panel'+IntToStr(Player[CurrentPlayer,posi])) as TPanel).Color := bankcolor;
                  end;
          end;
          hypohuis.BitBtn1.Enabled := true;
        end;
        If BrainOfTheGame[Player[CurrentPlayer,posi],sold] = (i+4) then
////////////////////////////////////////////////////////////
//FELD GEHÖRT SPIELER DER AN DER REIHE IST, ABER HYPOTHEEK//
////////////////////////////////////////////////////////////
        begin
          MessageKind := 2;
          InsertMessage('Deze straat is al van jou!', 'Maar je hebt er een hypotheek op.', 'Wil je die terugbetalen?');
          if Player[CurrentPlayer, money] < (GameInfo[Player[CurrentPlayer,posi],price] div 2) then
            yesno1.BitBtn1.Enabled := false;
          if yesno1.ShowModal = mrYes then
          begin
            Player[CurrentPlayer,money] := Player[CurrentPlayer,money] - (GameInfo[Player[CurrentPlayer,posi],price] div 2);
            (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
            BrainOfTheGame[Player[CurrentPlayer,posi],sold] := CurrentPlayer;
            (FindComponent('Panel'+IntToStr(Player[CurrentPlayer,posi])) as TPanel).Color := colors[CurrentPlayer];
          end;
        yesno1.BitBtn1.Enabled := true;
        end;
////////////////////////////////////////////////////////////
      end
////////////////////////////////////////////////////////////
//////////i IST NICHT SPIELER DER AN DER REIHE IST//////////
////////////////////////////////////////////////////////////
      else
      begin
        if BrainOfTheGame[Player[CurrentPlayer,posi],sold] = i then
////////////////////////////////////////////////////////////
/////////////FELD GEHÖRT ANDEREM SPIELER i//////////////////
////////////////////////////////////////////////////////////
        begin
          CurrentRent := rent[Player[CurrentPlayer, posi],BrainOfTheGame[Player[CurrentPlayer, posi],built]];
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 1/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 6 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end
          else
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 2/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 16 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end
          else
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 3/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 26 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end
          else
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 4/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 36 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end;
////////////////////////////////////////////////////////////
//////////////////////E-WERK////////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 13 then
          if BrainOfTheGame[29,sold] = i then CurrentRent := ((dice1 + dice2)*200)
          else
          CurrentRent := ((dice1 + dice2)*80);
////////////////////////////////////////////////////////////
/////////////////WASSER-WERK////////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 29 then
          if BrainOfTheGame[13,sold] = i then CurrentRent := ((dice1 + dice2)*200)
          else
          CurrentRent := ((dice1 + dice2)*80);
////////////////////////////////////////////////////////////
/////////////KANN MIETE NICHT BEZAHLEN!/////////////////////
////////////////////////////////////////////////////////////
          if Player[CurrentPlayer, money] < CurrentRent then
          begin
            MessageKind := 5;
            InsertMessage(StreetNames[Player[CurrentPlayer, posi]]+' is van Speler '+ IntToStr(i)+'!', 'Je kunt de huur van ', IntToStr(CurrentRent) + ' Euro niet betalen!');
            info1.ShowModal;
            MessageKind := 6;
            InsertMessage('','Je vliegt eruit!','');
            info1.ShowModal;
            Player[i, money] := Player[i, money] + Player[CurrentPlayer, money];
            Player[CurrentPlayer, money] := 0;
            InGame[CurrentPlayer] := false;
            (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := 'eruit';
            (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).Text := IntToStr(Player[i, money]);
            (FindComponent('Image'+IntToStr(CurrentPlayer)) as TImage).Visible := False;
          end
////////////////////////////////////////////////////////////
///////////////////KANN MIETE BEZAHLEN!/////////////////////
////////////////////////////////////////////////////////////
          else
          begin
            MessageKind := 3;
            InsertMessage(StreetNames[Player[CurrentPlayer, posi]]+' is van Speler '+ IntToStr(i)+'!', 'Je betaalt ', IntToStr(CurrentRent) + ' Euro huur');
            info1.ShowModal;
            Player[CurrentPlayer, money] := Player[CurrentPlayer, money] - CurrentRent;
            Player[i, money] := Player[i, money] + CurrentRent;
            (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
            (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).Text := IntToStr(Player[i,money]);
            mitspieler := 0;
            for n := 1 to 4 do
            if InGame[n] = true then
            inc(mitspieler);
            if mitspieler = 1 then
            for n := 1 to 4 do
            if InGame[n] = true then
            begin
              MessageKind := 3000;
              InsertMessage((FindComponent('LabeledEdit'+IntToStr(n)) as TLabeledEdit).EditLabel.Caption +' is de winner!!','Hartelijk gefeliciteerd!','-eind van het speel-');
              info1.ShowModal;
              button1.Enabled := false;
              button4.Enabled := false;
            end;
          end;
        end;
        if BrainOfTheGame[Player[CurrentPlayer,posi],sold] = (i+4) then
////////////////////////////////////////////////////////////
////////FELD GEHÖRT ANDEREM SPIELER i, ABER HYPOTHEK////////
////////////////////////////////////////////////////////////
        begin
        CurrentRent := rent[Player[CurrentPlayer, posi],BrainOfTheGame[Player[CurrentPlayer, posi],built]];
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 1/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 6 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end
          else
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 2/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 16 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end
          else
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 3/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 26 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end
          else
////////////////////////////////////////////////////////////
//////////////////////Bahnhof 4/////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 36 then
          begin
            if BrainOfTheGame[6,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[16,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[26,sold] = i then CurrentRent := CurrentRent + 500;
            if BrainOfTheGame[36,sold] = i then CurrentRent := CurrentRent + 500;
          end;
////////////////////////////////////////////////////////////
//////////////////////E-WERK////////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 13 then
          if BrainOfTheGame[29,sold] = i then CurrentRent := ((dice1 + dice2)*200)
          else
          CurrentRent := ((dice1 + dice2)*80);
////////////////////////////////////////////////////////////
/////////////////WASSER-WERK////////////////////////////////
////////////////////////////////////////////////////////////
          If Player[CurrentPlayer, posi] = 29 then
          if BrainOfTheGame[13,sold] = i then CurrentRent := ((dice1 + dice2)*200)
          else
          CurrentRent := ((dice1 + dice2)*80);
////////////////////////////////////////////////////////////
////////////KANN MIETE NICHT ZAHLEN/////////////////////////
////////////////////////////////////////////////////////////
          if Player[CurrentPlayer, money] < CurrentRent then
          begin
            MessageKind := 5;
            InsertMessage(StreetNames[Player[CurrentPlayer, posi]]+' is van Speler '+ IntToStr(i)+'!', 'Je kunt de huur van ', IntToStr(CurrentRent) + ' Euro niet betalen!');
            info1.ShowModal;
            MessageKind := 6;
            InsertMessage('','Je vliegt eruit!','');
            info1.ShowModal;
            Player[i, money] := Player[i, money] + Player[CurrentPlayer, money];
            Player[CurrentPlayer, money] := 0;
            InGame[CurrentPlayer] := false;
            (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := 'eruit';
            (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).Text := IntToStr(Player[i, money]);
            (FindComponent('Image'+IntToStr(CurrentPlayer)) as TImage).Visible := False;
            mitspieler := 0;
            for n := 1 to 4 do
            if InGame[n] = true then
            inc(mitspieler);
            if mitspieler = 1 then
            for n := 1 to 4 do
            if InGame[n] = true then
            begin
              MessageKind := 3000;
              InsertMessage((FindComponent('LabeledEdit'+IntToStr(n)) as TLabeledEdit).EditLabel.Caption +' is de winner!!','Hartelijk gefeliciteerd!','-eind van het speel-');
              info1.ShowModal;
              button1.Enabled := false;
              button4.Enabled := false;
            end;
          end
////////////////////////////////////////////////////////////
////////////KANN MIETE ZAHLEN/////////////////////////
////////////////////////////////////////////////////////////
          else
          begin
          CurrentRent := rent[Player[CurrentPlayer, posi],BrainOfTheGame[Player[CurrentPlayer, posi],built]];
          MessageKind := 3;
          InsertMessage(StreetNames[Player[CurrentPlayer, posi]]+' is van Speler '+ IntToStr(i)+'!', 'Helaas heeft hij een hypotheek op zijn straat!', 'Daarom betaal je '+ IntToStr(CurrentRent) + ' Euro huur aan de bank');
          info1.ShowModal;
          Player[CurrentPlayer, money] := Player[CurrentPlayer, money] - CurrentRent;
          (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
          end;
        end;
////////////////////////////////////////////////////////////
////////////ENDE DER FOR-SCHLEIFE///////////////////////////
////////////////////////////////////////////////////////////
      end;
////////////////////////////////////////////////////////////
    end;
////////////////////////////////////////////////////////////
/////////////FELD IST NOCH NICHT VERKAUFT///////////////////
////////////////////////////////////////////////////////////
  end
  else
  begin
    if Player[CurrentPlayer,money] < GameInfo[Player[CurrentPlayer,posi],price] then
////////////////////////////////////////////////////////////
/////////HAT DER SPIELER GENUG GELD????/////////////////////
////////////////////////////////////////////////////////////
    begin
      MessageKind := 4;
      insertmessage('Je hebt niet genoeg geld', 'om deze straat', 'te kopen');
      info1.ShowModal;
    end
    else
////////////////////////////////////////////////////////////
////////////SPIELER HAT GENUG GELD!!////////////////////////
////////////////////////////////////////////////////////////
    begin
      MessageKind := 0;
      insertmessage('De '+streetnames[Player[CurrentPlayer,posi]]+' kost', IntToStr(GameInfo[Player[CurrentPlayer,posi], price])+' Euro!','Wil je deze straat kopen?');
      if yesno1.ShowModal = mrYes then
      begin
        Player[CurrentPlayer,money] := Player[CurrentPlayer,money] - GameInfo[Player[CurrentPlayer,posi],price];
        (FindComponent('LabeledEdit'+IntToStr(CurrentPlayer)) as TLabeledEdit).Text := IntToStr(Player[CurrentPlayer,money]);
        BrainOfTheGame[Player[CurrentPlayer,posi],sold] := CurrentPlayer;
        (FindComponent('Panel'+IntToStr(Player[CurrentPlayer,posi])) as TPanel).Color := colors[CurrentPlayer];
      end;
    end;
  end;
end
////////////////////////////////////////////////////////////
////////////STRASSE NICHT ERHÄLTLICH!!!/////////////////////
////////////////////////////////////////////////////////////
else
begin
end;
////////////////////////////////////////////////////////////
end;
end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
    Button4.Caption := '&Next';
    Inc(CurrentPlayer);
    if CurrentPlayer > MaxPlayer then CurrentPlayer := 1;
    if InGame[CurrentPlayer] = false then inc(CurrentPlayer);
    label51.Caption := ('Speler '+IntToStr(CurrentPlayer)+' aan de beurt.');
    label51.Color := colors[CurrentPlayer+8];
    label52.Color := colors[CurrentPlayer+8];
    label53.Color := colors[CurrentPlayer+8];
    label54.Color := colors[CurrentPlayer+8];
    label55.Color := colors[CurrentPlayer+4];
    label57.Color := colors[CurrentPlayer+4];
    label60.Color := colors[CurrentPlayer+4];
    label62.Color := colors[CurrentPlayer+4];
    label58.Color := colors[CurrentPlayer];
    label61.Color := colors[CurrentPlayer];
    label59.Color := colors[CurrentPlayer];
    label56.Color := colors[CurrentPlayer];
//////////////////////////////////////////////////////////////////////
////////////////////////GEFÄNGNIS/////////////////////////////////////
//////////////////////////////////////////////////////////////////////
    If gevangen[CurrentPlayer] > 0 then
//////////////////////////////////////////////////////////////////////
////////////////////////FREIKAUFEN?///////////////////////////////////
//////////////////////////////////////////////////////////////////////
    begin
      MessageKind := 12;
      InsertMessage('Je zit vast!', '1000 Euro betalen om', 'vrij te komen?');
      if yesno1.showmodal = mrOk then gevangen[CurrentPlayer] := 0;
    end;
//////////////////////////////////////////////////////////////////////
    If gevangen[CurrentPlayer] > 0 then if gevangen[CurrentPlayer] < 4 then tryouts := 3;
    If gevangen[CurrentPlayer] = 4 then gevangen[CurrentPlayer] := 3;  
    Button1.Enabled := true;
    Button4.Enabled := false;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  randomize;
  dice1 := (random(5)+1);  dice2 := (random(5)+1);
  label31.Caption := IntToStr(dice1);  label32.Caption := IntToStr(dice2);
end;

procedure TForm1.Preferences1Click(Sender: TObject);
var
optINI: TINIFile;
i,n,k : integer;
begin
  optINI := TINIFile.Create(ExtractFilePath(Application.EXEName) + 'preferences.ini');
  case form3.ShowModal of
  mrOk :    For i:=1 to MaxPlayer do
            (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).EditLabel.Caption := (optINI.ReadString('Playernames', 'name'+IntToStr(i),'Speler '+IntToStr(i)));
  mrRetry : begin
            MaxPlayer:=optINI.ReadInteger('Players', 'Players', 4);
///////////////////////////////////////////////////////////
////////ANFANG NEUSTART////////////////////////////////////
///////////////////////////////////////////////////////////
            case MaxPlayer of
            2 : begin
                  LabeledEdit1.Visible := True;
                  LabeledEdit2.Visible := True;
                  LabeledEdit3.Visible := False;
                  LabeledEdit4.Visible := False;
                end;
            3 : begin
                  LabeledEdit1.Visible := True;
                  LabeledEdit2.Visible := True;
                  LabeledEdit3.Visible := True;
                  LabeledEdit4.Visible := False;
                end;
            4 : begin
                  LabeledEdit1.Visible := True;
                  LabeledEdit2.Visible := True;
                  LabeledEdit3.Visible := True;
                  LabeledEdit4.Visible := True;
                end;
            end;
    For i:=1 to MaxPlayer do
    begin
      InGame[i] := true;
      player[i,money] := 30000;
      player[i, posi] := 1;
      (FindComponent('Image'+IntToStr(i)) as TImage).Parent := Panel1;
      (FindComponent('Image'+IntToStr(i)) as TImage).Visible := True;
      (FindComponent('Image'+IntToStr(i)) as TImage).Top := 45;
      (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).Text := IntToStr(player[i,money]);
      (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).EditLabel.Caption := (optINI.ReadString('Playernames', 'name'+IntToStr(i),'Speler '+IntToStr(i)));
    end;
    For i:=2 to 10 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=12 to 20 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=22 to 30 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=32 to 40 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=(MaxPlayer+1) to 4 do
    (FindComponent('Image'+IntToStr(i)) as TImage).Visible := false;
    Button4.Caption := '&Start';
    Button4.Enabled := true;
    Button1.Enabled := false;
    CurrentPlayer := 0;
    image1.Left := 0;
    for i:=2 to 4 do
    (FindComponent('Image'+IntToStr(i)) as TImage).Left := ((FindComponent('Image'+IntToStr(i-1)) as TImage).Left + 18);
    pott := 0;
    for n := 1 to 4 do
    for i := 1 to 40 do
    if BrainOfTheGame[i,built] = n then
    for k := 1 to n do
    ((houses[i,k]) as TImage).Destroy;
    for i := 1 to 40 do
    if BrainOfTheGame[i,built] = 5 then
    ((houses[i,5]) as TImage).Destroy;
    for i := 1 to 40 do
    begin
      BrainOfTheGame[i, sold] := 0;
      BrainOfTheGame[i, built] := 0;
      BrainOfTheGame[i, debt] := 0;
    end;
  end;
///////////////////////////////////////////////////////////
////////ENDE NEUSTART//////////////////////////////////////
///////////////////////////////////////////////////////////
            end;
end;

procedure TForm1.ViewonlinerulesDuits1Click(Sender: TObject);
begin
  form6.ShowModal;
end;

procedure TForm1.about1Click(Sender: TObject);
begin
  form7.ShowModal;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  gevangen[CurrentPlayer+1] := 3;
  Player[CurrentPlayer+1,posi] := 11;
end;

procedure TForm1.Restart1Click(Sender: TObject);
var
i,n, k: integer;
begin
///////////////////////////////////////////////////////////
////////ANFANG NEUSTART////////////////////////////////////
///////////////////////////////////////////////////////////
            case MaxPlayer of
            2 : begin
                  LabeledEdit1.Visible := True;
                  LabeledEdit2.Visible := True;
                  LabeledEdit3.Visible := False;
                  LabeledEdit4.Visible := False;
                end;
            3 : begin
                  LabeledEdit1.Visible := True;
                  LabeledEdit2.Visible := True;
                  LabeledEdit3.Visible := True;
                  LabeledEdit4.Visible := False;
                end;
            4 : begin
                  LabeledEdit1.Visible := True;
                  LabeledEdit2.Visible := True;
                  LabeledEdit3.Visible := True;
                  LabeledEdit4.Visible := True;
                end;
            end;
    For i:=1 to MaxPlayer do
    begin
      InGame[i] := true;
      player[i,money] := 30000;
      player[i, posi] := 1;
      (FindComponent('Image'+IntToStr(i)) as TImage).Parent := Panel1;
      (FindComponent('Image'+IntToStr(i)) as TImage).Visible := True;
      (FindComponent('Image'+IntToStr(i)) as TImage).Top := 45;
      (FindComponent('LabeledEdit'+IntToStr(i)) as TLabeledEdit).Text := IntToStr(player[i,money]);
    end;
    For i:=2 to 10 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=12 to 20 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=22 to 30 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=32 to 40 do
    (FindComponent('Panel'+IntToStr(i)) as TPanel).Color := panelcolor;
    For i:=(MaxPlayer+1) to 4 do
    (FindComponent('Image'+IntToStr(i)) as TImage).Visible := false;
    Button4.Caption := '&Start';
    Button4.Enabled := true;
    Button1.Enabled := false;
    CurrentPlayer := 0;
    image1.Left := 0;
    for i:=2 to 4 do
    (FindComponent('Image'+IntToStr(i)) as TImage).Left := ((FindComponent('Image'+IntToStr(i-1)) as TImage).Left + 18);
    pott := 0;
    for n := 1 to 4 do
    for i := 1 to 40 do
    if BrainOfTheGame[i,built] = n then
    for k := 1 to n do
    ((houses[i,k]) as TImage).Destroy;
    for i := 1 to 40 do
    if BrainOfTheGame[i,built] = 5 then
    ((houses[i,5]) as TImage).Destroy;
    for i := 1 to 40 do
    begin
      BrainOfTheGame[i, sold] := 0;
      BrainOfTheGame[i, built] := 0;
      BrainOfTheGame[i, debt] := 0;
    end;
///////////////////////////////////////////////////////////
////////ENDE NEUSTART//////////////////////////////////////
///////////////////////////////////////////////////////////

end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
 hide;
 form8.Show;
 timer2.Enabled := false;
end;

end.
