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