- Timestamp:
- Mar 10, 2019, 6:19:51 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormGameSystem.pas
r283 r284 138 138 FormUnitKinds.UpdateList; 139 139 FormUnitKinds.UpdateInterface; 140 Caption := ExtractFileName(Self.GameSystem.FileName) + ' - ' + SGameSystem; 140 141 end; 141 142 -
trunk/Forms/UFormNation.pas
r283 r284 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Spin,ColorBox, UNation;9 ColorBox, UNation; 10 10 11 11 type … … 30 30 FormNation: TFormNation; 31 31 32 32 33 implementation 33 34 … … 40 41 EditName.Text := Nation.Name; 41 42 ColorBoxColor.Selected := Nation.Color; 43 Caption := Nation.Name + ' - ' + SNation; 42 44 end; 43 45 -
trunk/Forms/UFormNations.lfm
r283 r284 95 95 Caption = 'Clone' 96 96 ImageIndex = 17 97 OnExecute = ACloneExecute 97 98 end 98 99 object ASelectAll: TAction -
trunk/Forms/UFormNations.pas
r283 r284 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ActnList, Menus, U GameSystem, UNation;9 ActnList, Menus, UNation; 10 10 11 11 type … … 33 33 ToolButton4: TToolButton; 34 34 procedure AAddExecute(Sender: TObject); 35 procedure ACloneExecute(Sender: TObject); 35 36 procedure AModifyExecute(Sender: TObject); 36 37 procedure ARemoveExecute(Sender: TObject); … … 137 138 end; 138 139 140 procedure TFormNations.ACloneExecute(Sender: TObject); 141 var 142 TempEntry: TNation; 143 begin 144 if Assigned(ListView1.Selected) then 145 with TNation(ListView1.Selected.Data) do begin 146 TempEntry := TNation.Create; 147 TempEntry.Assign(TNation(ListView1.Selected.Data)); 148 FormNation := TFormNation.Create(Self); 149 try 150 TempEntry.Name := Nations.GetNextAvailableName(TempEntry.Name); 151 FormNation.Load(TempEntry); 152 if FormNation.ShowModal = mrOk then begin 153 FormNation.Save(TempEntry); 154 Nations.Add(TempEntry); 155 TempEntry := nil; 156 UpdateList; 157 UpdateInterface; 158 end; 159 finally 160 FreeAndNil(FormNation); 161 end; 162 TempEntry.Free; 163 end; 164 end; 165 139 166 procedure TFormNations.ASelectAllExecute(Sender: TObject); 140 167 var -
trunk/Forms/UFormPlayers.pas
r282 r284 69 69 70 70 uses 71 UCore, UFormPlayer, UGame ;71 UCore, UFormPlayer, UGame, UNation; 72 72 73 73 resourcestring … … 131 131 TempEntry.Id := Players.GetNewId; 132 132 TempEntry.Name := SPlayer + ' ' + IntToStr(TempEntry.Id); 133 TempEntry.Nation := Core.Game.GameSystem.Nations.First;133 TempEntry.Nation := TNation(Core.Game.GameSystem.Nations.First); 134 134 TempEntry.Color := TempEntry.Nation.Color; 135 135 TempEntry.Mode := pmComputer; 136 136 TempEntry.Agressivity := caMedium; 137 TempEntry.Game := Players.Game; 137 138 FormPlayer.LoadData(TempEntry); 138 139 if FormPlayer.ShowModal = mrOk then begin -
trunk/Forms/UFormUnitKinds.pas
r277 r284 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ActnList, Menus, U GameSystem, UUnit;9 ActnList, Menus, UUnit; 10 10 11 11 type -
trunk/Languages/xtactics.cs.po
r283 r284 227 227 228 228 #: tformgamesystem.caption 229 msgctxt "tformgamesystem.caption" 229 230 msgid "Game system" 230 231 msgstr "Herní systém" … … 1353 1354 msgstr "Chybný formát souboru" 1354 1355 1356 #: ugamesystem.sgamesystem 1357 #, fuzzy 1358 msgctxt "ugamesystem.sgamesystem" 1359 msgid "Game system" 1360 msgstr "Herní systém" 1361 1355 1362 #: ugamesystem.swrongfileformat 1356 1363 msgctxt "ugamesystem.swrongfileformat" … … 1396 1403 msgstr "Trojúhelníková" 1397 1404 1405 #: unation.snation 1406 #, fuzzy 1407 #| msgid "Start units" 1408 msgctxt "unation.snation" 1409 msgid "Nation" 1410 msgstr "Počátečních jednotek" 1411 1398 1412 #: uplayer.sattackerpowerpositive 1399 1413 msgctxt "uplayer.sattackerpowerpositive" … … 1426 1440 msgid "64-bit UInt read overflow." 1427 1441 msgstr "Přetečení při čtení 64-bit UInt" 1442 -
trunk/Languages/xtactics.po
r283 r284 217 217 218 218 #: tformgamesystem.caption 219 msgctxt "tformgamesystem.caption" 219 220 msgid "Game system" 220 221 msgstr "" … … 1313 1314 msgstr "" 1314 1315 1316 #: ugamesystem.sgamesystem 1317 msgctxt "ugamesystem.sgamesystem" 1318 msgid "Game system" 1319 msgstr "" 1320 1315 1321 #: ugamesystem.swrongfileformat 1316 1322 msgctxt "ugamesystem.swrongfileformat" … … 1350 1356 msgstr "" 1351 1357 1358 #: unation.snation 1359 msgctxt "unation.snation" 1360 msgid "Nation" 1361 msgstr "" 1362 1352 1363 #: uplayer.sattackerpowerpositive 1353 1364 msgid "Attacker power have to be higher then 0." -
trunk/UCore.pas
r282 r284 129 129 uses 130 130 UFormMain, UFormNew, UFormSettings, UFormAbout, UClientAI, UFormKeyShortcuts, 131 UFormHelp, UFormCharts, UFormUnitMoves, UFormPlayersStats, UClientGUI, UMapType; 131 UFormHelp, UFormCharts, UFormUnitMoves, UFormPlayersStats, UClientGUI, UMapType, 132 UNation; 132 133 133 134 const … … 521 522 PreferedMapType := mtNone; 522 523 MaxPlayerCount := 3; 523 with Nations.AddNew('Nation 1') do begin524 with TNation(Nations.AddItem('Nation 1')) do begin 524 525 Color := clBlue; 525 526 end; 526 with Nations.AddNew('Nation 2') do begin527 with TNation(Nations.AddItem('Nation 2')) do begin 527 528 Color := clRed; 528 529 end; 529 with Nations.AddNew('Nation 3') do begin530 with TNation(Nations.AddItem('Nation 3')) do begin 530 531 Color := clGreen; 531 532 end; 532 with Nations.AddNew('Nation 4') do begin533 with TNation(Nations.AddItem('Nation 4')) do begin 533 534 Color := clOrange; 534 535 end; 535 with Nations.AddNew('Nation 5') do begin536 with TNation(Nations.AddItem('Nation 5')) do begin 536 537 Color := clPurple; 537 538 end; 538 with Nations.AddNew('Nation 6') do begin539 with TNation(Nations.AddItem('Nation 6')) do begin 539 540 Color := clMaroon; 540 541 end; 541 with Nations.AddNew('Nation 7') do begin542 with TNation(Nations.AddItem('Nation 7')) do begin 542 543 Color := clAqua; 543 544 end; 544 with Nations.AddNew('Nation 8') do begin545 with TNation(Nations.AddItem('Nation 8')) do begin 545 546 Color := clFuchsia; 546 547 end; … … 555 556 UnitsMoveImmediately := False; 556 557 MaxPlayerCount := 8; 557 with Nations.AddNew('Nation 1') do begin558 with TNation(Nations.AddItem('Nation 1')) do begin 558 559 Color := clBlue; 559 560 end; 560 with Nations.AddNew('Nation 2') do begin561 with TNation(Nations.AddItem('Nation 2')) do begin 561 562 Color := clRed; 562 563 end; 563 with Nations.AddNew('Nation 3') do begin564 with TNation(Nations.AddItem('Nation 3')) do begin 564 565 Color := clGreen; 565 566 end; 566 with Nations.AddNew('Nation 4') do begin567 with TNation(Nations.AddItem('Nation 4')) do begin 567 568 Color := clOrange; 568 569 end; 569 with Nations.AddNew('Nation 5') do begin570 with TNation(Nations.AddItem('Nation 5')) do begin 570 571 Color := clPurple; 571 572 end; 572 with Nations.AddNew('Nation 6') do begin573 with TNation(Nations.AddItem('Nation 6')) do begin 573 574 Color := clMaroon; 574 575 end; 575 with Nations.AddNew('Nation 7') do begin576 with TNation(Nations.AddItem('Nation 7')) do begin 576 577 Color := clAqua; 577 578 end; 578 with Nations.AddNew('Nation 8') do begin579 with TNation(Nations.AddItem('Nation 8')) do begin 579 580 Color := clFuchsia; 580 581 end; … … 589 590 UnitsMoveImmediately := True; 590 591 MaxPlayerCount := 3; 591 with Nations.AddNew('Americans') do begin592 with TNation(Nations.AddItem('Americans')) do begin 592 593 Color := clFuchsia; 593 594 end; … … 676 677 UnitsMoveImmediately := True; 677 678 MaxPlayerCount := 3; 678 with Nations.AddNew('Attreides') do begin679 with TNation(Nations.AddItem('Attreides')) do begin 679 680 Color := clBlue; 680 681 end; 681 with Nations.AddNew('Harkonen') do begin682 with TNation(Nations.AddItem('Harkonen')) do begin 682 683 Color := clRed; 683 684 end; 684 with Nations.AddNew('Ordos') do begin685 with TNation(Nations.AddItem('Ordos')) do begin 685 686 Color := clGreen; 686 687 end; 687 with Nations.AddNew('Fremens') do begin688 with TNation(Nations.AddItem('Fremens')) do begin 688 689 Color := clBrown; 689 690 end; 690 with Nations.AddNew('Sardaukers') do begin691 with TNation(Nations.AddItem('Sardaukers')) do begin 691 692 Color := clPurple; 692 693 end; 693 with Nations.AddNew('Merceneries') do begin694 with TNation(Nations.AddItem('Merceneries')) do begin 694 695 Color := clOrange; 695 696 end; … … 734 735 UnitsMoveImmediately := True; 735 736 MaxPlayerCount := 2; 736 with Nations.AddNew('Germany') do begin737 with TNation(Nations.AddItem('Germany')) do begin 737 738 Color := clBlue; 738 739 end; 739 with Nations.AddNew('Russia') do begin740 with TNation(Nations.AddItem('Russia')) do begin 740 741 Color := clRed; 741 742 end; 742 with Nations.AddNew('Alliance') do begin743 with TNation(Nations.AddItem('Alliance')) do begin 743 744 Color := clGreen; 744 745 end; -
trunk/UGameSystem.pas
r282 r284 46 46 GameSystemExt = '.xts'; 47 47 48 resourcestring 49 SGameSystem = 'Game system'; 50 48 51 49 52 implementation -
trunk/UNation.pas
r283 r284 6 6 7 7 uses 8 Classes, SysUtils, fgl, DOM, UXMLUtils, Graphics ;8 Classes, SysUtils, fgl, DOM, UXMLUtils, Graphics, UItemList; 9 9 10 10 type … … 12 12 { TNation } 13 13 14 TNation = class 15 Id: Integer; 16 Name: string; 14 TNation = class(TItem) 17 15 Color: TColor; 18 procedure Assign(Source: TNation); 19 procedure LoadFromNode(Node: TDOMNode); 20 procedure SaveToNode(Node: TDOMNode); 16 function GetFields: TItemFields; override; 17 procedure GetValue(Index: Integer; out Value); override; 18 procedure SetValue(Index: Integer; var Value); override; 19 procedure Assign(Source: TItem); override; 20 procedure LoadFromNode(Node: TDOMNode); override; 21 procedure SaveToNode(Node: TDOMNode); override; 21 22 end; 22 23 23 24 { TNations } 24 25 25 TNations = class(TFPGObjectList<TNation>) 26 NewId: Integer; 27 function FindById(Id: Integer): TNation; 28 function GetNewId: Integer; 29 function AddNew(Name: string): TNation; 26 TNations = class(TItemList) 27 function GetItemClass: TItemClass; override; 30 28 procedure LoadFromNode(Node: TDOMNode); 31 29 procedure SaveToNode(Node: TDOMNode); 32 30 constructor Create(FreeObjects: Boolean = True); 33 procedure Assign(Source: TNations);34 31 end; 32 33 resourcestring 34 SNation = 'Nation'; 35 35 36 36 37 implementation 37 38 39 uses 40 UCommon; 41 38 42 { TNation } 39 43 40 procedure TNation.Assign(Source: TNation);44 function TNation.GetFields: TItemFields; 41 45 begin 42 Id := Source.Id; 43 Name := Source.Name; 44 Color := Source.Color; 46 inherited; 47 Result.AddField('Name'); 48 Result.AddField('Color'); 49 end; 50 51 procedure TNation.GetValue(Index: Integer; out Value); 52 begin 53 if Index = 0 then string(Value) := Name 54 else if Index = 1 then TColor(Value) := Color 55 else raise Exception.Create('Unsupported value index ' + IntToStr(Index)); 56 end; 57 58 procedure TNation.SetValue(Index: Integer; var Value); 59 begin 60 if Index = 0 then Name := string(Value) 61 else if Index = 1 then Color := TColor(Value) 62 else raise Exception.Create('Unsupported value index ' + IntToStr(Index)); 63 end; 64 65 procedure TNation.Assign(Source: TItem); 66 begin 67 inherited; 68 Color := TNation(Source).Color; 45 69 end; 46 70 47 71 procedure TNation.LoadFromNode(Node: TDOMNode); 48 72 begin 49 Id := ReadInteger(Node, 'Id', 0); 50 Name := ReadString(Node, 'Name', ''); 73 inherited; 51 74 Color := ReadInteger(Node, 'Color', 0); 52 75 end; … … 54 77 procedure TNation.SaveToNode(Node: TDOMNode); 55 78 begin 56 WriteInteger(Node, 'Id', Id); 57 WriteString(Node, 'Name', Name); 79 inherited; 58 80 WriteInteger(Node, 'Color', Color); 59 81 end; … … 61 83 { TNations } 62 84 63 function TNations.FindById(Id: Integer): TNation; 64 var 65 I: Integer; 85 function TNations.GetItemClass: TItemClass; 66 86 begin 67 I := 0; 68 while (I < Count) and (Items[I].Id <> Id) do Inc(I); 69 if I < Count then Result := Items[I] 70 else Result := nil; 71 end; 72 73 function TNations.GetNewId: Integer; 74 begin 75 Result := NewId; 76 Inc(NewId); 77 end; 78 79 function TNations.AddNew(Name: string): TNation; 80 begin 81 Result := TNation.Create; 82 Result.Name := Name; 83 Result.Id := GetNewId; 84 Add(Result); 87 Result := TNation; 85 88 end; 86 89 … … 116 119 begin 117 120 inherited; 118 NewId := 1;119 end;120 121 procedure TNations.Assign(Source: TNations);122 var123 I: Integer;124 begin125 while Count > Source.Count do Delete(Count - 1);126 while Count < Source.Count do AddNew('');127 for I := 0 to Count - 1 do128 Items[I].Assign(Source.Items[I]);129 121 end; 130 122 -
trunk/UPlayer.pas
r282 r284 908 908 Defensive := GetValue(DOMString(Path + '/Defensive'), False); 909 909 Agressivity := TComputerAgressivity(GetValue(DOMString(Path + '/Agressivity'), 0)); 910 Nation := T Game(Game).GameSystem.Nations.FindById(GetValue(DOMString(Path + '/Nation'), 0));910 Nation := TNation(TGame(Game).GameSystem.Nations.FindById(GetValue(DOMString(Path + '/Nation'), 0))); 911 911 end; 912 912 end; -
trunk/xtactics.lpi
r283 r284 109 109 </Item7> 110 110 </RequiredPackages> 111 <Units Count="4 5">111 <Units Count="46"> 112 112 <Unit0> 113 113 <Filename Value="xtactics.lpr"/> … … 339 339 </Unit41> 340 340 <Unit42> 341 <Filename Value=" Forms/UFormAbout.lfm"/>341 <Filename Value="UItemList.pas"/> 342 342 <IsPartOfProject Value="True"/> 343 343 </Unit42> 344 344 <Unit43> 345 <Filename Value="Forms/UFormNation.pas"/> 346 <IsPartOfProject Value="True"/> 347 <ComponentName Value="FormNation"/> 348 <HasResources Value="True"/> 349 <ResourceBaseClass Value="Form"/> 345 <Filename Value="Forms/UFormAbout.lfm"/> 346 <IsPartOfProject Value="True"/> 350 347 </Unit43> 351 348 <Unit44> 349 <Filename Value="Forms/UFormNation.pas"/> 350 <IsPartOfProject Value="True"/> 351 <ComponentName Value="FormNation"/> 352 <HasResources Value="True"/> 353 <ResourceBaseClass Value="Form"/> 354 </Unit44> 355 <Unit45> 352 356 <Filename Value="Forms/UFormNations.pas"/> 353 357 <IsPartOfProject Value="True"/> … … 355 359 <HasResources Value="True"/> 356 360 <ResourceBaseClass Value="Form"/> 357 </Unit4 4>361 </Unit45> 358 362 </Units> 359 363 </ProjectOptions>
Note:
See TracChangeset
for help on using the changeset viewer.