Changeset 80


Ignore:
Timestamp:
Nov 4, 2014, 9:24:27 PM (10 years ago)
Author:
chronos
Message:
  • Fixed: Autosave should not affect game filename and path selected by user.
  • Fixed: In some cases more units was moved from cell then call have in total. Now move units only up to maximum of cell.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r79 r80  
    141141
    142142procedure TCore.AutoSave;
    143 begin
     143var
     144  OldFileName: string;
     145begin
     146  OldFileName := Game.FileName;
    144147  Game.SaveToFile(GetAppConfigDir(False) + 'AutoSave.xtg');
    145   GetUserDir;
     148  Game.FileName := OldFileName;
    146149end;
    147150
  • trunk/UGame.pas

    r79 r80  
    18021802var
    18031803  I: Integer;
    1804   Remain: Integer;
    18051804  AttackerPower: Integer;
    18061805  DefenderPower: Integer;
     1806  UnitCount: Integer;
    18071807begin
    18081808  I := 0;
     
    18111811  if CountOnce > 0 then begin
    18121812    if CellFrom.Player = Player then begin
     1813      UnitCount := CountOnce;
     1814      if CountOnce > CellFrom.Power then
     1815        UnitCount := CellFrom.Power;
    18131816      if CellTo.Player = Player then begin
    18141817        // Inner move
    1815         CellTo.Power := CellTo.Power + CountOnce;
     1818        CellTo.Power := CellTo.Power + UnitCount;
    18161819      end else begin
    1817         AttackerPower := CountOnce;
     1820        AttackerPower := UnitCount;
    18181821        DefenderPower := CellTo.Power;
    18191822        Attack(AttackerPower, DefenderPower);
     
    18301833          raise Exception.Create(SUnfinishedBattle);
    18311834      end;
    1832       CellFrom.Power := CellFrom.Power - CountOnce;
     1835      CellFrom.Power := CellFrom.Power - UnitCount;
    18331836      CountOnce := 0;
    18341837    end;
Note: See TracChangeset for help on using the changeset viewer.