Ignore:
Timestamp:
Mar 19, 2021, 12:32:32 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Defined and used more Templates graphic set items.
  • Fixed: Incorrect evaluation of nil graphic set references.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Select.pas

    r315 r318  
    5353    Column: array [0 .. nPl - 1] of integer;
    5454    Closable, MultiPage: boolean;
    55     ScienceNationDot: TBitmap;
     55    ScienceNationDotBuffer: TBitmap;
    5656    procedure ScrollBarUpdate(Sender: TObject);
    5757    procedure InitLines;
     
    110110  Layer1Btn.Hint := Phrases.Lookup('BTN_WONDERS');
    111111  Layer2Btn.Hint := Phrases.Lookup('BTN_CLASSES');
    112   ScienceNationDot := TBitmap.Create;
    113   ScienceNationDot.PixelFormat := pf24bit;
    114   ScienceNationDot.SetSize(17, 17);
    115   ScienceNationDot.Canvas.FillRect(0, 0, ScienceNationDot.Width, ScienceNationDot.Height);
     112  ScienceNationDotBuffer := TBitmap.Create;
     113  ScienceNationDotBuffer.PixelFormat := pf24bit;
     114  ScienceNationDotBuffer.SetSize(17, 17);
     115  ScienceNationDotBuffer.Canvas.FillRect(0, 0, ScienceNationDotBuffer.Width, ScienceNationDotBuffer.Height);
    116116end;
    117117
     
    119119begin
    120120  FreeAndNil(sb);
    121   FreeAndNil(ScienceNationDot);
     121  FreeAndNil(ScienceNationDotBuffer);
    122122end;
    123123
     
    817817        LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10,
    818818          ClientHeight - 29, s);
    819         BitBltCanvas(ScienceNationDot.Canvas, 0, 0, 17, 17, Canvas,
    820           xScreen - 10, ClientHeight - 27);
    821         ImageOp_BCC(ScienceNationDot, Templates.Data, 0, 0, 114, 211, 17, 17,
    822           MainTexture.clBevelShade, Tribe[ScienceNation].Color);
    823         BitBltCanvas(Canvas, xScreen - 10, ClientHeight - 27, 17, 17,
    824           ScienceNationDot.Canvas, 0, 0);
    825       end;
    826     end
     819        BitBltCanvas(ScienceNationDotBuffer.Canvas, 0, 0, ScienceNationDot.Width,
     820          ScienceNationDot.Height, Canvas, xScreen - 10, ClientHeight - 27);
     821        ImageOp_BCC(ScienceNationDotBuffer, Templates.Data, Point(0, 0),
     822          ScienceNationDot.BoundsRect, MainTexture.clBevelShade, Tribe[ScienceNation].Color);
     823        BitBltCanvas(Canvas, xScreen - 10, ClientHeight - 27, ScienceNationDot.Width,
     824          ScienceNationDot.Height, ScienceNationDotBuffer.Canvas, 0, 0);
     825      end;
     826    end;
    827827  end;
    828828end;
     
    855855    begin
    856856      CityDlg.FormShow(nil);
    857       CityDlg.Invalidate
     857      CityDlg.Invalidate;
    858858    end;
    859     result := true
     859    result := true;
    860860  end
    861861  else
    862     result := false
     862    result := false;
    863863end;
    864864
     
    881881    begin
    882882      UnitStatDlg.FormShow(nil);
    883       UnitStatDlg.Invalidate
     883      UnitStatDlg.Invalidate;
    884884    end;
    885     result := true
     885    result := true;
    886886  end
    887887  else
    888     result := false
     888    result := false;
    889889end;
    890890
     
    905905      result := lix;
    906906      Closable := true;
    907       Close
    908     end
     907      Close;
     908    end;
    909909  end
    910910  else if (ssLeft in Shift) and (ssShift in Shift) then
     
    949949        kShipPart, kEShipPart:
    950950          ;
    951       end
     951      end;
    952952  end
    953953  else if ssRight in Shift then
     
    961961          if RenameModel(lix) then
    962962            SmartUpdateContent;
    963       end
    964   end
     963      end;
     964  end;
    965965end;
    966966
     
    991991            swap := code[0, i];
    992992            code[0, i] := code[0, j];
    993             code[0, j] := swap
     993            code[0, j] := swap;
    994994          end;
    995995  end;
     
    10061006          swap := code[0, i];
    10071007          code[0, i] := code[0, j];
    1008           code[0, j] := swap
     1008          code[0, j] := swap;
    10091009        end;
    10101010  end;
     
    10471047      if (AdvPreq[i, 1] >= 0) then
    10481048        MarkPreqs(AdvPreq[i, 1]);
    1049     end
     1049    end;
    10501050  end;
    10511051
     
    10601060  begin
    10611061    Lines[i] := 0;
    1062     FirstShrinkedLine[i] := MaxInt
     1062    FirstShrinkedLine[i] := MaxInt;
    10631063  end;
    10641064  case Kind of
     
    11031103                    (MyMap[Loc1] and fCanal > 0)) then
    11041104                    ok := true;
    1105                 end
     1105                end;
    11061106          end
    11071107          else
     
    11121112            begin
    11131113              code[2, Lines[2]] := i;
    1114               inc(Lines[2])
     1114              inc(Lines[2]);
    11151115            end;
    11161116            if MyModel[i].Status and msAllowConscripts <> 0 then
    11171117            begin
    11181118              code[2, Lines[2]] := i + cpConscripts;
    1119               inc(Lines[2])
     1119              inc(Lines[2]);
    11201120            end;
    11211121          end;
     
    11531153        begin
    11541154          code[0, Lines[0]] := adMilitary;
    1155           inc(Lines[0])
     1155          inc(Lines[0]);
    11561156        end;
    11571157      end;
     
    12701270            begin
    12711271              code[0, Lines[0]] := i;
    1272               inc(Lines[0])
     1272              inc(Lines[0]);
    12731273            end;
    12741274        SortCities;
     
    12821282          begin
    12831283            code[0, Lines[0]] := i;
    1284             inc(Lines[0])
     1284            inc(Lines[0]);
    12851285          end;
    12861286        SortCities;
    1287         FirstShrinkedLine[0] := 0
     1287        FirstShrinkedLine[0] := 0;
    12881288      end;
    12891289    { kChooseECity:
     
    13051305        Lines[0] := MyRO.nModel;
    13061306        SortModels;
    1307         FirstShrinkedLine[0] := 0
     1307        FirstShrinkedLine[0] := 0;
    13081308      end;
    13091309    kChooseModel:
     
    13291329        begin
    13301330          code[0, Lines[0]] := mixAll;
    1331           inc(Lines[0]);
    1332         end;
    1333         FirstShrinkedLine[0] := 0
     1331          inc(Lines[0]);;
     1332        end;
     1333        FirstShrinkedLine[0] := 0;
    13341334      end;
    13351335    kChooseEModel:
     
    13491349          if ModelOk[emix] then
    13501350          begin
    1351             if Tribe[DipMem[me].pContact].ModelPicture
    1352               [MyRO.EnemyModel[emix].mix].HGr = HGrSystem then
     1351            if not Assigned(Tribe[DipMem[me].pContact].ModelPicture
     1352              [MyRO.EnemyModel[emix].mix].HGr) then
    13531353              InitEnemyModel(emix);
    13541354            code[0, Lines[0]] := emix;
     
    13621362          inc(Lines[0]);
    13631363        end;
    1364         FirstShrinkedLine[0] := 0
     1364        FirstShrinkedLine[0] := 0;
    13651365      end;
    13661366    kEModels:
     
    13731373            (MyRO.EnemyModel[code[1, Lines[0]]].mix = i)) do
    13741374            dec(code[1, Lines[0]]);
    1375           if Tribe[pView].ModelPicture[i].HGr = HGrSystem then
     1375          if not Assigned(Tribe[pView].ModelPicture[i].HGr) then
    13761376            InitEnemyModel(code[1, Lines[0]]);
    13771377          code[0, Lines[0]] := i;
     
    13811381        end;
    13821382        SortModels;
    1383         FirstShrinkedLine[0] := 0
     1383        FirstShrinkedLine[0] := 0;
    13841384      end;
    13851385    kAllEModels:
     
    13941394            PPicture := @Tribe[MyRO.EnemyModel[emix].Owner].ModelPicture
    13951395              [MyRO.EnemyModel[emix].mix];
    1396             if PPicture.HGr = HGrSystem then
     1396            if not Assigned(PPicture.HGr) then
    13971397              InitEnemyModel(emix);
    13981398            ok := true;
     
    14091409                  code[1, j] := 1;
    14101410                  ok := false;
    1411                   Break
     1411                  Break;
    14121412                end;
    14131413              end;
     
    14181418              code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], true);
    14191419              inc(Lines[0]);
    1420             end
     1420            end;
    14211421          end;
    14221422        SortModels;
     
    14271427      begin
    14281428        code[0, Lines[0]] := i;
    1429         inc(Lines[0])
     1429        inc(Lines[0]);
    14301430      end;
    14311431    (* kDeliver:
     
    14721472        begin
    14731473          code[0, Lines[0]] := i;
    1474           inc(Lines[0])
     1474          inc(Lines[0]);
    14751475        end;
    14761476    kMission:
     
    14781478      begin
    14791479        code[0, Lines[0]] := i;
    1480         inc(Lines[0])
     1480        inc(Lines[0]);
    14811481      end;
    14821482  end;
     
    15861586          TechNameSpace := TechNameSpace + 640 - InnerWidth - 2 * SideFrame;
    15871587          InnerWidth := 640 - 2 * SideFrame
    1588         end
     1588        end;
    15891589      end;
    15901590    kAdvance, kFarAdvance:
     
    16951695  begin
    16961696    ToggleBtn.ButtonIndex := 13;
    1697     ToggleBtn.Hint := Phrases.Lookup('FARTECH')
     1697    ToggleBtn.Hint := Phrases.Lookup('FARTECH');
    16981698  end
    16991699  else if Kind = kCities then
    17001700  begin
    17011701    ToggleBtn.ButtonIndex := 15;
    1702     ToggleBtn.Hint := Phrases.Lookup('BTN_PAGE')
     1702    ToggleBtn.Hint := Phrases.Lookup('BTN_PAGE');
    17031703  end
    17041704  else
    17051705  begin
    17061706    ToggleBtn.ButtonIndex := 28;
    1707     ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT')
     1707    ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT');
    17081708  end;
    17091709
     
    17401740    ShowNewContent(NewMode, kModels)
    17411741  else
    1742     ShowNewContent(NewMode, kEModels)
     1742    ShowNewContent(NewMode, kEModels);
    17431743end;
    17441744
     
    17561756  sb.Init(Lines[Layer] - 1, DispLines);
    17571757  OffscreenPaint;
    1758   Invalidate
     1758  Invalidate;
    17591759end;
    17601760
     
    17681768  Sel := -2;
    17691769  sb.Init(Lines[Layer] - 1, DispLines);
    1770   SmartUpdateContent
     1770  SmartUpdateContent;
    17711771end;
    17721772
     
    17811781        result := adFar;
    17821782        Closable := true;
    1783         Close
     1783        Close;
    17841784      end;
    17851785    kCities, kCityEvents:
     
    18211821        Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top +
    18221822          ToggleBtn.Height);
    1823       end
    1824   end
     1823      end;
     1824  end;
    18251825end;
    18261826
     
    18351835  // prevent closing
    18361836  else
    1837     inherited
     1837    inherited;
    18381838end;
    18391839
     
    18411841begin
    18421842  if Visible and (Kind = kCities) then
    1843     SmartUpdateContent
     1843    SmartUpdateContent;
    18441844end;
    18451845
Note: See TracChangeset for help on using the changeset viewer.