94 procedure FreeTeamsList; forward; |
94 procedure FreeTeamsList; forward; |
95 |
95 |
96 function CheckForWin: boolean; |
96 function CheckForWin: boolean; |
97 var AliveClan: PClan; |
97 var AliveClan: PClan; |
98 s: shortstring; |
98 s: shortstring; |
99 t, AliveCount: LongInt; |
99 t, AliveCount, i, j: LongInt; |
100 begin |
100 begin |
101 AliveCount:= 0; |
101 AliveCount:= 0; |
102 for t:= 0 to Pred(ClansCount) do |
102 for t:= 0 to Pred(ClansCount) do |
103 if ClansArray[t]^.ClanHealth > 0 then |
103 if ClansArray[t]^.ClanHealth > 0 then |
104 begin |
104 begin |
110 ((AliveCount = 1) and ((GameFlags and gfOneClanMode) <> 0)) then exit(false); |
110 ((AliveCount = 1) and ((GameFlags and gfOneClanMode) <> 0)) then exit(false); |
111 CheckForWin:= true; |
111 CheckForWin:= true; |
112 |
112 |
113 TurnTimeLeft:= 0; |
113 TurnTimeLeft:= 0; |
114 if AliveCount = 0 then |
114 if AliveCount = 0 then |
115 begin // draw |
115 begin // draw |
116 AddCaption(trmsg[sidDraw], $FFFFFF, capgrpGameState); |
116 AddCaption(trmsg[sidDraw], $FFFFFF, capgrpGameState); |
117 SendStat(siGameResult, trmsg[sidDraw]); |
117 SendStat(siGameResult, trmsg[sidDraw]); |
118 AddGear(0, 0, gtATFinishGame, 0, _0, _0, 2000) |
118 AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000) |
119 end else // win |
119 end else // win |
120 with AliveClan^ do |
120 with AliveClan^ do |
121 begin |
121 begin |
122 if TeamsNumber = 1 then |
122 if TeamsNumber = 1 then |
123 s:= Format(trmsg[sidWinner], Teams[0]^.TeamName) // team wins |
123 s:= Format(trmsg[sidWinner], Teams[0]^.TeamName) // team wins |
124 else |
124 else |
125 s:= Format(trmsg[sidWinner], Teams[0]^.TeamName); // clan wins |
125 s:= Format(trmsg[sidWinner], Teams[0]^.TeamName); // clan wins |
126 |
126 |
127 AddCaption(s, $FFFFFF, capgrpGameState); |
127 for j:= 0 to Pred(TeamsNumber) do |
128 SendStat(siGameResult, s); |
128 with Teams[j]^ do |
129 AddGear(0, 0, gtATFinishGame, 0, _0, _0, 2000) |
129 for i:= 0 to cMaxHHIndex do |
130 end; |
130 with Hedgehogs[i] do |
|
131 if (Gear <> nil) then |
|
132 Gear^.State:= gstWinner; |
|
133 |
|
134 AddCaption(s, $FFFFFF, capgrpGameState); |
|
135 SendStat(siGameResult, s); |
|
136 AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000) |
|
137 end; |
131 SendStats |
138 SendStats |
132 end; |
139 end; |
133 |
140 |
134 procedure SwitchHedgehog; |
141 procedure SwitchHedgehog; |
135 var c: LongWord; |
142 var c: LongWord; |