Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 8 8 backup 9 9 xtactics.exe 10 *.lrj
-
- Property svn:ignore
-
trunk/UCore.lfm
r160 r176 3 3 OnDestroy = DataModuleDestroy 4 4 OldCreateOrder = False 5 Height = 542 6 HorizontalOffset = 565 7 VerticalOffset = 329 8 Width = 752 5 Height = 678 6 HorizontalOffset = 706 7 VerticalOffset = 352 8 Width = 940 9 PPI = 120 9 10 object ActionList1: TActionList 10 11 Images = ImageListSmall 11 left = 7212 top = 3212 left = 90 13 top = 40 13 14 object AGameNew: TAction 14 15 Caption = 'New' … … 84 85 end 85 86 object ImageListSmall: TImageList 86 left = 41987 top = 2 2487 left = 524 88 top = 280 88 89 Bitmap = { 89 90 4C690C00000010000000100000000000000000000000E3AA4BD6E5B35EFFE3B1 … … 477 478 POFilesFolder = 'Languages' 478 479 OnTranslate = CoolTranslator1Translate 479 left = 73480 top = 2 32480 left = 91 481 top = 290 481 482 end 482 483 object ImageListLarge: TImageList 483 484 Height = 32 484 485 Width = 32 485 left = 419486 top = 1 52486 left = 524 487 top = 190 487 488 Bitmap = { 488 489 4C690C0000002000000020000000000000000000000000000000E2AA4B36E2A9 … … 2029 2030 RootName = 'CONFIG' 2030 2031 ReadOnly = False 2031 left = 732032 top = 2962032 left = 91 2033 top = 370 2033 2034 end 2034 2035 object OpenDialog1: TOpenDialog 2035 2036 DefaultExt = '.xtmap' 2036 left = 6002037 top = 1 552037 left = 750 2038 top = 194 2038 2039 end 2039 2040 object SaveDialog1: TSaveDialog 2040 2041 DefaultExt = '.xtmap' 2041 left = 6002042 top = 882042 left = 750 2043 top = 110 2043 2044 end 2044 2045 object ApplicationInfo: TApplicationInfo … … 2057 2058 RegistryRoot = rrKeyCurrentUser 2058 2059 License = 'CC0' 2059 left = 732060 top = 962060 left = 91 2061 top = 120 2061 2062 end 2062 2063 object PersistentForm: TPersistentForm 2063 2064 MinVisiblePart = 50 2064 2065 EntireVisible = False 2065 left = 4162066 top = 3202066 left = 520 2067 top = 400 2067 2068 end 2068 2069 object ScaleDPI1: TScaleDPI 2069 2070 AutoDetect = False 2070 left = 722071 top = 3602071 left = 90 2072 top = 450 2072 2073 end 2073 2074 object LastOpenedList1: TLastOpenedList 2074 2075 MaxCount = 10 2075 2076 OnChange = LastOpenedList1Change 2076 left = 732077 top = 1602077 left = 91 2078 top = 200 2078 2079 end 2079 2080 end -
trunk/UCore.pas
r174 r176 78 78 public 79 79 Game: TGame; 80 Server: TServer; 80 81 UseSingleView: Boolean; 81 82 DevelMode: Boolean; … … 247 248 FirstHuman := Game.Players.GetFirstHuman; 248 249 if Assigned(FirstHuman) then CurrentClient := FirstHuman.Client 249 else CurrentClient := TClient( Game.Clients.First);250 else CurrentClient := TClient(Server.Clients.First); 250 251 end; 251 252 … … 384 385 procedure TCore.DataModuleCreate(Sender: TObject); 385 386 begin 387 Server := TServer.Create; 386 388 Game := TGame.Create; 387 389 Game.OnMove := DoOnMove; … … 390 392 Game.OnNewTurn := GameNewTurnExecute; 391 393 Game.OnPlayerChange := DoPlayerChange; 394 Game.Server := Server; 395 Server.Game := Game; 392 396 StoredDimension := TControlDimension.Create; 393 397 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; … … 400 404 Game.SaveConfig(XMLConfig1, 'Game'); 401 405 SaveConfig; 406 FreeAndNil(Server); 402 407 FreeAndNil(Game); 403 408 end; … … 416 421 begin 417 422 Game.LoadFromFile(FileName); 423 Server.InitClients; 418 424 SelectClient; 419 425 LastOpenedList1.AddItem(FileName); … … 430 436 begin 431 437 Game.New; 438 Server.InitClients; 432 439 Game.DevelMode := DevelMode; 433 440 SelectClient; -
trunk/UGame.pas
r171 r176 30 30 TMapArea = class; 31 31 TClient = class; 32 TServer = class; 32 33 33 34 TTerrainType = (ttVoid, ttNormal, ttCity); … … 430 431 Game: TGame; 431 432 procedure New(Name: string); 433 constructor Create(FreeObjects: Boolean = True); 432 434 end; 433 435 … … 460 462 procedure SetRunning(AValue: Boolean); 461 463 procedure BuildTerrain; 462 procedure InitClients;463 464 procedure SelectPlayerStartCell(Player: TPlayer); 464 465 procedure CalculatePlayersDistance; … … 466 467 procedure InitDefaultPlayersSetting; 467 468 public 469 Server: TServer; 468 470 DevelMode: Boolean; 469 471 Players: TPlayers; 470 472 PlayersSetting: TPlayers; 471 Clients: TClients;472 473 Map: TMap; 473 474 MapImageFileName: string; … … 511 512 end; 512 513 514 { TServer } 515 516 TServer = class 517 private 518 FGame: TGame; 519 procedure SetGame(AValue: TGame); 520 public 521 Clients: TClients; 522 procedure InitClients; 523 procedure Clear; 524 constructor Create; 525 destructor Destroy; override; 526 property Game: TGame read FGame write SetGame; 527 end; 528 513 529 var 514 530 PlayerModeText: array[TPlayerMode] of string; … … 617 633 NewClient.Name := Name; 618 634 Add(NewClient); 635 end; 636 637 constructor TClients.Create(FreeObjects: Boolean = True); 638 begin 639 Game := nil; 640 inherited; 619 641 end; 620 642 … … 2906 2928 end else begin 2907 2929 FRunning := AValue; 2908 for I := 0 to Clients.Count - 1 do2909 with TClient( Clients[I]) do begin2930 for I := 0 to Server.Clients.Count - 1 do 2931 with TClient(Server.Clients[I]) do begin 2910 2932 View.Clear; 2911 2933 end; … … 3098 3120 end; 3099 3121 3100 procedure TGame.InitClients; 3122 procedure TServer.SetGame(AValue: TGame); 3123 var 3124 I: Integer; 3125 begin 3126 if FGame = AValue then Exit; 3127 FGame := AValue; 3128 for I := 0 to Clients.Count - 1 do 3129 Clients[I].Game := FGame; 3130 Clients.Game := Game; 3131 end; 3132 3133 procedure TServer.InitClients; 3101 3134 var 3102 3135 Client: TClient; … … 3106 3139 Clients.New('Spectator'); 3107 3140 3108 for Player in Players do3141 for Player in Game.Players do 3109 3142 with Player do 3110 3143 if Mode = pmHuman then begin … … 3121 3154 else View.CenterMap; 3122 3155 end; 3156 end; 3157 3158 procedure TServer.Clear; 3159 begin 3160 Clients.Clear; 3161 Game.Clear; 3162 end; 3163 3164 constructor TServer.Create; 3165 begin 3166 FGame := nil; 3167 Clients := TClients.Create; 3168 end; 3169 3170 destructor TServer.Destroy; 3171 begin 3172 FreeAndNil(Clients); 3173 inherited Destroy; 3123 3174 end; 3124 3175 … … 3300 3351 else CurrentPlayer := nil; 3301 3352 3302 InitClients;3303 3353 Map.Cells.FixRefId; 3304 3354 … … 3484 3534 PlayersSetting := TPlayers.Create; 3485 3535 PlayersSetting.Game := Self; 3486 Clients := TClients.Create;3487 Clients.Game := Self;3488 3536 3489 3537 MapImageFileName := 'Images/Maps/WorldMap.png'; … … 3501 3549 destructor TGame.Destroy; 3502 3550 begin 3503 FreeAndNil(Clients);3504 3551 FreeAndNil(PlayersSetting); 3505 3552 FreeAndNil(Players); … … 3510 3557 procedure TGame.Clear; 3511 3558 begin 3512 Clients.Clear;3513 3559 Players.Clear; 3514 3560 Map.Clear; … … 3558 3604 else CurrentPlayer := nil; 3559 3605 3560 InitClients;3561 3606 ComputePlayerStats; 3562 3607 end;
Note:
See TracChangeset
for help on using the changeset viewer.