Adjust LocalClan when shuffling, set to -1 in case all local clans are bots.
--- a/hedgewars/HHHandlers.inc Wed Feb 24 01:55:59 2010 +0000
+++ b/hedgewars/HHHandlers.inc Wed Feb 24 03:03:43 2010 +0000
@@ -314,7 +314,6 @@
AddAmmo(PHedgehog(HH^.Hedgehog)^, a);
// Possibly needs to check shared clan ammo game flag once added.
// On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
-AddFileLog(inttostr(PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex) + ' --------- ' + inttostr(LocalClan));
if (not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven
or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0)))
or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan)
--- a/hedgewars/uTeams.pas Wed Feb 24 01:55:59 2010 +0000
+++ b/hedgewars/uTeams.pas Wed Feb 24 03:03:43 2010 +0000
@@ -98,8 +98,8 @@
TeamsCount: Longword;
ClansArray: array[0..Pred(cMaxTeams)] of PClan;
ClansCount: Longword;
- LocalClan: Longword; // last non-bot, non-extdriven clan
- LocalAmmo: Longword; // last non-bot, non-extdriven clan's first team's ammo index
+ LocalClan: LongInt; // last non-bot, non-extdriven clan
+ LocalAmmo: LongInt; // last non-bot, non-extdriven clan's first team's ammo index
CurMinAngle, CurMaxAngle: Longword;
procedure init_uTeams;
@@ -349,7 +349,7 @@
begin
if (not ExtDriven) and (Hedgehogs[0].BotLevel = 0) then
begin
- LocalClan:= Clan^.ClanIndex + 1;
+ LocalClan:= Clan^.ClanIndex;
LocalAmmo:= Hedgehogs[0].AmmoStore
end;
th:= 0;
@@ -467,7 +467,8 @@
CurrentHedgehog:= nil;
TeamsCount:= 0;
ClansCount:= 0;
- LocalClan:= 0; // first non-bot, non-extdriven clan
+ LocalClan:= -1;
+ LocalAmmo:= -1;
end;
procedure free_uTeams;
--- a/hedgewars/uWorld.pas Wed Feb 24 01:55:59 2010 +0000
+++ b/hedgewars/uWorld.pas Wed Feb 24 03:03:43 2010 +0000
@@ -90,6 +90,8 @@
ClansArray[t]:= cp;
ClansArray[t]^.ClanIndex:= t;
ClansArray[0]^.ClanIndex:= 0;
+ if (LocalClan = t) then LocalClan:= 0
+ else if (LocalClan = 0) then LocalClan:= t
end;
end;
CurrentTeam:= ClansArray[0]^.Teams[0];
@@ -139,7 +141,7 @@
end;
if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
Ammo:= CurrentHedgehog^.Ammo
-else
+else if (LocalAmmo <> -1) then
Ammo:= GetAmmoByNum(LocalAmmo);
Slot:= 0;
Pos:= -1;