- Timestamp:
- Apr 24, 2021, 11:41:07 PM (4 years ago)
- Location:
- branches/highdpi
- Files:
-
- 12 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Direct.pas
r361 r378 43 43 44 44 uses 45 ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global; 45 ScreenTools, Protocol, Start, LocalPlayer, NoTerm, Back, Global, UNetworkServer, 46 UNetworkClient; 46 47 47 48 {$R *.lfm} … … 57 58 // p: pointer; 58 59 s: string; 59 begin60 Begin 60 61 case ID of 61 62 ntInitLocalHuman: begin … … 64 65 Info := Phrases.Lookup('BUSY_MODLH'); 65 66 Show; 66 {$IFDEF LINUX} 67 // Force shown window repaint on Gtk2 widgetset 68 Sleep(1); 69 DpiApplication.ProcessMessages; 70 {$ENDIF} 67 Gtk2Fix; 71 68 Invalidate; 72 69 Update; … … 185 182 BrainTerm.Client := LocalPlayer.Client; 186 183 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; 187 190 BrainRandom.Name := Phrases.Lookup('RANDOMAI'); 188 191 Canvas.Font.Assign(UniFont[ftNormal]); … … 191 194 192 195 procedure TDirectDlg.FormShow(Sender: TObject); 196 var 197 I: Integer; 193 198 begin 194 199 if not Gone then -
branches/highdpi/GameServer.pas
r361 r378 7 7 8 8 uses 9 UDpiControls,Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils,10 Graphics ;9 Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, 10 Graphics, UBrain; 11 11 12 12 const … … 14 14 FirstAICompatibleVersion = $000D00; 15 15 FirstBookCompatibleVersion = $010103; 16 17 // module flags18 fMultiple = $10000000;19 fDotNet = $20000000;20 fUsed = $40000000;21 16 22 17 maxBrain = 255; … … 52 47 TNotifyFunction = procedure(ID: TNotify; Index: Integer = 0); 53 48 54 TBrainType = (btNoTerm, btSuperVirtual, btTerm, btRandom, btAI);55 56 { TBrain }57 58 TBrain = class59 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 85 49 var 86 50 // PARAMETERS 87 PlayersBrain: TBrains; { brain of the players }51 PlayersBrain: TBrains; { brain of the players view } 88 52 Difficulty: array [0 .. nPl - 1] of integer absolute Database.Difficulty; 89 53 { difficulty } … … 98 62 BrainTerm: TBrain; 99 63 BrainRandom: TBrain; 100 BrainBeginner: TBrain; // AI to use for beginner level 64 BrainNetworkClient: TBrain; 65 BrainNetworkServer: TBrain; 66 67 NetworkEnabled: Boolean; 101 68 102 69 procedure Init(NotifyFunction: TNotifyFunction); … … 184 151 {$ELSE} 185 152 try 186 Brain[bix[p]].Client(Command, p, Data);153 bix[p].Client(Command, p, Data); 187 154 except 188 155 Notify(ntException + bix[p]); … … 190 157 {$ENDIF} 191 158 end 159 end; 160 161 procedure CallAllPlayers(Command: Integer; var Data); 162 var 163 I: Integer; 164 begin 165 for I := 0 to nPl - 1 do 166 if Assigned(bix[I]) then 167 CallPlayer(Command, I, Data); 192 168 end; 193 169 … … 236 212 BrainNoTerm.FileName := ':AIT'; 237 213 BrainNoTerm.Flags := 0; 238 BrainNoTerm.Initialized := false;214 BrainNoTerm.Initialized := False; 239 215 BrainNoTerm.Kind := btNoTerm; 240 216 BrainSuperVirtual := Brains.AddNew; 241 217 BrainSuperVirtual.FileName := ':Supervisor'; 242 218 BrainSuperVirtual.Flags := 0; 243 BrainSuperVirtual.Initialized := false;219 BrainSuperVirtual.Initialized := False; 244 220 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; 245 229 BrainTerm := Brains.AddNew; 246 230 BrainTerm.FileName := ':StdIntf'; 247 231 BrainTerm.Flags := fMultiple; 248 BrainTerm.Initialized := false;232 BrainTerm.Initialized := False; 249 233 BrainTerm.ServerVersion := Version; 250 234 BrainTerm.Kind := btTerm; … … 252 236 BrainRandom.FileName := ':Random'; 253 237 BrainRandom.Flags := fMultiple; 254 BrainRandom.Initialized := false;238 BrainRandom.Initialized := False; 255 239 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; 258 248 259 249 if FindFirst(GetAiDir + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then … … 369 359 Notify(ntDeactivationMissing, p); 370 360 ForceClientDeactivation; 371 end 361 end; 372 362 end; 373 363 … … 1355 1345 begin 1356 1346 CL.State := FormerCLState; 1357 Break 1358 end 1347 Break; 1348 end; 1359 1349 end; 1360 1350 {$IFOPT O-}InvalidTreatyMap := 0; {$ENDIF} … … 1364 1354 Newlx, Newly, NewLandMass, NewMaxTurn: integer); 1365 1355 var 1366 p: integer;1356 I: Integer; 1367 1357 begin 1368 1358 Notify(ntStartDone); … … 1389 1379 StartGame; 1390 1380 NoLogChanges; 1391 for p := 0 to nPl - 1 do 1392 if Assigned(bix[p]) then 1393 CallPlayer(cGetReady, p, nil^); 1381 CallAllPlayers(cGetReady, nil^); 1394 1382 LogChanges; 1395 1383 CL.Put(sTurn, 0, 0, nil); … … 1399 1387 nLogOpened := -1; 1400 1388 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^); 1402 1393 Notify(ntBackOff); 1403 1394 Inform(pTurn); … … 1505 1496 CallPlayer(cShowShipChange, p1, ShowShipChange); 1506 1497 end; 1507 end 1508 end 1498 end; 1499 end; 1509 1500 end; 1510 1501 … … 2425 2416 if PModel.Attack = 0 then 2426 2417 Flags := Flags and not unBombsLoaded; 2427 dec(Movement, 100) 2418 dec(Movement, 100); 2428 2419 end 2429 2420 else if MoveInfo.MoveType = mtExpel then … … 2432 2423 Job := jNone; 2433 2424 Flags := Flags and not unFortified; 2434 dec(Movement, 100) 2425 dec(Movement, 100); 2435 2426 end 2436 2427 else … … 2482 2473 inc(nUpdateLoc); 2483 2474 Flags := Flags or unWithdrawn; 2484 end 2475 end; 2485 2476 end 2486 2477 else if (MoveInfo.MoveType = mtAttack) and (MoveInfo.EndHealthDef > 0) then … … 2520 2511 begin 2521 2512 UpdateLoc[nUpdateLoc] := Loc; 2522 inc(nUpdateLoc) 2513 inc(nUpdateLoc); 2523 2514 end; 2524 2515 // unit will be removed -- remember position and update for all players … … 2568 2559 CallPlayer(cShowUnitChanged, p1, ExpelToLoc); 2569 2560 end; 2570 end 2571 end 2561 end; 2562 end; 2572 2563 end; // ExecuteAttack 2573 2564 … … 2585 2576 begin 2586 2577 result := eInvalid; 2587 exit 2578 exit; 2588 2579 end; 2589 2580 result := CalculateMove(p, uix, ToLoc, 3 - dy and 1, TestOnly, MoveInfo); … … 2619 2610 result := ExecuteMove(p, uix, ToLoc, MoveInfo, ShowMove) or result; 2620 2611 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; 2624 2615 end; // with 2625 2616 end; { MoveUnit } … … 2695 2686 result := ptShip 2696 2687 else 2697 result := ptImp 2688 result := ptImp; 2698 2689 end; 2699 2690 … … 2726 2717 begin 2727 2718 result := eUnknown; 2728 exit 2719 exit; 2729 2720 end; 2730 2721 … … 2734 2725 begin 2735 2726 result := eInvalid; 2736 exit 2727 exit; 2737 2728 end; 2738 2729 … … 2744 2735 PutMessage(1 shl 16 + 1, Format('NOT Alive: %d', [Player])); 2745 2736 result := eNoTurn; 2746 exit 2737 exit; 2747 2738 end; 2748 2739 … … 2771 2762 [Player, Command shr 4])); 2772 2763 result := eNoTurn; 2773 exit 2764 exit; 2774 2765 end; 2775 2766 … … 2897 2888 else 2898 2889 result := GetTileInfo(Player, TTileInfo(Data).ExplCity, Subject, 2899 TTileInfo(Data)) 2890 TTileInfo(Data)); 2900 2891 end 2901 2892 else … … 2908 2899 result := eNoPreq 2909 2900 else 2910 result := GetJobProgress(Player, Subject, TJobProgressData(Data)) 2901 result := GetJobProgress(Player, Subject, TJobProgressData(Data)); 2911 2902 end 2912 2903 else … … 2957 2948 end; 2958 2949 if result = eOK then 2959 result := eInvalid // no enemy unit there!2950 result := eInvalid; // no enemy unit there! 2960 2951 end 2961 2952 else … … 2988 2979 result := eOK 2989 2980 else 2990 result := eNoWay 2981 result := eNoWay; 2991 2982 end; 2992 2983 … … 3040 3031 TCityReport(Data).HypoTax := -1; 3041 3032 TCityReport(Data).HypoLux := -1; 3042 GetCityReport(p1, cix1, TCityReport(Data)) 3033 GetCityReport(p1, cix1, TCityReport(Data)); 3043 3034 end 3044 3035 else … … 3071 3062 p1 := 1; 3072 3063 SearchCity(Subject, p1, cix1); 3073 GetCityAreaInfo(p1, Subject, TCityAreaInfo(Data)) 3064 GetCityAreaInfo(p1, Subject, TCityAreaInfo(Data)); 3074 3065 end 3075 3066 else … … 3135 3126 LogChanges; 3136 3127 SaveGame('~' + LogFileName, true); 3137 end 3128 end; 3138 3129 {$ENDIF} 3139 3130 end … … 3164 3155 begin 3165 3156 if CheckSum <> Subject then 3166 LoadOK := false 3157 LoadOK := false; 3167 3158 end 3168 3159 else // save checksum … … 3210 3201 CCCommand := cTurn; 3211 3202 CCPlayer := pTurn; 3212 Notify(ntNextPlayer) 3203 Notify(ntNextPlayer); 3213 3204 end 3214 3205 else … … 3274 3265 sReload: 3275 3266 LoadGame(SavePath, LogFileName, integer(Data), false); 3276 end 3267 end; 3277 3268 end 3278 3269 else … … 3291 3282 Notify(ntStartGoRefreshMaps) 3292 3283 else 3293 Notify(ntStartGo) 3284 Notify(ntStartGo); 3294 3285 end 3295 3286 else … … 3331 3322 assert(Mode = moPlaying); 3332 3323 ChangeClientWhenDone(cContinue, pTurn, nil^, 0); 3333 end 3324 end; 3334 3325 end 3335 3326 else … … 3348 3339 IntServer(sIntHaveContact, pTurn, pContacted, nil^); 3349 3340 ChangeClientWhenDone(scDipStart, pDipActive, nil^, 0); 3350 end 3341 end; 3351 3342 end 3352 3343 else … … 3407 3398 ShowShipChange.Ship2Change[Price[i] shr 16 and 3] := 3408 3399 +integer(Price[i] and $FFFF); 3409 end 3400 end; 3410 3401 end; 3411 3402 if HasShipChanged then … … 3421 3412 if 1 shl p2 and GWatching <> 0 then 3422 3413 CallPlayer(cShowShipChange, p2, ShowShipChange); 3423 end 3424 end 3414 end; 3415 end; 3425 3416 end; 3426 3417 end … … 3447 3438 CallPlayer(cShowCancelTreatyByAlliance, pDipActive, i); 3448 3439 end; 3449 end 3440 end; 3450 3441 end 3451 3442 else … … 3470 3461 pDipActive := p1; 3471 3462 ChangeClientWhenDone(Command, pDipActive, nil^, 0); 3472 end 3463 end; 3473 3464 end 3474 3465 else … … 3488 3479 assert(Mode = moPlaying); 3489 3480 ChangeClientWhenDone(cContinue, pTurn, nil^, 0); 3490 end 3481 end; 3491 3482 end 3492 3483 else … … 4504 4495 end; { <<<server } 4505 4496 4506 function ExtractFileNameWithoutExt(const Filename: string): string;4507 var4508 P: Integer;4509 begin4510 Result := Filename;4511 P := Length(Result);4512 while P > 0 do begin4513 case Result[P] of4514 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 var4528 T: Text;4529 Key: string;4530 Value: string;4531 S: string;4532 BasePath: string;4533 I: Integer;4534 begin4535 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) then4545 raise Exception.Create(Format('AI specification file %s not found', [AIFileName]));4546 AssignFile(T, AIFileName);4547 Reset(T);4548 while not EOF(T) do4549 begin4550 ReadLn(T, s);4551 s := trim(s);4552 if Pos(' ', S) > 0 then begin4553 Key := Copy(S, 1, Pos(' ', S) - 1);4554 Value := Trim(Copy(S, Pos(' ', S) + 1, Length(S)));4555 end else begin4556 Key := S;4557 Value := '';4558 end;4559 if Key = '#NAME' then4560 Name := Value4561 else if Key = '#.NET' then4562 Flags := Flags or fDotNet4563 else if Key = '#BEGINNER' then4564 BrainBeginner := Self4565 else if Key = '#PATH' then4566 DLLName := BasePath + DirectorySeparator + Value4567 {$IFDEF WINDOWS}{$IFDEF CPU32}4568 else if Key = '#PATH_WIN32' then4569 DLLName := BasePath + DirectorySeparator + Value4570 {$ENDIF}{$ENDIF}4571 {$IFDEF WINDOWS}{$IFDEF CPU64}4572 else if Key = '#PATH_WIN64' then4573 DLLName := BasePath + DirectorySeparator + Value4574 {$ENDIF}{$ENDIF}4575 {$IFDEF LINUX}{$IFDEF CPU32}4576 else if Key = '#PATH_LINUX32' then4577 DLLName := BasePath + DirectorySeparator + Value4578 {$ENDIF}{$ENDIF}4579 {$IFDEF LINUX}{$IFDEF CPU64}4580 else if Key = '#PATH_LINUX64' then4581 DLLName := BasePath + DirectorySeparator + Value4582 {$ENDIF}{$ENDIF}4583 else if Key = '#GAMEVERSION' then4584 for i := 1 to Length(Value) do4585 case Value[i] of4586 '0' .. '9':4587 ServerVersion := ServerVersion and $FFFF00 + ServerVersion and4588 $FF * 10 + ord(Value[i]) - 48;4589 '.':4590 ServerVersion := ServerVersion shl 8;4591 end4592 else if Key = '#CREDITS' then4593 Credits := Value;4594 end;4595 CloseFile(T);4596 end;4597 4598 constructor TBrain.Create;4599 begin4600 Picture := TDpiBitmap.Create;4601 Picture.SetSize(64, 64);4602 end;4603 4604 destructor TBrain.Destroy;4605 begin4606 FreeAndNil(Picture);4607 inherited;4608 end;4609 4610 { TBrains }4611 4612 function TBrains.AddNew: TBrain;4613 begin4614 Result := TBrain.Create;4615 Add(Result);4616 end;4617 4618 function TBrains.GetKindCount(Kind: TBrainType): Integer;4619 var4620 I: Integer;4621 begin4622 Result := 0;4623 for I := 0 to Count - 1 do4624 if Items[I].Kind = Kind then Inc(Result);4625 end;4626 4627 procedure TBrains.GetByKind(Kind: TBrainType; Brains: TBrains);4628 var4629 I: Integer;4630 begin4631 Brains.Clear;4632 for I := 0 to Count - 1 do4633 if Items[I].Kind = Kind then Brains.Add(Items[I]);4634 end;4635 4497 4636 4498 initialization -
branches/highdpi/Global.pas
r349 r378 12 12 CevoContact = 'https://' + CevoContactShort; 13 13 CevoContactBug = 'https://app.zdechov.net/c-evo/report/1'; 14 CevoNetworkPort = 41363; 14 15 AppRegistryKey = '\SOFTWARE\C-evo'; 15 16 AITemplateManual = 'AI development manual'; -
branches/highdpi/Integrated.lpi
r349 r378 39 39 <SearchPaths> 40 40 <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/> 41 <OtherUnitFiles Value="LocalPlayer "/>41 <OtherUnitFiles Value="LocalPlayer;Network"/> 42 42 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 43 43 </SearchPaths> … … 102 102 </Item3> 103 103 </RequiredPackages> 104 <Units Count="4 3">104 <Units Count="47"> 105 105 <Unit0> 106 106 <Filename Value="Integrated.lpr"/> … … 347 347 <IsPartOfProject Value="True"/> 348 348 </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> 349 365 </Units> 350 366 </ProjectOptions> … … 357 373 <SearchPaths> 358 374 <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/> 359 <OtherUnitFiles Value="LocalPlayer "/>375 <OtherUnitFiles Value="LocalPlayer;Network"/> 360 376 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 361 377 </SearchPaths> … … 391 407 <Other> 392 408 <CompilerMessages> 393 <IgnoredMessages idx 5024="True"/>409 <IgnoredMessages idx6058="True" idx5024="True"/> 394 410 </CompilerMessages> 395 411 <CustomOptions Value="-dDEBUG"/> -
branches/highdpi/Integrated.lpr
r210 r378 3 3 4 4 uses 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, 6 10 Back, Log, LocalPlayer, ClientTools, Tribes, IsoEngine, Term, CityScreen, Nego, 7 11 NoTerm, ScreenTools, Directories; -
branches/highdpi/Language.txt
r349 r378 405 405 #UTILIZE Utilize 406 406 #INTEGRATE Integrate 407 #NETWORK_SERVER Network Server 408 #NETWORK_CLIENT Network Client 407 409 408 410 'Busy Messages -
branches/highdpi/LocalPlayer/CityScreen.pas
r361 r378 1492 1492 (cpImp or cpIndex) then 1493 1493 begin // loss of material -- do query 1494 DpiApplication.ProcessMessages; // TODO: Needed for Gtk2, Lazarus gtk2 bug?1494 Gtk2Fix; 1495 1495 if (pt1 = ptTrGoods) or (pt1 = ptShip) or (pt1 <> pt0) and 1496 1496 (pt0 <> ptCaravan) then begin -
branches/highdpi/LocalPlayer/LocalPlayer.pas
r361 r378 16 16 FormsCreated: boolean; 17 17 18 procedure Client ;18 procedure Client(Command, Player: integer; var Data); 19 19 begin 20 20 if not FormsCreated then -
branches/highdpi/LocalPlayer/Select.pas
r361 r378 1568 1568 DispLines := MaxLines; 1569 1569 InnerHeight := LineDistance * (DispLines + 1) + 24; 1570 ClientHeight := InnerHeight + TitleHeight + WideFrame 1570 ClientHeight := InnerHeight + TitleHeight + WideFrame; 1571 1571 end 1572 1572 else -
branches/highdpi/LocalPlayer/Term.pas
r361 r378 2916 2916 FormResize(nil); // calculate geometrics and paint all 2917 2917 SetTroopLoc(-1); 2918 idle := true 2918 idle := true; 2919 2919 end; 2920 2920 … … 2949 2949 DipMem[me].DeliveredPrices := []; 2950 2950 DipMem[me].ReceivedPrices := []; 2951 DipCall(scDipStart) 2951 DipCall(scDipStart); 2952 2952 end 2953 2953 else 2954 2954 begin 2955 2955 DipCall(scReject); 2956 EndNego 2956 EndNego; 2957 2957 end; 2958 2958 end; … … 2993 2993 end; 2994 2994 NegoDlg.Start; 2995 idle := true 2995 idle := true; 2996 2996 end; 2997 2997 … … 3045 3045 CurrentMoveInfo.DoShow := not mAlNoMoves.Checked 3046 3046 else 3047 CurrentMoveInfo.DoShow := not mEnNoMoves.Checked 3047 CurrentMoveInfo.DoShow := not mEnNoMoves.Checked; 3048 3048 end 3049 3049 else if Command = cShowUnitChanged then … … 3057 3057 else 3058 3058 CurrentMoveInfo.DoShow := 3059 not(mEnNoMoves.Checked or mEnAttacks.Checked) 3059 not(mEnNoMoves.Checked or mEnAttacks.Checked); 3060 3060 end; 3061 3061 // else keep DoShow from cShowMove/cShowAttack … … 3151 3151 ShowMoveDomain := Domain; 3152 3152 IsAlpine := Cap[mcAlpine] > 0; 3153 end 3154 end 3153 end; 3154 end; 3155 3155 end 3156 3156 else … … 3204 3204 CurrentMoveInfo.AfterMovePaintRadius := 2 3205 3205 else 3206 CurrentMoveInfo.AfterMovePaintRadius := 1 3206 CurrentMoveInfo.AfterMovePaintRadius := 1; 3207 3207 end 3208 3208 else … … 3271 3271 else 3272 3272 MapValid := false; 3273 end 3273 end; 3274 3274 end; 3275 3275 … … 3356 3356 else 3357 3357 MapValid := false; 3358 end 3358 end; 3359 3359 end; 3360 3360 … … 3368 3368 if 3 shl (p1 * 2) and Cardinal(Data) <> 0 then 3369 3369 s := s + '\' + Tribe[p1].TPhrase('SHORTNAME'); 3370 SoundMessageEx(s, '') 3370 SoundMessageEx(s, ''); 3371 3371 end; 3372 3372 -
branches/highdpi/Localization/cs/Language.txt
r349 r378 405 405 #UTILIZE Využít 406 406 #INTEGRATE Sloučit 407 #NETWORK_SERVER Síťový server 408 #NETWORK_CLIENT Síťový klient 407 409 408 410 'Busy Messages -
branches/highdpi/Localization/de/Language.txt
r349 r378 414 414 #UTILIZE Anwenden 415 415 #INTEGRATE Integrieren 416 #NETWORK_SERVER Network Server 417 #NETWORK_CLIENT Network Client 416 418 417 419 'Busy Messages -
branches/highdpi/Localization/it/Language.txt
r349 r378 395 395 #UTILIZE Ricicla 396 396 #INTEGRATE Integra 397 #NETWORK_SERVER Network Server 398 #NETWORK_CLIENT Network Client 397 399 398 400 'Busy Messages -
branches/highdpi/Localization/ru/Language.txt
r349 r378 421 421 #UTILIZE Использовать 422 422 #INTEGRATE Внедрить 423 #NETWORK_SERVER Network Server 424 #NETWORK_CLIENT Network Client 423 425 424 426 'Сообщения паузы -
branches/highdpi/Localization/zh-Hans/language.txt
r349 r378 413 413 #UTILIZE ²Î½¨ 414 414 #INTEGRATE Õû±à 415 #NETWORK_SERVER Network Server 416 #NETWORK_CLIENT Network Client 415 417 416 418 'Busy Messages -
branches/highdpi/Localization/zh-Hant/language.txt
r349 r378 413 413 #UTILIZE °Ñ«Ø 414 414 #INTEGRATE ¾ã½s 415 #NETWORK_SERVER Network Server 416 #NETWORK_CLIENT Network Client 415 417 416 418 'Busy Messages -
branches/highdpi/NoTerm.pas
r361 r378 9 9 10 10 type 11 TRunMode = (rmStop, rmStopped, rmRunning, rmQuit); 12 11 13 TNoTermDlg = class(TDrawDlg) 12 14 QuitBtn: TButtonB; … … 20 22 procedure Client(Command, Player: integer; var Data); 21 23 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; 25 33 G: TNewGameData; 26 34 Server: TServerCall; 27 35 Shade: TDpiBitmap; 28 36 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; 33 43 procedure NewStat; 34 44 procedure EndPlaying; … … 92 102 FillChar(TimeStat, SizeOf(TimeStat), 0); 93 103 TotalStatTime := 0; 94 Mode := Stop;104 Mode := rmStop; 95 105 end; 96 106 … … 109 119 EndCommand := sResign 110 120 else 111 EndCommand := sBreak 121 EndCommand := sBreak; 112 122 end 113 123 else … … 171 181 begin 172 182 inc(Round); 173 if Mode = Running then183 if Mode = rmRunning then 174 184 begin 175 185 Invalidate; 176 Update 186 Update; 177 187 end 178 188 else … … 192 202 begin 193 203 LogDlg.List.Clear; 194 if Mode <> Running then204 if Mode <> rmRunning then 195 205 begin 196 206 if LogDlg.Visible then 197 207 LogDlg.Close; 198 208 Close; 199 end 209 end; 200 210 end; 201 211 … … 206 216 begin 207 217 ShowActive(Active, false); 208 Active := -1 218 Active := -1; 209 219 end; // should not happen 210 220 … … 229 239 end; 230 240 DpiApplication.ProcessMessages; 231 if Mode = Quit then241 if Mode = rmQuit then 232 242 EndPlaying 233 243 else if G.RO[me].Happened and phGameEnd <> 0 then … … 248 258 inc(WinStat[p]); 249 259 end; 250 if Mode = Running then251 Server(sNextRound, me, 0, nil^) 260 if Mode = rmRunning then 261 Server(sNextRound, me, 0, nil^); 252 262 end 253 else if Mode = Running then263 else if Mode = rmRunning then 254 264 Server(sTurn, me, 0, nil^); 255 if Mode = Stop then265 if Mode = rmStop then 256 266 begin 257 267 GoBtn.ButtonIndex := 22; 258 Mode := Stopped;268 Mode := rmStopped; 259 269 end; 260 270 end; … … 284 294 procedure TNoTermDlg.GoBtnClick(Sender: TObject); 285 295 begin 286 if Mode = Running then287 Mode := Stop288 else if Mode = Stopped then296 if Mode = rmRunning then 297 Mode := rmStop 298 else if Mode = rmStopped then 289 299 begin 290 Mode := Running;300 Mode := rmRunning; 291 301 GoBtn.ButtonIndex := 23; 292 302 GoBtn.Update; … … 297 307 procedure TNoTermDlg.QuitBtnClick(Sender: TObject); 298 308 begin 299 if Mode = Stopped then 300 EndPlaying 301 else 302 Mode := Quit; 309 if Mode = rmStopped then EndPlaying 310 else Mode := rmQuit; 303 311 end; 304 312 … … 362 370 end; 363 371 364 procedure Client ;372 procedure Client(Command, Player: integer; var Data); 365 373 begin 366 374 if not FormsCreated then … … 384 392 initialization 385 393 386 FormsCreated := false;394 FormsCreated := False; 387 395 388 396 end. -
branches/highdpi/Packages/CevoComponents/DrawDlg.pas
r361 r378 138 138 NewFormPos := ScreenToClient(DpiMouse.CursorPos); 139 139 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 141 142 MoveMousePos := ClientToScreen(Point(X, Y)); 142 143 MoveFormPos := Point(Left, Top); -
branches/highdpi/Packages/CevoComponents/ScreenTools.pas
r361 r378 54 54 procedure EditFrame(ca: TDpiCanvas; p: TRect; T: TTexture); 55 55 function HexStringToColor(S: string): integer; 56 function ExtractFileNameWithoutExt(const Filename: string): string; 56 57 function LoadGraphicFile(Bmp: TDpiBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): boolean; 57 58 function LoadGraphicSet(const Name: string): TGraphicSet; … … 124 125 procedure DarkenImage(Bitmap: TDpiBitmap; Change: Integer); 125 126 procedure UnshareBitmap(Bitmap: TDpiBitmap); 127 procedure Gtk2Fix; 126 128 127 129 const … … 488 490 if (not (gfNoGamma in Options)) and (Gamma <> 100) then 489 491 ApplyGammaToBitmap(Bmp); 492 end; 493 494 function ExtractFileNameWithoutExt(const Filename: string): string; 495 var 496 P: Integer; 497 begin 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; 490 510 end; 491 511 … … 1651 1671 end; 1652 1672 1673 procedure Gtk2Fix; 1674 var 1675 I: Integer; 1676 begin 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} 1684 end; 1685 1653 1686 procedure LoadFonts; 1654 1687 var -
branches/highdpi/Packages/DpiControls/UDpiControls.pas
r353 r378 44 44 property OnMouseLeave; 45 45 property OnMouseEnter; 46 property OnDblClick; 46 47 property ParentFont; 47 48 end; … … 165 166 function GetHint: string; 166 167 function GetOnClick: TNotifyEvent; 168 function GetOnDblClick: TNotifyEvent; 167 169 function GetParentFont: Boolean; 168 170 function GetShowHint: Boolean; … … 182 184 procedure SetOnChangeBounds(AValue: TNotifyEvent); 183 185 procedure SetOnClick(AValue: TNotifyEvent); 186 procedure SetOnDblClick(AValue: TNotifyEvent); 184 187 procedure SetOnResize(AValue: TNotifyEvent); 185 188 procedure SetParentFont(AValue: Boolean); … … 263 266 property OnChangeBounds: TNotifyEvent read FOnChangeBounds write SetOnChangeBounds; 264 267 property OnClick: TNotifyEvent read GetOnClick write SetOnClick; 268 property OnDblClick: TNotifyEvent read GetOnDblClick write SetOnDblClick; 265 269 property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown; 266 270 property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove; … … 3575 3579 end; 3576 3580 3581 function TDpiControl.GetOnDblClick: TNotifyEvent; 3582 begin 3583 Result := TControlEx(GetNativeControl).OnDblClick; 3584 end; 3585 3577 3586 function TDpiControl.GetParentFont: Boolean; 3578 3587 begin … … 3655 3664 begin 3656 3665 GetNativeControl.OnClick := AValue; 3666 end; 3667 3668 procedure TDpiControl.SetOnDblClick(AValue: TNotifyEvent); 3669 begin 3670 TControlEx(GetNativeControl).OnDblClick := AValue; 3657 3671 end; 3658 3672 -
branches/highdpi/Protocol.pas
r349 r378 1275 1275 TClientCall = procedure (Command, Player: Integer; var Data); stdcall; 1276 1276 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 1277 1330 TUn = packed record 1278 1331 Loc: LongInt; { location } … … 1669 1722 Flags: Integer; 1670 1723 end; 1724 PInitModuleData = ^TInitModuleData; 1671 1725 1672 1726 TNewGameData = record … … 1777 1831 function DelphiRandom: Extended; overload; 1778 1832 procedure DelphiRandomize; 1833 function GetCommandDataSize(Command: TCommand): Integer; 1779 1834 1780 1835 … … 1919 1974 end; 1920 1975 1976 function GetCommandDataSize(Command: TCommand): Integer; 1977 begin 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; 2003 end; 2004 2005 1921 2006 initialization 1922 2007 -
branches/highdpi/Start.lfm
r349 r378 196 196 ItemHeight = 0 197 197 OnClick = ListClick 198 OnKeyDown = FormKeyDown 198 OnDblClick = StartBtnClick 199 OnKeyPress = ListKeyPress 200 OnKeyDown = ListKeyDown 199 201 ParentFont = False 200 202 ScrollWidth = 266 -
branches/highdpi/Start.pas
r361 r378 7 7 UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types, 8 8 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls, 9 Menus, Registry, DrawDlg, fgl, Protocol, UMiniMap ;9 Menus, Registry, DrawDlg, fgl, Protocol, UMiniMap, UBrain; 10 10 11 11 type 12 13 { TPlayerSlot } 14 12 15 TPlayerSlot = class 13 16 DiffUpBtn: TButtonC; … … 54 57 AutoEnemyDownBtn: TButtonC; 55 58 ReplayBtn: TButtonB; 59 procedure ListKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 60 procedure ListKeyPress(Sender: TObject; var Key: char); 56 61 procedure StartBtnClick(Sender: TObject); 57 62 procedure FormPaint(Sender: TObject); … … 84 89 procedure AutoEnemyDownBtnClick(Sender: TObject); 85 90 procedure ReplayBtnClick(Sender: TObject); 86 public87 EmptyPicture: TDpiBitmap;88 procedure UpdateFormerGames;89 procedure UpdateMaps;90 91 private 91 92 WorldSize: Integer; … … 134 135 procedure LoadAiBrainsPictures; 135 136 procedure UpdateInterface; 137 procedure ShowSettings; 138 public 139 EmptyPicture: TDpiBitmap; 140 procedure UpdateFormerGames; 141 procedure UpdateMaps; 136 142 end; 137 143 … … 356 362 I: Integer; 357 363 S: string; 364 {$IFDEF WINDOWS} 358 365 ResolutionX, ResolutionY, ResolutionBPP, ResolutionFreq: Integer; 366 {$ENDIF} 359 367 ScreenMode: Integer; 360 368 begin … … 394 402 if ValueExists('LastGame') then LastGame := Reg.ReadString('LastGame') 395 403 else LastGame := ''; 404 if ValueExists('NetworkEnabled') then NetworkEnabled := Reg.ReadBool('NetworkEnabled') 405 else NetworkEnabled := False; 396 406 397 407 if ValueExists('ScreenMode') then … … 399 409 else ScreenMode := 1; 400 410 FullScreen := ScreenMode > 0; 411 if ValueExists('MultiControl') then 412 MultiControl := ReadInteger('MultiControl') 413 else MultiControl := 0; 414 {$IFDEF WINDOWS} 401 415 if ValueExists('ResolutionX') then 402 416 ResolutionX := ReadInteger('ResolutionX'); … … 407 421 if ValueExists('ResolutionFreq') then 408 422 ResolutionFreq := ReadInteger('ResolutionFreq'); 409 if ValueExists('MultiControl') then410 MultiControl := ReadInteger('MultiControl')411 else MultiControl := 0;412 {$IFDEF WINDOWS}413 423 if ScreenMode = 2 then 414 424 ChangeResolution(ResolutionX, ResolutionY, ResolutionBPP, … … 436 446 WriteInteger('StartTab', Integer(ShowTab)); 437 447 WriteString('LastGame', LastGame); 448 WriteBool('NetworkEnabled', NetworkEnabled); 438 449 finally 439 450 Free; … … 492 503 (DpiScreen.Height - Height) div 2, Width, Height) 493 504 end; 505 end; 506 507 procedure TStartDlg.ShowSettings; 508 begin 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); 494 517 end; 495 518 … … 750 773 yMain + 164 { y0Mini-77 } , Phrases.Lookup('STARTCONTROLS', 16)); 751 774 if AutoDiff = 1 then 752 FrameImage(Canvas, Brain Beginner.Picture, xDefault, yDefault, 64,775 FrameImage(Canvas, Brains.GetBeginner.Picture, xDefault, yDefault, 64, 753 776 64, 0, 0, false) 754 777 else … … 908 931 FormerGames.Delete(I); 909 932 if ListIndex[tbNew] = I then 910 ListIndex[tbNew] := 0 933 ListIndex[tbNew] := 0; 911 934 end; 912 935 end; … … 968 991 969 992 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; 995 1019 end; 996 1020 … … 1027 1051 end; 1028 1052 end; 1053 end; 1054 1055 procedure TStartDlg.ListKeyPress(Sender: TObject; var Key: char); 1056 begin 1057 if Key = #13 then StartBtnClick(Sender); 1058 end; 1059 1060 procedure TStartDlg.ListKeyDown(Sender: TObject; var Key: Word; 1061 Shift: TShiftState); 1062 const 1063 DelKey = 46; 1064 begin 1065 if Key = DelKey then DeleteBtnClick(Sender) 1066 else FormKeyDown(Sender, Key, Shift); 1029 1067 end; 1030 1068 … … 1162 1200 AIBrains: TBrains; 1163 1201 begin 1202 FixedLines := 0; 1164 1203 PlayerPopupIndex := PlayerIndex; 1165 1204 EmptyMenu(PopupMenu1.Items); 1166 1205 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); 1168 1216 if Brains.GetKindCount(btAI) >= 2 then begin 1169 1217 OfferBrain(BrainRandom, FixedLines); … … 1177 1225 FreeAndNil(AIBrains); 1178 1226 end else begin 1179 FixedLines := 0;1180 1227 if PlayerPopupIndex > 0 then begin 1181 1228 OfferBrain(nil, FixedLines); … … 1189 1236 end; 1190 1237 if PlayerPopupIndex > 0 then begin 1238 if NetworkEnabled then begin 1239 OfferBrain(BrainNetworkServer, FixedLines); 1240 Inc(FixedLines); 1241 end; 1242 1191 1243 MenuItem := TDpiMenuItem.Create(PopupMenu1); 1192 1244 MenuItem.Caption := '-'; … … 1267 1319 begin 1268 1320 PlayersBrain[0] := BrainSuperVirtual; 1269 Difficulty[0] := 0 1321 Difficulty[0] := 0; 1270 1322 end; 1271 1323 if PlayersBrain[0].Kind in [btNoTerm, btSuperVirtual] then … … 1424 1476 ChangeTab(TStartTab((x - TabOffset) div TabSize)); 1425 1477 end 1426 else if Page = pgMain then 1427 begin 1478 else if Page = pgMain then begin 1428 1479 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); 1448 1485 end; 1449 1486 end … … 1460 1497 else 1461 1498 PopupMenu1.Popup(left + xBrain[I] + 4, top + yBrain[I] + 4); 1462 end 1499 end; 1463 1500 end 1464 1501 else if (AutoDiff > 1) and ((Page = pgStartRandom) or (Page = pgStartMap)) and
Note:
See TracChangeset
for help on using the changeset viewer.