Hi All,

I am porting my general.pas unit from my Delphi 5 Enterprise game. I use
TStringGrid (previously TStringAlignGrid) and this worked fine in my
project.

In procedure Thxboard.flip_boards; the var board2: TStringGrid; gives a
type definition (board2: TStringGrid) error. The unit uses Grid unit.

general.pas is a unit which accept sg1 (a TStringGrid -- previously a
TStringAlignGrid) passed as a parameter from hxboard2.pas which has a
form and StringGrid1 on it's form (a TStringGrid).

>From unit general.pas
unit general;

interface
           
procedure encode_board(sg1: TStringGrid;
  var x_piece, o_piece: board_data_type;
  var x_count: integer);

implementation

// line 55 below
procedure encode_board(sg1: TStringGrid;
  var x_piece, o_piece: board_data_type;
  var x_count: integer);
//general.pas(55,11) Hint: Found declaration:
encode_board(TStringGrid,var board_data_type,var board_data_type,var
LongInt);

//..
end; { encode_board }
{---------------------------------------------------------}

procedure Thxboard.flip_boards;

{ flip known boards for new patterns }
var
  pc, LastRecord, same: integer;
//line 837 -- board1 renamed board1A to avoid 
//name conflict with TStringGrid on TForm
  board1A { board1 }, board2: TStringGrid;
//hexboard2.pas(837,42) Error: Error in type definition
//..
{.........................................................}

  procedure flip_options_symmetrical_board;
//..
  end; { flip_options_symmetrical_board }
{.........................................................}

  procedure add_amend_flipped_pattern;
  var
    b, c: integer;
  begin
    with temp2_pattern do
      begin
//line 868 below
        encode_board(board2, x_piece, o_piece, pc);
//hexboard2.pas(868,28) Error: Incompatible type for arg no. 1: Got
"<erroneous type>", expected "TStringGrid"
    { flip the pawn options }
        if pc > 0 then
          for b := 1 to pc do
            for c := 1 to 3 do
              option[abs(b - pc - 1), abs(c - 4)] :=
temp1_pattern.option[b, c];
        if pc <> level then
          for b := pc + 1 to level do
            for c := 1 to 3 do
              option[b, abs(c - 4)] := temp1_pattern.option[b, c];
      end; { with }
    inc(this_game_counter);
    temp2_pattern.this_game := 0;
    write_updated_pattern(temp2_pattern);
  end; { add_amend_flipped_pattern }
{.........................................................}

  function board_is_symmetrical: boolean;
//..
  end; { board_is_symmetrical }
{.........................................................}

begin { flip_boards }
  {board1} board1A := TStringGrid.create(nil);
  board2 := TStringGrid.create(nil);
  {board1} board1A.ColCount := 8;
  {board1} board1A.RowCount := 8;
  board2.ColCount := 8;
  board2.RowCount := 8;

  { more code commented out }

  {board1} board1A.Free;
  {board1} board1A := nil;
  board2.Free;
  board2 := nil;
end; { flip_boards }
{---------------------------------------------------------}

Best Regards,
        Peter

-- 
Proudly developing Quality Cross Platform Open Source Games
Since 1970 with a Commodore PET 4016 with 16 KRAM
http://pews-freeware-games.org (<--- brand new)


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to