Mistři v programování na #hovnokod

Delphi #3937

Proč to dělat jednoduše, když to jde složitě :D

function FindInList(const AName: string): pointer;
begin
   case CompareNames(AName) of
   -1: result:= nil;
    0: result:= FBuildings.Items[CompareNames(AName)];
    1: result:= FBuildings.Items[CompareNames(AName)];
    2: result:= FBuildings.Items[CompareNames(AName)];
    3: result:= FBuildings.Items[CompareNames(AName)];
    4: result:= FBuildings.Items[CompareNames(AName)];
    5: result:= FBuildings.Items[CompareNames(AName)];
    6: result:= FBuildings.Items[CompareNames(AName)];
   end;
end;

function CompareNames(AName : string) : integer;
begin
 if AName='' then result := -1;
 if AName='string0' then result:= 0;
 if AName='string1' then result := 1;
 if AName='string2' then result := 2;
 if AName='string3' then result := 3;
 if AName='string4' then result := 4;
 if AName='string5' then result := 5;
 if AName='string6' then result := 6;

end;

Anonymous,