Changeset 435


Ignore:
Timestamp:
May 4, 2022, 4:59:24 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Possible exception during cities or units rename with right mouse click.
  • Fixed: Gtk2Fix added to more places.
  • Modified: Code cleanup;
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GameServer.pas

    r425 r435  
    155155    end;
    156156{$ENDIF}
    157   end
     157  end;
    158158end;
    159159
  • trunk/LocalPlayer/Select.pas

    r431 r435  
    2727    ToggleBtn: TButtonB;
    2828    Popup: TPopupMenu;
     29    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2930    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
    3031      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
     
    291292          begin
    292293            first := j;
    293             Break
     294            Break;
    294295          end;
    295296        if first >= 0 then
     
    300301          begin
    301302            inc(i);
    302             inc(test, test)
     303            inc(test, test);
    303304          end;
    304305          s := CityEventName(i);
     
    321322                begin
    322323                  inc(i);
    323                   inc(test, test)
     324                  inc(test, test);
    324325                end;
    325326                if (CityEventPriority[j] = chNoGrowthWarning) and
     
    328329                Sprite(offscreen, HGrSystem, x, y0 + 1, 18, 18,
    329330                  1 + i mod 3 * 19, 1 + i div 3 * 19);
    330                 dec(x, 20)
    331               end
    332           end
    333         end
     331                dec(x, 20);
     332              end;
     333          end;
     334        end;
    334335      end
    335336      else
     
    366367              y0 + 1, s);
    367368            ca.Font.Assign(UniFont[ftNormal]);
    368           end
     369          end;
    369370        end
    370371        else
     
    385386            Sprite(offscreen, HGrSystem, x + CityNameSpace + 4 + 132 + 1, y + 6,
    386387              10, 10, 88, 115);
    387           end
     388          end;
    388389        end;
    389390        s := inttostr(CityTaxBalance(lix, CityReport));
     
    421422              CityReport.ProjectCost, true, MainTexture);
    422423          end;
    423         end
     424        end;
    424425      end;
    425426    end
     
    431432    begin
    432433      x := x + SideFrame;
    433       y := y + TitleHeight
     434      y := y + TitleHeight;
    434435    end;
    435436    if lit then
     
    631632                    icon := 4 + ResearchDone div 25;
    632633                    if icon > 4 + 3 then
    633                       icon := 4 + 3
     634                      icon := 4 + 3;
    634635                  end
    635636                  else if lix = adMilitary then
     
    654655                RisedTextout(ca, 104 - 33 + 15 + 10 + TechNameSpace + 24 * j -
    655656                  BiColorTextWidth(ca, number) div 2, y0, number);
    656               end
    657             end
     657              end;
     658            end;
    658659          end;
    659660        end; // kAdvance, kScience
     
    685686              xSizeSmall, ySizeSmall, SmallImp.Canvas,
    686687              (lix - 1) * xSizeSmall, ySizeSmall);
    687           end
     688          end;
    688689        end;
    689690      kMission:
     
    709710    begin
    710711      x := x + SideFrame;
    711       y := y + TitleHeight
     712      y := y + TitleHeight;
    712713    end;
    713714    if lit then
     
    718719      integer(TribeNames.Objects[lix]),s)
    719720      else } ReplaceText(x, y, TextColor, s);
    720   end
     721  end;
    721722end;
    722723
     
    760761            MoveTo(104 - 33 + 15 + TechNameSpace + 24 * i + j * 2, 0);
    761762            LineTo(104 - 33 + 15 + TechNameSpace + 24 * i + j * 2, InnerHeight);
    762           end
     763          end;
    763764        end;
    764765      end;
     
    766767    for i := -1 to DispLines do
    767768      if (i + sb.Position >= 0) and (i + sb.Position < Lines[Layer]) then
    768         Self.line(offscreen.Canvas, i, true, false)
     769        Self.line(offscreen.Canvas, i, true, false);
    769770  end;
    770771  MarkUsedOffscreen(InnerWidth, 8 + 48 + DispLines * LineDistance);
     
    794795      line(Canvas, Sel0, false, false);
    795796    if Sel <> -2 then
    796       line(Canvas, Sel, false, true)
     797      line(Canvas, Sel, false, true);
    797798  end;
    798799
     
    846847end;
    847848
     849procedure TListDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     850begin
     851  Gtk2Fix;
     852end;
     853
    848854function TListDlg.RenameCity(cix: integer): boolean;
    849855var
     
    859865    CityNameInfo.ID := MyCity[cix].ID;
    860866    CityNameInfo.NewName := InputDlg.EInput.Text;
    861     Server(cSetCityName + (length(CityNameInfo.NewName) + 8) div 4, me, 0,
    862       CityNameInfo);
     867    Server(cSetCityName, me, 0, CityNameInfo);
    863868    if CityDlg.Visible then
    864869    begin
     
    885890    ModelNameInfo.mix := mix;
    886891    ModelNameInfo.NewName := InputDlg.EInput.Text;
    887     Server(cSetModelName + (length(ModelNameInfo.NewName) + 1 + 4 + 3) div 4,
    888       me, 0, ModelNameInfo);
     892    Server(cSetModelName, me, 0, ModelNameInfo);
    889893    if UnitStatDlg.Visible then
    890894    begin
     
    17361740
    17371741  inherited ShowNewContent(NewMode, forceclose);
    1738 end; // ShowNewContent
     1742end;
    17391743
    17401744procedure TListDlg.ShowNewContent_CityProject(NewMode: TWindowMode; cix: integer);
  • trunk/LocalPlayer/Term.pas

    r431 r435  
    772772      result := 2;
    773773    100:
    774       result := 3
     774      result := 3;
    775775  end;
    776776end;
     
    812812      Tribe[p].SetModelPicture(Picture, IsNew)
    813813    else if IsNew then
    814       Server(cSetNewModelPicture + (Length(Picture.GrName) + 1 + 16 + 3) div 4,
    815         0, 0, Picture)
     814      Server(cSetNewModelPicture, 0, 0, Picture)
    816815    else
    817       Server(cSetModelPicture + (Length(Picture.GrName) + 1 + 16 + 3) div 4, 0,
    818         0, Picture)
     816      Server(cSetModelPicture, 0, 0, Picture)
    819817  else
    820818    with Tribe[p].ModelPicture[mix] do
     
    830828  begin
    831829    result := false;
    832     exit
     830    exit;
    833831  end;
    834832  with MyRO.EnemyModel[emix] do
     
    914912        TribeMessage(p1, Tribe[p1].TPhrase('FRNEWNATION'), '');
    915913        MyData.ToldContact := MyData.ToldContact or (1 shl p1);
    916       end
     914      end;
    917915end;
    918916
     
    963961          ModelNameInfo.mix := MyData.ToldModels;
    964962          ModelNameInfo.NewName := EInput.Text;
    965           Server(cSetModelName + (Length(ModelNameInfo.NewName) + 1 + 4 + 3)
    966             div 4, me, 0, ModelNameInfo);
     963          Server(cSetModelName, me, 0, ModelNameInfo);
    967964        end;
    968965      end;
     
    18571854          GrName := 'StdUnits.png';
    18581855          Tribe[p1].SetModelPicture(Picture, true);
    1859         end
     1856        end;
    18601857  end;
    18611858
     
    21392136              begin
    21402137                OpenSound := 'MSG_COLDWAR';
    2141                 s := Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('COLDWAR')
     2138                s := Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('COLDWAR');
    21422139              end
    21432140              else if MyRO.Wonder[i].EffectiveOwner >= 0 then
     
    21452142                OpenSound := 'WONDER_BUILT';
    21462143                s := Tribe[MyRO.Wonder[i].EffectiveOwner]
    2147                   .TPhrase('WONDERBUILT')
     2144                  .TPhrase('WONDERBUILT');
    21482145              end
    21492146              else
     
    21612158              IconIndex := i;
    21622159              ShowModal;
    2163             end
    2164         end
     2160            end;
     2161        end;
    21652162      end
    21662163      else if (MyRO.Wonder[i].EffectiveOwner <> MyData.ToldWonders[i]
     
    21812178              IconIndex := i;
    21822179              ShowModal;
    2183             end
     2180            end;
    21842181        end
    21852182        else if (MyData.ToldWonders[i].EffectiveOwner >= 0) and not OwnWonder
     
    22032200    begin
    22042201      SoundMessageEx(Phrases.Lookup('COLDWAREND'), 'MSG_DEFAULT');
    2205       MyData.ColdWarStart := -ColdWarTurns - 1
     2202      MyData.ColdWarStart := -ColdWarTurns - 1;
    22062203    end;
    22072204
     
    27342731                CreateTribe(TribeInfo.trix, TribeInfo.FileName, false)
    27352732              else
    2736                 Server(cSetTribe + (Length(TribeInfo.FileName) + 1 + 7) div 4,
    2737                   0, 0, TribeInfo);
     2733                Server(cSetTribe, 0, 0, TribeInfo);
    27382734            end;
    27392735
     
    27492745                CreateTribe(TribeInfo.trix, TribeInfo.FileName, false)
    27502746              else
    2751                 Server(cSetTribe + (Length(TribeInfo.FileName) + 1 + 7) div 4,
    2752                   0, 0, TribeInfo);
     2747                Server(cSetTribe, 0, 0, TribeInfo);
    27532748            end;
    27542749        end;
     
    34453440          MainOffscreenPaint;
    34463441          Update;
    3447         end
     3442        end;
    34483443      end;
    34493444
    34503445  else
    34513446    if Command >= cClientEx then
    3452       case Command and $FFF0 of
    3453 
     3447      case Command  of
    34543448        cSetTribe:
    3455           with TTribeInfo(Data) do
    3456           begin
     3449          with TTribeInfo(Data) do begin
    34573450            i := UnusedTribeFiles.Count - 1;
    34583451            while (i >= 0) and
     
    34633456            CreateTribe(trix, FileName, true);
    34643457          end;
    3465 
    3466         cSetNewModelPicture, cSetModelPicture:
     3458        cSetNewModelPicture:
    34673459          if TribeOriginal[TModelPictureInfo(Data).trix] then
    34683460            Tribe[TModelPictureInfo(Data).trix].SetModelPicture
    3469               (TModelPictureInfo(Data), Command and
    3470               $FFF0 = cSetNewModelPicture);
    3471 
    3472         cSetSlaveIndex and $FFF0:
     3461              (TModelPictureInfo(Data), True);
     3462        cSetModelPicture:
     3463          if TribeOriginal[TModelPictureInfo(Data).trix] then
     3464            Tribe[TModelPictureInfo(Data).trix].SetModelPicture
     3465              (TModelPictureInfo(Data), False);
     3466        cSetSlaveIndex:
    34733467          Tribe[integer(Data) shr 16].mixSlaves := integer(Data) and $FFFF;
    3474 
    34753468        cSetCityName:
    34763469          with TCityNameInfo(Data) do
    34773470            if TribeOriginal[ID shr 12] then
    34783471              Tribe[ID shr 12].SetCityName(ID and $FFF, NewName);
    3479 
    34803472        cSetModelName:
    34813473          with TModelNameInfo(Data) do
     
    51385130      Brush.Style := bsClear;
    51395131      if UnFocus >= 0 then
    5140         with MyUn[UnFocus] do
    5141         with MyModel[mix] do
     5132        with MyUn^[UnFocus] do
     5133        with MyModel^[mix] do
    51425134        begin { display info about selected unit }
    51435135          if Job = jCity then
Note: See TracChangeset for help on using the changeset viewer.