- Proper turns counting, split SwitchHedgehog into two functions
- Health decrease afte r15 turns of each team, water rise after 17 turns
--- a/hedgewars/CCHandlers.inc Sun Jul 06 20:03:09 2008 +0000
+++ b/hedgewars/CCHandlers.inc Sun Jul 06 21:52:07 2008 +0000
@@ -281,7 +281,6 @@
if not CurrentTeam^.ExtDriven then SendIPC('N');
TickTrigger(trigTurns);
{$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF}
- SwitchHedgehog;
end
end;
--- a/hedgewars/uGears.pas Sun Jul 06 20:03:09 2008 +0000
+++ b/hedgewars/uGears.pas Sun Jul 06 21:52:07 2008 +0000
@@ -479,9 +479,13 @@
if delay = 0 then
inc(step)
end;
- stChWin: if not CheckForWin then inc(step) else step:= stDelay;
+ stChWin: if not CheckForWin then
+ begin
+ if not bBetweenTurns then SwitchHedgehog;
+ inc(step)
+ end else step:= stDelay;
stWater: begin
- if GameTicks > 25 * 60 * 1000 then bWaterRising:= true;
+ if TotalRounds = 17 then bWaterRising:= true;
if not bWaterRising then
inc(step)
@@ -497,12 +501,12 @@
end
end;
stHealth: begin
- if GameTicks > 20 * 60 * 1000 then cHealthDecrease:= 5;
+ if TotalRounds = 15 then cHealthDecrease:= 5;
if (cHealthDecrease = 0)
or bBetweenTurns
or isInMultiShoot
- or (FinishedTurnsTotal = 0) then inc(step)
+ or (TotalRounds = 0) then inc(step)
else begin
bBetweenTurns:= true;
HealthMachine;
@@ -517,6 +521,7 @@
if isInMultiShoot then isInMultiShoot:= false
else begin
ParseCommand('/nextturn', true);
+ AfterSwitchHedgehog;
bBetweenTurns:= false
end;
step:= Low(step)
--- a/hedgewars/uStats.pas Sun Jul 06 20:03:09 2008 +0000
+++ b/hedgewars/uStats.pas Sun Jul 06 21:52:07 2008 +0000
@@ -38,7 +38,9 @@
procedure TurnReaction;
procedure SendStats;
-var FinishedTurnsTotal: LongInt = -1;
+var
+ TotalRounds: Longword = -1;
+ FinishedTurnsTotal: LongInt = -1;
implementation
uses uTeams, uSound, uMisc;
--- a/hedgewars/uTeams.pas Sun Jul 06 20:03:09 2008 +0000
+++ b/hedgewars/uTeams.pas Sun Jul 06 21:52:07 2008 +0000
@@ -79,13 +79,14 @@
ClansCount: Longword = 0;
CurMinAngle, CurMaxAngle: Longword;
-function AddTeam(TeamColor: Longword): PTeam;
+function AddTeam(TeamColor: Longword): PTeam;
procedure SwitchHedgehog;
+procedure AfterSwitchHedgehog;
procedure InitTeams;
function TeamSize(p: PTeam): Longword;
procedure RecountTeamHealth(team: PTeam);
procedure RestoreTeamsFromSave;
-function CheckForWin: boolean;
+function CheckForWin: boolean;
implementation
uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uSound;
@@ -140,7 +141,6 @@
procedure SwitchHedgehog;
var c: LongWord;
- g: PGear;
PrevHH, PrevTeam: LongWord;
begin
FreeActionsList;
@@ -159,23 +159,34 @@
c:= CurrentTeam^.Clan^.ClanIndex;
repeat
- c:= Succ(c) mod ClansCount;
- with ClansArray[c]^ do
- repeat
- PrevTeam:= CurrTeam;
- CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
- CurrentTeam:= Teams[CurrTeam];
- with CurrentTeam^ do
- begin
- PrevHH:= CurrHedgehog;
- repeat
- CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
- until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
- end
- until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam);
+ inc(c);
+ if c = ClansCount then
+ begin
+ inc(TotalRounds);
+ c:= 0
+ end;
+
+ with ClansArray[c]^ do
+ repeat
+ PrevTeam:= CurrTeam;
+ CurrTeam:= Succ(CurrTeam) mod TeamsNumber;
+ CurrentTeam:= Teams[CurrTeam];
+ with CurrentTeam^ do
+ begin
+ PrevHH:= CurrHedgehog;
+ repeat
+ CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
+ until (Hedgehogs[CurrHedgehog].Gear <> nil) or (CurrHedgehog = PrevHH)
+ end
+ until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam);
until CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil;
-CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]);
+CurrentHedgehog:= @(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog])
+end;
+
+procedure AfterSwitchHedgehog;
+var g: PGear;
+begin
SwitchNotHoldedAmmo(CurrentHedgehog^);
with CurrentHedgehog^ do
begin