Changeset 294
- Timestamp:
- Mar 29, 2019, 8:40:42 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Languages/xtactics.cs.po
r290 r294 877 877 msgstr "Obecné" 878 878 879 #: tformunitkind.buttoncancel.caption880 msgctxt "tformunitkind.buttoncancel.caption"881 msgid "Cancel"882 msgstr "Zrušit"883 884 #: tformunitkind.buttonok.caption885 msgctxt "tformunitkind.buttonok.caption"886 msgid "OK"887 msgstr "OK"888 889 #: tformunitkind.caption890 msgid "Unit kind"891 msgstr "Druh jednotky"892 893 #: tformunitkind.labelhealth.caption894 msgid "Health:"895 msgstr "Zdraví:"896 897 #: tformunitkind.labelname.caption898 msgctxt "tformunitkind.labelname.caption"899 msgid "Name:"900 msgstr "Jméno:"901 902 #: tformunitkinds.aadd.caption903 msgctxt "tformunitkinds.aadd.caption"904 msgid "Add"905 msgstr "Přidat"906 907 #: tformunitkinds.aclone.caption908 msgctxt "tformunitkinds.aclone.caption"909 msgid "Clone"910 msgstr "Klonovat"911 912 #: tformunitkinds.amodify.caption913 msgctxt "tformunitkinds.amodify.caption"914 msgid "Modify"915 msgstr "Upravit"916 917 #: tformunitkinds.aremove.caption918 msgctxt "tformunitkinds.aremove.caption"919 msgid "Remove"920 msgstr "Odstranit"921 922 #: tformunitkinds.aselectall.caption923 msgctxt "tformunitkinds.aselectall.caption"924 msgid "Select all"925 msgstr "Vybrat vše"926 927 #: tformunitkinds.caption928 msgid "Unit kinds"929 msgstr "Druhy jednotek"930 931 #: tformunitkinds.listview1.columns[0].caption932 msgctxt "tformunitkinds.listview1.columns[0].caption"933 msgid "Name"934 msgstr "Jméno"935 936 879 #: ubuilding.sbuildingkind 937 880 msgctxt "ubuilding.sbuildingkind" … … 940 883 941 884 #: ubuilding.scost 885 msgctxt "ubuilding.scost" 942 886 msgid "Cost" 943 887 msgstr "Cena" 888 889 #: ubuilding.sspecialtype 890 msgid "Special type" 891 msgstr "Speciální typ" 944 892 945 893 #: uclientgui.swrongarrowangle … … 1200 1148 msgstr "Opravdu chcete odstranit vybrané položky?" 1201 1149 1202 #: uformunitkinds.snewunitkind1203 msgid "New unit kind"1204 msgstr "Nový druh jednotky"1205 1206 #: uformunitkinds.sremoveitems1207 msgctxt "uformunitkinds.sremoveitems"1208 msgid "Remove items"1209 msgstr "Odstranit položky"1210 1211 #: uformunitkinds.sremoveitemsquery1212 msgctxt "uformunitkinds.sremoveitemsquery"1213 msgid "Do you want to remove selected items?"1214 msgstr "Opravdu chcete odstranit vybrané položky?"1215 1216 1150 #: ugame.scomputer 1217 1151 msgctxt "ugame.scomputer" … … 1341 1275 msgstr "Neukončená bitva" 1342 1276 1277 #: uunit.scost 1278 msgctxt "uunit.scost" 1279 msgid "Cost" 1280 msgstr "Cena" 1281 1282 #: uunit.smoves 1283 msgid "Moves" 1284 msgstr "Pohyby" 1285 1286 #: uunit.spowerattack 1287 msgid "Attack power" 1288 msgstr "Síla útoku" 1289 1290 #: uunit.spowerdefense 1291 msgid "Defense power" 1292 msgstr "Síla obrany" 1293 1294 #: uunit.sstack 1295 msgid "Stack" 1296 msgstr "Sada" 1297 1298 #: uunit.sunitkind 1299 msgctxt "uunit.sunitkind" 1300 msgid "Unit kind" 1301 msgstr "Druh jednotky" 1302 1303 #: uunit.sviewrange 1304 msgid "View range" 1305 msgstr "Dohled" -
trunk/Languages/xtactics.po
r290 r294 863 863 msgstr "" 864 864 865 #: tformunitkind.buttoncancel.caption866 msgctxt "tformunitkind.buttoncancel.caption"867 msgid "Cancel"868 msgstr ""869 870 #: tformunitkind.buttonok.caption871 msgctxt "tformunitkind.buttonok.caption"872 msgid "OK"873 msgstr ""874 875 #: tformunitkind.caption876 msgid "Unit kind"877 msgstr ""878 879 #: tformunitkind.labelhealth.caption880 msgid "Health:"881 msgstr ""882 883 #: tformunitkind.labelname.caption884 msgctxt "tformunitkind.labelname.caption"885 msgid "Name:"886 msgstr ""887 888 #: tformunitkinds.aadd.caption889 msgctxt "tformunitkinds.aadd.caption"890 msgid "Add"891 msgstr ""892 893 #: tformunitkinds.aclone.caption894 msgctxt "tformunitkinds.aclone.caption"895 msgid "Clone"896 msgstr ""897 898 #: tformunitkinds.amodify.caption899 msgctxt "tformunitkinds.amodify.caption"900 msgid "Modify"901 msgstr ""902 903 #: tformunitkinds.aremove.caption904 msgctxt "tformunitkinds.aremove.caption"905 msgid "Remove"906 msgstr ""907 908 #: tformunitkinds.aselectall.caption909 msgctxt "tformunitkinds.aselectall.caption"910 msgid "Select all"911 msgstr ""912 913 #: tformunitkinds.caption914 msgid "Unit kinds"915 msgstr ""916 917 #: tformunitkinds.listview1.columns[0].caption918 msgctxt "tformunitkinds.listview1.columns[0].caption"919 msgid "Name"920 msgstr ""921 922 865 #: ubuilding.sbuildingkind 923 866 msgctxt "ubuilding.sbuildingkind" … … 926 869 927 870 #: ubuilding.scost 871 msgctxt "ubuilding.scost" 928 872 msgid "Cost" 873 msgstr "" 874 875 #: ubuilding.sspecialtype 876 msgid "Special type" 929 877 msgstr "" 930 878 … … 1178 1126 msgstr "" 1179 1127 1180 #: uformunitkinds.snewunitkind1181 msgid "New unit kind"1182 msgstr ""1183 1184 #: uformunitkinds.sremoveitems1185 msgctxt "uformunitkinds.sremoveitems"1186 msgid "Remove items"1187 msgstr ""1188 1189 #: uformunitkinds.sremoveitemsquery1190 msgctxt "uformunitkinds.sremoveitemsquery"1191 msgid "Do you want to remove selected items?"1192 msgstr ""1193 1194 1128 #: ugame.scomputer 1195 1129 msgctxt "ugame.scomputer" … … 1310 1244 msgstr "" 1311 1245 1246 #: uunit.scost 1247 msgctxt "uunit.scost" 1248 msgid "Cost" 1249 msgstr "" 1250 1251 #: uunit.smoves 1252 msgid "Moves" 1253 msgstr "" 1254 1255 #: uunit.spowerattack 1256 msgid "Attack power" 1257 msgstr "" 1258 1259 #: uunit.spowerdefense 1260 msgid "Defense power" 1261 msgstr "" 1262 1263 #: uunit.sstack 1264 msgid "Stack" 1265 msgstr "" 1266 1267 #: uunit.sunitkind 1268 msgctxt "uunit.sunitkind" 1269 msgid "Unit kind" 1270 msgstr "" 1271 1272 #: uunit.sviewrange 1273 msgid "View range" 1274 msgstr "" 1275 -
trunk/Systems/HexWars.xts
r292 r294 17 17 </UnitKind> 18 18 </UnitKinds> 19 <BuildingKinds/> 19 <BuildingKinds> 20 <BuildingKind> 21 <Id>0</Id> 22 <Name>City</Name> 23 <Cost>0</Cost> 24 <SpecialType>9515521</SpecialType> 25 </BuildingKind> 26 </BuildingKinds> 20 27 <Nations> 21 28 <Nation> -
trunk/UBuilding.pas
r290 r294 9 9 10 10 type 11 TBuildingSpecialType = (stNone, stCity); 11 12 12 13 { TBuildingKind } … … 14 15 TBuildingKind = class(TItem) 15 16 Cost: Integer; 17 SpecialType: TBuildingSpecialType; 16 18 class function GetFields: TItemFields; override; 17 19 procedure GetValue(Index: Integer; out Value); override; … … 25 27 TBuildingKinds = class(TItemList) 26 28 class function GetItemClass: TItemClass; override; 29 function FindBySpecialType(SpecialType: TBuildingSpecialType): TItem; 27 30 end; 28 31 29 TBuilding = class 32 { TBuilding } 33 34 TBuilding = class(TItem) 35 private 36 FMapCell: TObject; 37 procedure SetMapCell(AValue: TObject); 38 public 30 39 Kind: TBuildingKind; 40 property MapCell: TObject read FMapCell write SetMapCell; // TMapCell; 41 end; 42 43 { TBuildings } 44 45 TBuildings = class(TItemList) 46 Game: TObject; // TGame; 47 class function GetItemClass: TItemClass; override; 31 48 end; 32 49 … … 34 51 SBuildingKind = 'Building'; 35 52 SCost = 'Cost'; 53 SSpecialType = 'Special type'; 36 54 37 55 38 56 implementation 57 58 uses 59 UMap; 60 61 { TBuildings } 62 63 class function TBuildings.GetItemClass: TItemClass; 64 begin 65 Result := TBuilding; 66 end; 67 68 { TBuilding } 69 70 procedure TBuilding.SetMapCell(AValue: TObject); 71 var 72 OldValue: TCell; 73 begin 74 if FMapCell = AValue then Exit; 75 OldValue := TCell(FMapCell); 76 FMapCell := nil; 77 if Assigned(OldValue) then TCell(OldValue).Building := nil; 78 FMapCell := AValue; 79 if Assigned(FMapCell) then TCell(FMapCell).Building := Self; 80 end; 39 81 40 82 { TBuildingKind } … … 44 86 Result := inherited; 45 87 Result.AddField(2, 'Cost', SCost, dtInteger); 88 Result.AddField(3, 'SpecialType', SSpecialType, dtInteger); 46 89 end; 47 90 … … 50 93 if Index = 1 then string(Value) := Name 51 94 else if Index = 2 then Integer(Value) := Cost 95 else if Index = 3 then TBuildingSpecialType(Value) := SpecialType 52 96 else raise Exception.Create('Unsupported value index ' + IntToStr(Index)); 53 97 end; … … 57 101 if Index = 1 then Name := string(Value) 58 102 else if Index = 2 then Cost := Integer(Value) 103 else if Index = 3 then SpecialType := TBuildingSpecialType(Value) 59 104 else raise Exception.Create('Unsupported value index ' + IntToStr(Index)); 60 105 end; … … 77 122 end; 78 123 124 function TBuildingKinds.FindBySpecialType(SpecialType: TBuildingSpecialType 125 ): TItem; 126 var 127 I: Integer; 128 begin 129 I := 0; 130 while (I < Count) and (TBuildingKind(Items[I]).SpecialType <> SpecialType) do Inc(I); 131 if I < Count then Result := Items[I] 132 else Result := nil; 133 end; 134 79 135 end. 80 136 -
trunk/UClientGUI.pas
r275 r294 70 70 implementation 71 71 72 uses 73 UBuilding; 74 72 75 resourcestring 73 76 SZeroZoomNotAlowed = 'Zero zoom not allowed'; … … 179 182 Pen.Width := 1; 180 183 end else 181 if Cell.Terrain = ttCitythen begin184 if Assigned(Cell.Building) and (Cell.Building.Kind.SpecialType = stCity) then begin 182 185 // Cannot set clear border as it will display shifted on gtk2 183 186 //Pen.Style := psClear; … … 441 444 for Cell in ControlPlayer.PlayerMap.Cells do begin 442 445 if (Cell.MapCell.Terrain <> ttVoid) and View.IsCellVisible(Cell.MapCell) then begin 443 if Cell.MapCell.Terrain = ttCitythen begin446 if Assigned(Cell.MapCell.Building) and (Cell.MapCell.Building.Kind.SpecialType = stCity) then begin 444 447 // Cannot set clear border as it will display shifted on gtk2 445 448 //Pen.Style := psClear; … … 461 464 if (MapCell.Terrain <> ttVoid) and View.IsCellVisible(MapCell) then begin 462 465 if View.IsCellVisible(MapCell) and (MapCell.Terrain <> ttVoid) then begin 463 if MapCell.Terrain = ttCitythen begin466 if Assigned(MapCell.Building) and (MapCell.Building.Kind.SpecialType = stCity) then begin 464 467 // Cannot set clear border as it will display shifted on gtk2 465 468 //Pen.Style := psClear; -
trunk/UGame.pas
r291 r294 7 7 uses 8 8 Classes, SysUtils, ExtCtrls, Graphics, XMLConf, XMLRead, XMLWrite, Forms, 9 DOM, Math, LazFileUtils, UXMLUtils, Dialogs, LCLType, LCLIntf, fgl, 9 DOM, Math, LazFileUtils, UXMLUtils, Dialogs, LCLType, LCLIntf, fgl, UBuilding, 10 10 UGeometry, UPlayer, UMap, UMapType, UUnit, UGameSystem; 11 11 … … 64 64 Players: TPlayers; 65 65 Units: TUnits; 66 Buildings: TBuildings; 66 67 Map: TMap; 67 68 MapImageFileName: string; … … 315 316 for Cell in Map.Cells do 316 317 with Cell do begin 317 if (Terrain = ttNormal) and CityEnabled and (Random < CityPercentage / 100) then 318 Terrain := ttCity; 318 if (Terrain = ttNormal) and CityEnabled and (Random < CityPercentage / 100) then begin 319 Building := TBuilding(Buildings.AddItem('City')); 320 Building.Kind := TBuildingKind(GameSystem.BuildingKinds.FindBySpecialType(stCity)); 321 end; 319 322 end; 320 323 end; … … 341 344 StartCell := Map.Cells[Map.Cells.Count - 1 - Map.Cells.IndexOf(Players[0].StartCell)]; 342 345 343 if CityEnabled then StartCell.Terrain := ttCity; 346 if CityEnabled then begin 347 StartCell.Building := TBuilding(Buildings.AddItem('City')); 348 StartCell.Building.Kind := TBuildingKind(GameSystem.BuildingKinds.FindBySpecialType(stCity)); 349 end; 344 350 StartCell.Player := Player; 345 351 if not Assigned(StartCell.OneUnit) then … … 855 861 Units := TUnits.Create; 856 862 Units.Game := Self; 863 Buildings := TBuildings.Create; 864 Buildings.Game := Self; 857 865 Map := TMap.Create; 858 866 Map.Game := Self; … … 878 886 FreeAndNil(Players); 879 887 FreeAndNil(Map); 888 FreeAndNil(Buildings); 880 889 FreeAndNil(Units); 881 890 inherited Destroy; -
trunk/UItemList.pas
r290 r294 10 10 type 11 11 TDataType = (dtNone, dtString, dtBoolean, dtInteger, dtFloat, dtColor, 12 dtTime, dtDate, dtDateTime );12 dtTime, dtDate, dtDateTime, dtEnumeration); 13 13 14 14 { TItemField } -
trunk/UMap.pas
r265 r294 6 6 7 7 uses 8 Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl, 8 Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl, UBuilding, 9 9 UXMLUtils, UUnit; 10 10 … … 18 18 TCellLinks = class; 19 19 20 TTerrainType = (ttVoid, ttNormal, ttCity );20 TTerrainType = (ttVoid, ttNormal, ttCityUnused); 21 21 TExtraType = (etNone, etObjectiveTarget, etAttack, etDefense, etLookout, 22 22 etGrowLow, etGrowMedium, etGrowHigh); … … 27 27 private 28 28 FArea: TMapArea; 29 FBuilding: TBuilding; 29 30 FId: Integer; 30 31 FMap: TMap; … … 33 34 function GetPower: Integer; 34 35 procedure SetArea(AValue: TMapArea); 36 procedure SetBuilding(AValue: TBuilding); 35 37 procedure SetId(AValue: Integer); 36 38 procedure SetPower(AValue: Integer); … … 67 69 property Area: TMapArea read FArea write SetArea; 68 70 property OneUnit: TUnit read FUnit write SetUnit; 71 property Building: TBuilding read FBuilding write SetBuilding; 69 72 //property Power: Integer read GetPower; 70 73 end; … … 619 622 if Assigned(OneUnit) then 620 623 Inc(TotalUnits, OneUnit.Power); 621 if Terrain = ttCitythen624 if Assigned(Building) and (Building.Kind.SpecialType = stCity) then 622 625 Inc(TotalCities); 623 626 if Extra = etObjectiveTarget then … … 968 971 end; 969 972 973 procedure TCell.SetBuilding(AValue: TBuilding); 974 var 975 OldValue: TBuilding; 976 begin 977 if FBuilding = AValue then Exit; 978 OldValue := FBuilding; 979 FBuilding := nil; 980 if Assigned(OldValue) then OldValue.MapCell := nil; 981 FBuilding := AValue; 982 if Assigned(FBuilding) then FBuilding.MapCell := Self; 983 end; 984 970 985 function TCell.GetPower: Integer; 971 986 begin -
trunk/UPlayer.pas
r291 r294 210 210 211 211 uses 212 UGame, UGameSystem ;212 UGame, UGameSystem, UBuilding; 213 213 214 214 resourcestring … … 1316 1316 with TCell(Cells[I]) do begin 1317 1317 if (Player = Self) and ((TGame(Game).GrowCells = gcPlayerAll) or 1318 ((TGame(Game).GrowCells = gcPlayerCities) and ( Terrain = ttCity))) then begin1318 ((TGame(Game).GrowCells = gcPlayerCities) and (Assigned(Building) and (Building.Kind.SpecialType = stCity)))) then begin 1319 1319 if not Assigned(OneUnit) then begin 1320 1320 NewUnit := TGame(Game).Units.AddNew(TUnitKind(TGame(Game).GameSystem.UnitKinds.First), 0);
Note:
See TracChangeset
for help on using the changeset viewer.