This repository was archived by the owner on Aug 21, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ TNamedCollectionItemClass = class of TNamedCollectionItem;
115115 THashedCollection = class (TCollection)
116116 private
117117 FHash: TFPHashObjectList;
118+
118119 protected
119120 procedure ItemIdentifierChanged (Item: TCollectionItem; AOldName: String; ANewName: String); virtual ;
120121 procedure ItemAdded (Item: TCollectionItem); virtual ;
@@ -132,6 +133,8 @@ THashedCollection = class(TCollection)
132133 procedure Remove (AIdentifier: String);
133134
134135 function FindItem (const AName: String): TNamedCollectionItem;
136+
137+ procedure SortByDisplayName ;
135138 end ;
136139
137140
@@ -564,6 +567,16 @@ function THashedCollection.FindItem(const AName: String): TNamedCollectionItem;
564567 Result := TNamedCollectionItem(Items[idx]);
565568end ;
566569
570+ function CompareByDisplayName (Item1, Item2: TCollectionItem): Integer;
571+ begin
572+ Result := CompareStr(Item1.DisplayName,Item2.DisplayName);
573+ end ;
574+
575+ procedure THashedCollection.SortByDisplayName ;
576+ begin
577+ Sort(@CompareByDisplayName);
578+ end ;
579+
567580{ TNamedCollectionItem }
568581
569582procedure TNamedCollectionItem.SetIdentifier (AValue: AnsiString);
Original file line number Diff line number Diff line change @@ -108,7 +108,6 @@ function filter_stub(ATarget: TBaseInfo): Boolean;
108108 Result := True;
109109end ;
110110
111-
112111function FillItems (ATarget: TStrings; AFullList: TStrings; ASelected: AnsiString): integer;
113112var
114113 i: Integer;
@@ -122,7 +121,7 @@ function FillItems(ATarget: TStrings; AFullList: TStrings; ASelected: AnsiString
122121 info := AFullList.Objects[i] as TBaseInfo;
123122 if info.IsValid then
124123 begin
125- ATarget.AddObject(info.Name + ' ( ' +info.Identifier+ ' ) ' ,info);
124+ ATarget.AddObject(info.Name ,info);
126125 if (ASelected <>' ' ) and (info.Identifier = ASelected) then
127126 begin
128127 Result := ATarget.Count - 1 ;
Original file line number Diff line number Diff line change @@ -550,7 +550,7 @@ TResolveRequest = record
550550 FCreatureInfos: TCreatureInfos;
551551 FHeroInfos: THeroInfos;
552552 FArtifactInfos: TArtifactInfos;
553- FArtifactSlotMaps: array [0 ..ARTIFACT_SLOT_COUNT-1 ] of TStrings ;
553+ FArtifactSlotMaps: array [0 ..ARTIFACT_SLOT_COUNT-1 ] of TStringList ;
554554 FSlotIds: TSlotMap;
555555
556556 FResolveRequests: TResolveRequests;
@@ -1368,7 +1368,9 @@ constructor TListsManager.Create(AOwner: TComponent);
13681368
13691369 for i in [0 ..ARTIFACT_SLOT_COUNT-1 ] do
13701370 begin
1371- FArtifactSlotMaps[i] := CrStrList;
1371+ FArtifactSlotMaps[i] := TStringList.Create;
1372+ FArtifactSlotMaps[i].Sorted:=false;
1373+ FArtifactSlotMaps[i].Duplicates:=dupAccept;
13721374 end ;
13731375
13741376 FHeroInfos := THeroInfos.Create(self);
@@ -2076,6 +2078,7 @@ procedure TListsManager.Load(AProgess: IProgressCallback; APaths: TModdedConfigP
20762078
20772079 FDestreamer.JSONToObjectEx(FCombinedConfig, ATarget);
20782080
2081+ ATarget.SortByDisplayName;
20792082 finally
20802083 FCombinedConfig.Free;
20812084 FConfig.Free;
Original file line number Diff line number Diff line change 2929 <AutoIncrementBuild Value =" True" />
3030 <MinorVersionNr Value =" 1" />
3131 <RevisionNr Value =" 14" />
32- <BuildNr Value =" 143 " />
32+ <BuildNr Value =" 144 " />
3333 <Attributes pvaPreRelease =" True" />
3434 <StringTable OriginalFilename =" vcmieditor.exe" ProductName =" VCMI" ProductVersion =" 0.99" />
3535 </VersionInfo >
You can’t perform that action at this time.
0 commit comments