Changeset 289
- Timestamp:
- Mar 24, 2019, 11:15:07 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormGameSystem.lfm
r283 r289 12 12 OnDestroy = FormDestroy 13 13 OnShow = FormShow 14 LCLVersion = ' 1.8.4.0'14 LCLVersion = '2.0.0.4' 15 15 object ButtonSave: TButton 16 16 Left = 160 … … 58 58 Top = 16 59 59 Width = 744 60 ActivePage = TabSheet Nations60 ActivePage = TabSheetBuildings 61 61 Anchors = [akTop, akLeft, akRight, akBottom] 62 TabIndex = 262 TabIndex = 3 63 63 TabOrder = 4 64 64 object TabSheetGeneral: TTabSheet … … 97 97 Caption = 'Nations' 98 98 end 99 object TabSheetBuildings: TTabSheet 100 Caption = 'Buildings' 101 end 99 102 end 100 103 object OpenDialog1: TOpenDialog -
trunk/Forms/UFormGameSystem.pas
r284 r289 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, UGameSystem, UFormUnitKinds, UFormNations ;9 ComCtrls, UGameSystem, UFormUnitKinds, UFormNations, UFormBuildingKinds; 10 10 11 11 type … … 24 24 PageControl1: TPageControl; 25 25 SaveDialog1: TSaveDialog; 26 TabSheetBuildings: TTabSheet; 26 27 TabSheetNations: TTabSheet; 27 28 TabSheetGeneral: TTabSheet; … … 37 38 FormUnitKinds: TFormUnitKinds; 38 39 FormNations: TFormNations; 40 FormBuildingKinds: TFormBuildingKinds; 39 41 procedure SetGameSystem(AValue: TGameSystem); 40 42 public … … 100 102 FormNations.Align := alClient; 101 103 FormNations.Visible := True; 104 FormBuildingKinds := TFormBuildingKinds.Create(nil); 105 FormBuildingKinds.ManualDock(TabSheetBuildings, nil, alClient); 106 FormBuildingKinds.Align := alClient; 107 FormBuildingKinds.Visible := True; 102 108 end; 103 109 … … 107 113 FreeAndNil(FormNations); 108 114 FreeAndNil(FormUnitKinds); 115 FreeAndNil(FormBuildingKinds); 109 116 end; 110 117 … … 120 127 FormUnitKinds.UnitKinds := nil; 121 128 FormNations.Nations := nil; 129 FormBuildingKinds.BuildingKinds := nil; 122 130 end; 123 131 FGameSystem := AValue; … … 125 133 FormUnitKinds.UnitKinds := GameSystem.UnitKinds; 126 134 FormNations.Nations := GameSystem.Nations; 135 FormBuildingKinds.BuildingKinds := GameSystem.BuildingKinds; 127 136 end; 128 137 end; … … 138 147 FormUnitKinds.UpdateList; 139 148 FormUnitKinds.UpdateInterface; 149 FormBuildingKinds.UpdateList; 150 FormBuildingKinds.UpdateInterface; 140 151 Caption := ExtractFileName(Self.GameSystem.FileName) + ' - ' + SGameSystem; 141 152 end; -
trunk/Languages/xtactics.cs.po
r288 r289 113 113 msgstr "Přepnout Skrytou mapu" 114 114 115 #: tformbuildingkind.buttoncancel.caption 116 #, fuzzy 117 msgctxt "tformbuildingkind.buttoncancel.caption" 118 msgid "Cancel" 119 msgstr "Zrušit" 120 121 #: tformbuildingkind.buttonok.caption 122 #, fuzzy 123 msgctxt "tformbuildingkind.buttonok.caption" 124 msgid "OK" 125 msgstr "OK" 126 127 #: tformbuildingkind.caption 128 msgid "Building kind" 129 msgstr "" 130 131 #: tformbuildingkind.labelname.caption 132 #, fuzzy 133 msgctxt "tformbuildingkind.labelname.caption" 134 msgid "Name:" 135 msgstr "Jméno:" 136 137 #: tformbuildingkinds.aadd.caption 138 #, fuzzy 139 msgctxt "tformbuildingkinds.aadd.caption" 140 msgid "Add" 141 msgstr "Přidat" 142 143 #: tformbuildingkinds.aclone.caption 144 #, fuzzy 145 msgctxt "tformbuildingkinds.aclone.caption" 146 msgid "Clone" 147 msgstr "Klonovat" 148 149 #: tformbuildingkinds.amodify.caption 150 #, fuzzy 151 msgctxt "tformbuildingkinds.amodify.caption" 152 msgid "Modify" 153 msgstr "Upravit" 154 155 #: tformbuildingkinds.aremove.caption 156 #, fuzzy 157 msgctxt "tformbuildingkinds.aremove.caption" 158 msgid "Remove" 159 msgstr "Odstranit" 160 161 #: tformbuildingkinds.aselectall.caption 162 #, fuzzy 163 msgctxt "tformbuildingkinds.aselectall.caption" 164 msgid "Select all" 165 msgstr "Vybrat vše" 166 167 #: tformbuildingkinds.caption 168 msgid "Building kinds" 169 msgstr "" 170 171 #: tformbuildingkinds.listview1.columns[0].caption 172 #, fuzzy 173 msgctxt "tformbuildingkinds.listview1.columns[0].caption" 174 msgid "Name" 175 msgstr "Jméno" 176 115 177 #: tformcharts.caption 116 178 msgctxt "tformcharts.caption" … … 218 280 msgid "Units can split or merge" 219 281 msgstr "Dělení nebo slučování jednotek" 282 283 #: tformgamesystem.tabsheetbuildings.caption 284 msgid "Buildings" 285 msgstr "" 220 286 221 287 #: tformgamesystem.tabsheetgeneral.caption … … 950 1016 msgstr "Jméno" 951 1017 1018 #: ubuilding.sbuilding 1019 msgid "Building" 1020 msgstr "" 1021 952 1022 #: uclientgui.swrongarrowangle 953 1023 msgid "Wrong arrow angle %s" … … 1007 1077 msgid "Version" 1008 1078 msgstr "Verze" 1079 1080 #: uformbuildingkinds.snewbuildingkind 1081 msgid "New building kind" 1082 msgstr "" 1083 1084 #: uformbuildingkinds.sremoveitems 1085 #, fuzzy 1086 msgctxt "uformbuildingkinds.sremoveitems" 1087 msgid "Remove items" 1088 msgstr "Odstranit položky" 1089 1090 #: uformbuildingkinds.sremoveitemsquery 1091 #, fuzzy 1092 msgctxt "uformbuildingkinds.sremoveitemsquery" 1093 msgid "Do you want to remove selected items?" 1094 msgstr "Opravdu chcete odstranit vybrané položky?" 1009 1095 1010 1096 #: uformcharts.scitiescount … … 1324 1410 msgid "Unfinished battle" 1325 1411 msgstr "Neukončená bitva" 1412 -
trunk/Languages/xtactics.po
r288 r289 103 103 msgstr "" 104 104 105 #: tformbuildingkind.buttoncancel.caption 106 msgctxt "tformbuildingkind.buttoncancel.caption" 107 msgid "Cancel" 108 msgstr "" 109 110 #: tformbuildingkind.buttonok.caption 111 msgctxt "tformbuildingkind.buttonok.caption" 112 msgid "OK" 113 msgstr "" 114 115 #: tformbuildingkind.caption 116 msgid "Building kind" 117 msgstr "" 118 119 #: tformbuildingkind.labelname.caption 120 msgctxt "tformbuildingkind.labelname.caption" 121 msgid "Name:" 122 msgstr "" 123 124 #: tformbuildingkinds.aadd.caption 125 msgctxt "tformbuildingkinds.aadd.caption" 126 msgid "Add" 127 msgstr "" 128 129 #: tformbuildingkinds.aclone.caption 130 msgctxt "tformbuildingkinds.aclone.caption" 131 msgid "Clone" 132 msgstr "" 133 134 #: tformbuildingkinds.amodify.caption 135 msgctxt "tformbuildingkinds.amodify.caption" 136 msgid "Modify" 137 msgstr "" 138 139 #: tformbuildingkinds.aremove.caption 140 msgctxt "tformbuildingkinds.aremove.caption" 141 msgid "Remove" 142 msgstr "" 143 144 #: tformbuildingkinds.aselectall.caption 145 msgctxt "tformbuildingkinds.aselectall.caption" 146 msgid "Select all" 147 msgstr "" 148 149 #: tformbuildingkinds.caption 150 msgid "Building kinds" 151 msgstr "" 152 153 #: tformbuildingkinds.listview1.columns[0].caption 154 msgctxt "tformbuildingkinds.listview1.columns[0].caption" 155 msgid "Name" 156 msgstr "" 157 105 158 #: tformcharts.caption 106 159 msgctxt "tformcharts.caption" … … 209 262 msgstr "" 210 263 264 #: tformgamesystem.tabsheetbuildings.caption 265 msgid "Buildings" 266 msgstr "" 267 211 268 #: tformgamesystem.tabsheetgeneral.caption 212 269 msgctxt "tformgamesystem.tabsheetgeneral.caption" … … 936 993 msgstr "" 937 994 995 #: ubuilding.sbuilding 996 msgid "Building" 997 msgstr "" 998 938 999 #: uclientgui.swrongarrowangle 939 1000 msgid "Wrong arrow angle %s" … … 992 1053 #: uformabout.sversion 993 1054 msgid "Version" 1055 msgstr "" 1056 1057 #: uformbuildingkinds.snewbuildingkind 1058 msgid "New building kind" 1059 msgstr "" 1060 1061 #: uformbuildingkinds.sremoveitems 1062 msgctxt "uformbuildingkinds.sremoveitems" 1063 msgid "Remove items" 1064 msgstr "" 1065 1066 #: uformbuildingkinds.sremoveitemsquery 1067 msgctxt "uformbuildingkinds.sremoveitemsquery" 1068 msgid "Do you want to remove selected items?" 994 1069 msgstr "" 995 1070 -
trunk/UBuilding.pas
r265 r289 9 9 10 10 type 11 12 { TBuildingKind } 13 11 14 TBuildingKind = class 12 15 Id: Integer; 13 16 Name: string; 14 17 Cost: Integer; 18 procedure Assign(Source: TBuildingKind); 19 procedure LoadFromNode(Node: TDOMNode); 20 procedure SaveToNode(Node: TDOMNode); 15 21 end; 16 22 … … 19 25 TBuildingKinds = class(TFPGObjectList<TBuildingKind>) 20 26 function AddNew(Name: string): TBuildingKind; 27 procedure LoadFromNode(Node: TDOMNode); 28 procedure SaveToNode(Node: TDOMNode); 29 procedure Assign(Source: TBuildingKinds); 21 30 end; 22 31 … … 25 34 end; 26 35 36 resourcestring 37 SBuilding = 'Building'; 38 27 39 28 40 implementation 41 42 { TBuildingKind } 43 44 procedure TBuildingKind.Assign(Source: TBuildingKind); 45 begin 46 Name := Source.Name; 47 Cost := Source.Cost; 48 end; 49 50 procedure TBuildingKind.LoadFromNode(Node: TDOMNode); 51 begin 52 Id := ReadInteger(Node, 'Id', 0); 53 Name := ReadString(Node, 'Name', ''); 54 Cost := ReadInteger(Node, 'Cost', 0); 55 end; 56 57 procedure TBuildingKind.SaveToNode(Node: TDOMNode); 58 begin 59 WriteInteger(Node, 'Id', Id); 60 WriteString(Node, 'Name', Name); 61 WriteInteger(Node, 'Cost', Cost); 62 end; 29 63 30 64 { TBuildingKinds } … … 37 71 end; 38 72 73 procedure TBuildingKinds.LoadFromNode(Node: TDOMNode); 74 var 75 Node2: TDOMNode; 76 NewItem: TBuildingKind; 77 begin 78 Count := 0; 79 Node2 := Node.FirstChild; 80 while Assigned(Node2) and (Node2.NodeName = 'BuildingKind') do begin 81 NewItem := TBuildingKind.Create; 82 NewItem.LoadFromNode(Node2); 83 Add(NewItem); 84 Node2 := Node2.NextSibling; 85 end; 86 end; 87 88 procedure TBuildingKinds.SaveToNode(Node: TDOMNode); 89 var 90 I: Integer; 91 NewNode2: TDOMNode; 92 begin 93 for I := 0 to Count - 1 do 94 with Items[I] do begin 95 NewNode2 := Node.OwnerDocument.CreateElement('BuildingKind'); 96 Node.AppendChild(NewNode2); 97 SaveToNode(NewNode2); 98 end; 99 end; 100 101 procedure TBuildingKinds.Assign(Source: TBuildingKinds); 102 var 103 I: Integer; 104 begin 105 while Count > Source.Count do Delete(Count - 1); 106 while Count < Source.Count do AddNew(''); 107 for I := 0 to Count - 1 do 108 Items[I].Assign(Source.Items[I]); 109 end; 110 39 111 end. 40 112 -
trunk/UGameSystem.pas
r284 r289 7 7 uses 8 8 Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, UXMLUtils, XMLConf, 9 FileUtil, UMapType, UNation ;9 FileUtil, UMapType, UNation, UBuilding; 10 10 11 11 type … … 23 23 PreferedMapType: TMapType; 24 24 Nations: TNations; 25 BuildingKinds: TBuildingKinds; 25 26 constructor Create; 26 27 destructor Destroy; override; … … 79 80 begin 80 81 UnitKinds := TUnitKinds.Create; 82 BuildingKinds := TBuildingKinds.Create; 81 83 Nations := TNations.Create; 82 84 end; … … 85 87 begin 86 88 Nations.Free; 89 BuildingKinds.Free; 87 90 UnitKinds.Free; 88 91 inherited Destroy; … … 92 95 begin 93 96 UnitKinds.Clear; 97 BuildingKinds.Clear; 94 98 Nations.Clear; 95 99 end; … … 109 113 PreferedMapType := Source.PreferedMapType; 110 114 UnitKinds.Assign(Source.UnitKinds); 115 BuildingKinds.Assign(Source.BuildingKinds); 111 116 Nations.Assign(Source.Nations); 112 117 end; … … 124 129 if Assigned(NewNode) then 125 130 UnitKinds.LoadFromNode(NewNode); 131 NewNode := Node.FindNode('BuildingKinds'); 132 if Assigned(NewNode) then 133 BuildingKinds.LoadFromNode(NewNode); 126 134 NewNode := Node.FindNode('Nations'); 127 135 if Assigned(NewNode) then … … 141 149 Node.AppendChild(NewNode); 142 150 UnitKinds.SaveToNode(NewNode); 151 NewNode := Node.OwnerDocument.CreateElement('BuildingKinds'); 152 Node.AppendChild(NewNode); 153 BuildingKinds.SaveToNode(NewNode); 143 154 NewNode := Node.OwnerDocument.CreateElement('Nations'); 144 155 Node.AppendChild(NewNode); -
trunk/xtactics.lpi
r287 r289 110 110 </Item7> 111 111 </RequiredPackages> 112 <Units Count="4 6">112 <Units Count="48"> 113 113 <Unit0> 114 114 <Filename Value="xtactics.lpr"/> … … 361 361 <ResourceBaseClass Value="Form"/> 362 362 </Unit45> 363 <Unit46> 364 <Filename Value="Forms/UFormBuildingKind.pas"/> 365 <IsPartOfProject Value="True"/> 366 <ComponentName Value="FormBuildingKind"/> 367 <HasResources Value="True"/> 368 <ResourceBaseClass Value="Form"/> 369 </Unit46> 370 <Unit47> 371 <Filename Value="Forms/UFormBuildingKinds.pas"/> 372 <IsPartOfProject Value="True"/> 373 <ComponentName Value="FormBuildingKinds"/> 374 <HasResources Value="True"/> 375 <ResourceBaseClass Value="Form"/> 376 </Unit47> 363 377 </Units> 364 378 </ProjectOptions>
Note:
See TracChangeset
for help on using the changeset viewer.