aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/src/base
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-17 10:02:18 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-05-17 10:02:18 +0000
commita282d4ee540e89cde99e1aaa0eff91080a6819c3 (patch)
treec8b441c01c52632862ed6aecf6af0531055c0805 /Lua/src/base
parent498ce4b4d57aa0b56c396eed61b499736f1722da (diff)
downloadusdx-a282d4ee540e89cde99e1aaa0eff91080a6819c3.tar.gz
usdx-a282d4ee540e89cde99e1aaa0eff91080a6819c3.tar.xz
usdx-a282d4ee540e89cde99e1aaa0eff91080a6819c3.zip
added TPartyGame.RoundPlayed
some changes to GetWinnerString, it can now be used for the game winner, too. adapted UScreenPartyScore uses TPartyGame.RoundPlayed in UScreenPartyScore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1748 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Lua/src/base')
-rw-r--r--Lua/src/base/UParty.pas50
1 files changed, 35 insertions, 15 deletions
diff --git a/Lua/src/base/UParty.pas b/Lua/src/base/UParty.pas
index fc741768..3d916f64 100644
--- a/Lua/src/base/UParty.pas
+++ b/Lua/src/base/UParty.pas
@@ -163,6 +163,9 @@ type
been played }
function NextRound: integer;
+ { indicates that current round has already been played }
+ procedure RoundPlayed;
+
{ true if in a Party Game (not in standard mode) }
property PartyGame: Boolean read BPartyGame;
@@ -624,6 +627,13 @@ begin
end;
end;
+{ indicates that current round has already been played }
+procedure TPartyGame.RoundPlayed;
+begin
+ if (bPartyStarted) and (CurRound >= 0) and (CurRound <= High(Rounds)) then
+ Rounds[CurRound].AlreadyPlayed := True;
+end;
+
{ returns true if last round was already played }
function TPartyGame.GameFinished: Boolean;
begin
@@ -788,35 +798,45 @@ begin
end;
end;
-{ returns a string like "Team 1 (and Team 2) win" }
+{ returns a string like "Team 1 (and Team 2) win"
+ if Round is in range from 0 to high(Rounds) then
+ result is name of winners of specified round.
+ if Round is -1 the result is name of winners of
+ the whole party game}
function TPartyGame.GetWinnerString(Round: Integer): String;
var
Winners: array of String;
I: integer;
+ Ranking: AParty_TeamRanking;
begin
Result := '';
-
+ Ranking := nil;
+
if (Round >= 0) and (Round <= High(Rounds)) then
begin
if (not Rounds[Round].AlreadyPlayed) then
- begin
- Result := Language.Translate('PARTY_NOTPLAYEDYET');
- end
+ Result := Language.Translate('PARTY_NOTPLAYEDYET')
else
+ Ranking := Rounds[Round].Ranking;
+ end
+ else if (Round = -1) then
+ Ranking := GetTeamRanking;
+
+
+ if (Ranking <> nil) then
+ begin
+ SetLength(Winners, 0);
+ for I := 0 to High(Ranking) do
begin
- SetLength(Winners, 0);
- for I := 0 to High(Rounds[Round].Ranking) do
+ if (Ranking[I].Rank = PR_First) and (Ranking[I].Team >= 0) and (Ranking[I].Team <= High(Teams)) then
begin
- if Rounds[Round].Ranking[I].Rank = PR_First then
- begin
- SetLength(Winners, Length(Winners) + 1);
- Winners[high(Winners)] := Teams[I].Name;
- end;
+ SetLength(Winners, Length(Winners) + 1);
+ Winners[high(Winners)] := Teams[Ranking[I].Team].Name;
end;
-
- if (Length(Winners) > 0) then
- Result := Language.Implode(Winners);
end;
+
+ if (Length(Winners) > 0) then
+ Result := Language.Implode(Winners);
end;
if (Length(Result) = 0) then