Commit e91bd904ee6aa39acea675f2b0d0b721c24518cc

Authored by Carlos Picanco
1 parent 282baa7e
Exists in master

runner: fix server crash

- occuring when a consequence style set does not have gscG.
experiment_runner/units/game_actors.pas
... ... @@ -732,8 +732,10 @@ procedure TConsequence.PresentPoints(APlayerBox: TPlayerBox; G: TLabel);
732 732 begin
733 733 if gscG in FStyle then
734 734 G.Caption:= IntToStr(StrToInt(G.Caption) + FP.ResultAsInteger)
735   - else
736   - APlayerBox.LabelPointsCount.Caption := IntToStr(StrToInt(APlayerBox.LabelPointsCount.Caption) + FP.ResultAsInteger);
  735 +
  736 + if (gscI in FStyle) or (gscA in FStyle) or (gscB in FStyle) then
  737 + if Assigned(APlayerBox) then
  738 + APlayerBox.LabelPointsCount.Caption := IntToStr(StrToInt(APlayerBox.LabelPointsCount.Caption) + FP.ResultAsInteger);
737 739 end;
738 740  
739 741 function TConsequence.GetShouldPublishMessage: Boolean; // for players only
... ...
experiment_runner/units/game_control.pas
... ... @@ -306,6 +306,7 @@ end;
306 306 function TGameControl.GetPlayerBox(AID: UTF8string): TPlayerBox;
307 307 var i : integer;
308 308 begin
  309 + Result := nil;
309 310 for i := 0 to FormMatrixGame.GBLastChoice.ComponentCount-1 do
310 311 if TPlayerBox(FormMatrixGame.GBLastChoice.Components[i]).ID = AID then
311 312 begin
... ... @@ -536,6 +537,8 @@ begin
536 537 {$IFDEF DEBUG}
537 538 WriteLn(S);
538 539 {$ENDIF}
  540 + // player box is ignored for group points
  541 + // LabelGroupCount is ignored for player points
539 542 LConsequence.PresentPoints(GetPlayerBox(AID), FormMatrixGame.LabelGroupCount);
540 543 end;
541 544 end;
... ... @@ -644,7 +647,6 @@ begin
644 647 gaPlayer:FExperiment := TExperiment.Create(FZMQActor.Owner);
645 648 gaWatcher:FExperiment := TExperiment.Create(FZMQActor.Owner);
646 649 end;
647   - FExperiment.State:=xsWaiting;
648 650 FExperiment.OnEndTurn := @NextTurn;
649 651 FExperiment.OnEndCycle := @NextCycle;
650 652 FExperiment.OnEndCondition:= @NextCondition;
... ...