Ignore:
Timestamp:
Aug 11, 2019, 4:53:05 PM (5 years ago)
Author:
chronos
Message:
  • Fixed: First game system was rewritten by game system stored in game file.
  • Modified: Each TGame instance has own TGameSystem instance and different game systems are assigned.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.pas

    r298 r304  
    304304    SpinEditTurns.Value := StayAliveForDefinedTurns;
    305305    SpinEditSpecialCells.Value := SpecialCaptureCellCount;
    306     GameSystem := Game.GameSystem;
    307     ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOf(GameSystemName);
     306    ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOf(GameSystem.GetName);
    308307    if (ComboBoxGameSystem.ItemIndex = -1) and (ComboBoxGameSystem.Items.Count > 0) then
    309308      ComboBoxGameSystem.ItemIndex := 0;
     
    335334    StayAliveForDefinedTurns := SpinEditTurns.Value;
    336335    SpecialCaptureCellCount := SpinEditSpecialCells.Value;
    337     if ComboBoxGameSystem.ItemIndex <> -1 then begin
    338       GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]);
    339       GameSystemName := GameSystem.GetName;
    340     end else begin
    341       GameSystem := nil;
    342       GameSystemName := '';
    343     end;
    344336  end;
    345337end;
     
    397389begin
    398390  Image1.Height := Round(Image1.Width * SpinEditMapSizeY.Value / SpinEditMapSizeX.Value);
    399   GamePreview.GameSystem := Core.GameSystems.First;
     391  GamePreview.GameSystem.Assign(FServer.Game.GameSystem);
    400392  SaveGame(GamePreview);
    401393  GamePreview.PostConfig;
     
    567559procedure TFormNew.ComboBoxGameSystemChange(Sender: TObject);
    568560begin
    569   FServer.Game.GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]);
     561  FServer.Game.GameSystem.Assign(TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]));
    570562  UpdateInterface;
    571563  MapPreviewRedraw;
Note: See TracChangeset for help on using the changeset viewer.