Changeset 378


Ignore:
Timestamp:
Apr 24, 2021, 11:41:07 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Merged changes from trunk r377.
Location:
branches/highdpi
Files:
12 added
24 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Direct.pas

    r361 r378  
    4343
    4444uses
    45   ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global;
     45  ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global, UNetworkServer,
     46  UNetworkClient;
    4647
    4748{$R *.lfm}
     
    5758//  p: pointer;
    5859  s: string;
    59 begin
     60Begin
    6061  case ID of
    6162    ntInitLocalHuman: begin
     
    6465      Info := Phrases.Lookup('BUSY_MODLH');
    6566      Show;
    66       {$IFDEF LINUX}
    67       // Force shown window repaint on Gtk2 widgetset
    68       Sleep(1);
    69       DpiApplication.ProcessMessages;
    70       {$ENDIF}
     67      Gtk2Fix;
    7168      Invalidate;
    7269      Update;
     
    185182  BrainTerm.Client := LocalPlayer.Client;
    186183  BrainTerm.Name := Phrases.Lookup('HUMAN');
     184  if NetworkEnabled then begin
     185    BrainNetworkServer.Client := UNetworkServer.Client;
     186    BrainNetworkServer.Name := Phrases.Lookup('NETWORK_SERVER');
     187    BrainNetworkClient.Client := UNetworkClient.Client;
     188    BrainNetworkClient.Name := Phrases.Lookup('NETWORK_CLIENT');
     189  end;
    187190  BrainRandom.Name := Phrases.Lookup('RANDOMAI');
    188191  Canvas.Font.Assign(UniFont[ftNormal]);
     
    191194
    192195procedure TDirectDlg.FormShow(Sender: TObject);
     196var
     197  I: Integer;
    193198begin
    194199  if not Gone then
  • branches/highdpi/GameServer.pas

    r361 r378  
    77
    88uses
    9   UDpiControls, Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils,
    10   Graphics;
     9  Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils,
     10  Graphics, UBrain;
    1111
    1212const
     
    1414  FirstAICompatibleVersion = $000D00;
    1515  FirstBookCompatibleVersion = $010103;
    16 
    17   // module flags
    18   fMultiple = $10000000;
    19   fDotNet = $20000000;
    20   fUsed = $40000000;
    2116
    2217  maxBrain = 255;
     
    5247  TNotifyFunction = procedure(ID: TNotify; Index: Integer = 0);
    5348
    54   TBrainType = (btNoTerm, btSuperVirtual, btTerm, btRandom, btAI);
    55 
    56   { TBrain }
    57 
    58   TBrain = class
    59     FileName: string;
    60     DLLName: string;
    61     Name: string;
    62     Credits: string; { filename and full name }
    63     hm: TLibHandle; { module handle }
    64     Flags: Integer;
    65     ServerVersion: Integer;
    66     DataVersion: Integer;
    67     DataSize: Integer;
    68     Client: TClientCall; { client function address }
    69     Initialized: Boolean;
    70     Kind: TBrainType;
    71     Picture: TDpiBitmap;
    72     procedure LoadFromFile(AIFileName: string);
    73     constructor Create;
    74     destructor Destroy; override;
    75   end;
    76 
    77   { TBrains }
    78 
    79   TBrains = class(TFPGObjectList<TBrain>)
    80     function AddNew: TBrain;
    81     function GetKindCount(Kind: TBrainType): Integer;
    82     procedure GetByKind(Kind: TBrainType; Brains: TBrains);
    83   end;
    84 
    8549var
    8650  // PARAMETERS
    87   PlayersBrain: TBrains; { brain of the players }
     51  PlayersBrain: TBrains; { brain of the players view }
    8852  Difficulty: array [0 .. nPl - 1] of integer absolute Database.Difficulty;
    8953  { difficulty }
     
    9862  BrainTerm: TBrain;
    9963  BrainRandom: TBrain;
    100   BrainBeginner: TBrain; // AI to use for beginner level
     64  BrainNetworkClient: TBrain;
     65  BrainNetworkServer: TBrain;
     66
     67  NetworkEnabled: Boolean;
    10168
    10269procedure Init(NotifyFunction: TNotifyFunction);
     
    184151{$ELSE}
    185152    try
    186       Brain[bix[p]].Client(Command, p, Data);
     153      bix[p].Client(Command, p, Data);
    187154    except
    188155      Notify(ntException + bix[p]);
     
    190157{$ENDIF}
    191158  end
     159end;
     160
     161procedure CallAllPlayers(Command: Integer; var Data);
     162var
     163  I: Integer;
     164begin
     165  for I := 0 to nPl - 1 do
     166    if Assigned(bix[I]) then
     167      CallPlayer(Command, I, Data);
    192168end;
    193169
     
    236212  BrainNoTerm.FileName := ':AIT';
    237213  BrainNoTerm.Flags := 0;
    238   BrainNoTerm.Initialized := false;
     214  BrainNoTerm.Initialized := False;
    239215  BrainNoTerm.Kind := btNoTerm;
    240216  BrainSuperVirtual := Brains.AddNew;
    241217  BrainSuperVirtual.FileName := ':Supervisor';
    242218  BrainSuperVirtual.Flags := 0;
    243   BrainSuperVirtual.Initialized := false;
     219  BrainSuperVirtual.Initialized := False;
    244220  BrainSuperVirtual.Kind := btSuperVirtual;
     221  if NetworkEnabled then begin
     222    BrainNetworkClient := Brains.AddNew;
     223    BrainNetworkClient.FileName := ':NetworkClient';
     224    BrainNetworkClient.Flags := fMultiple;
     225    BrainNetworkClient.Initialized := False;
     226    BrainNetworkClient.ServerVersion := Version;
     227    BrainNetworkClient.Kind := btNetworkClient;
     228  end;
    245229  BrainTerm := Brains.AddNew;
    246230  BrainTerm.FileName := ':StdIntf';
    247231  BrainTerm.Flags := fMultiple;
    248   BrainTerm.Initialized := false;
     232  BrainTerm.Initialized := False;
    249233  BrainTerm.ServerVersion := Version;
    250234  BrainTerm.Kind := btTerm;
     
    252236  BrainRandom.FileName := ':Random';
    253237  BrainRandom.Flags := fMultiple;
    254   BrainRandom.Initialized := false;
     238  BrainRandom.Initialized := False;
    255239  BrainRandom.Kind := btRandom;
    256 
    257   BrainBeginner := nil;
     240  if NetworkEnabled then begin
     241    BrainNetworkServer := Brains.AddNew;
     242    BrainNetworkServer.FileName := ':NetworkServer';
     243    BrainNetworkServer.Flags := fMultiple;
     244    BrainNetworkServer.Initialized := False;
     245    BrainNetworkServer.ServerVersion := Version;
     246    BrainNetworkServer.Kind := btNetworkServer;
     247  end;
    258248
    259249  if FindFirst(GetAiDir + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then
     
    369359    Notify(ntDeactivationMissing, p);
    370360    ForceClientDeactivation;
    371   end
     361  end;
    372362end;
    373363
     
    13551345    begin
    13561346      CL.State := FormerCLState;
    1357       Break
    1358     end
     1347      Break;
     1348    end;
    13591349  end;
    13601350{$IFOPT O-}InvalidTreatyMap := 0; {$ENDIF}
     
    13641354  Newlx, Newly, NewLandMass, NewMaxTurn: integer);
    13651355var
    1366   p: integer;
     1356  I: Integer;
    13671357begin
    13681358  Notify(ntStartDone);
     
    13891379  StartGame;
    13901380  NoLogChanges;
    1391   for p := 0 to nPl - 1 do
    1392     if Assigned(bix[p]) then
    1393       CallPlayer(cGetReady, p, nil^);
     1381  CallAllPlayers(cGetReady, nil^);
    13941382  LogChanges;
    13951383  CL.Put(sTurn, 0, 0, nil);
     
    13991387  nLogOpened := -1;
    14001388  LastEndClientCommand := -1;
    1401   bix[0].Client(cShowGame, 0, nil^);
     1389  CallPlayer(cShowGame, 0, nil^);
     1390  for I := 0 to nPl - 1 do
     1391    if Assigned(bix[I]) and (bix[I].Kind = btNetworkServer) then
     1392      CallPlayer(cShowGame, I, nil^);
    14021393  Notify(ntBackOff);
    14031394  Inform(pTurn);
     
    15051496              CallPlayer(cShowShipChange, p1, ShowShipChange);
    15061497          end;
    1507       end
    1508     end
     1498      end;
     1499    end;
    15091500end;
    15101501
     
    24252416      if PModel.Attack = 0 then
    24262417        Flags := Flags and not unBombsLoaded;
    2427       dec(Movement, 100)
     2418      dec(Movement, 100);
    24282419    end
    24292420    else if MoveInfo.MoveType = mtExpel then
     
    24322423      Job := jNone;
    24332424      Flags := Flags and not unFortified;
    2434       dec(Movement, 100)
     2425      dec(Movement, 100);
    24352426    end
    24362427    else
     
    24822473          inc(nUpdateLoc);
    24832474          Flags := Flags or unWithdrawn;
    2484         end
     2475        end;
    24852476      end
    24862477    else if (MoveInfo.MoveType = mtAttack) and (MoveInfo.EndHealthDef > 0) then
     
    25202511              begin
    25212512                UpdateLoc[nUpdateLoc] := Loc;
    2522                 inc(nUpdateLoc)
     2513                inc(nUpdateLoc);
    25232514              end;
    25242515          // unit will be removed -- remember position and update for all players
     
    25682559            CallPlayer(cShowUnitChanged, p1, ExpelToLoc);
    25692560        end;
    2570     end
    2571   end
     2561    end;
     2562  end;
    25722563end; // ExecuteAttack
    25732564
     
    25852576    begin
    25862577      result := eInvalid;
    2587       exit
     2578      exit;
    25882579    end;
    25892580    result := CalculateMove(p, uix, ToLoc, 3 - dy and 1, TestOnly, MoveInfo);
     
    26192610          result := ExecuteMove(p, uix, ToLoc, MoveInfo, ShowMove) or result;
    26202611        mtAttack, mtBombard, mtExpel:
    2621           result := ExecuteAttack(p, uix, ToLoc, MoveInfo, ShowMove) or result
    2622       end;
    2623     end
     2612          result := ExecuteAttack(p, uix, ToLoc, MoveInfo, ShowMove) or result;
     2613      end;
     2614    end;
    26242615  end; // with
    26252616end; { MoveUnit }
     
    26952686      result := ptShip
    26962687    else
    2697       result := ptImp
     2688      result := ptImp;
    26982689  end;
    26992690
     
    27262717  begin
    27272718    result := eUnknown;
    2728     exit
     2719    exit;
    27292720  end;
    27302721
     
    27342725  begin
    27352726    result := eInvalid;
    2736     exit
     2727    exit;
    27372728  end;
    27382729
     
    27442735    PutMessage(1 shl 16 + 1, Format('NOT Alive: %d', [Player]));
    27452736    result := eNoTurn;
    2746     exit
     2737    exit;
    27472738  end;
    27482739
     
    27712762      [Player, Command shr 4]));
    27722763    result := eNoTurn;
    2773     exit
     2764    exit;
    27742765  end;
    27752766
     
    28972888        else
    28982889          result := GetTileInfo(Player, TTileInfo(Data).ExplCity, Subject,
    2899             TTileInfo(Data))
     2890            TTileInfo(Data));
    29002891      end
    29012892      else
     
    29082899          result := eNoPreq
    29092900        else
    2910           result := GetJobProgress(Player, Subject, TJobProgressData(Data))
     2901          result := GetJobProgress(Player, Subject, TJobProgressData(Data));
    29112902      end
    29122903      else
     
    29572948            end;
    29582949            if result = eOK then
    2959               result := eInvalid // no enemy unit there!
     2950              result := eInvalid; // no enemy unit there!
    29602951          end
    29612952          else
     
    29882979          result := eOK
    29892980        else
    2990           result := eNoWay
     2981          result := eNoWay;
    29912982      end;
    29922983
     
    30403031        TCityReport(Data).HypoTax := -1;
    30413032        TCityReport(Data).HypoLux := -1;
    3042         GetCityReport(p1, cix1, TCityReport(Data))
     3033        GetCityReport(p1, cix1, TCityReport(Data));
    30433034      end
    30443035      else
     
    30713062          p1 := 1;
    30723063        SearchCity(Subject, p1, cix1);
    3073         GetCityAreaInfo(p1, Subject, TCityAreaInfo(Data))
     3064        GetCityAreaInfo(p1, Subject, TCityAreaInfo(Data));
    30743065      end
    30753066      else
     
    31353126              LogChanges;
    31363127              SaveGame('~' + LogFileName, true);
    3137             end
     3128            end;
    31383129{$ENDIF}
    31393130          end
     
    31643155          begin
    31653156            if CheckSum <> Subject then
    3166               LoadOK := false
     3157              LoadOK := false;
    31673158          end
    31683159          else // save checksum
     
    32103201            CCCommand := cTurn;
    32113202            CCPlayer := pTurn;
    3212             Notify(ntNextPlayer)
     3203            Notify(ntNextPlayer);
    32133204          end
    32143205          else
     
    32743265            sReload:
    32753266              LoadGame(SavePath, LogFileName, integer(Data), false);
    3276           end
     3267          end;
    32773268        end
    32783269        else
     
    32913282          Notify(ntStartGoRefreshMaps)
    32923283        else
    3293           Notify(ntStartGo)
     3284          Notify(ntStartGo);
    32943285      end
    32953286      else
     
    33313322          assert(Mode = moPlaying);
    33323323          ChangeClientWhenDone(cContinue, pTurn, nil^, 0);
    3333         end
     3324        end;
    33343325      end
    33353326      else
     
    33483339          IntServer(sIntHaveContact, pTurn, pContacted, nil^);
    33493340          ChangeClientWhenDone(scDipStart, pDipActive, nil^, 0);
    3350         end
     3341        end;
    33513342      end
    33523343      else
     
    34073398                    ShowShipChange.Ship2Change[Price[i] shr 16 and 3] :=
    34083399                      +integer(Price[i] and $FFFF);
    3409                   end
     3400                  end;
    34103401                end;
    34113402              if HasShipChanged then
     
    34213412                    if 1 shl p2 and GWatching <> 0 then
    34223413                      CallPlayer(cShowShipChange, p2, ShowShipChange);
    3423                   end
    3424               end
     3414                  end;
     3415              end;
    34253416            end;
    34263417          end
     
    34473438                CallPlayer(cShowCancelTreatyByAlliance, pDipActive, i);
    34483439              end;
    3449           end
     3440          end;
    34503441        end
    34513442        else
     
    34703461            pDipActive := p1;
    34713462            ChangeClientWhenDone(Command, pDipActive, nil^, 0);
    3472           end
     3463          end;
    34733464      end
    34743465      else
     
    34883479            assert(Mode = moPlaying);
    34893480            ChangeClientWhenDone(cContinue, pTurn, nil^, 0);
    3490           end
     3481          end;
    34913482        end
    34923483        else
     
    45044495end; { <<<server }
    45054496
    4506 function ExtractFileNameWithoutExt(const Filename: string): string;
    4507 var
    4508   P: Integer;
    4509 begin
    4510   Result := Filename;
    4511   P := Length(Result);
    4512   while P > 0 do begin
    4513     case Result[P] of
    4514       PathDelim: Exit;
    4515       {$ifdef windows}
    4516       '/': if ('/' in AllowDirectorySeparators) then Exit;
    4517       {$endif}
    4518       '.': Exit(Copy(Result, 1, P - 1));
    4519     end;
    4520     Dec(P);
    4521   end;
    4522 end;
    4523 
    4524 { TBrain }
    4525 
    4526 procedure TBrain.LoadFromFile(AIFileName: string);
    4527 var
    4528   T: Text;
    4529   Key: string;
    4530   Value: string;
    4531   S: string;
    4532   BasePath: string;
    4533   I: Integer;
    4534 begin
    4535   BasePath := ExtractFileDir(AIFileName);
    4536   FileName := ExtractFileName(ExtractFileNameWithoutExt(ExtractFileNameWithoutExt(AIFileName)));
    4537   Name := FileName;
    4538   DLLName := BasePath + DirectorySeparator + Name + '.dll';
    4539   Credits := '';
    4540   Flags := fMultiple;
    4541   Client := nil;
    4542   Initialized := false;
    4543   ServerVersion := 0;
    4544   if not FileExists(AIFileName) then
    4545     raise Exception.Create(Format('AI specification file %s not found', [AIFileName]));
    4546   AssignFile(T, AIFileName);
    4547   Reset(T);
    4548   while not EOF(T) do
    4549   begin
    4550     ReadLn(T, s);
    4551     s := trim(s);
    4552     if Pos(' ', S) > 0 then begin
    4553       Key := Copy(S, 1, Pos(' ', S) - 1);
    4554       Value := Trim(Copy(S, Pos(' ', S) + 1, Length(S)));
    4555     end else begin
    4556       Key := S;
    4557       Value := '';
    4558     end;
    4559     if Key = '#NAME' then
    4560       Name := Value
    4561     else if Key = '#.NET' then
    4562       Flags := Flags or fDotNet
    4563     else if Key = '#BEGINNER' then
    4564       BrainBeginner := Self
    4565     else if Key = '#PATH' then
    4566       DLLName := BasePath + DirectorySeparator + Value
    4567     {$IFDEF WINDOWS}{$IFDEF CPU32}
    4568     else if Key = '#PATH_WIN32' then
    4569       DLLName := BasePath + DirectorySeparator + Value
    4570     {$ENDIF}{$ENDIF}
    4571     {$IFDEF WINDOWS}{$IFDEF CPU64}
    4572     else if Key = '#PATH_WIN64' then
    4573       DLLName := BasePath + DirectorySeparator + Value
    4574     {$ENDIF}{$ENDIF}
    4575     {$IFDEF LINUX}{$IFDEF CPU32}
    4576     else if Key = '#PATH_LINUX32' then
    4577       DLLName := BasePath + DirectorySeparator + Value
    4578     {$ENDIF}{$ENDIF}
    4579     {$IFDEF LINUX}{$IFDEF CPU64}
    4580     else if Key = '#PATH_LINUX64' then
    4581       DLLName := BasePath + DirectorySeparator + Value
    4582     {$ENDIF}{$ENDIF}
    4583     else if Key = '#GAMEVERSION' then
    4584       for i := 1 to Length(Value) do
    4585         case Value[i] of
    4586           '0' .. '9':
    4587             ServerVersion := ServerVersion and $FFFF00 + ServerVersion and
    4588               $FF * 10 + ord(Value[i]) - 48;
    4589           '.':
    4590           ServerVersion := ServerVersion shl 8;
    4591       end
    4592     else if Key = '#CREDITS' then
    4593       Credits := Value;
    4594   end;
    4595   CloseFile(T);
    4596 end;
    4597 
    4598 constructor TBrain.Create;
    4599 begin
    4600   Picture := TDpiBitmap.Create;
    4601   Picture.SetSize(64, 64);
    4602 end;
    4603 
    4604 destructor TBrain.Destroy;
    4605 begin
    4606   FreeAndNil(Picture);
    4607   inherited;
    4608 end;
    4609 
    4610 { TBrains }
    4611 
    4612 function TBrains.AddNew: TBrain;
    4613 begin
    4614   Result := TBrain.Create;
    4615   Add(Result);
    4616 end;
    4617 
    4618 function TBrains.GetKindCount(Kind: TBrainType): Integer;
    4619 var
    4620   I: Integer;
    4621 begin
    4622   Result := 0;
    4623   for I := 0 to Count - 1 do
    4624     if Items[I].Kind = Kind then Inc(Result);
    4625 end;
    4626 
    4627 procedure TBrains.GetByKind(Kind: TBrainType; Brains: TBrains);
    4628 var
    4629   I: Integer;
    4630 begin
    4631   Brains.Clear;
    4632   for I := 0 to Count - 1 do
    4633     if Items[I].Kind = Kind then Brains.Add(Items[I]);
    4634 end;
    46354497
    46364498initialization
  • branches/highdpi/Global.pas

    r349 r378  
    1212  CevoContact = 'https://' + CevoContactShort;
    1313  CevoContactBug = 'https://app.zdechov.net/c-evo/report/1';
     14  CevoNetworkPort = 41363;
    1415  AppRegistryKey = '\SOFTWARE\C-evo';
    1516  AITemplateManual = 'AI development manual';
  • branches/highdpi/Integrated.lpi

    r349 r378  
    3939          <SearchPaths>
    4040            <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/>
    41             <OtherUnitFiles Value="LocalPlayer"/>
     41            <OtherUnitFiles Value="LocalPlayer;Network"/>
    4242            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/>
    4343          </SearchPaths>
     
    102102      </Item3>
    103103    </RequiredPackages>
    104     <Units Count="43">
     104    <Units Count="47">
    105105      <Unit0>
    106106        <Filename Value="Integrated.lpr"/>
     
    347347        <IsPartOfProject Value="True"/>
    348348      </Unit42>
     349      <Unit43>
     350        <Filename Value="UBrain.pas"/>
     351        <IsPartOfProject Value="True"/>
     352      </Unit43>
     353      <Unit44>
     354        <Filename Value="Network\UNetworkServer.pas"/>
     355        <IsPartOfProject Value="True"/>
     356      </Unit44>
     357      <Unit45>
     358        <Filename Value="Network\UNetworkClient.pas"/>
     359        <IsPartOfProject Value="True"/>
     360      </Unit45>
     361      <Unit46>
     362        <Filename Value="Network\UNetworkCommon.pas"/>
     363        <IsPartOfProject Value="True"/>
     364      </Unit46>
    349365    </Units>
    350366  </ProjectOptions>
     
    357373    <SearchPaths>
    358374      <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/>
    359       <OtherUnitFiles Value="LocalPlayer"/>
     375      <OtherUnitFiles Value="LocalPlayer;Network"/>
    360376      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/>
    361377    </SearchPaths>
     
    391407    <Other>
    392408      <CompilerMessages>
    393         <IgnoredMessages idx5024="True"/>
     409        <IgnoredMessages idx6058="True" idx5024="True"/>
    394410      </CompilerMessages>
    395411      <CustomOptions Value="-dDEBUG"/>
  • branches/highdpi/Integrated.lpr

    r210 r378  
    33
    44uses
    5   UDpiControls, Forms, Interfaces, SysUtils, Protocol, GameServer, Direct, Start, Messg, Inp,
     5  UDpiControls, {$IFDEF UNIX}
     6  //cthreads,
     7  clocale,
     8  {$ENDIF}
     9  Forms, Interfaces, SysUtils, Protocol, GameServer, Direct, Start, Messg, Inp,
    610  Back, Log, LocalPlayer, ClientTools, Tribes, IsoEngine, Term, CityScreen, Nego,
    711  NoTerm, ScreenTools, Directories;
  • branches/highdpi/Language.txt

    r349 r378  
    405405#UTILIZE Utilize
    406406#INTEGRATE Integrate
     407#NETWORK_SERVER Network Server
     408#NETWORK_CLIENT Network Client
    407409
    408410'Busy Messages
  • branches/highdpi/LocalPlayer/CityScreen.pas

    r361 r378  
    14921492            (cpImp or cpIndex) then
    14931493          begin // loss of material -- do query
    1494             DpiApplication.ProcessMessages; // TODO: Needed for Gtk2, Lazarus gtk2 bug?
     1494            Gtk2Fix;
    14951495            if (pt1 = ptTrGoods) or (pt1 = ptShip) or (pt1 <> pt0) and
    14961496              (pt0 <> ptCaravan) then begin
  • branches/highdpi/LocalPlayer/LocalPlayer.pas

    r361 r378  
    1616  FormsCreated: boolean;
    1717
    18 procedure Client;
     18procedure Client(Command, Player: integer; var Data);
    1919begin
    2020  if not FormsCreated then
  • branches/highdpi/LocalPlayer/Select.pas

    r361 r378  
    15681568      DispLines := MaxLines;
    15691569    InnerHeight := LineDistance * (DispLines + 1) + 24;
    1570     ClientHeight := InnerHeight + TitleHeight + WideFrame
     1570    ClientHeight := InnerHeight + TitleHeight + WideFrame;
    15711571  end
    15721572  else
  • branches/highdpi/LocalPlayer/Term.pas

    r361 r378  
    29162916        FormResize(nil); // calculate geometrics and paint all
    29172917        SetTroopLoc(-1);
    2918         idle := true
     2918        idle := true;
    29192919      end;
    29202920
     
    29492949              DipMem[me].DeliveredPrices := [];
    29502950              DipMem[me].ReceivedPrices := [];
    2951               DipCall(scDipStart)
     2951              DipCall(scDipStart);
    29522952            end
    29532953            else
    29542954            begin
    29552955              DipCall(scReject);
    2956               EndNego
     2956              EndNego;
    29572957            end;
    29582958          end;
     
    29932993        end;
    29942994        NegoDlg.Start;
    2995         idle := true
     2995        idle := true;
    29962996      end;
    29972997
     
    30453045            CurrentMoveInfo.DoShow := not mAlNoMoves.Checked
    30463046          else
    3047             CurrentMoveInfo.DoShow := not mEnNoMoves.Checked
     3047            CurrentMoveInfo.DoShow := not mEnNoMoves.Checked;
    30483048        end
    30493049        else if Command = cShowUnitChanged then
     
    30573057          else
    30583058            CurrentMoveInfo.DoShow :=
    3059               not(mEnNoMoves.Checked or mEnAttacks.Checked)
     3059              not(mEnNoMoves.Checked or mEnAttacks.Checked);
    30603060        end;
    30613061        // else keep DoShow from cShowMove/cShowAttack
     
    31513151                ShowMoveDomain := Domain;
    31523152                IsAlpine := Cap[mcAlpine] > 0;
    3153               end
    3154             end
     3153              end;
     3154            end;
    31553155          end
    31563156          else
     
    32043204                    CurrentMoveInfo.AfterMovePaintRadius := 2
    32053205                  else
    3206                     CurrentMoveInfo.AfterMovePaintRadius := 1
     3206                    CurrentMoveInfo.AfterMovePaintRadius := 1;
    32073207              end
    32083208              else
     
    32713271          else
    32723272            MapValid := false;
    3273         end
     3273        end;
    32743274      end;
    32753275
     
    33563356          else
    33573357            MapValid := false;
    3358         end
     3358        end;
    33593359      end;
    33603360
     
    33683368          if 3 shl (p1 * 2) and Cardinal(Data) <> 0 then
    33693369            s := s + '\' + Tribe[p1].TPhrase('SHORTNAME');
    3370         SoundMessageEx(s, '')
     3370        SoundMessageEx(s, '');
    33713371      end;
    33723372
  • branches/highdpi/Localization/cs/Language.txt

    r349 r378  
    405405#UTILIZE Využít
    406406#INTEGRATE Sloučit
     407#NETWORK_SERVER Síťový server
     408#NETWORK_CLIENT Síťový klient
    407409
    408410'Busy Messages
  • branches/highdpi/Localization/de/Language.txt

    r349 r378  
    414414#UTILIZE Anwenden
    415415#INTEGRATE Integrieren
     416#NETWORK_SERVER Network Server
     417#NETWORK_CLIENT Network Client
    416418
    417419'Busy Messages
  • branches/highdpi/Localization/it/Language.txt

    r349 r378  
    395395#UTILIZE Ricicla
    396396#INTEGRATE Integra
     397#NETWORK_SERVER Network Server
     398#NETWORK_CLIENT Network Client
    397399
    398400'Busy Messages
  • branches/highdpi/Localization/ru/Language.txt

    r349 r378  
    421421#UTILIZE Использовать
    422422#INTEGRATE Внедрить
     423#NETWORK_SERVER Network Server
     424#NETWORK_CLIENT Network Client
    423425
    424426'Сообщения паузы
  • branches/highdpi/Localization/zh-Hans/language.txt

    r349 r378  
    413413#UTILIZE ²Î½¨
    414414#INTEGRATE Õû±à
     415#NETWORK_SERVER Network Server
     416#NETWORK_CLIENT Network Client
    415417
    416418'Busy Messages
  • branches/highdpi/Localization/zh-Hant/language.txt

    r349 r378  
    413413#UTILIZE °Ñ«Ø
    414414#INTEGRATE ¾ã½s
     415#NETWORK_SERVER Network Server
     416#NETWORK_CLIENT Network Client
    415417
    416418'Busy Messages
  • branches/highdpi/NoTerm.pas

    r361 r378  
    99
    1010type
     11  TRunMode = (rmStop, rmStopped, rmRunning, rmQuit);
     12
    1113  TNoTermDlg = class(TDrawDlg)
    1214    QuitBtn: TButtonB;
     
    2022    procedure Client(Command, Player: integer; var Data);
    2123  private
    22     me, Active, ToldAlive, Round: integer;
    23     LastShowYearTime, LastShowTurnChange, LastNewTurn: TDateTime;
    24     TurnTime, TotalStatTime: extended;
     24    Me: Integer;
     25    Active: Integer;
     26    ToldAlive: Integer;
     27    Round: Integer;
     28    LastShowYearTime: TDateTime;
     29    LastShowTurnChange: TDateTime;
     30    LastNewTurn: TDateTime;
     31    TurnTime: Extended;
     32    TotalStatTime: Extended;
    2533    G: TNewGameData;
    2634    Server: TServerCall;
    2735    Shade: TDpiBitmap;
    2836    State: TDpiBitmap;
    29     WinStat, ExtStat, AloneStat: array [0 .. nPl - 1] of integer;
    30     DisallowShowActive: array [0 .. nPl - 1] of boolean;
    31     TimeStat: array [0 .. nPl - 1] of extended;
    32     Mode: (Stop, Stopped, Running, Quit);
     37    WinStat: array [0 .. nPl - 1] of Integer;
     38    ExtStat: array [0 .. nPl - 1] of Integer;
     39    AloneStat: array [0 .. nPl - 1] of Integer;
     40    DisallowShowActive: array [0 .. nPl - 1] of Boolean;
     41    TimeStat: array [0 .. nPl - 1] of Extended;
     42    Mode: TRunMode;
    3343    procedure NewStat;
    3444    procedure EndPlaying;
     
    92102  FillChar(TimeStat, SizeOf(TimeStat), 0);
    93103  TotalStatTime := 0;
    94   Mode := Stop;
     104  Mode := rmStop;
    95105end;
    96106
     
    109119        EndCommand := sResign
    110120      else
    111         EndCommand := sBreak
     121        EndCommand := sBreak;
    112122    end
    113123  else
     
    171181      begin
    172182        inc(Round);
    173         if Mode = Running then
     183        if Mode = rmRunning then
    174184        begin
    175185          Invalidate;
    176           Update
     186          Update;
    177187        end
    178188        else
     
    192202      begin
    193203        LogDlg.List.Clear;
    194         if Mode <> Running then
     204        if Mode <> rmRunning then
    195205        begin
    196206          if LogDlg.Visible then
    197207            LogDlg.Close;
    198208          Close;
    199         end
     209        end;
    200210      end;
    201211
     
    206216        begin
    207217          ShowActive(Active, false);
    208           Active := -1
     218          Active := -1;
    209219        end; // should not happen
    210220
     
    229239        end;
    230240        DpiApplication.ProcessMessages;
    231         if Mode = Quit then
     241        if Mode = rmQuit then
    232242          EndPlaying
    233243        else if G.RO[me].Happened and phGameEnd <> 0 then
     
    248258                  inc(WinStat[p]);
    249259              end;
    250           if Mode = Running then
    251             Server(sNextRound, me, 0, nil^)
     260          if Mode = rmRunning then
     261            Server(sNextRound, me, 0, nil^);
    252262        end
    253         else if Mode = Running then
     263        else if Mode = rmRunning then
    254264          Server(sTurn, me, 0, nil^);
    255         if Mode = Stop then
     265        if Mode = rmStop then
    256266        begin
    257267          GoBtn.ButtonIndex := 22;
    258           Mode := Stopped;
     268          Mode := rmStopped;
    259269        end;
    260270      end;
     
    284294procedure TNoTermDlg.GoBtnClick(Sender: TObject);
    285295begin
    286   if Mode = Running then
    287     Mode := Stop
    288   else if Mode = Stopped then
     296  if Mode = rmRunning then
     297    Mode := rmStop
     298  else if Mode = rmStopped then
    289299  begin
    290     Mode := Running;
     300    Mode := rmRunning;
    291301    GoBtn.ButtonIndex := 23;
    292302    GoBtn.Update;
     
    297307procedure TNoTermDlg.QuitBtnClick(Sender: TObject);
    298308begin
    299   if Mode = Stopped then
    300     EndPlaying
    301   else
    302     Mode := Quit;
     309  if Mode = rmStopped then EndPlaying
     310    else Mode := rmQuit;
    303311end;
    304312
     
    362370end;
    363371
    364 procedure Client;
     372procedure Client(Command, Player: integer; var Data);
    365373begin
    366374  if not FormsCreated then
     
    384392initialization
    385393
    386 FormsCreated := false;
     394FormsCreated := False;
    387395
    388396end.
  • branches/highdpi/Packages/CevoComponents/DrawDlg.pas

    r361 r378  
    138138    NewFormPos := ScreenToClient(DpiMouse.CursorPos);
    139139    if (NewFormPos.X >= 0) and (NewFormPos.X < Width) and
    140       (NewFormPos.Y >= 0) and (NewFormPos.Y < Height) then begin
     140      (NewFormPos.Y >= 0) and (NewFormPos.Y < Height) and
     141      (NewFormPos.Y < TitleHeight) then begin
    141142      MoveMousePos := ClientToScreen(Point(X, Y));
    142143      MoveFormPos := Point(Left, Top);
  • branches/highdpi/Packages/CevoComponents/ScreenTools.pas

    r361 r378  
    5454procedure EditFrame(ca: TDpiCanvas; p: TRect; T: TTexture);
    5555function HexStringToColor(S: string): integer;
     56function ExtractFileNameWithoutExt(const Filename: string): string;
    5657function LoadGraphicFile(Bmp: TDpiBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): boolean;
    5758function LoadGraphicSet(const Name: string): TGraphicSet;
     
    124125procedure DarkenImage(Bitmap: TDpiBitmap; Change: Integer);
    125126procedure UnshareBitmap(Bitmap: TDpiBitmap);
     127procedure Gtk2Fix;
    126128
    127129const
     
    488490  if (not (gfNoGamma in Options)) and (Gamma <> 100) then
    489491    ApplyGammaToBitmap(Bmp);
     492end;
     493
     494function ExtractFileNameWithoutExt(const Filename: string): string;
     495var
     496  P: Integer;
     497begin
     498  Result := Filename;
     499  P := Length(Result);
     500  while P > 0 do begin
     501    case Result[P] of
     502      PathDelim: Exit;
     503      {$ifdef windows}
     504      '/': if ('/' in AllowDirectorySeparators) then Exit;
     505      {$endif}
     506      '.': Exit(Copy(Result, 1, P - 1));
     507    end;
     508    Dec(P);
     509  end;
    490510end;
    491511
     
    16511671end;
    16521672
     1673procedure Gtk2Fix;
     1674var
     1675  I: Integer;
     1676begin
     1677  {$IFDEF LINUX}
     1678  // Wait and process messages little bit to avoid crash or force repaint under Gtk2
     1679  for I := 0 to 10 do begin
     1680    Sleep(1);
     1681    DpiApplication.ProcessMessages;
     1682  end;
     1683  {$ENDIF}
     1684end;
     1685
    16531686procedure LoadFonts;
    16541687var
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r353 r378  
    4444    property OnMouseLeave;
    4545    property OnMouseEnter;
     46    property OnDblClick;
    4647    property ParentFont;
    4748  end;
     
    165166    function GetHint: string;
    166167    function GetOnClick: TNotifyEvent;
     168    function GetOnDblClick: TNotifyEvent;
    167169    function GetParentFont: Boolean;
    168170    function GetShowHint: Boolean;
     
    182184    procedure SetOnChangeBounds(AValue: TNotifyEvent);
    183185    procedure SetOnClick(AValue: TNotifyEvent);
     186    procedure SetOnDblClick(AValue: TNotifyEvent);
    184187    procedure SetOnResize(AValue: TNotifyEvent);
    185188    procedure SetParentFont(AValue: Boolean);
     
    263266    property OnChangeBounds: TNotifyEvent read FOnChangeBounds write SetOnChangeBounds;
    264267    property OnClick: TNotifyEvent read GetOnClick write SetOnClick;
     268    property OnDblClick: TNotifyEvent read GetOnDblClick write SetOnDblClick;
    265269    property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;
    266270    property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
     
    35753579end;
    35763580
     3581function TDpiControl.GetOnDblClick: TNotifyEvent;
     3582begin
     3583  Result := TControlEx(GetNativeControl).OnDblClick;
     3584end;
     3585
    35773586function TDpiControl.GetParentFont: Boolean;
    35783587begin
     
    36553664begin
    36563665  GetNativeControl.OnClick := AValue;
     3666end;
     3667
     3668procedure TDpiControl.SetOnDblClick(AValue: TNotifyEvent);
     3669begin
     3670  TControlEx(GetNativeControl).OnDblClick := AValue;
    36573671end;
    36583672
  • branches/highdpi/Protocol.pas

    r349 r378  
    12751275  TClientCall = procedure (Command, Player: Integer; var Data); stdcall;
    12761276
     1277  TCommand = (
     1278    cmInitModule = $0000,
     1279    cmReleaseModule = $0100,
     1280    cmBroadcast = $0200,
     1281    cmHelpOnly = $0700,
     1282    cmStartHelp = $0710,
     1283    cmStartCredits = $0720,
     1284
     1285    cmNewGame = $0800,
     1286    cmLoadGame = $0810,
     1287    cmMovie = $0820,
     1288    cmNewGameEx = $0840,
     1289    cmLoadGameEx = $0850,
     1290    cmNewMap = $0880,
     1291    cmReplay = $08E0,
     1292    cmGetReady = $08F0,
     1293    cmBreakGame = $0900,
     1294
     1295    cmTurn = $2000,
     1296    cmResume = $2010,
     1297    cmContinue = $2080,
     1298    cmMovieTurn = $2100,
     1299    cmMovieEndTurn = $2110,
     1300    cmEditMap = $2800,
     1301
     1302    // cShowTileM=$3000;cShowTileA=$3010;cShowFoundCity=$3020;
     1303    cmShowUnitChanged = $3030,
     1304    cmShowAfterMove = $3040,
     1305    cmShowAfterAttack = $3050,
     1306    cmShowCityChanged = $3090,
     1307    // cShowMove=$3100;cShowCapture=$3110;
     1308    // cShowAttackBegin=$3200;cShowAttackWon=$3210;cShowAttackLost=$3220;
     1309    cmShowMoving = $3140,
     1310    cmShowCapturing = $3150,
     1311    cmShowAttacking = $3240,
     1312    cmShowMissionResult = $3300,
     1313    cmShowShipChange = $3400,
     1314    cmShowGreatLibTech = $3500,
     1315    cmShowTurnChange = $3700,
     1316    cmShowCancelTreaty = $3800,
     1317    cmShowEndContact = $3810,
     1318    cmShowCancelTreatyByAlliance = $3820,
     1319    cmShowSupportAllianceAgainst = $3830,
     1320    cmShowPeaceViolation = $3880,
     1321    cmShowGame = $3F00, { cShowSuperView=$3F80; }
     1322    cmRefreshDebugMap = $3F90,
     1323
     1324    // diplomacy commands equal to server, see below
     1325
     1326    cmDebugMessage = $7000,
     1327    cmShowNego = $7010
     1328  );
     1329
    12771330  TUn = packed record
    12781331    Loc: LongInt; { location }
     
    16691722    Flags: Integer;
    16701723  end;
     1724  PInitModuleData = ^TInitModuleData;
    16711725
    16721726  TNewGameData = record
     
    17771831function DelphiRandom: Extended; overload;
    17781832procedure DelphiRandomize;
     1833function GetCommandDataSize(Command: TCommand): Integer;
    17791834
    17801835
     
    19191974end;
    19201975
     1976function GetCommandDataSize(Command: TCommand): Integer;
     1977begin
     1978  case Command of
     1979    cmInitModule: Result := SizeOf(TInitModuleData);
     1980    cmGetReady: Result := 0;
     1981    cmTurn: Result := 0;
     1982    cmShowTurnChange: Result := SizeOf(Integer);
     1983    cmShowNego: Result := SizeOf(TShowNegoData);
     1984    cmNewGame, cmLoadGame, cmMovie, cmNewMap: Result := SizeOf(TNewGameData);
     1985    cmShowShipChange: Result := SizeOf(TShowShipChange);
     1986    cmShowGreatLibTech: Result := SizeOf(Integer);
     1987    cmShowCityChanged: Result := SizeOf(Integer);
     1988    cmShowPeaceViolation: Result := SizeOf(Integer);
     1989    cmShowMoving: Result := SizeOf(TShowMove);
     1990    cmShowUnitChanged: Result := SizeOf(Integer);
     1991    cmShowMissionResult: Result := SizeOf(Cardinal);
     1992    cmShowAfterMove: Result := SizeOf(Integer);
     1993    cmShowAfterAttack: Result := SizeOf(Integer);
     1994    cmShowSupportAllianceAgainst: Result := SizeOf(Integer);
     1995    cmShowCancelTreatyByAlliance: Result := SizeOf(Integer);
     1996    cmShowEndContact: Result := 0;
     1997    cmShowGame: Result := 0;
     1998    //sIntCancelTreaty: Result := SizeOf(Integer);
     1999    else begin
     2000      Result := 0;
     2001    end;
     2002  end;
     2003end;
     2004
     2005
    19212006initialization
    19222007
  • branches/highdpi/Start.lfm

    r349 r378  
    196196    ItemHeight = 0
    197197    OnClick = ListClick
    198     OnKeyDown = FormKeyDown
     198    OnDblClick = StartBtnClick
     199    OnKeyPress = ListKeyPress
     200    OnKeyDown = ListKeyDown
    199201    ParentFont = False
    200202    ScrollWidth = 266
  • branches/highdpi/Start.pas

    r361 r378  
    77  UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types,
    88  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
    9   Menus, Registry,  DrawDlg, fgl, Protocol, UMiniMap;
     9  Menus, Registry,  DrawDlg, fgl, Protocol, UMiniMap, UBrain;
    1010
    1111type
     12
     13  { TPlayerSlot }
     14
    1215  TPlayerSlot = class
    1316    DiffUpBtn: TButtonC;
     
    5457    AutoEnemyDownBtn: TButtonC;
    5558    ReplayBtn: TButtonB;
     59    procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
     60    procedure ListKeyPress(Sender: TObject; var Key: char);
    5661    procedure StartBtnClick(Sender: TObject);
    5762    procedure FormPaint(Sender: TObject);
     
    8489    procedure AutoEnemyDownBtnClick(Sender: TObject);
    8590    procedure ReplayBtnClick(Sender: TObject);
    86   public
    87     EmptyPicture: TDpiBitmap;
    88     procedure UpdateFormerGames;
    89     procedure UpdateMaps;
    9091  private
    9192    WorldSize: Integer;
     
    134135    procedure LoadAiBrainsPictures;
    135136    procedure UpdateInterface;
     137    procedure ShowSettings;
     138  public
     139    EmptyPicture: TDpiBitmap;
     140    procedure UpdateFormerGames;
     141    procedure UpdateMaps;
    136142  end;
    137143
     
    356362  I: Integer;
    357363  S: string;
     364  {$IFDEF WINDOWS}
    358365  ResolutionX, ResolutionY, ResolutionBPP, ResolutionFreq: Integer;
     366  {$ENDIF}
    359367  ScreenMode: Integer;
    360368begin
     
    394402    if ValueExists('LastGame') then LastGame := Reg.ReadString('LastGame')
    395403       else LastGame := '';
     404    if ValueExists('NetworkEnabled') then NetworkEnabled := Reg.ReadBool('NetworkEnabled')
     405       else NetworkEnabled := False;
    396406
    397407    if ValueExists('ScreenMode') then
     
    399409      else ScreenMode := 1;
    400410    FullScreen := ScreenMode > 0;
     411    if ValueExists('MultiControl') then
     412      MultiControl := ReadInteger('MultiControl')
     413      else MultiControl := 0;
     414    {$IFDEF WINDOWS}
    401415    if ValueExists('ResolutionX') then
    402416      ResolutionX := ReadInteger('ResolutionX');
     
    407421    if ValueExists('ResolutionFreq') then
    408422      ResolutionFreq := ReadInteger('ResolutionFreq');
    409     if ValueExists('MultiControl') then
    410       MultiControl := ReadInteger('MultiControl')
    411       else MultiControl := 0;
    412     {$IFDEF WINDOWS}
    413423    if ScreenMode = 2 then
    414424      ChangeResolution(ResolutionX, ResolutionY, ResolutionBPP,
     
    436446    WriteInteger('StartTab', Integer(ShowTab));
    437447    WriteString('LastGame', LastGame);
     448    WriteBool('NetworkEnabled', NetworkEnabled);
    438449  finally
    439450    Free;
     
    492503      (DpiScreen.Height - Height) div 2, Width, Height)
    493504  end;
     505end;
     506
     507procedure TStartDlg.ShowSettings;
     508begin
     509  SettingsDlg := TSettingsDlg.Create(nil);
     510  if SettingsDlg.ShowModal = mrOk then begin
     511    LoadAssets;
     512    Invalidate;
     513    UpdateInterface;
     514    Background.UpdateInterface;
     515  end;
     516  FreeAndNil(SettingsDlg);
    494517end;
    495518
     
    750773        yMain + 164 { y0Mini-77 } , Phrases.Lookup('STARTCONTROLS', 16));
    751774      if AutoDiff = 1 then
    752         FrameImage(Canvas, BrainBeginner.Picture, xDefault, yDefault, 64,
     775        FrameImage(Canvas, Brains.GetBeginner.Picture, xDefault, yDefault, 64,
    753776          64, 0, 0, false)
    754777      else
     
    908931    FormerGames.Delete(I);
    909932    if ListIndex[tbNew] = I then
    910       ListIndex[tbNew] := 0
     933      ListIndex[tbNew] := 0;
    911934  end;
    912935end;
     
    968991
    969992          OpenKey(AppRegistryKey, True);
    970           if AutoDiff > 0 then
    971           begin
    972             WriteString('DefaultAI', BrainDefault.FileName);
    973             SlotAvailable := 0; // PlayerSlot will be invalid hereafter
    974             PlayersBrain[0] := BrainTerm;
    975             Difficulty[0] := PlayerAutoDiff[AutoDiff];
    976             for I := 1 to nPl - 1 do
    977               if (Page = pgStartRandom) and (I <= AutoEnemies) or
    978                 (Page = pgStartMap) and (I < nMapStartPositions) then begin
    979                 if AutoDiff = 1 then PlayersBrain[I] := BrainBeginner
    980                   else PlayersBrain[I] := BrainDefault;
    981                 Difficulty[I] := EnemyAutoDiff[AutoDiff];
    982               end  else PlayersBrain[I] := nil;
    983           end else begin
    984             for I := 6 to 8 do
    985               if (PlayersBrain[0].Kind <> btNoTerm) and (MultiControl and (1 shl I) <> 0)
    986               then begin
    987                 PlayersBrain[I + 3] := PlayersBrain[I];
    988                 Difficulty[I + 3] := Difficulty[I];
    989                 PlayersBrain[I + 6] := PlayersBrain[I];
    990                 Difficulty[I + 6] := Difficulty[I];
    991               end else begin
    992                 PlayersBrain[I + 3] := nil;
    993                 PlayersBrain[I + 6] := nil;
    994               end;
     993          if BrainDefault.Kind <> btNetworkClient then begin
     994            if AutoDiff > 0 then begin
     995              WriteString('DefaultAI', BrainDefault.FileName);
     996              SlotAvailable := 0; // PlayerSlot will be invalid hereafter
     997              PlayersBrain[0] := BrainTerm;
     998              Difficulty[0] := PlayerAutoDiff[AutoDiff];
     999              for I := 1 to nPl - 1 do
     1000                if (Page = pgStartRandom) and (I <= AutoEnemies) or
     1001                  (Page = pgStartMap) and (I < nMapStartPositions) then begin
     1002                  if AutoDiff = 1 then PlayersBrain[I] := Brains.GetBeginner
     1003                    else PlayersBrain[I] := BrainDefault;
     1004                  Difficulty[I] := EnemyAutoDiff[AutoDiff];
     1005                end else PlayersBrain[I] := nil;
     1006            end else begin
     1007              for I := 6 to 8 do
     1008                if (PlayersBrain[0].Kind <> btNoTerm) and (MultiControl and (1 shl I) <> 0)
     1009                then begin
     1010                  PlayersBrain[I + 3] := PlayersBrain[I];
     1011                  Difficulty[I + 3] := Difficulty[I];
     1012                  PlayersBrain[I + 6] := PlayersBrain[I];
     1013                  Difficulty[I + 6] := Difficulty[I];
     1014                end else begin
     1015                  PlayersBrain[I + 3] := nil;
     1016                  PlayersBrain[I + 6] := nil;
     1017                end;
     1018            end;
    9951019          end;
    9961020
     
    10271051      end;
    10281052  end;
     1053end;
     1054
     1055procedure TStartDlg.ListKeyPress(Sender: TObject; var Key: char);
     1056begin
     1057  if Key = #13 then StartBtnClick(Sender);
     1058end;
     1059
     1060procedure TStartDlg.ListKeyDown(Sender: TObject; var Key: Word;
     1061  Shift: TShiftState);
     1062const
     1063  DelKey = 46;
     1064begin
     1065  if Key = DelKey then DeleteBtnClick(Sender)
     1066    else FormKeyDown(Sender, Key, Shift);
    10291067end;
    10301068
     
    11621200  AIBrains: TBrains;
    11631201begin
     1202  FixedLines := 0;
    11641203  PlayerPopupIndex := PlayerIndex;
    11651204  EmptyMenu(PopupMenu1.Items);
    11661205  if PlayerPopupIndex < 0 then begin // select default AI
    1167     FixedLines := 0;
     1206    if NetworkEnabled then begin
     1207      OfferBrain(BrainNetworkClient, FixedLines);
     1208      Inc(FixedLines);
     1209    end;
     1210
     1211    MenuItem := TDpiMenuItem.Create(PopupMenu1);
     1212    MenuItem.Caption := '-';
     1213    PopupMenu1.Items.Add(MenuItem);
     1214
     1215    Inc(FixedLines);
    11681216    if Brains.GetKindCount(btAI) >= 2 then begin
    11691217      OfferBrain(BrainRandom, FixedLines);
     
    11771225    FreeAndNil(AIBrains);
    11781226  end else begin
    1179     FixedLines := 0;
    11801227    if PlayerPopupIndex > 0 then begin
    11811228      OfferBrain(nil, FixedLines);
     
    11891236      end;
    11901237    if PlayerPopupIndex > 0 then begin
     1238      if NetworkEnabled then begin
     1239        OfferBrain(BrainNetworkServer, FixedLines);
     1240        Inc(FixedLines);
     1241      end;
     1242
    11911243      MenuItem := TDpiMenuItem.Create(PopupMenu1);
    11921244      MenuItem.Caption := '-';
     
    12671319          begin
    12681320            PlayersBrain[0] := BrainSuperVirtual;
    1269             Difficulty[0] := 0
     1321            Difficulty[0] := 0;
    12701322          end;
    12711323          if PlayersBrain[0].Kind in [btNoTerm, btSuperVirtual] then
     
    14241476    ChangeTab(TStartTab((x - TabOffset) div TabSize));
    14251477  end
    1426   else if Page = pgMain then
    1427   begin
     1478  else if Page = pgMain then begin
    14281479    case SelectedAction of
    1429       maConfig:
    1430         begin
    1431           SettingsDlg := TSettingsDlg.Create(nil);
    1432           if SettingsDlg.ShowModal = mrOk then begin
    1433             LoadAssets;
    1434             Invalidate;
    1435             UpdateInterface;
    1436             Background.UpdateInterface;
    1437           end;
    1438           FreeAndNil(SettingsDlg);
    1439         end;
    1440       maManual:
    1441         DirectHelp(cStartHelp);
    1442       maCredits:
    1443         DirectHelp(cStartCredits);
    1444       maAIDev:
    1445         OpenDocument(HomeDir + AITemplateFileName);
    1446       maWeb:
    1447         OpenURL(CevoHomepage);
     1480      maConfig: ShowSettings;
     1481      maManual: DirectHelp(cStartHelp);
     1482      maCredits: DirectHelp(cStartCredits);
     1483      maAIDev: OpenDocument(HomeDir + AITemplateFileName);
     1484      maWeb: OpenURL(CevoHomepage);
    14481485    end;
    14491486  end
     
    14601497        else
    14611498          PopupMenu1.Popup(left + xBrain[I] + 4, top + yBrain[I] + 4);
    1462       end
     1499      end;
    14631500  end
    14641501  else if (AutoDiff > 1) and ((Page = pgStartRandom) or (Page = pgStartMap)) and
Note: See TracChangeset for help on using the changeset viewer.