Changeset 337


Ignore:
Timestamp:
Sep 8, 2024, 10:29:37 PM (10 days ago)
Author:
chronos
Message:
  • Added: Game systems action in Tools menu.
  • Modified: TurnStats moved to separate unit.
Location:
trunk
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClientAI.pas

    r317 r337  
    340340end;
    341341
    342 
    343342end.
    344343
  • trunk/Core.lfm

    r336 r337  
    126126      Caption = 'Tests'
    127127      OnExecute = ATestsExecute
     128    end
     129    object AGameSystems: TAction
     130      Category = 'Tools'
     131      Caption = 'Game systems'
     132      OnExecute = AGameSystemsExecute
    128133    end
    129134  end
  • trunk/Core.lrj

    r336 r337  
    2323{"hash":108810549,"name":"tcore.afullscreen.caption","sourcebytes":[70,117,108,108,32,115,99,114,101,101,110,32,109,111,100,101],"value":"Full screen mode"},
    2424{"hash":5950131,"name":"tcore.atests.caption","sourcebytes":[84,101,115,116,115],"value":"Tests"},
     25{"hash":265461043,"name":"tcore.agamesystems.caption","sourcebytes":[71,97,109,101,32,115,121,115,116,101,109,115],"value":"Game systems"},
    2526{"hash":160200403,"name":"tcore.savedialog1.title","sourcebytes":[83,97,118,101,32,97,115],"value":"Save as"},
    2627{"hash":131198430,"name":"tcore.applicationinfo.description","sourcebytes":[65,32,116,117,114,110,45,98,97,115,101,100,32,115,116,114,97,116,101,103,121,32,103,97,109,101,32,105,110,115,112,105,114,101,100,32,98,121,32,99,108,97,115,115,105,99,32,82,105,115,107,32,98,111,97,114,100,32,103,97,109,101,46,32,84,104,101,32,103,97,109,101,32,105,115,32,104,105,103,104,108,121,32,99,111,110,102,105,103,117,114,97,98,108,101,32,116,111,32,97,108,108,111,119,32,116,111,32,97,100,106,117,115,116,32,98,97,116,116,108,101,32,102,105,101,108,100,32,97,110,100,32,103,97,109,101,32,114,117,108,101,115,46],"value":"A turn-based strategy game inspired by classic Risk board game. The game is highly configurable to allow to adjust battle field and game rules."}
  • trunk/Core.pas

    r336 r337  
    1616  TCore = class(TDataModule)
    1717    AAbout: TAction;
     18    AGameSystems: TAction;
    1819    ATests: TAction;
    1920    AFullscreen: TAction;
     
    5455    procedure AGameSaveAsExecute(Sender: TObject);
    5556    procedure AGameSaveExecute(Sender: TObject);
     57    procedure AGameSystemsExecute(Sender: TObject);
    5658    procedure AHelpExecute(Sender: TObject);
    5759    procedure ANewSpectatorClientExecute(Sender: TObject);
     
    130132uses
    131133  FormNew, FormSettings, ClientAI, FormKeyShortcuts, Common, FormEx, FormTests,
    132   FormHelp, FormUnitMoves, FormPlayersStats, ClientGUI, FormAbout, Tests;
     134  FormHelp, FormUnitMoves, FormPlayersStats, ClientGUI, FormAbout, Tests,
     135  FormGameSystems;
    133136
    134137const
     
    406409    Game.SaveToFile(Game.FileName)
    407410    else AGameSaveAs.Execute;
     411end;
     412
     413procedure TCore.AGameSystemsExecute(Sender: TObject);
     414var
     415  FormGameSystems: TFormGameSystems;
     416begin
     417  FormGameSystems := TFormGameSystems.Create(nil);
     418  try
     419    FormGameSystems.GameSystems := GameSystems;
     420    FormGameSystems.ShowModal;
     421  finally
     422    FreeAndNil(FormGameSystems);
     423  end;
    408424end;
    409425
  • trunk/Forms/FormMain.lfm

    r336 r337  
    178178        Action = Core.ASettings
    179179      end
     180      object MenuItem37: TMenuItem
     181        Action = Core.AGameSystems
     182      end
     183      object Separator1: TMenuItem
     184        Caption = '-'
     185      end
    180186      object MenuItem24: TMenuItem
    181187        Action = Core.AShowCharts
  • trunk/Forms/FormMain.pas

    r336 r337  
    5252    MenuItem35: TMenuItem;
    5353    MenuItem36: TMenuItem;
     54    MenuItem37: TMenuItem;
    5455    MenuItemDebug: TMenuItem;
    5556    MenuItem31: TMenuItem;
     
    6465    PanelMain: TPanel;
    6566    PopupMenuToolbar: TPopupMenu;
     67    Separator1: TMenuItem;
    6668    Timer1: TTimer;
    6769    ToolBar1: TToolBar;
  • trunk/Game.pas

    r336 r337  
    126126implementation
    127127
     128uses
     129  TurnStats;
     130
    128131resourcestring
    129132  SMinimumPlayers = 'You need at least one player';
  • trunk/Languages/xtactics.cs.po

    r336 r337  
    563563msgstr "Uložit jako..."
    564564
     565#: tcore.agamesystems.caption
     566msgctxt "tcore.agamesystems.caption"
     567msgid "Game systems"
     568msgstr "Herní systémy"
     569
    565570#: tcore.ahelp.caption
    566571msgctxt "tcore.ahelp.caption"
     
    767772
    768773#: tformgamesystems.caption
     774msgctxt "tformgamesystems.caption"
    769775msgid "Game systems"
    770776msgstr "Herní systémy"
  • trunk/Languages/xtactics.pot

    r336 r337  
    541541msgstr ""
    542542
     543#: tcore.agamesystems.caption
     544msgctxt "tcore.agamesystems.caption"
     545msgid "Game systems"
     546msgstr ""
     547
    543548#: tcore.ahelp.caption
    544549msgctxt "tcore.ahelp.caption"
     
    743748
    744749#: tformgamesystems.caption
     750msgctxt "tformgamesystems.caption"
    745751msgid "Game systems"
    746752msgstr ""
  • trunk/MapType.pas

    r330 r337  
    771771end;
    772772
    773 
    774773end.
    775774
  • trunk/Player.pas

    r336 r337  
    55uses
    66  Classes, SysUtils, Graphics, Map, DOM, Generics.Collections, Generics.Defaults,
    7   XMLConf, XML, Math, Geometry, &Unit, Nation, ItemList;
     7  XMLConf, XML, Math, Geometry, &Unit, Nation, ItemList, TurnStats;
    88
    99type
     
    6767    Update: Boolean; var Confirm: Boolean) of object;
    6868  TMoveUpdatedEvent = procedure(UnitMove: TUnitMove) of object;
    69 
    70   { TGameTurnStat }
    71 
    72   TGameTurnStat = class
    73     OccupiedCells: Integer;
    74     Units: Integer;
    75     DiscoveredCells: Integer;
    76     Cities: Integer;
    77     WinObjectiveCells: Integer;
    78     procedure LoadFromNode(Node: TDOMNode);
    79     procedure SaveToNode(Node: TDOMNode);
    80   end;
    81 
    82   { TGameTurnStats }
    83 
    84   TGameTurnStats = class(TObjectList<TGameTurnStat>)
    85     procedure LoadFromNode(Node: TDOMNode);
    86     procedure SaveToNode(Node: TDOMNode);
    87   end;
    8869
    8970  { TPlayer }
     
    13201301end;
    13211302
    1322 { TGameTurnStat }
    1323 
    1324 procedure TGameTurnStat.LoadFromNode(Node: TDOMNode);
    1325 begin
    1326   OccupiedCells := ReadInteger(Node, 'OccupiedCells', 0);
    1327   Units := ReadInteger(Node, 'Units', 0);
    1328   DiscoveredCells := ReadInteger(Node, 'DiscoveredCells', 0);
    1329   Cities := ReadInteger(Node, 'Cities', 0);
    1330   WinObjectiveCells := ReadInteger(Node, 'WinObjectiveCells', 0);
    1331 end;
    1332 
    1333 procedure TGameTurnStat.SaveToNode(Node: TDOMNode);
    1334 begin
    1335   WriteInteger(Node, 'OccupiedCells', OccupiedCells);
    1336   WriteInteger(Node, 'Units', Units);
    1337   WriteInteger(Node, 'DiscoveredCells', DiscoveredCells);
    1338   WriteInteger(Node, 'Cities', Cities);
    1339   WriteInteger(Node, 'WinObjectiveCells', WinObjectiveCells);
    1340 end;
    1341 
    1342 { TGameTurnStats }
    1343 
    1344 procedure TGameTurnStats.LoadFromNode(Node: TDOMNode);
    1345 var
    1346   Node2: TDOMNode;
    1347   NewTurnStat: TGameTurnStat;
    1348 begin
    1349   Count := 0;
    1350   Node2 := Node.FirstChild;
    1351   while Assigned(Node2) and (Node2.NodeName = 'TurnStat') do begin
    1352     NewTurnStat := TGameTurnStat.Create;
    1353     NewTurnStat.LoadFromNode(Node2);
    1354     Add(NewTurnStat);
    1355     Node2 := Node2.NextSibling;
    1356   end;
    1357 end;
    1358 
    1359 procedure TGameTurnStats.SaveToNode(Node: TDOMNode);
    1360 var
    1361   I: Integer;
    1362   NewNode: TDOMNode;
    1363 begin
    1364   for I := 0 to Count - 1 do begin;
    1365     NewNode := Node.OwnerDocument.CreateElement('TurnStat');
    1366     Node.AppendChild(NewNode);
    1367     Items[I].SaveToNode(NewNode);
    1368   end;
    1369 end;
    1370 
    13711303end.
    13721304
  • trunk/xtactics.lpi

    r336 r337  
    110110      </Item6>
    111111    </RequiredPackages>
    112     <Units Count="40">
     112    <Units Count="41">
    113113      <Unit0>
    114114        <Filename Value="xtactics.lpr"/>
     
    320320        <IsPartOfProject Value="True"/>
    321321      </Unit39>
     322      <Unit40>
     323        <Filename Value="TurnStats.pas"/>
     324        <IsPartOfProject Value="True"/>
     325      </Unit40>
    322326    </Units>
    323327  </ProjectOptions>
  • trunk/xtactics.lpr

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