Changeset 103 for trunk/Engine.pas


Ignore:
Timestamp:
May 21, 2024, 3:55:43 PM (6 months ago)
Author:
chronos
Message:
  • Fixed: Destroying other player didn't end the round.
  • Modified: End the game after three wins of the best player.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Engine.pas

    r98 r103  
    260260    Lock: TCriticalSection;
    261261    CurrentRound: Integer;
    262     MaxRound: Integer;
     262    MaxScore: Integer;
    263263    AudioShot: TSound;
    264264    AudioExplode: TSound;
     
    733733    Explosion(Position, ExplosionRange);
    734734    Exploded := True;
     735    ExplosionPending := True;
     736    ExplosionTime := Now;
    735737    Engine.AudioExplode.Play;
    736738  end;
     
    18831885var
    18841886  I: Integer;
     1887  HighestScore: Integer;
    18851888begin
    18861889  if Players.GetAliveCount <= 1 then begin
     1890    HighestScore := 0;
    18871891    for I := 0 to Players.Count - 1 do
    1888     with Players[I] do
     1892    with Players[I] do begin
    18891893      if not Exploded then Inc(Score);
    1890     if CurrentRound < MaxRound then begin
     1894      HighestScore := Max(Score, HighestScore);
     1895    end;
     1896    if HighestScore < MaxScore then begin
    18911897      Inc(CurrentRound);
    18921898      NewRound;
    18931899      State := gsNewRound;
    1894     end else
     1900    end else begin
    18951901      State := gsMap;
    18961902      if Assigned(FOnGameEnd) then
    18971903        FOnGameEnd(Self);
     1904    end;
    18981905  end;
    18991906end;
     
    21442151  InitDigMasks;
    21452152  Redraw;
    2146   MaxRound := 5;
     2153  MaxScore := 3;
    21472154end;
    21482155
Note: See TracChangeset for help on using the changeset viewer.