Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.477 Beiträge
Delphi 12 Athens
|
AW: Breakpoint / Compiler Probleme
7. Jan 2011, 13:48
+Warum eigentlich "Shortstring", das wird doch unnötig groß da immer die maximale Größe an Speicher reserviert wird. Da Name und Dateiname immer als Paar auftreten und z.T. mehrfach verwendet werden, würde ich die Struktur auch anders aufbauen:
Delphi-Quellcode:
interface
function ChartsName(n1, n2: Integer): string;
function ChartsPath(n1, n2: Integer): string;
implementation
type
TChartRec = record
Name: string;
Path: string;
end
const
Chart_INFO1 : TChartRec = (Name = 'INFO 1' , Path = 'INFO1.jpg');
Chart_INFO2 : TChartRec = (Name = 'INFO 1' , Path = 'INFO1.jpg');
Chart_GND : TChartRec = (Name = 'GND' , Path = 'GND.jpg');
Chart_PARKEast : TChartRec = (Name = 'PARK East' , Path = 'PARKEast.jpg');
Chart_PARK : TChartRec = (Name = 'PARK' , Path = 'PARK.jpg');
Chart_PARKWest : TChartRec = (Name = 'PARK West' , Path = 'PARKWest.jpg');
Chart_SIDAMEXO : TChartRec = (Name = 'SID AMEXO' , Path = 'SIDAMEXO.jpg');
Chart_SID : TChartRec = (Name = 'SID' , Path = 'SID.jpg');
{...usw....}
FCharts: array [0..40, 0..4] of TChartRec =
((Chart_INFO1, Chart_INFO1, Chart_GND, Chart_GND, Chart_GND),
(Chart_INFO2, Chart_INFO2, Chart_PARKEast, Chart_PARK, Chart_PARK),
(Chart_GND, Chart_GND, Chart_PARKWest, Chart_SIDAMEXO, Chart_SID),
{...usw....}
);
function ChartsName(n1, n2: Integer): string;
begin
Result := FCharts[n1, n2].Name;
end;
function ChartsPath(n1, n2: Integer): string;
begin
case n2 of
0: Result := 'EDDG';
1: Result := 'EDDH';
2: Result := 'EDDK';
3: Result := 'EDDM';
4: Result := 'EDDT';
else
Result := '';
Exit;
end;
Result := Format('Charts/%s/%s', [Result, FCharts[n1, n2].Path]);
end;
P.S. warum versaut der Delphi-Tag meine schöne Formatierung
|
|
Zitat
|