hedgewars/uTeams.pas
changeset 15220 ceb289e8a582
parent 15053 e3b3fa42a93b
child 15337 63372e3879df
equal deleted inserted replaced
15219:b71bae455926 15220:ceb289e8a582
   199            DeleteCI(Gear);
   199            DeleteCI(Gear);
   200            FindPlace(Gear, false, 0, LAND_WIDTH, true);
   200            FindPlace(Gear, false, 0, LAND_WIDTH, true);
   201            if Gear <> nil then
   201            if Gear <> nil then
   202                AddCI(Gear)
   202                AddCI(Gear)
   203            end
   203            end
   204         end;
   204         end
       
   205     else if (PreviousTeam <> nil) and PlacingKings and UnplacedKing then
       
   206         UnplacedKing:= false;
   205 
   207 
   206 PreviousTeam:= CurrentTeam;
   208 PreviousTeam:= CurrentTeam;
   207 
   209 
   208 with CurrentHedgehog^ do
   210 with CurrentHedgehog^ do
   209     begin
   211     begin
   250                 end;
   252                 end;
   251             end;
   253             end;
   252 
   254 
   253         with ClansArray[c]^ do
   255         with ClansArray[c]^ do
   254             begin
   256             begin
   255             if (not PlacingHogs) and ((Succ(CurrTeam) mod TeamsNumber) = TagTeamIndex) then
   257             if (not PlacingHogs) and (not PlacingKings) and ((Succ(CurrTeam) mod TeamsNumber) = TagTeamIndex) then
   256                 begin
   258                 begin
   257                 if c = SwapClanPre then
   259                 if c = SwapClanPre then
   258                     inc(TotalRoundsPre);
   260                     inc(TotalRoundsPre);
   259                 end;
   261                 end;
   260             end;
   262             end;
   262     else
   264     else
   263         begin
   265         begin
   264         inc(c);
   266         inc(c);
   265         if c = ClansCount then
   267         if c = ClansCount then
   266             c:= 0;
   268             c:= 0;
   267         if (not PlacingHogs) then
   269         if (not PlacingHogs) and (not PlacingKings) then
   268             begin
   270             begin
   269             if c = SwapClanPre then
   271             if c = SwapClanPre then
   270                 inc(TotalRoundsPre);
   272                 inc(TotalRoundsPre);
   271             if c = SwapClanReal then
   273             if c = SwapClanReal then
   272                 inc(TotalRoundsReal);
   274                 inc(TotalRoundsReal);
   332     w: real;
   334     w: real;
   333     vg: PVisualGear;
   335     vg: PVisualGear;
   334     g: PGear;
   336     g: PGear;
   335     s: ansistring;
   337     s: ansistring;
   336 begin
   338 begin
   337 if PlacingHogs then
   339 if PlacingHogs or PlacingKings then
   338     begin
   340     begin
   339     PlacingHogs:= false;
   341     PlacingHogs:= false;
       
   342     PlacingKings:= false;
   340     for t:= 0 to Pred(TeamsCount) do
   343     for t:= 0 to Pred(TeamsCount) do
   341         for i:= 0 to cMaxHHIndex do
   344         for i:= 0 to cMaxHHIndex do
   342             if (TeamsArray[t]^.Hedgehogs[i].Gear <> nil) and (TeamsArray[t]^.Hedgehogs[i].Unplaced) then
   345             if ((GameFlags and gfPlaceHog) <> 0) and (TeamsArray[t]^.Hedgehogs[i].Gear <> nil) and (TeamsArray[t]^.Hedgehogs[i].Unplaced) then
   343                 PlacingHogs:= true;
   346                 PlacingHogs:= true
   344 
   347             else if ((GameFlags and gfPlaceHog) = 0) and ((GameFlags and gfKing) <> 0) and (TeamsArray[t]^.Hedgehogs[i].Gear <> nil) and (TeamsArray[t]^.Hedgehogs[i].UnplacedKing) then
   345     if not PlacingHogs then // Reset  various things I mucked with
   348                 PlacingKings:= true;
       
   349 
       
   350     if (not PlacingHogs) and (not PlacingKings) then // Reset various things I mucked with
   346         begin
   351         begin
   347         for i:= 0 to ClansCount do
   352         for i:= 0 to ClansCount do
   348             if ClansArray[i] <> nil then
   353             if ClansArray[i] <> nil then
   349                 begin
   354                 begin
   350                 ClansArray[i]^.TurnNumber:= 0;
   355                 ClansArray[i]^.TurnNumber:= 0;
   352         ResetWeapons
   357         ResetWeapons
   353         end;
   358         end;
   354 
   359 
   355     end;
   360     end;
   356 
   361 
   357 if not PlacingHogs then
   362 if (not PlacingHogs) and (not PlacingKings) then
   358     begin
   363     begin
   359     if (TotalRoundsReal = -1) then
   364     if (TotalRoundsReal = -1) then
   360         TotalRoundsReal:= 0;
   365         TotalRoundsReal:= 0;
   361     if (TotalRoundsPre = -1) and (ClansCount = 1) then
   366     if (TotalRoundsPre = -1) and (ClansCount = 1) then
   362         TotalRoundsPre:= 0;
   367         TotalRoundsPre:= 0;
   363     end;
   368     end;
   364 
   369 
   365 // Determine clan ID to check to determine whether to increase TotalRoundsPre/TotalRoundsReal
   370 // Determine clan ID to check to determine whether to increase TotalRoundsPre/TotalRoundsReal
   366 if (not PlacingHogs) then
   371 if (not PlacingHogs) and (not PlacingKings) then
   367     begin
   372     begin
   368     if SwapClanPre = -1 then
   373     if SwapClanPre = -1 then
   369         begin
   374         begin
   370         if (GameFlags and gfRandomOrder) <> 0 then
   375         if (GameFlags and gfRandomOrder) <> 0 then
   371             SwapClanPre:= 0
   376             SwapClanPre:= 0
   422     begin
   427     begin
   423     if CurrentHedgehog^.Unplaced then
   428     if CurrentHedgehog^.Unplaced then
   424         TurnTimeLeft:= 15000
   429         TurnTimeLeft:= 15000
   425     else TurnTimeLeft:= 0
   430     else TurnTimeLeft:= 0
   426     end
   431     end
       
   432 else if PlacingKings then
       
   433     if CurrentHedgehog^.King and CurrentHedgehog^.UnplacedKing then
       
   434         TurnTimeLeft:= cHedgehogTurnTime
       
   435     else
       
   436         TurnTimeLeft:= 0
   427 else
   437 else
   428     begin
   438     begin
   429     if ((GameFlags and gfTagTeam) <> 0) and (not NextClan) then
   439     if ((GameFlags and gfTagTeam) <> 0) and (not NextClan) then
   430         begin
   440         begin
   431         if TagTurnTimeLeft <> 0 then
   441         if TagTurnTimeLeft <> 0 then