Changeset 391
- Timestamp:
- Jan 5, 2025, 9:08:52 PM (3 days ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Forms/FormList.pas
r373 r391 72 72 SRemoveItems = 'Remove items'; 73 73 SRemoveItemsQuery = 'Do you want to remove selected items?'; 74 SNew = 'New';75 74 76 75 { TFormList } … … 129 128 FormItem := TFormItem.Create(Self); 130 129 try 131 TempEntry.Name := FList.GetNextAvailableName( SNew + ' ' + LowerCase(List.GetName));130 TempEntry.Name := FList.GetNextAvailableName(List.GetName); 132 131 FormItem.Item := TempEntry; 133 132 if FormItem.ShowModal = mrOk then begin -
trunk/Packages/Common/ItemList.pas
r359 r391 368 368 NewName: string); 369 369 begin 370 NewName := Name ;370 NewName := Name + ' 1'; 371 371 while Assigned(FindByName(NewName)) do 372 372 NewName := IncrementName(NewName); -
trunk/Packages/Common/Languages/FormList.cs.po
r364 r391 12 12 "X-Generator: Poedit 3.5\n" 13 13 14 #: formlist.snew15 msgid "New"16 msgstr "Nová"17 18 14 #: formlist.sremoveitems 19 15 msgid "Remove items" -
trunk/Packages/Common/Languages/FormList.pot
r355 r391 1 1 msgid "" 2 2 msgstr "Content-Type: text/plain; charset=UTF-8" 3 4 #: formlist.snew5 msgid "New"6 msgstr ""7 3 8 4 #: formlist.sremoveitems -
trunk/Player.pas
r349 r391 137 137 public 138 138 Game: TObject; //TGame; 139 function GetPlayerByColor(Color: TColor): TPlayer; 140 function GetUnusedColor: TColor; 139 141 procedure Assign(Source: TItemList<TPlayer>); override; 140 142 procedure New(Name: string; Color: TColor; Mode: TPlayerMode); … … 206 208 SDefensive = 'Defensive'; 207 209 210 const 211 PlayerColors: array[0..11] of TColor = (clBlue, clRed, clGreen, clYellow, 212 clFuchsia, clAqua, clOlive, clMaroon, clNavy, clPurple, clTeal, clGray); 213 208 214 function ComparePointer(constref Item1, Item2: Integer): Integer; 209 215 begin … … 502 508 end; 503 509 510 function TPlayers.GetPlayerByColor(Color: TColor): TPlayer; 511 var 512 I: Integer; 513 begin 514 I := 0; 515 while (I < Count) do begin 516 if Assigned(Items[I]) and (Items[I].Color = Color) then Break; 517 Inc(I); 518 end; 519 if I < Count then Result := Items[I] 520 else Result := nil; 521 end; 522 523 function TPlayers.GetUnusedColor: TColor; 524 var 525 I: Integer; 526 begin 527 Result := clBlack; 528 for I := 0 to Length(PlayerColors) - 1 do 529 if not Assigned(GetPlayerByColor(PlayerColors[I])) then begin 530 Result := PlayerColors[I]; 531 Exit; 532 end; 533 end; 534 504 535 procedure TPlayers.Assign(Source: TItemList<TPlayer>); 505 536 var … … 526 557 Result := inherited; 527 558 Result.Game := Game; 559 Result.Color := GetUnusedColor; 528 560 end; 529 561
Note:
See TracChangeset
for help on using the changeset viewer.