Changeset 183


Ignore:
Timestamp:
May 4, 2020, 10:23:41 PM (5 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Log.pas

    r38 r183  
    4141var
    4242  LogDlg: TLogDlg;
     43
    4344
    4445implementation
  • trunk/Start.pas

    r170 r183  
    88  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
    99  Menus, Registry, DrawDlg, fgl, Protocol;
    10 
    11 const
    12   // main actions
    13   nMainActions = 5;
    14   maConfig = 0;
    15   maManual = 1;
    16   maCredits = 2;
    17   maAIDev = 3;
    18   maWeb = 4;
    1910
    2011type
     
    4031  );
    4132
    42   TStartTab = (
    43     tbMain,
    44     tbMap,
    45     tbNew,
    46     tbPrevious
    47   );
     33  TStartTab = (tbMain, tbMap, tbNew, tbPrevious);
     34  TMiniMode = (mmNone, mmPicture, mmMultiPlayer);
     35  TMainAction = (maConfig, maManual, maCredits, maAIDev, maWeb, maNone);
     36  TMainActionSet = set of TMainAction;
    4837
    4938  TMapArray = array[0 .. lxmax * lymax - 1] of Byte;
     
    111100    MiniWidth: Integer;
    112101    MiniHeight: Integer;
    113     SelectedAction: Integer;
    114102    Page: TStartPage;
    115103    ShowTab: TStartTab;
     
    131119    // BookDate: string;
    132120    PlayerSlots: TPlayerSlots;
    133     MiniMode: (mmNone, mmPicture, mmMultiPlayer);
    134     ActionsOffered: set of 0 .. nMainActions - 1;
    135     TurnValid, Tracking: boolean;
     121    MiniMode: TMiniMode;
     122    ActionsOffered: TMainActionSet;
     123    SelectedAction: TMainAction;
     124    TurnValid: Boolean;
     125    Tracking: Boolean;
    136126    DefaultAI: string;
    137127    procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string);
     
    237227  LoadConfig;
    238228
    239   ActionsOffered := [maManual, maCredits, maWeb];
    240   Include(ActionsOffered, maConfig);
     229  ActionsOffered := [maConfig, maManual, maCredits, maWeb];
    241230  if FileExists(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html') then
    242231    Include(ActionsOffered, maAIDev);
     
    511500  s: string;
    512501  Tab2: TStartTab;
     502  MainAction: TMainAction;
    513503begin
    514504  PaintBackground(self, 3, 3, TabOffset + 4 * TabSize - 4, TabHeight - 3);
     
    600590  if Page = pgMain then
    601591  begin
    602     if SelectedAction >= 0 then // mark selected action
     592    if SelectedAction >= maNone then // mark selected action
    603593      for i := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do
    604594      begin
     
    607597          w := wBuffer;
    608598        h := ActionPitch;
    609         if yAction + SelectedAction * ActionPitch - 8 + h > ClientHeight - ActionBottomBorder
     599        if yAction + Integer(SelectedAction) * ActionPitch - 8 + h > ClientHeight - ActionBottomBorder
    610600        then
    611601          h := ClientHeight - ActionBottomBorder -
    612             (yAction + SelectedAction * ActionPitch - 8);
     602            (yAction + Integer(SelectedAction) * ActionPitch - 8);
    613603        BitBltCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas,
    614           ActionSideBorder + i * wBuffer, yAction + SelectedAction * ActionPitch
     604          ActionSideBorder + i * wBuffer, yAction + Integer(SelectedAction) * ActionPitch
    615605          - 8, SRCCOPY);
    616606        MakeBlue(LogoBuffer, 0, 0, w, h);
    617607        BitBlt(Canvas.Handle, ActionSideBorder + i * wBuffer,
    618           yAction + SelectedAction * ActionPitch - 8, w, h,
     608          yAction + Integer(SelectedAction) * ActionPitch - 8, w, h,
    619609          LogoBuffer.Canvas.Handle, 0, 0, SRCCOPY);
    620610      end;
    621611    y := yAction;
    622     for i := 0 to nMainActions - 1 do
     612    for MainAction := Low(TMainActionSet) to High(TMainActionSet) do
    623613    begin
    624       if i in ActionsOffered then
    625         case i of
     614      if MainAction in ActionsOffered then
     615        case MainAction of
    626616          maConfig:
    627617            DrawAction(y, 25, 'ACTIONHEADER_CONFIG', 'ACTION_CONFIG');
     
    892882  Difficulty[0] := Diff0;
    893883
    894   SelectedAction := -1;
     884  SelectedAction := maNone;
    895885  if ShowTab = tbPrevious then
    896886    PreviewMap(StartLandMass); // avoid delay on first TabX change
     
    19641954  x, y: integer);
    19651955var
    1966   OldLoadTurn, NewSelectedAction: Integer;
     1956  OldLoadTurn: Integer;
     1957  NewSelectedAction: TMainAction;
    19671958begin
    19681959  if Tracking then
     
    19951986      (y >= yAction - 8) and (y < ClientHeight - ActionBottomBorder) then
    19961987    begin
    1997       NewSelectedAction := (y - (yAction - 8)) div ActionPitch;
    1998       if not(NewSelectedAction in ActionsOffered) then
    1999         NewSelectedAction := -1;
     1988      NewSelectedAction := TMainAction((y - (yAction - 8)) div ActionPitch);
     1989      if not (NewSelectedAction in ActionsOffered) then
     1990        NewSelectedAction := maNone;
    20001991    end
    20011992    else
    2002       NewSelectedAction := -1;
     1993      NewSelectedAction := maNone;
    20031994    if NewSelectedAction <> SelectedAction then
    20041995    begin
    2005       if SelectedAction >= 0 then
    2006         SmartInvalidate(ActionSideBorder, yAction + SelectedAction * ActionPitch
    2007           - 8, ClientWidth - ActionSideBorder, yAction + (SelectedAction + 1) *
     1996      if SelectedAction <> maNone then
     1997        SmartInvalidate(ActionSideBorder, yAction + Integer(SelectedAction) * ActionPitch
     1998          - 8, ClientWidth - ActionSideBorder, yAction + (Integer(SelectedAction) + 1) *
    20081999          ActionPitch - 8);
    20092000      SelectedAction := NewSelectedAction;
    2010       if SelectedAction >= 0 then
    2011         SmartInvalidate(ActionSideBorder, yAction + SelectedAction * ActionPitch
    2012           - 8, ClientWidth - ActionSideBorder, yAction + (SelectedAction + 1) *
     2001      if SelectedAction <> maNone then
     2002        SmartInvalidate(ActionSideBorder, yAction + Integer(SelectedAction) * ActionPitch
     2003          - 8, ClientWidth - ActionSideBorder, yAction + (Integer(SelectedAction) + 1) *
    20132004          ActionPitch - 8);
    20142005    end;
  • trunk/readme.txt

    r146 r183  
    11C-evo 1.2.0 sources ported to Lazarus/FPC
    22
    3 * Used development environment: Lazarus 1.8.2 (https://www.lazarus-ide.org/)
     3* Used development environment: Lazarus 2.0.8 (https://www.lazarus-ide.org/)
    44* Supported platforms: Windows and Linux
    55* Supported architectures: 32-bit and 64-bit x86
Note: See TracChangeset for help on using the changeset viewer.