Changeset 339 for trunk


Ignore:
Timestamp:
Sep 9, 2024, 10:50:10 PM (3 months ago)
Author:
chronos
Message:
  • Modified: Moved unit kinds into separate unit.
Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Core.pas

    r337 r339  
    77  Game, ApplicationInfo, PersistentForm, ScaleDPI, Translator, DOM,
    88  RegistryEx, LastOpenedList, Theme, Registry, Menus, FormCharts, FormMain,
    9   FormClient, Player, GameServer, GameClient, ServerList, GameSystem, Graphics,
    10   &Unit;
     9  FormClient, Player, GameServer, GameClient, ServerList, GameSystem, Graphics;
    1110
    1211type
     
    133132  FormNew, FormSettings, ClientAI, FormKeyShortcuts, Common, FormEx, FormTests,
    134133  FormHelp, FormUnitMoves, FormPlayersStats, ClientGUI, FormAbout, Tests,
    135   FormGameSystems;
     134  FormGameSystems, UnitKind;
    136135
    137136const
  • trunk/Game.pas

    r337 r339  
    127127
    128128uses
    129   TurnStats;
     129  TurnStats, UnitKind;
    130130
    131131resourcestring
  • trunk/GameSystem.pas

    r322 r339  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections, &Unit, DOM, XMLRead, XMLWrite, XML, XMLConf,
    7   FileUtil, LazFileUtils, MapType, Nation, Building, ItemList;
     6  Classes, SysUtils, Generics.Collections, &Unit, DOM, XMLRead, XMLWrite, XML,
     7  XMLConf, FileUtil, LazFileUtils, MapType, Nation, Building, ItemList, UnitKind;
    88
    99type
  • trunk/Languages/xtactics.cs.po

    r337 r339  
    13401340msgid "View range"
    13411341msgstr "Dohled"
     1342
     1343#: unitkind.scost
     1344msgctxt "unitkind.scost"
     1345msgid "Cost"
     1346msgstr "Cena"
     1347
     1348#: unitkind.smoves
     1349msgctxt "unitkind.smoves"
     1350msgid "Moves"
     1351msgstr "Pohyby"
     1352
     1353#: unitkind.spowerattack
     1354msgctxt "unitkind.spowerattack"
     1355msgid "Attack power"
     1356msgstr "Síla útoku"
     1357
     1358#: unitkind.spowerdefense
     1359msgctxt "unitkind.spowerdefense"
     1360msgid "Defense power"
     1361msgstr "Síla obrany"
     1362
     1363#: unitkind.sstack
     1364msgctxt "unitkind.sstack"
     1365msgid "Stack"
     1366msgstr "Sada"
     1367
     1368#: unitkind.sunitkind
     1369msgctxt "unitkind.sunitkind"
     1370msgid "Unit kind"
     1371msgstr "Druh jednotky"
     1372
     1373#: unitkind.sviewrange
     1374msgctxt "unitkind.sviewrange"
     1375msgid "View range"
     1376msgstr "Dohled"
  • trunk/Languages/xtactics.pot

    r337 r339  
    13041304msgstr ""
    13051305
     1306#: unitkind.scost
     1307msgctxt "unitkind.scost"
     1308msgid "Cost"
     1309msgstr ""
     1310
     1311#: unitkind.smoves
     1312msgctxt "unitkind.smoves"
     1313msgid "Moves"
     1314msgstr ""
     1315
     1316#: unitkind.spowerattack
     1317msgctxt "unitkind.spowerattack"
     1318msgid "Attack power"
     1319msgstr ""
     1320
     1321#: unitkind.spowerdefense
     1322msgctxt "unitkind.spowerdefense"
     1323msgid "Defense power"
     1324msgstr ""
     1325
     1326#: unitkind.sstack
     1327msgctxt "unitkind.sstack"
     1328msgid "Stack"
     1329msgstr ""
     1330
     1331#: unitkind.sunitkind
     1332msgctxt "unitkind.sunitkind"
     1333msgid "Unit kind"
     1334msgstr ""
     1335
     1336#: unitkind.sviewrange
     1337msgctxt "unitkind.sviewrange"
     1338msgid "View range"
     1339msgstr ""
     1340
  • trunk/Player.pas

    r337 r339  
    186186
    187187uses
    188   Game, GameSystem, Building;
     188  Game, GameSystem, Building, UnitKind;
    189189
    190190resourcestring
  • trunk/Unit.pas

    r336 r339  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections, Geometry, DOM, XML, ItemList;
     6  Classes, SysUtils, Generics.Collections, Geometry, DOM, XML, ItemList, UnitKind;
    77
    88type
    9 
    10   { TUnitKind }
    11 
    12   TUnitKind = class(TItem)
    13     PowerAttack: Integer;
    14     PowerDefense: Integer;
    15     Moves: Integer;
    16     Cost: Integer;
    17     Power: Integer;
    18     ViewRange: Integer;
    19     class function GetFields: TItemFields; override;
    20     procedure GetValue(Index: Integer; out Value); override;
    21     procedure SetValue(Index: Integer; var Value); override;
    22     class function GetClassSysName: string; override;
    23     class function GetClassName: string; override;
    24   end;
    25 
    26   { TUnitKinds }
    27 
    28   TUnitKinds = class(TItemList)
    29     constructor Create(FreeObjects: Boolean = True);
    30     class function GetItemClass: TItemClass; override;
    31   end;
    32 
    339  TUnit = class
    3410  private
     
    8157  Player, Map, Game;
    8258
    83 resourcestring
    84   SStack = 'Stack';
    85   SCost = 'Cost';
    86   SMoves = 'Moves';
    87   SPowerAttack =  'Attack power';
    88   SPowerDefense = 'Defense power';
    89   SViewRange = 'View range';
    90   SUnitKind = 'Unit kind';
    91 
    92 { TUnitKind }
    93 
    94 class function TUnitKind.GetFields: TItemFields;
    95 begin
    96   Result := inherited;
    97   Result.AddField(2, 'Stack', SStack, dtInteger);
    98   Result.AddField(3, 'Cost', SCost, dtInteger);
    99   Result.AddField(4, 'Moves', SMoves, dtInteger);
    100   Result.AddField(5, 'PowerAttack', SPowerAttack, dtInteger);
    101   Result.AddField(6, 'PowerDefense', SPowerDefense, dtInteger);
    102   Result.AddField(7, 'ViewRange', SViewRange, dtInteger);
    103 end;
    104 
    105 procedure TUnitKind.GetValue(Index: Integer; out Value);
    106 begin
    107   if Index = 1 then string(Value) := Name
    108   else if Index = 2 then Integer(Value) := Power
    109   else if Index = 3 then Integer(Value) := Cost
    110   else if Index = 4 then Integer(Value) := Moves
    111   else if Index = 5 then Integer(Value) := PowerAttack
    112   else if Index = 6 then Integer(Value) := PowerDefense
    113   else if Index = 7 then Integer(Value) := ViewRange
    114   else inherited;
    115 end;
    116 
    117 procedure TUnitKind.SetValue(Index: Integer; var Value);
    118 begin
    119   if Index = 1 then Name := string(Value)
    120   else if Index = 2 then Power := Integer(Value)
    121   else if Index = 3 then Cost := Integer(Value)
    122   else if Index = 4 then Moves := Integer(Value)
    123   else if Index = 5 then PowerAttack := Integer(Value)
    124   else if Index = 6 then PowerDefense := Integer(Value)
    125   else if Index = 7 then ViewRange := Integer(Value)
    126   else inherited;
    127 end;
    128 
    129 class function TUnitKind.GetClassSysName: string;
    130 begin
    131   Result := 'UnitKind';
    132 end;
    133 
    134 class function TUnitKind.GetClassName: string;
    135 begin
    136   Result := SUnitKind;
    137 end;
    138 
    13959{ TUnits }
    14060
     
    309229end;
    310230
    311 { TUnitKinds }
    312 
    313 constructor TUnitKinds.Create(FreeObjects: Boolean);
    314 begin
    315   inherited;
    316 end;
    317 
    318 class function TUnitKinds.GetItemClass: TItemClass;
    319 begin
    320   Result := TUnitKind;
    321 end;
    322 
    323231end.
    324232
  • trunk/xtactics.lpi

    r337 r339  
    110110      </Item6>
    111111    </RequiredPackages>
    112     <Units Count="41">
     112    <Units Count="42">
    113113      <Unit0>
    114114        <Filename Value="xtactics.lpr"/>
     
    324324        <IsPartOfProject Value="True"/>
    325325      </Unit40>
     326      <Unit41>
     327        <Filename Value="UnitKind.pas"/>
     328        <IsPartOfProject Value="True"/>
     329      </Unit41>
    326330    </Units>
    327331  </ProjectOptions>
  • trunk/xtactics.lpr

    r337 r339  
    88  Forms, tachartlazaruspkg, Game, Core, Common, TemplateGenerics
    99  { you can add units after this },
    10   SysUtils, FormMain, CoolStreaming, Tests, TurnStats;
     10  SysUtils, FormMain, CoolStreaming, Tests, TurnStats, UnitKind;
    1111
    1212{$R *.res}
Note: See TracChangeset for help on using the changeset viewer.