Ignore:
Timestamp:
Apr 21, 2024, 8:55:53 PM (7 months ago)
Author:
chronos
Message:
  • Modified: Optimize code with earlier break from for cycle evaluating boolean result.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Select.pas

    r536 r549  
    11191119                  if (Loc1 >= 0) and (Loc1 < G.lx * G.ly) and
    11201120                    ((MyMap[Loc1] and fTerrain = fShore) or
    1121                     (MyMap[Loc1] and fCanal > 0)) then
    1122                     Ok := True;
     1121                    (MyMap[Loc1] and fCanal > 0)) then begin
     1122                      Ok := True;
     1123                      Break;
     1124                    end;
    11231125                end;
    11241126          end
     
    11661168        for I := 0 to nDomains - 1 do
    11671169          if (upgrade[I, 0].Preq = preNone) or
    1168             (MyRO.Tech[upgrade[I, 0].Preq] >= tsApplicable) then
    1169             Ok := True;
     1170            (MyRO.Tech[upgrade[I, 0].Preq] >= tsApplicable) then begin
     1171              Ok := True;
     1172              Break;
     1173            end;
    11701174        if Ok then { new unit class }
    11711175        begin
     
    12731277          with MyRO.EnemyReport[Column[J]]^ do
    12741278            if (MyRO.Alive and (1 shl Column[J]) <> 0) and
    1275               (TurnOfCivilReport >= 0) and (ResearchTech = adMilitary) then
    1276               Ok := True;
     1279              (TurnOfCivilReport >= 0) and (ResearchTech = adMilitary) then begin
     1280                Ok := True;
     1281                Break;
     1282              end;
    12771283        if Ok then
    12781284        begin
     
    13331339          for emix := 0 to MyRO.nEnemyModel - 1 do
    13341340            if (MyRO.EnemyModel[emix].Owner = DipMem[Me].pContact) and
    1335               IsSameModel(MyRO.EnemyModel[emix], mi) then
    1336               Ok := False;
     1341              IsSameModel(MyRO.EnemyModel[emix], mi) then begin
     1342                Ok := False;
     1343                Break;
     1344              end;
    13371345          if Ok then
    13381346          begin
     
    14391447          end;
    14401448        SortModels;
    1441         FirstShrinkedLine[0] := 0
     1449        FirstShrinkedLine[0] := 0;
    14421450      end;
    14431451    kTribe:
     
    15541562  MultiPage := False;
    15551563  for I := 1 to MaxLayer - 1 do
    1556     if Lines[I] > 0 then
     1564    if Lines[I] > 0 then begin
    15571565      MultiPage := True;
     1566      Break;
     1567    end;
    15581568  WideBottom := MultiPage or (Kind = kScience) or
    15591569    not Phrases2FallenBackToEnglish and
     
    17371747          ((AdvValue[I] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and
    17381748          ((AdvValue[I] < 1000) or (MyRO.Tech[adScience] > tsNA)) and
    1739           (Server(sSetResearch - sExecute, Me, I, nil^) < rExecuted) then
    1740           ShowFocus := True;
     1749          (Server(sSetResearch - sExecute, Me, I, nil^) < rExecuted) then begin
     1750            ShowFocus := True;
     1751            Break;
     1752          end;
    17411753    end;
    17421754  ToggleBtn.Visible := (Kind = kCities) and not Supervising or (Kind = kAdvance)
Note: See TracChangeset for help on using the changeset viewer.