Changeset 197 for trunk/UGame.pas


Ignore:
Timestamp:
May 16, 2018, 11:03:48 AM (6 years ago)
Author:
chronos
Message:
  • Added: Evaluate win objection to stay alive for defined number of turns. Multiple players can win.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r194 r197  
    32063206    SetValue(DOMString(Path + '/GrowCells'), Integer(GrowCells));
    32073207    SetValue(DOMString(Path + '/WinObjective'), Integer(WinObjective));
     3208    SetValue(DOMString(Path + '/StayAliveForDefinedTurns'), StayAliveForDefinedTurns);
    32083209    PlayersSetting.SaveConfig(Config, Path + '/Players');
    32093210  end;
     
    32383239    if (Value >= Integer(Low(TWinObjective))) and (Value <= Integer(High(TWinObjective))) then
    32393240      WinObjective := TWinObjective(Value) else WinObjective := Low(TWinObjective);
     3241    StayAliveForDefinedTurns := GetValue(DOMString(Path + '/StayAliveForDefinedTurns'), 20);
    32403242    PlayersSetting.LoadConfig(Config, Path + '/Players');
    32413243  end;
     
    34313433  end else
    34323434  if WinObjective = woStayAliveForDefinedTurns then begin
    3433     // TODO: Not only one can win but multiple human players can survive.
    34343435    if TurnCounter > StayAliveForDefinedTurns then
    34353436      EndGame(nil);
     
    35223523begin
    35233524  Running := False;
    3524   if Assigned(OnWin) and Assigned(Winner) then OnWin(Winner);
     3525  if Assigned(OnWin) then OnWin(Winner);
    35253526end;
    35263527
Note: See TracChangeset for help on using the changeset viewer.