Ignore:
Timestamp:
Mar 19, 2021, 12:32:32 PM (4 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/Term.pas

    r316 r318  
    752752  for emix := 0 to MyRO.nEnemyModel - 1 do
    753753    with MyRO.EnemyModel[emix] do
    754       if Tribe[Owner].ModelPicture[mix].HGr = HGrSystem then
     754      if not Assigned(Tribe[Owner].ModelPicture[mix].HGr) then
    755755        InitEnemyModel(emix);
    756756end;
     
    835835    while MyData.ToldModels < MyRO.nModel do
    836836    begin { new Unit class available }
    837       if (ModelPicture[MyData.ToldModels].HGr <> HGrSystem) and
     837      if Assigned(ModelPicture[MyData.ToldModels].HGr) and
    838838        (MyModel[MyData.ToldModels].Kind <> mkSelfDeveloped) then
    839839      begin // save picture of DevModel
    840840        ModelPicture[MyData.ToldModels + 1] := ModelPicture[MyData.ToldModels];
    841841        ModelName[MyData.ToldModels + 1] := ModelName[MyData.ToldModels];
    842         ModelPicture[MyData.ToldModels].HGr := HGrSystem
     842        ModelPicture[MyData.ToldModels].HGr := nil;
    843843      end;
    844       if ModelPicture[MyData.ToldModels].HGr = HGrSystem then
     844      if not Assigned(ModelPicture[MyData.ToldModels].HGr) then
    845845        InitMyModel(MyData.ToldModels, true);
    846846      { only run if no researched model }
     
    873873          Server(cSetModelName + (Length(ModelNameInfo.NewName) + 1 + 4 + 3)
    874874            div 4, me, 0, ModelNameInfo);
    875         end
     875        end;
    876876      end;
    877877      if MyModel[MyData.ToldModels].Kind = mkSettler then
     
    10431043        DraftDlg.ShowNewContent(wmModal);
    10441044        if DraftDlg.ModalResult <> mrOK then
    1045           Tribe[me].ModelPicture[MyRO.nModel].HGr := HGrSystem
     1045          Tribe[me].ModelPicture[MyRO.nModel].HGr := nil
    10461046      end;
    10471047    until (ChosenResearch <> adMilitary) or (DraftDlg.ModalResult = mrOK);
     
    27852785              ItsMeAgain(p1);
    27862786              for mix := 0 to MyRO.nModel - 1 do
    2787                 if Tribe[me].ModelPicture[mix].HGr = HGrSystem then
     2787                if not Assigned(Tribe[me].ModelPicture[mix].HGr) then
    27882788                  InitMyModel(mix, true);
    27892789            end;
     
    30753075        begin
    30763076          CurrentMoveInfo.DoShow := false;
    3077           if not idle and (Tribe[Owner].ModelPicture[mix].HGr = HGrSystem) then
     3077          if not idle and (not Assigned(Tribe[Owner].ModelPicture[mix].HGr)) then
    30783078            InitEnemyModel(emix);
    30793079
     
    32703270          begin
    32713271            ToLoc := dLoc(FromLoc, dx, dy);
    3272             if Tribe[Owner].ModelPicture[mix].HGr = HGrSystem then
     3272            if not Assigned(Tribe[Owner].ModelPicture[mix].HGr) then
    32733273              InitEnemyModel(emix);
    32743274
     
    34033403            if TribeOriginal[NewPlayer] then
    34043404              Tribe[NewPlayer].ModelName[mix] := NewName;
    3405       end
    3406   end
     3405      end;
     3406  end;
    34073407end;
    34083408
     
    48594859
    48604860    // treasury section
    4861     ImageOp_BCC(TopBar, Templates.Data, xTreasurySection + 8, 1, 145, 1, 36, 36,
     4861    ImageOp_BCC(TopBar, Templates.Data, Point(xTreasurySection + 8, 1), TreasuryIcon.BoundsRect,
    48624862      $40A040, $4030C0);
    48634863    s := IntToStr(TrueMoney);
     
    48664866    if MyRO.Government <> gAnarchy then
    48674867    begin
    4868       ImageOp_BCC(TopBar, Templates.Data, xTreasurySection + 48, 22, 124, 1, 14, 14,
     4868      ImageOp_BCC(TopBar, Templates.Data, Point(xTreasurySection + 48, 22), ChangeIcon.BoundsRect,
    48694869        $0000C0, $0080C0);
    48704870      if TaxSum >= 0 then
     
    48774877
    48784878    // research section
    4879     ImageOp_BCC(TopBar, Templates.Data, xResearchSection + 8, 1, 145, 75, 36, 36,
     4879    ImageOp_BCC(TopBar, Templates.Data, Point(xResearchSection + 8, 1), ResearchIcon.BoundsRect,
    48804880      $FF0000, $00FFE0);
    48814881    if MyData.FarTech <> adNexus then
     
    49284928    if (MyData.FarTech <> adNexus) and (ScienceSum > 0) then
    49294929    begin
    4930       ImageOp_BCC(TopBar, Templates.Data, xResearchSection + 48 + CostFactor + 11,
    4931         22, 124, 1, 14, 14, $0000C0, $0080C0);
     4930      ImageOp_BCC(TopBar, Templates.Data, Point(xResearchSection + 48 + CostFactor + 11,
     4931        22), ChangeIcon.BoundsRect, $0000C0, $0080C0);
    49324932      s := Format(Phrases.Lookup('TECHGAIN'), [ScienceSum]);
    49334933      LoweredTextOut(TopBar.Canvas, -1, MainTexture, xResearchSection + 48 +
     
    53535353              MyRO.EnemyModel[emix].mix, MouseLoc) >= rExecuted) then
    53545354            begin
    5355               if Tribe[p1].ModelPicture[MyRO.EnemyModel[emix].mix].HGr = HGrSystem then
     5355              if not Assigned(Tribe[p1].ModelPicture[MyRO.EnemyModel[emix].mix].HGr) then
    53565356                InitEnemyModel(emix);
    53575357              m2 := TMenuItem.Create(m);
     
    64476447    SumCities(TaxSum, ScienceSum);
    64486448    for i := 0 to MyRO.nModel - 1 do
    6449       if Tribe[me].ModelPicture[i].HGr = HGrSystem then
     6449      if not Assigned(Tribe[me].ModelPicture[i].HGr) then
    64506450        InitMyModel(i, True);
    64516451
Note: See TracChangeset for help on using the changeset viewer.