Einzelnen Beitrag anzeigen

Benutzerbild von pustekuchen
pustekuchen

Registriert seit: 27. Aug 2010
265 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: overload procedure macht probleme

  Alt 14. Okt 2010, 08:40
Nochmals Danke an alle

Bin euren Ratschlägen gefolgt und zu folgendem Ergebnis gekommen

Delphi-Quellcode:
procedure TMap.LoadMap(fileName: string);
var
  listFields: TStringList;
  i,k,c: integer;
  dlgOpenMap: TOpenDialog;
begin
  dlgOpenMap := TOpenDialog.Create(nil);
  listFields := TStringList.Create;
  fileName := fileName + MAP_FILE_EXTENSION;
  try
  if not FileExists(mapPath + fileName ) then
    if dlgOpenMap.Execute then
      fileName := ExtractFileName(dlgOpenMap.FileName);

  listFields.LoadFromFile(mapPath + fileName);

  c := 0;
  for i := 0 to High(Playground) do
    for k := 0 to High(Playground[i]) do
    begin
      Playground[i][k].Free;
      Playground[i][k] := nil;
      Playground[i][k] := TField.Create(
                             TFieldKinds(StrToInt(listFields.Strings[c][1]))
                                        ,i,k);

      case TFieldKinds(StrToInt(listFields.Strings[c][1])) of
        fkENTRANCE: listEntrances.Add(Playground[i][k]);
        fkEXIT: listExits.Add(Playground[i][k]);
      end;

      if (listFields.Strings[c][2] = '-') then
        Playground[i][k].nextField := TNextField(StrToInt('-' +listFields.Strings[c][3]))
      else
        Playground[i][k].nextField := TNextField(StrToInt(listFields.Strings[c][2]));
      inc(c);
    end;
  finally
    listFields.Free;
    dlgOpenMap.Free;
  end;
  Draw(false);
end;
  Mit Zitat antworten Zitat