Changeset 344 for trunk/Building.pas
- Timestamp:
- Dec 23, 2024, 8:16:05 AM (9 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Building.pas
r317 r344 27 27 { TBuildingKinds } 28 28 29 TBuildingKinds = class(TItemList) 30 class function GetItemClass: TItemClass; override; 31 function FindBySpecialType(SpecialType: TBuildingSpecialType): TItem; 29 TBuildingKinds = class(TItemList<TBuildingKind>) 30 function FindBySpecialType(SpecialType: TBuildingSpecialType): TBuildingKind; 32 31 end; 33 32 … … 46 45 { TBuildings } 47 46 48 TBuildings = class(TItemList )47 TBuildings = class(TItemList<TBuilding>) 49 48 Game: TObject; // TGame; 50 class function GetItemClass: TItemClass; override;51 49 end; 52 50 … … 67 65 uses 68 66 Map; 69 70 { TBuildings }71 72 class function TBuildings.GetItemClass: TItemClass;73 begin74 Result := TBuilding;75 end;76 67 77 68 { TBuilding } … … 148 139 { TBuildingKinds } 149 140 150 class function TBuildingKinds.GetItemClass: TItemClass;151 begin152 Result := TBuildingKind;153 end;154 155 141 function TBuildingKinds.FindBySpecialType(SpecialType: TBuildingSpecialType 156 ): T Item;142 ): TBuildingKind; 157 143 var 158 144 I: Integer; 159 145 begin 160 146 I := 0; 161 while (I < Count) and ( TBuildingKind(Items[I]).SpecialType <> SpecialType) do Inc(I);147 while (I < Count) and (Items[I].SpecialType <> SpecialType) do Inc(I); 162 148 if I < Count then Result := Items[I] 163 149 else Result := nil;
Note:
See TracChangeset
for help on using the changeset viewer.