Commit 0b963003753f2f8e53538faccaf09a3fe3b276e9
1 parent
1722c6f8
Exists in
master
comment prompts for debugging, fix UTF8String strange chars, add global var
Showing
5 changed files
with
216 additions
and
198 deletions
Show diff stats
units/game_actors.pas
| ... | ... | @@ -56,7 +56,7 @@ type |
| 56 | 56 | ID, |
| 57 | 57 | Nicname, |
| 58 | 58 | Login, |
| 59 | - Password : UTF8string; | |
| 59 | + Password : string; | |
| 60 | 60 | Status : TGamePlayerStatus; |
| 61 | 61 | Data : TStringList; |
| 62 | 62 | Choice : TPlayerChoice; |
| ... | ... | @@ -78,10 +78,10 @@ type |
| 78 | 78 | |
| 79 | 79 | TConsequence = class(TComponent) |
| 80 | 80 | private |
| 81 | - FAppendicePlural: UTF8String; | |
| 82 | - FAppendiceSingular: UTF8String; | |
| 83 | - FLastPresentedMessage: UTF8string; | |
| 84 | - FNicname: UTF8String; | |
| 81 | + FAppendicePlural: string; | |
| 82 | + FAppendiceSingular: string; | |
| 83 | + FLastPresentedMessage: string; | |
| 84 | + FNicname: string; | |
| 85 | 85 | FStyle : TConsequenceStyle; |
| 86 | 86 | FP : TGamePoint; |
| 87 | 87 | FMessage : TPopupNotifier; |
| ... | ... | @@ -91,18 +91,18 @@ type |
| 91 | 91 | procedure StopTimer(Sender:TObject;var ACloseAction:TCloseAction); |
| 92 | 92 | procedure TimerTimer(Sender:TOBject);virtual; |
| 93 | 93 | public |
| 94 | - constructor Create(AOwner:TComponent; AP:TGamePoint; AStyle:TConsequenceStyle; AAppendiceSingular,AAppendicePlural:UTF8String);overload; | |
| 95 | - constructor Create(AOwner:TComponent; AP:integer; AStyle: TConsequenceStyle; AMessage:array of UTF8string);overload; | |
| 96 | - constructor Create(AOwner:TComponent; AConsequenceString: UTF8String);virtual;overload; | |
| 94 | + constructor Create(AOwner:TComponent; AP:TGamePoint; AStyle:TConsequenceStyle; AAppendiceSingular,AAppendicePlural:string);overload; | |
| 95 | + constructor Create(AOwner:TComponent; AP:integer; AStyle: TConsequenceStyle; AMessage:array of string);overload; | |
| 96 | + constructor Create(AOwner:TComponent; AConsequenceString: string);virtual;overload; | |
| 97 | 97 | destructor Destroy;override; |
| 98 | - function AsString(AID :UTF8String): UTF8String; | |
| 99 | - function PointMessage(ForGroup: Boolean):UTF8String; | |
| 98 | + function AsString(AID :string): string; | |
| 99 | + function PointMessage(ForGroup: Boolean):string; | |
| 100 | 100 | procedure Present(ForGroup: Boolean); |
| 101 | 101 | property ShouldPublishMessage : Boolean read GetShouldPublishMessage; |
| 102 | - property LastPresentedMessage : UTF8string read FLastPresentedMessage; | |
| 103 | - property PlayerNicname : UTF8String read FNicname write FNicname; | |
| 104 | - property AppendiceSingular : UTF8String read FAppendiceSingular; | |
| 105 | - property AppendicePlural : UTF8String read FAppendicePlural; | |
| 102 | + property LastPresentedMessage : string read FLastPresentedMessage; | |
| 103 | + property PlayerNicname : string read FNicname write FNicname; | |
| 104 | + property AppendiceSingular : string read FAppendiceSingular; | |
| 105 | + property AppendicePlural : string read FAppendicePlural; | |
| 106 | 106 | property ConsequenseByPlayerID : TStringList read FConsequenceByPlayerID; |
| 107 | 107 | end; |
| 108 | 108 | |
| ... | ... | @@ -119,7 +119,7 @@ type |
| 119 | 119 | procedure CriteriaEvent; |
| 120 | 120 | public |
| 121 | 121 | constructor Create(AOwner:TComponent;AConsequence:TConsequence;ACriteria:TCriteria;IsMeta:Boolean);overload; |
| 122 | - function CriteriaString : UTF8String; | |
| 122 | + function CriteriaString : string; | |
| 123 | 123 | function ResponseMeetsCriteriaI(R : TGameRow; C : TGameColor):Boolean; // Does response meets operant criteria? |
| 124 | 124 | function ResponseMeetsCriteriaG(Players : TPlayers):Boolean; |
| 125 | 125 | property OnCriteria : TNotifyEvent read FOnCriteria write FOncriteria; |
| ... | ... | @@ -137,19 +137,19 @@ type |
| 137 | 137 | |
| 138 | 138 | TPrompt = class(TConsequence) |
| 139 | 139 | private |
| 140 | - FResponses : array of UTF8String; | |
| 141 | - FResult : UTF8String; | |
| 140 | + FResponses : array of string; | |
| 141 | + FResult : string; | |
| 142 | 142 | FPromptTargets : TContingencies; // need to test this |
| 143 | 143 | FPromptStyle : TPromptStyle; |
| 144 | - FPromptMessage : UTF8String; | |
| 144 | + FPromptMessage : string; | |
| 145 | 145 | procedure ClearResponses; |
| 146 | 146 | public |
| 147 | - constructor Create(AOwner:TComponent; APStyle:TPromptStyle; APTarget : TContingencies; AMessage:UTF8string);reintroduce; | |
| 147 | + constructor Create(AOwner:TComponent; APStyle:TPromptStyle; APTarget : TContingencies; AMessage:string);reintroduce; | |
| 148 | 148 | function ResponsesCount : integer; |
| 149 | - procedure AppendResponse(AID,R:UTF8String); | |
| 149 | + procedure AppendResponse(AID,R:string); | |
| 150 | 150 | function AsString: TStringList; overload; |
| 151 | - property Question: UTF8String read FPromptMessage; | |
| 152 | - property PromptResult:UTF8String read FResult; | |
| 151 | + property Question: string read FPromptMessage; | |
| 152 | + property PromptResult:string read FResult; | |
| 153 | 153 | |
| 154 | 154 | end; |
| 155 | 155 | |
| ... | ... | @@ -229,7 +229,7 @@ begin |
| 229 | 229 | FFired := False; |
| 230 | 230 | end; |
| 231 | 231 | |
| 232 | -function TContingency.CriteriaString: UTF8String; | |
| 232 | +function TContingency.CriteriaString: string; | |
| 233 | 233 | var R : TGameRow; |
| 234 | 234 | C : TGameColor; |
| 235 | 235 | begin |
| ... | ... | @@ -398,7 +398,7 @@ begin |
| 398 | 398 | end; |
| 399 | 399 | |
| 400 | 400 | constructor TPrompt.Create(AOwner: TComponent; APStyle: TPromptStyle; |
| 401 | - APTarget: TContingencies; AMessage: UTF8string); | |
| 401 | + APTarget: TContingencies; AMessage: string); | |
| 402 | 402 | begin |
| 403 | 403 | inherited Create(AOwner); |
| 404 | 404 | FPromptStyle := APStyle; |
| ... | ... | @@ -411,7 +411,7 @@ begin |
| 411 | 411 | Result := Length(FResponses); |
| 412 | 412 | end; |
| 413 | 413 | |
| 414 | -procedure TPrompt.AppendResponse(AID, R: UTF8String); | |
| 414 | +procedure TPrompt.AppendResponse(AID, R: string); | |
| 415 | 415 | begin |
| 416 | 416 | SetLength(FResponses,Length(FResponses)+1); |
| 417 | 417 | FResponses[High(FResponses)] := AID+'|'+R+'|'; |
| ... | ... | @@ -420,7 +420,7 @@ end; |
| 420 | 420 | function TPrompt.AsString: TStringList; |
| 421 | 421 | var |
| 422 | 422 | j,i : integer; |
| 423 | - LID,LConsequence : UTF8string; | |
| 423 | + LID,LConsequence : string; | |
| 424 | 424 | LCsqStyle : TConsequenceStyle; |
| 425 | 425 | Pts : integer; |
| 426 | 426 | |
| ... | ... | @@ -437,7 +437,7 @@ var |
| 437 | 437 | |
| 438 | 438 | procedure ApplyPointsConditions(IsMeta:Boolean); |
| 439 | 439 | var |
| 440 | - S : UTF8string; | |
| 440 | + S : string; | |
| 441 | 441 | begin |
| 442 | 442 | Pts := StrToInt(ExtractDelimited(1,LConsequence, ['|'])); |
| 443 | 443 | if gsRevertPoints in FPromptStyle then |
| ... | ... | @@ -493,7 +493,7 @@ end; |
| 493 | 493 | { TConsequence } |
| 494 | 494 | |
| 495 | 495 | constructor TConsequence.Create(AOwner: TComponent; AP: TGamePoint; |
| 496 | - AStyle: TConsequenceStyle; AAppendiceSingular, AAppendicePlural: UTF8String); | |
| 496 | + AStyle: TConsequenceStyle; AAppendiceSingular, AAppendicePlural: string); | |
| 497 | 497 | begin |
| 498 | 498 | inherited Create(AOwner); |
| 499 | 499 | FStyle:=AStyle; |
| ... | ... | @@ -506,7 +506,7 @@ begin |
| 506 | 506 | end; |
| 507 | 507 | |
| 508 | 508 | constructor TConsequence.Create(AOwner: TComponent; AP: integer; |
| 509 | - AStyle:TConsequenceStyle; AMessage: array of UTF8string); | |
| 509 | + AStyle:TConsequenceStyle; AMessage: array of string); | |
| 510 | 510 | begin |
| 511 | 511 | inherited Create(AOwner); |
| 512 | 512 | FStyle:=AStyle; |
| ... | ... | @@ -519,7 +519,7 @@ begin |
| 519 | 519 | end; |
| 520 | 520 | |
| 521 | 521 | constructor TConsequence.Create(AOwner: TComponent; |
| 522 | - AConsequenceString: UTF8String); | |
| 522 | + AConsequenceString: string); | |
| 523 | 523 | begin |
| 524 | 524 | inherited Create(AOwner); |
| 525 | 525 | FP := TGamePoint.Create(AOwner,ExtractDelimited(1,AConsequenceString,['|'])); |
| ... | ... | @@ -537,7 +537,7 @@ begin |
| 537 | 537 | inherited Destroy; |
| 538 | 538 | end; |
| 539 | 539 | |
| 540 | -function TConsequence.AsString(AID: UTF8String): UTF8String; | |
| 540 | +function TConsequence.AsString(AID: string): string; | |
| 541 | 541 | begin |
| 542 | 542 | Result := IntToStr(FP.ValueWithVariation) + '|'; |
| 543 | 543 | Result += GetConsequenceStylesString(FStyle)+'|'; |
| ... | ... | @@ -547,7 +547,7 @@ begin |
| 547 | 547 | FConsequenceByPlayerID.Values[AID]:=Result; |
| 548 | 548 | end; |
| 549 | 549 | |
| 550 | -function TConsequence.PointMessage(ForGroup: Boolean): UTF8String; | |
| 550 | +function TConsequence.PointMessage(ForGroup: Boolean): string; | |
| 551 | 551 | begin |
| 552 | 552 | Result := FP.PointMessage(FNicname,FAppendicePlural, FAppendiceSingular,ForGroup); |
| 553 | 553 | ... | ... |
units/game_actors_point.pas
| ... | ... | @@ -23,7 +23,7 @@ type |
| 23 | 23 | //Cycles : integer; // specify when present points regarding condition cycles |
| 24 | 24 | constructor Create(AOwner:TComponent;AValue : integer);overload; |
| 25 | 25 | constructor Create(AOwner:TComponent;AValue : array of integer); overload; |
| 26 | - constructor Create(AOwner:TComponent;AResult : UTF8String); overload; | |
| 26 | + constructor Create(AOwner:TComponent;AResult : string); overload; | |
| 27 | 27 | function PointMessage(APrepend, AAppendicePlural, AAppendiceSingular: string; IsGroupPoint: Boolean) : string; |
| 28 | 28 | property ValueWithVariation : integer read GetValue write FValue; |
| 29 | 29 | property Variation : integer read FVariation write FVariation; |
| ... | ... | @@ -81,7 +81,7 @@ begin |
| 81 | 81 | FVariation := AValue[1]; |
| 82 | 82 | end; |
| 83 | 83 | |
| 84 | -constructor TGamePoint.Create(AOwner: TComponent; AResult: utf8string); | |
| 84 | +constructor TGamePoint.Create(AOwner: TComponent; AResult: string); | |
| 85 | 85 | begin |
| 86 | 86 | FValue := 0;//does not matter here, this creation method is called by a player, admin sent a result |
| 87 | 87 | FVariation := 0; |
| ... | ... | @@ -99,7 +99,7 @@ begin |
| 99 | 99 | |
| 100 | 100 | if (AAppendiceSingular = '') or (AAppendicePlural = '') then |
| 101 | 101 | begin |
| 102 | - case FValue of | |
| 102 | + case FResult of | |
| 103 | 103 | -MaxInt..-2: Result += ' produziram a perda de '+Self.AsString+ ' pontos para o grupo'; |
| 104 | 104 | -1 : Result += ' produziram a perda de 1 ponto para o grupo'; |
| 105 | 105 | 0 : Result += ' pontos do grupo não foram produzidos nem perdidos'; |
| ... | ... | @@ -109,7 +109,7 @@ begin |
| 109 | 109 | end |
| 110 | 110 | else |
| 111 | 111 | begin |
| 112 | - case FValue of | |
| 112 | + case FResult of | |
| 113 | 113 | -MaxInt..-2: Result += ' produziram a perda de '+Self.AsString+ ' ' + AAppendicePlural; |
| 114 | 114 | -1 : Result += ' produziram a perda de 1'+ ' ' + AAppendiceSingular; |
| 115 | 115 | 0 : Result += ' não produziram ' + AAppendicePlural; |
| ... | ... | @@ -127,7 +127,7 @@ begin |
| 127 | 127 | |
| 128 | 128 | if (AAppendiceSingular = '') or (AAppendicePlural = '') then |
| 129 | 129 | begin |
| 130 | - case FValue of | |
| 130 | + case FResult of | |
| 131 | 131 | -MaxInt..-2: Result += ' perdeu '+Self.AsString+ ' pontos'; |
| 132 | 132 | -1 : Result += ' perdeu 1 ponto'; |
| 133 | 133 | 0 : Result += ' não perdeu nem ganhou pontos'; |
| ... | ... | @@ -137,7 +137,7 @@ begin |
| 137 | 137 | end |
| 138 | 138 | else |
| 139 | 139 | begin |
| 140 | - case FValue of | |
| 140 | + case FResult of | |
| 141 | 141 | -MaxInt..-2: Result += ' perdeu '+Self.AsString+ ' ' + AAppendicePlural; |
| 142 | 142 | -1 : Result += ' ponto 1 ' + AAppendiceSingular; |
| 143 | 143 | 0 : Result += ' não perdeu nem ganhou ' + AAppendicePlural; | ... | ... |
units/game_control.pas
| ... | ... | @@ -21,18 +21,18 @@ type |
| 21 | 21 | |
| 22 | 22 | TGameControl = class(TComponent) |
| 23 | 23 | private |
| 24 | - FID: string; | |
| 24 | + FID: UTF8string; | |
| 25 | 25 | FMustDrawDots: Boolean; |
| 26 | 26 | FMustDrawDotsClear: Boolean; |
| 27 | 27 | FRowBase : integer; |
| 28 | 28 | FActor : TGameActor; |
| 29 | 29 | FZMQActor : TZMQActor; |
| 30 | 30 | FExperiment : TExperiment; |
| 31 | - function GetPlayerBox(AID:string) : TPlayerBox; | |
| 32 | - function GetActorNicname(AID:string) : string; | |
| 31 | + function GetPlayerBox(AID:UTF8string) : TPlayerBox; | |
| 32 | + function GetActorNicname(AID:UTF8string) : UTF8string; | |
| 33 | 33 | function GetSelectedColorF(AStringGrid : TStringGrid) : UTF8string; |
| 34 | 34 | function GetSelectedRowF(AStringGrid : TStringGrid) : UTF8string; |
| 35 | - function MessageHas(const A_CONST : string; AMessage : TStringList; I:ShortInt=0): Boolean; | |
| 35 | + function MessageHas(const A_CONST : UTF8string; AMessage : TStringList; I:ShortInt=0): Boolean; | |
| 36 | 36 | procedure CreatePlayerBox(P:TPlayer; Me:Boolean); |
| 37 | 37 | procedure SetMatrixType(AStringGrid : TStringGrid; AMatrixType:TGameMatrixType; |
| 38 | 38 | var ARowBase:integer; var ADrawDots, ADrawClear : Boolean); |
| ... | ... | @@ -43,11 +43,11 @@ type |
| 43 | 43 | procedure SetMustDrawDotsClear(AValue: Boolean); |
| 44 | 44 | procedure SetRowBase(AValue: integer); |
| 45 | 45 | private |
| 46 | - function AskQuestion(AQuestion:UTF8string):UTF8String; | |
| 47 | - procedure ShowPopUp(AText:UTF8String); | |
| 46 | + function AskQuestion(AQuestion:string):UTF8string; | |
| 47 | + procedure ShowPopUp(AText:string); | |
| 48 | 48 | procedure DisableConfirmationButton; |
| 49 | 49 | procedure CleanMatrix(AEnabled : Boolean); |
| 50 | - procedure EnablePlayerMatrix(AID:UTF8String; ATurn:integer; AEnabled:Boolean); | |
| 50 | + procedure EnablePlayerMatrix(AID:UTF8string; ATurn:integer; AEnabled:Boolean); | |
| 51 | 51 | private |
| 52 | 52 | function ShouldStartCycle : Boolean; |
| 53 | 53 | function ShouldAskQuestion : Boolean; |
| ... | ... | @@ -71,7 +71,7 @@ type |
| 71 | 71 | procedure Pause; |
| 72 | 72 | procedure Resume; |
| 73 | 73 | property Experiment : TExperiment read FExperiment write FExperiment; |
| 74 | - property ID : string read FID; | |
| 74 | + property ID : UTF8string read FID; | |
| 75 | 75 | property RowBase : integer read FRowBase write SetRowBase; |
| 76 | 76 | property MustDrawDots: Boolean read FMustDrawDots write SetMustDrawDots; |
| 77 | 77 | property MustDrawDotsClear:Boolean read FMustDrawDotsClear write SetMustDrawDotsClear; |
| ... | ... | @@ -103,7 +103,7 @@ const |
| 103 | 103 | |
| 104 | 104 | implementation |
| 105 | 105 | |
| 106 | -uses ButtonPanel,Controls,ExtCtrls, | |
| 106 | +uses ButtonPanel,Controls,ExtCtrls,StdCtrls, | |
| 107 | 107 | LazUTF8, Forms, strutils, zhelpers, |
| 108 | 108 | form_matrixgame, form_chooseactor, game_resources, string_methods ; |
| 109 | 109 | |
| ... | ... | @@ -232,7 +232,7 @@ begin |
| 232 | 232 | |
| 233 | 233 | end; |
| 234 | 234 | |
| 235 | -function TGameControl.GetPlayerBox(AID: string): TPlayerBox; | |
| 235 | +function TGameControl.GetPlayerBox(AID: UTF8string): TPlayerBox; | |
| 236 | 236 | var i : integer; |
| 237 | 237 | begin |
| 238 | 238 | for i := 0 to FormMatrixGame.GBLastChoice.ComponentCount-1 do |
| ... | ... | @@ -243,7 +243,7 @@ begin |
| 243 | 243 | end; |
| 244 | 244 | end; |
| 245 | 245 | |
| 246 | -function TGameControl.GetActorNicname(AID: string): string; | |
| 246 | +function TGameControl.GetActorNicname(AID: UTF8string): UTF8string; | |
| 247 | 247 | begin |
| 248 | 248 | case FActor of |
| 249 | 249 | gaPlayer: begin |
| ... | ... | @@ -256,7 +256,7 @@ begin |
| 256 | 256 | end; |
| 257 | 257 | end; |
| 258 | 258 | |
| 259 | -function TGameControl.MessageHas(const A_CONST: string; AMessage: TStringList; | |
| 259 | +function TGameControl.MessageHas(const A_CONST: UTF8string; AMessage: TStringList; | |
| 260 | 260 | I: ShortInt): Boolean; |
| 261 | 261 | begin |
| 262 | 262 | Result:= False; |
| ... | ... | @@ -364,11 +364,11 @@ begin |
| 364 | 364 | FRowBase:=AValue; |
| 365 | 365 | end; |
| 366 | 366 | |
| 367 | -function TGameControl.AskQuestion(AQuestion: UTF8string): UTF8String; | |
| 367 | +function TGameControl.AskQuestion(AQuestion: string): UTF8string; | |
| 368 | 368 | var |
| 369 | 369 | Prompt: TForm; |
| 370 | 370 | ButtonPanel: TButtonPanel; |
| 371 | - QuestionPanel: TPanel; | |
| 371 | + LabelQuestion: TLabel; | |
| 372 | 372 | mr: TModalResult; |
| 373 | 373 | begin |
| 374 | 374 | Prompt:=TForm.CreateNew(nil); |
| ... | ... | @@ -386,10 +386,14 @@ begin |
| 386 | 386 | ShowGlyphs:=[]; |
| 387 | 387 | Parent:=Prompt; |
| 388 | 388 | end; |
| 389 | - QuestionPanel:=TPanel.Create(Prompt); | |
| 390 | - with QuestionPanel do begin | |
| 389 | + LabelQuestion:=TLabel.Create(Prompt); | |
| 390 | + with LabelQuestion do begin | |
| 391 | 391 | Align:=alClient; |
| 392 | 392 | Caption:= AQuestion; |
| 393 | + Alignment := taCenter; | |
| 394 | + Anchors := [akLeft,akRight]; | |
| 395 | + Layout := tlCenter; | |
| 396 | + WordWrap := True; | |
| 393 | 397 | Parent:=Prompt; |
| 394 | 398 | end; |
| 395 | 399 | |
| ... | ... | @@ -403,7 +407,7 @@ begin |
| 403 | 407 | end; |
| 404 | 408 | end; |
| 405 | 409 | |
| 406 | -procedure TGameControl.ShowPopUp(AText: UTF8String); | |
| 410 | +procedure TGameControl.ShowPopUp(AText: string); | |
| 407 | 411 | var PopUpPos : TPoint; |
| 408 | 412 | begin |
| 409 | 413 | PopUpPos.X := FormMatrixGame.GBIndividualAB.Left; |
| ... | ... | @@ -432,7 +436,7 @@ begin |
| 432 | 436 | FormMatrixGame.btnConfirmRow.Visible := False; |
| 433 | 437 | end; |
| 434 | 438 | |
| 435 | -procedure TGameControl.EnablePlayerMatrix(AID:UTF8String; ATurn:integer; AEnabled:Boolean); | |
| 439 | +procedure TGameControl.EnablePlayerMatrix(AID:UTF8string; ATurn:integer; AEnabled:Boolean); | |
| 436 | 440 | begin |
| 437 | 441 | if FExperiment.PlayerFromID[AID].Turn = ATurn then |
| 438 | 442 | CleanMatrix(AEnabled); |
| ... | ... | @@ -463,12 +467,11 @@ begin |
| 463 | 467 | FExperiment.State:=xsWaiting; |
| 464 | 468 | FExperiment.OnEndTurn := @NextTurn; |
| 465 | 469 | FExperiment.OnEndCycle := @NextCycle; |
| 470 | + FExperiment.OnEndCondition:= @NextCondition; | |
| 466 | 471 | FExperiment.OnEndGeneration:=@NextLineage; |
| 472 | + FExperiment.OnEndExperiment:= @EndExperiment; | |
| 467 | 473 | FExperiment.OnInterlocking:=@Interlocking; |
| 468 | 474 | FExperiment.OnConsequence:=@Consequence; |
| 469 | - FExperiment.OnEndCondition:= @NextCondition; | |
| 470 | - FExperiment.OnEndExperiment:= @EndExperiment; | |
| 471 | - FExperiment.OnInterlocking := @Interlocking; | |
| 472 | 475 | |
| 473 | 476 | NextTurn(Self); |
| 474 | 477 | NextCycle(Self); |
| ... | ... | @@ -492,9 +495,9 @@ end; |
| 492 | 495 | |
| 493 | 496 | procedure TGameControl.SendRequest(ARequest: UTF8string); |
| 494 | 497 | var |
| 495 | - M : array of UTF8String; | |
| 498 | + M : array of UTF8string; | |
| 496 | 499 | |
| 497 | - procedure SetM(A : array of UTF8String); | |
| 500 | + procedure SetM(A : array of UTF8string); | |
| 498 | 501 | var i : integer; |
| 499 | 502 | begin |
| 500 | 503 | SetLength(M,Length(A)); |
| ... | ... | @@ -534,9 +537,9 @@ end; |
| 534 | 537 | // called from outside |
| 535 | 538 | procedure TGameControl.SendMessage(AMessage: UTF8string); |
| 536 | 539 | var |
| 537 | - M : array of UTF8String; | |
| 540 | + M : array of UTF8string; | |
| 538 | 541 | |
| 539 | - procedure SetM(A : array of UTF8String); | |
| 542 | + procedure SetM(A : array of UTF8string); | |
| 540 | 543 | var i : integer; |
| 541 | 544 | begin |
| 542 | 545 | SetLength(M,Length(A)); |
| ... | ... | @@ -582,7 +585,7 @@ end; |
| 582 | 585 | |
| 583 | 586 | // Here FActor is garanted to be a TZMQPlayer |
| 584 | 587 | procedure TGameControl.ReceiveMessage(AMessage: TStringList); |
| 585 | - function MHas(const C : string) : Boolean; | |
| 588 | + function MHas(const C : UTF8string) : Boolean; | |
| 586 | 589 | begin |
| 587 | 590 | Result := MessageHas(C,AMessage); |
| 588 | 591 | end; |
| ... | ... | @@ -731,43 +734,43 @@ procedure TGameControl.ReceiveMessage(AMessage: TStringList); |
| 731 | 734 | // end; |
| 732 | 735 | |
| 733 | 736 | |
| 734 | - procedure QuestionMessages; | |
| 735 | - var | |
| 736 | - LConsequence : TConsequence; | |
| 737 | - i : integer; | |
| 738 | - MID : UTF8String; | |
| 739 | - begin | |
| 740 | - case FActor of | |
| 741 | - // AMessage[i] := | |
| 742 | - // S + '+' + | |
| 743 | - // IntToStr(Pts) +'|'+ | |
| 744 | - // GetConsequenceStylesString(LCsqStyle) +'|'+ | |
| 745 | - // ExtractDelimited(3,LConsequence, ['|']) +'|'+ | |
| 746 | - // ExtractDelimited(4,LConsequence, ['|']) +'|'+ | |
| 747 | - // ExtractDelimited(5,LConsequence, ['|']); | |
| 748 | - gaPlayer:begin | |
| 749 | - if AMessage.Count > 1 then | |
| 750 | - begin | |
| 751 | - for i := 1 to AMessage.Count -1 do | |
| 752 | - begin | |
| 753 | - MID := ExtractDelimited(1,AMessage[i],['+']); | |
| 754 | - if (MID = 'M') or (MID = Self.ID) then | |
| 755 | - begin | |
| 756 | - LConsequence := TConsequence.Create(FormMatrixGame,ExtractDelimited(2,AMessage[i],['+'])); | |
| 757 | - //LConsequence.PlayerNicname := P.Nicname; | |
| 758 | - ShowPopUp(LConsequence.PointMessage(MID = 'M')); | |
| 759 | - while FormMatrixGame.PopupNotifier.Visible do | |
| 760 | - Application.ProcessMessages; | |
| 761 | - | |
| 762 | - {$IFDEF DEBUG} | |
| 763 | - WriteLn('A consequence should have shown.'); | |
| 764 | - {$ENDIF} | |
| 765 | - end; | |
| 766 | - end; | |
| 767 | - end; | |
| 768 | - end; | |
| 769 | - end; | |
| 770 | - end; | |
| 737 | + //procedure QuestionMessages; | |
| 738 | + //var | |
| 739 | + // LConsequence : TConsequence; | |
| 740 | + // i : integer; | |
| 741 | + // MID : string; | |
| 742 | + //begin | |
| 743 | + // case FActor of | |
| 744 | + // // AMessage[i] := | |
| 745 | + // // S + '+' + | |
| 746 | + // // IntToStr(Pts) +'|'+ | |
| 747 | + // // GetConsequenceStylesString(LCsqStyle) +'|'+ | |
| 748 | + // // ExtractDelimited(3,LConsequence, ['|']) +'|'+ | |
| 749 | + // // ExtractDelimited(4,LConsequence, ['|']) +'|'+ | |
| 750 | + // // ExtractDelimited(5,LConsequence, ['|']); | |
| 751 | + // gaPlayer:begin | |
| 752 | + // if AMessage.Count > 1 then | |
| 753 | + // begin | |
| 754 | + // for i := 1 to AMessage.Count -1 do | |
| 755 | + // begin | |
| 756 | + // MID := ExtractDelimited(1,AMessage[i],['+']); | |
| 757 | + // if (MID = 'M') or (MID = Self.ID) then | |
| 758 | + // begin | |
| 759 | + // LConsequence := TConsequence.Create(FormMatrixGame,ExtractDelimited(2,AMessage[i],['+'])); | |
| 760 | + // //LConsequence.PlayerNicname := P.Nicname; | |
| 761 | + // ShowPopUp(LConsequence.PointMessage(MID = 'M')); | |
| 762 | + // while FormMatrixGame.PopupNotifier.Visible do | |
| 763 | + // Application.ProcessMessages; | |
| 764 | + // | |
| 765 | + // {$IFDEF DEBUG} | |
| 766 | + // WriteLn('A consequence should have shown.'); | |
| 767 | + // {$ENDIF} | |
| 768 | + // end; | |
| 769 | + // end; | |
| 770 | + // end; | |
| 771 | + // end; | |
| 772 | + // end; | |
| 773 | + //end; | |
| 771 | 774 | |
| 772 | 775 | |
| 773 | 776 | begin |
| ... | ... | @@ -779,12 +782,12 @@ begin |
| 779 | 782 | if MHas(K_START) then NotifyPlayers; |
| 780 | 783 | if MHas(K_CYCLES) then OnEndCycle; |
| 781 | 784 | if MHas(K_QUESTION) then ShowQuestion; |
| 782 | - if MHas(K_QMESSAGE) then QuestionMessages; | |
| 785 | + //if MHas(K_QMESSAGE) then QuestionMessages; | |
| 783 | 786 | end; |
| 784 | 787 | |
| 785 | 788 | // Here FActor is garanted to be a TZMQAdmin |
| 786 | 789 | procedure TGameControl.ReceiveRequest(var ARequest: TStringList); |
| 787 | - function MHas(const C : string) : Boolean; | |
| 790 | + function MHas(const C : UTF8string) : Boolean; | |
| 788 | 791 | begin |
| 789 | 792 | Result := MessageHas(C,ARequest, 2); |
| 790 | 793 | end; |
| ... | ... | @@ -793,7 +796,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); |
| 793 | 796 | var i : integer; |
| 794 | 797 | P : TPlayer; |
| 795 | 798 | TS, |
| 796 | - PS : UTF8string; | |
| 799 | + PS : string; | |
| 797 | 800 | begin |
| 798 | 801 | if not FExperiment.PlayerIsPlaying[ARequest[0]] then |
| 799 | 802 | begin |
| ... | ... | @@ -822,8 +825,8 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); |
| 822 | 825 | P.Status:=gpsPlaying; |
| 823 | 826 | P.Choice.Color:=gcNone; |
| 824 | 827 | P.Choice.Row:=grNone; |
| 825 | - // turns by entrance order or by random order | |
| 826 | - P.Turn := FExperiment.NextTurn; | |
| 828 | + // first turn always by entrance order | |
| 829 | + P.Turn := i; | |
| 827 | 830 | FExperiment.Player[i] := P; |
| 828 | 831 | end; |
| 829 | 832 | |
| ... | ... | @@ -874,6 +877,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); |
| 874 | 877 | |
| 875 | 878 | procedure ValidateChoice; |
| 876 | 879 | var P : TPlayer; |
| 880 | + S : string; | |
| 877 | 881 | begin |
| 878 | 882 | P := FExperiment.PlayerFromID[ARequest[0]]; |
| 879 | 883 | P.Choice.Row:= GetRowFromString(ARequest[3]); // row |
| ... | ... | @@ -881,7 +885,14 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); |
| 881 | 885 | ARequest[2] := K_CHOICE+K_ARRIVED; |
| 882 | 886 | |
| 883 | 887 | //individual consequences |
| 884 | - ARequest.Append(FExperiment.ConsequenceStringFromChoice[P]); | |
| 888 | + S := FExperiment.ConsequenceStringFromChoice[P]; | |
| 889 | + {$IFDEF DEBUG} | |
| 890 | + WriteLn('ValidateChoice:',s); | |
| 891 | + {$ENDIF} | |
| 892 | + | |
| 893 | + if Pos('$NICNAME',S) > 0 then | |
| 894 | + S := ReplaceStr(S,'$NICNAME',P.Nicname); | |
| 895 | + ARequest.Append(S); | |
| 885 | 896 | |
| 886 | 897 | // update turn |
| 887 | 898 | P.Turn := FExperiment.NextTurn; |
| ... | ... | @@ -890,57 +901,63 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); |
| 890 | 901 | // broadcast choice |
| 891 | 902 | FZMQActor.SendMessage([K_CHOICE,P.ID,ARequest[3],ARequest[4],IntToStr(P.Turn)]); |
| 892 | 903 | |
| 893 | - if ShouldAskQuestion then // TODO: prompt only when an odd row was selected | |
| 904 | + if ShouldStartCycle then | |
| 894 | 905 | begin |
| 895 | - P.Turn := 0; | |
| 896 | - FZMQActor.SendMessage([K_QUESTION,FExperiment.Condition[FExperiment.CurrentCondition].Prompt.Question]); | |
| 897 | - end; | |
| 898 | - end; | |
| 906 | + while FormMatrixGame.PopupNotifier.Visible do | |
| 907 | + Application.ProcessMessages; | |
| 899 | 908 | |
| 900 | - procedure ValidateQuestionResponse; | |
| 901 | - var | |
| 902 | - P : TPlayer; | |
| 903 | - M : array of UTF8string; | |
| 904 | - i : integer; | |
| 905 | - LPromptConsequences : TStringList; | |
| 906 | - begin | |
| 907 | - P := FExperiment.PlayerFromID[ARequest[0]]; | |
| 908 | - ARequest[2] := K_QUESTION+K_ARRIVED; | |
| 909 | - | |
| 910 | - // append response of each player | |
| 911 | - FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AppendResponse(P.ID,ARequest[3]); | |
| 912 | - | |
| 913 | - // return to experiment and present the prompt consequence, if any | |
| 914 | - if FExperiment.Condition[FExperiment.CurrentCondition].Prompt.ResponsesCount = Experiment.PlayersCount then | |
| 915 | - begin | |
| 916 | - // M setup | |
| 917 | - | |
| 918 | - | |
| 919 | - // generate messages | |
| 920 | - LPromptConsequences := FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AsString; | |
| 921 | - if LPromptConsequences.Count > 0 then | |
| 909 | + if ShouldAskQuestion then // TODO: prompt only when an odd row was selected | |
| 922 | 910 | begin |
| 923 | - SetLength(M, 1+LPromptConsequences.Count); | |
| 924 | - M[0] := GA_ADMIN+K_QUESTION+K_QMESSAGE; | |
| 925 | - for i := 0 to LPromptConsequences.Count -1 do | |
| 926 | - M[i+1] := LPromptConsequences[i] | |
| 911 | + P.Turn := 0; | |
| 912 | + FZMQActor.SendMessage([K_QUESTION,FExperiment.Condition[FExperiment.CurrentCondition].Prompt.Question]); | |
| 927 | 913 | end; |
| 928 | - | |
| 929 | - // send identified messages; each player takes only its own message and ignore the rest | |
| 930 | - FZMQActor.SendMessage(M); | |
| 931 | 914 | end; |
| 932 | 915 | end; |
| 916 | + | |
| 917 | + //procedure ValidateQuestionResponse; | |
| 918 | + //var | |
| 919 | + // P : TPlayer; | |
| 920 | + // M : array of UTF8string; | |
| 921 | + // i : integer; | |
| 922 | + // LPromptConsequences : TStringList; | |
| 923 | + //begin | |
| 924 | + // P := FExperiment.PlayerFromID[ARequest[0]]; | |
| 925 | + // ARequest[2] := K_QUESTION+K_ARRIVED; | |
| 926 | + // | |
| 927 | + // // append response of each player | |
| 928 | + // FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AppendResponse(P.ID,ARequest[3]); | |
| 929 | + // | |
| 930 | + // // return to experiment and present the prompt consequence, if any | |
| 931 | + // if FExperiment.Condition[FExperiment.CurrentCondition].Prompt.ResponsesCount = Experiment.PlayersCount then | |
| 932 | + // begin | |
| 933 | + // // M setup | |
| 934 | + // | |
| 935 | + // | |
| 936 | + // // generate messages | |
| 937 | + // LPromptConsequences := FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AsString; | |
| 938 | + // if LPromptConsequences.Count > 0 then | |
| 939 | + // begin | |
| 940 | + // SetLength(M, 1+LPromptConsequences.Count); | |
| 941 | + // M[0] := GA_ADMIN+K_QUESTION+K_QMESSAGE; | |
| 942 | + // for i := 0 to LPromptConsequences.Count -1 do | |
| 943 | + // M[i+1] := LPromptConsequences[i] | |
| 944 | + // end; | |
| 945 | + // | |
| 946 | + // // send identified messages; each player takes only its own message and ignore the rest | |
| 947 | + // FZMQActor.SendMessage(M); | |
| 948 | + // end; | |
| 949 | + //end; | |
| 933 | 950 | begin |
| 934 | 951 | if MHas(K_LOGIN) then ReplyLoginRequest; |
| 935 | 952 | if MHas(K_CHOICE) then ValidateChoice; |
| 936 | - if MHas(K_QUESTION) then ValidateQuestionResponse; | |
| 953 | + //if MHas(K_QUESTION) then ValidateQuestionResponse; | |
| 937 | 954 | end; |
| 938 | 955 | |
| 939 | 956 | // Here FActor is garanted to be a TZMQPlayer, reply by: |
| 940 | 957 | // - sending private data to player player |
| 941 | 958 | // - sending data from early history to income players |
| 942 | 959 | procedure TGameControl.ReceiveReply(AReply: TStringList); |
| 943 | - function MHas(const C : string) : Boolean; | |
| 960 | + function MHas(const C : UTF8string) : Boolean; | |
| 944 | 961 | begin |
| 945 | 962 | Result := MessageHas(C,AReply,2); |
| 946 | 963 | end; |
| ... | ... | @@ -1004,10 +1021,11 @@ procedure TGameControl.ReceiveReply(AReply: TStringList); |
| 1004 | 1021 | |
| 1005 | 1022 | end; |
| 1006 | 1023 | end; |
| 1007 | - procedure QuestionValidated; | |
| 1008 | - begin | |
| 1009 | - // wait | |
| 1010 | - end; | |
| 1024 | + | |
| 1025 | + //procedure QuestionValidated; | |
| 1026 | + //begin | |
| 1027 | + // // wait | |
| 1028 | + //end; | |
| 1011 | 1029 | |
| 1012 | 1030 | procedure ResumePlayer; |
| 1013 | 1031 | begin |
| ... | ... | @@ -1018,7 +1036,7 @@ begin |
| 1018 | 1036 | if MHas(K_RESUME+K_ARRIVED) then ResumePlayer; |
| 1019 | 1037 | if MHas(K_LOGIN+K_ARRIVED) then LoginAccepted; |
| 1020 | 1038 | if MHas(K_CHOICE+K_ARRIVED) then ChoiceValidated; |
| 1021 | - if MHas(K_QUESTION+K_ARRIVED) then QuestionValidated; | |
| 1039 | + //if MHas(K_QUESTION+K_ARRIVED) then QuestionValidated; | |
| 1022 | 1040 | end; |
| 1023 | 1041 | |
| 1024 | 1042 | ... | ... |
units/game_resources.pas
| ... | ... | @@ -9,7 +9,7 @@ uses |
| 9 | 9 | , game_actors |
| 10 | 10 | ; |
| 11 | 11 | |
| 12 | -function GenResourceName(i : integer) : UTF8string; | |
| 12 | +function GenResourceName(i : integer) : string; | |
| 13 | 13 | function GetColorFromCode(ACode : TGameColor) : TColor; |
| 14 | 14 | |
| 15 | 15 | resourcestring |
| ... | ... | @@ -83,7 +83,7 @@ const |
| 83 | 83 | |
| 84 | 84 | const |
| 85 | 85 | |
| 86 | - CPlayerNamesMale : array [0..49] of UTF8String = | |
| 86 | + CPlayerNamesMale : array [0..49] of string = | |
| 87 | 87 | ('João','Rodrigo','Francisco','Martim','Santiago', |
| 88 | 88 | 'Tomás','Afonso','Duarte','Miguel','Guilherme','Tiago', |
| 89 | 89 | 'Gonçalo','Diogo','Gabriel','Pedro','Rafael','Salvador', |
| ... | ... | @@ -94,7 +94,7 @@ const |
| 94 | 94 | 'Alexandre','Leandro','Filipe','Enzo','Ricardo', |
| 95 | 95 | 'Matias','Rúben','Samuel','Bruno','Isaac','Xavier','Nuno','Carlos'); |
| 96 | 96 | |
| 97 | - CPlayerNamesFemale : array [0..49] of UTF8String = | |
| 97 | + CPlayerNamesFemale : array [0..49] of string = | |
| 98 | 98 | ('Maria','Matilde','Thais','Beatriz','Mariana', |
| 99 | 99 | 'Carolina','Ana','Inês','Sofia','Margarida', |
| 100 | 100 | 'Lara','Joana','Laura','Francisca','Diana', |
| ... | ... | @@ -238,7 +238,7 @@ implementation |
| 238 | 238 | |
| 239 | 239 | uses zhelpers; |
| 240 | 240 | |
| 241 | -function GenResourceName(i: integer): UTF8string; | |
| 241 | +function GenResourceName(i: integer): string; | |
| 242 | 242 | begin |
| 243 | 243 | Randomize; |
| 244 | 244 | if (i <= 49) and (i>=0) then | ... | ... |
units/string_methods.pas
| ... | ... | @@ -12,34 +12,34 @@ uses |
| 12 | 12 | |
| 13 | 13 | function GetAndDelFirstValue(var S: string;Sep:Char=','):string; deprecated 'Use ExtracteDelimited from strutils instead'; |
| 14 | 14 | |
| 15 | -function GetRowString(ARow : TGameRow) : UTF8String; | |
| 16 | -function GetRowFromString(S : UTF8String):TGameRow; | |
| 15 | +function GetRowString(ARow : TGameRow) : string; | |
| 16 | +function GetRowFromString(S : string):TGameRow; | |
| 17 | 17 | |
| 18 | -function GetColorString(C : TColor):UTF8String; overload; | |
| 19 | -function GetColorFromString(S : UTF8String): TColor; | |
| 20 | -function GetColorString(AColor : TGameColor) : UTF8String; overload; | |
| 21 | -function GetGameColorFromString(S : UTF8String) : TGameColor; | |
| 18 | +function GetColorString(C : TColor):string; overload; | |
| 19 | +function GetColorFromString(S : string): TColor; | |
| 20 | +function GetColorString(AColor : TGameColor) : string; overload; | |
| 21 | +function GetGameColorFromString(S : string) : TGameColor; | |
| 22 | 22 | |
| 23 | -function GetPromptStyleFromString(S : UTF8String) : TPromptStyle; | |
| 24 | -function GetPromptStyleString(AStyle : TPromptStyle) : UTF8String; | |
| 23 | +function GetPromptStyleFromString(S : string) : TPromptStyle; | |
| 24 | +function GetPromptStyleString(AStyle : TPromptStyle) : string; | |
| 25 | 25 | |
| 26 | -function GetConsequenceStyleFromString(s : UTF8String):TGameConsequenceStyle; | |
| 27 | -function GetConsequenceStyleString(AStyle : TGameConsequenceStyle): UTF8String; | |
| 28 | -function GetConsequenceStylesFromString(S : UTF8String):TConsequenceStyle; | |
| 29 | -function GetConsequenceStylesString(CS : TConsequenceStyle): UTF8String; | |
| 26 | +function GetConsequenceStyleFromString(s : string):TGameConsequenceStyle; | |
| 27 | +function GetConsequenceStyleString(AStyle : TGameConsequenceStyle): string; | |
| 28 | +function GetConsequenceStylesFromString(S : string):TConsequenceStyle; | |
| 29 | +function GetConsequenceStylesString(CS : TConsequenceStyle): string; | |
| 30 | 30 | |
| 31 | -function GetCriteriaString(ACriteria : TCriteria) : UTF8String; | |
| 32 | -function GetCriteriaFromString(S : UTF8String) : TCriteria; | |
| 33 | -function GetCriteriaStyleString(AStyle: TGameStyle) : UTF8String; | |
| 31 | +function GetCriteriaString(ACriteria : TCriteria) : string; | |
| 32 | +function GetCriteriaFromString(S : string) : TCriteria; | |
| 33 | +function GetCriteriaStyleString(AStyle: TGameStyle) : string; | |
| 34 | 34 | |
| 35 | -function GetStatusString(AStatus : TGamePlayerStatus): UTF8String; | |
| 36 | -function GetPPointsString(APPoints : TPlayerPoints) : UTF8String; | |
| 37 | -function GetChoiceString(AChoice : TPlayerChoice) : UTF8String; | |
| 38 | -function GetPointsString(APoints : TPoints) : UTF8String; | |
| 39 | -function GetEndCriteriaString(AEndCriterium:TEndConditionCriterium) : UTF8String; | |
| 35 | +function GetStatusString(AStatus : TGamePlayerStatus): string; | |
| 36 | +function GetPPointsString(APPoints : TPlayerPoints) : string; | |
| 37 | +function GetChoiceString(AChoice : TPlayerChoice) : string; | |
| 38 | +function GetPointsString(APoints : TPoints) : string; | |
| 39 | +function GetEndCriteriaString(AEndCriterium:TEndConditionCriterium) : string; | |
| 40 | 40 | |
| 41 | -function GetPlayerFromString(s: UTF8string): TPlayer; | |
| 42 | -function GetPlayerAsString(P: TPlayer): UTF8string; | |
| 41 | +function GetPlayerFromString(s: string): TPlayer; | |
| 42 | +function GetPlayerAsString(P: TPlayer): string; | |
| 43 | 43 | |
| 44 | 44 | implementation |
| 45 | 45 | |
| ... | ... | @@ -52,7 +52,7 @@ begin |
| 52 | 52 | if Length(S) > 0 then while S[1] = Sep do Delete(S, 1, 1); |
| 53 | 53 | end; |
| 54 | 54 | |
| 55 | -function GetRowString(ARow: TGameRow): UTF8String; | |
| 55 | +function GetRowString(ARow: TGameRow): string; | |
| 56 | 56 | begin |
| 57 | 57 | case ARow of |
| 58 | 58 | grNone : Result := '0'; |
| ... | ... | @@ -71,7 +71,7 @@ begin |
| 71 | 71 | end; |
| 72 | 72 | end; |
| 73 | 73 | |
| 74 | -function GetRowFromString(S: UTF8String): TGameRow; | |
| 74 | +function GetRowFromString(S: string): TGameRow; | |
| 75 | 75 | begin |
| 76 | 76 | case UpperCase(S) of |
| 77 | 77 | 'NA', '.' , '0', 'NONE' : Result := grNone; |
| ... | ... | @@ -90,7 +90,7 @@ begin |
| 90 | 90 | end; |
| 91 | 91 | end; |
| 92 | 92 | |
| 93 | -function GetColorString(AColor: TGameColor): UTF8String; | |
| 93 | +function GetColorString(AColor: TGameColor): string; | |
| 94 | 94 | begin |
| 95 | 95 | case AColor of |
| 96 | 96 | gcNone :Result := 'INDIFERENTE'; |
| ... | ... | @@ -104,7 +104,7 @@ begin |
| 104 | 104 | end; |
| 105 | 105 | end; |
| 106 | 106 | |
| 107 | -function GetGameColorFromString(S: UTF8String): TGameColor; | |
| 107 | +function GetGameColorFromString(S: string): TGameColor; | |
| 108 | 108 | begin |
| 109 | 109 | case UpperCase(S) of |
| 110 | 110 | '.', 'INDIFERENTE', 'NONE' : Result := gcNone; |
| ... | ... | @@ -119,7 +119,7 @@ begin |
| 119 | 119 | end; |
| 120 | 120 | |
| 121 | 121 | |
| 122 | -function GetPromptStyleFromString(S: UTF8String): TPromptStyle; | |
| 122 | +function GetPromptStyleFromString(S: string): TPromptStyle; | |
| 123 | 123 | begin |
| 124 | 124 | // todos,sim,metacontingência,recuperar pontos, |
| 125 | 125 | case UpperCase(S) of |
| ... | ... | @@ -134,7 +134,7 @@ begin |
| 134 | 134 | end; |
| 135 | 135 | end; |
| 136 | 136 | |
| 137 | -function GetPromptStyleString(AStyle: TPromptStyle): UTF8String; | |
| 137 | +function GetPromptStyleString(AStyle: TPromptStyle): string; | |
| 138 | 138 | var Style : TGamePromptStyle; |
| 139 | 139 | begin |
| 140 | 140 | Result:=''; |
| ... | ... | @@ -151,7 +151,7 @@ begin |
| 151 | 151 | end; |
| 152 | 152 | end; |
| 153 | 153 | |
| 154 | -function GetConsequenceStyleFromString(s: UTF8String): TGameConsequenceStyle; | |
| 154 | +function GetConsequenceStyleFromString(s: string): TGameConsequenceStyle; | |
| 155 | 155 | begin |
| 156 | 156 | case UpperCase(S) of |
| 157 | 157 | 'NADA': Result:= gscNone; |
| ... | ... | @@ -162,7 +162,7 @@ begin |
| 162 | 162 | end; |
| 163 | 163 | end; |
| 164 | 164 | |
| 165 | -function GetConsequenceStyleString(AStyle: TGameConsequenceStyle): UTF8String; | |
| 165 | +function GetConsequenceStyleString(AStyle: TGameConsequenceStyle): string; | |
| 166 | 166 | begin |
| 167 | 167 | case AStyle of |
| 168 | 168 | gscNone : Result:= 'NADA'; |
| ... | ... | @@ -173,7 +173,7 @@ begin |
| 173 | 173 | end; |
| 174 | 174 | end; |
| 175 | 175 | |
| 176 | -function GetCriteriaString(ACriteria: TCriteria): UTF8String; | |
| 176 | +function GetCriteriaString(ACriteria: TCriteria): string; | |
| 177 | 177 | var R : TGameRow; |
| 178 | 178 | C : TGameColor; |
| 179 | 179 | begin |
| ... | ... | @@ -188,7 +188,7 @@ begin |
| 188 | 188 | Result += '|'; |
| 189 | 189 | end; |
| 190 | 190 | |
| 191 | -function GetCriteriaFromString(S: UTF8String): TCriteria; | |
| 191 | +function GetCriteriaFromString(S: string): TCriteria; | |
| 192 | 192 | var |
| 193 | 193 | s1 : string; |
| 194 | 194 | i : integer; |
| ... | ... | @@ -217,7 +217,7 @@ begin |
| 217 | 217 | else Break; |
| 218 | 218 | end; |
| 219 | 219 | |
| 220 | -function GetCriteriaStyleString(AStyle: TGameStyle): UTF8String; | |
| 220 | +function GetCriteriaStyleString(AStyle: TGameStyle): string; | |
| 221 | 221 | begin |
| 222 | 222 | case AStyle of |
| 223 | 223 | gtNone : Result := 'INDIFERENTE'; |
| ... | ... | @@ -228,7 +228,7 @@ begin |
| 228 | 228 | end; |
| 229 | 229 | end; |
| 230 | 230 | |
| 231 | -function GetColorString(C: TColor): UTF8String; | |
| 231 | +function GetColorString(C: TColor): string; | |
| 232 | 232 | begin |
| 233 | 233 | case C of |
| 234 | 234 | ccYellow: Result := 'Y'; |
| ... | ... | @@ -239,7 +239,7 @@ begin |
| 239 | 239 | end; |
| 240 | 240 | end; |
| 241 | 241 | |
| 242 | -function GetColorFromString(S: UTF8String): TColor; | |
| 242 | +function GetColorFromString(S: string): TColor; | |
| 243 | 243 | begin |
| 244 | 244 | case S of |
| 245 | 245 | 'Y' : Result := ccYellow; |
| ... | ... | @@ -250,7 +250,7 @@ begin |
| 250 | 250 | end; |
| 251 | 251 | end; |
| 252 | 252 | |
| 253 | -function GetConsequenceStylesFromString(S:UTF8String):TConsequenceStyle; | |
| 253 | +function GetConsequenceStylesFromString(S:string):TConsequenceStyle; | |
| 254 | 254 | var |
| 255 | 255 | LCount, |
| 256 | 256 | i : integer; |
| ... | ... | @@ -270,7 +270,7 @@ begin |
| 270 | 270 | end; |
| 271 | 271 | end; |
| 272 | 272 | |
| 273 | -function GetConsequenceStylesString(CS: TConsequenceStyle): UTF8String; | |
| 273 | +function GetConsequenceStylesString(CS: TConsequenceStyle): string; | |
| 274 | 274 | var ConsequenceStyle : TGameConsequenceStyle; |
| 275 | 275 | begin |
| 276 | 276 | Result := ''; |
| ... | ... | @@ -291,7 +291,7 @@ begin |
| 291 | 291 | end; |
| 292 | 292 | |
| 293 | 293 | function GetEndCriteriaString(AEndCriterium: TEndConditionCriterium |
| 294 | - ): UTF8String; | |
| 294 | + ): string; | |
| 295 | 295 | begin |
| 296 | 296 | // 2,20,10,10, |
| 297 | 297 | case AEndCriterium.Value of |
| ... | ... | @@ -305,25 +305,25 @@ begin |
| 305 | 305 | Result := Result + IntToStr(AEndCriterium.LastCycles) + VV_SEP; |
| 306 | 306 | end; |
| 307 | 307 | |
| 308 | -function GetPointsString(APoints: TPoints): UTF8String; | |
| 308 | +function GetPointsString(APoints: TPoints): string; | |
| 309 | 309 | begin |
| 310 | 310 | Result := IntToStr(APoints.A) + VV_SEP; |
| 311 | 311 | Result := Result + IntToStr(APoints.B) + VV_SEP; |
| 312 | 312 | Result := Result + IntToStr(APoints.G) + VV_SEP; |
| 313 | 313 | end; |
| 314 | 314 | |
| 315 | -function GetChoiceString(AChoice: TPlayerChoice): UTF8String; | |
| 315 | +function GetChoiceString(AChoice: TPlayerChoice): string; | |
| 316 | 316 | begin |
| 317 | 317 | Result := GetRowString(AChoice.Row) + VV_SEP; |
| 318 | 318 | Result := Result+ GetColorString(AChoice.Color) + VV_SEP; |
| 319 | 319 | end; |
| 320 | 320 | |
| 321 | -function GetPPointsString(APPoints: TPlayerPoints): UTF8String; | |
| 321 | +function GetPPointsString(APPoints: TPlayerPoints): string; | |
| 322 | 322 | begin |
| 323 | 323 | Result := IntToStr(APPoints.A)+VV_SEP+IntToStr(APPoints.B); |
| 324 | 324 | end; |
| 325 | 325 | |
| 326 | -function GetStatusString(AStatus: TGamePlayerStatus): UTF8String; | |
| 326 | +function GetStatusString(AStatus: TGamePlayerStatus): string; | |
| 327 | 327 | begin |
| 328 | 328 | case AStatus of |
| 329 | 329 | gpsWaiting: Result := 'esperando'; |
| ... | ... | @@ -332,12 +332,12 @@ begin |
| 332 | 332 | end; |
| 333 | 333 | end; |
| 334 | 334 | |
| 335 | -function GetPlayerAsString(P: TPlayer): UTF8string; | |
| 335 | +function GetPlayerAsString(P: TPlayer): string; | |
| 336 | 336 | var |
| 337 | 337 | i : integer; |
| 338 | - M : array of UTF8String; | |
| 338 | + M : array of string; | |
| 339 | 339 | |
| 340 | - procedure SetM(A : array of UTF8String); | |
| 340 | + procedure SetM(A : array of string); | |
| 341 | 341 | var i : integer; |
| 342 | 342 | begin |
| 343 | 343 | SetLength(M,Length(A)); |
| ... | ... | @@ -407,7 +407,7 @@ begin |
| 407 | 407 | Result += M[i] + '|'; |
| 408 | 408 | end; |
| 409 | 409 | |
| 410 | -function GetPlayerFromString(s: UTF8string): TPlayer; | |
| 410 | +function GetPlayerFromString(s: string): TPlayer; | |
| 411 | 411 | |
| 412 | 412 | function RowFromString(S: string): TGameRow; |
| 413 | 413 | begin | ... | ... |