# HG changeset patch # User unc0rr # Date 1211898648 0 # Node ID 474afaab0365ba95e39a4b6bdb97b14360e6dfb0 # Parent 0cc31e998f4ea0fee38ee839c816dcd6c35ac400 Fix forts mode to take in account clans, not teams diff -r 0cc31e998f4e -r 474afaab0365 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Mon May 26 22:47:48 2008 +0000 +++ b/hedgewars/uGears.pas Tue May 27 14:30:48 2008 +0000 @@ -904,7 +904,7 @@ procedure ShotgunShot(Gear: PGear); var t: PGear; - dmg: integer; + dmg: LongInt; begin Gear^.Radius:= cShotgunRadius; t:= GearsList; @@ -972,44 +972,46 @@ end; procedure AssignHHCoords; -var i, t, p: LongInt; +var i, t, p, j: LongInt; ar: array[0..Pred(cMaxHHs)] of PGear; Count: Longword; begin if (GameFlags and gfForts) <> 0 then - begin - t:= 0; - for p:= 0 to Pred(TeamsCount) do - with TeamsArray[p]^ do - begin - for i:= 0 to cMaxHHIndex do - with Hedgehogs[i] do - if (Gear <> nil) and (Gear^.X.QWordValue = 0) then FindPlace(Gear, false, t, t + 1024); - inc(t, 1024); - end - end else // mix hedgehogs - begin - Count:= 0; - for p:= 0 to Pred(TeamsCount) do - with TeamsArray[p]^ do - begin - for i:= 0 to cMaxHHIndex do - with Hedgehogs[i] do - if (Gear <> nil) and (Gear^.X.QWordValue = 0) then - begin - ar[Count]:= Gear; - inc(Count) - end; - end; + begin + t:= 0; + for p:= 0 to 1 do + begin + with ClansArray[p]^ do + for j:= 0 to Pred(TeamsNumber) do + with Teams[j]^ do + for i:= 0 to cMaxHHIndex do + with Hedgehogs[i] do + if (Gear <> nil) and (Gear^.X.QWordValue = 0) then FindPlace(Gear, false, t, t + 1024); + inc(t, 1024) + end + end else // mix hedgehogs + begin + Count:= 0; + for p:= 0 to Pred(TeamsCount) do + with TeamsArray[p]^ do + begin + for i:= 0 to cMaxHHIndex do + with Hedgehogs[i] do + if (Gear <> nil) and (Gear^.X.QWordValue = 0) then + begin + ar[Count]:= Gear; + inc(Count) + end; + end; - while (Count > 0) do - begin - i:= GetRandom(Count); - FindPlace(ar[i], false, 0, 2048); - ar[i]:= ar[Count - 1]; - dec(Count) - end - end + while (Count > 0) do + begin + i:= GetRandom(Count); + FindPlace(ar[i], false, 0, 2048); + ar[i]:= ar[Count - 1]; + dec(Count) + end + end end; function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; diff -r 0cc31e998f4e -r 474afaab0365 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Mon May 26 22:47:48 2008 +0000 +++ b/hedgewars/uLand.pas Tue May 27 14:30:48 2008 +0000 @@ -542,17 +542,17 @@ var tmpsurf: PSDL_Surface; begin WriteLnToConsole('Generating forts land...'); -TryDo(TeamsCount = 2, 'More or less than 2 teams on map in forts mode!', true); +TryDo(ClansCount = 2, 'More or less than 2 clans on map in forts mode!', true); LandSurface:= SDL_CreateRGBSurface(SDL_HWSURFACE, 2048, 1024, 32, RMask, GMask, BMask, AMask); SDL_FillRect(LandSurface, nil, 0); -tmpsurf:= LoadImage(Pathz[ptForts] + '/' + TeamsArray[0]^.FortName + 'L', false, true, true); +tmpsurf:= LoadImage(Pathz[ptForts] + '/' + ClansArray[0]^.Teams[0]^.FortName + 'L', false, true, true); BlitImageAndGenerateCollisionInfo(0, 0, tmpsurf, LandSurface); SDL_FreeSurface(tmpsurf); -tmpsurf:= LoadImage(Pathz[ptForts] + '/' + TeamsArray[1]^.FortName + 'R', false, true, true); +tmpsurf:= LoadImage(Pathz[ptForts] + '/' + ClansArray[0]^.Teams[0]^.FortName + 'R', false, true, true); BlitImageAndGenerateCollisionInfo(1024, 0, tmpsurf, LandSurface); SDL_FreeSurface(tmpsurf);