Ignore:
Timestamp:
May 18, 2022, 11:12:29 AM (2 years ago)
Author:
chronos
Message:
  • Fixed: Data size was not correctly stored in server commands. Introduced in rev 435.
  • Fixed: Check data size for its maximum. Limit maximum length of unit and city name so it can fit into data block.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Select.pas

    r435 r438  
    55
    66uses
    7   Protocol, ClientTools, Term, ScreenTools, IsoEngine, PVSB, BaseWin,
     7  Protocol, ClientTools, Term, ScreenTools, PVSB, BaseWin,
    88  LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    99  ExtCtrls, ButtonB, ButtonBase, Menus, Types;
     
    9999
    100100uses
    101   CityScreen, Help, UnitStat, Tribes, Inp;
     101  CityScreen, Help, UnitStat, Tribes, Inp, CmdList;
    102102
    103103{$R *.lfm}
     
    865865    CityNameInfo.ID := MyCity[cix].ID;
    866866    CityNameInfo.NewName := InputDlg.EInput.Text;
    867     Server(cSetCityName, me, 0, CityNameInfo);
     867    if CityNameInfo.GetCommandDataSize > CommandDataMaxSize then
     868      Delete(CityNameInfo.NewName, Length(CityNameInfo.NewName) -
     869        (CityNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt);
     870    Server(CommandWithData(cSetCityName, CityNameInfo.GetCommandDataSize),
     871      me, 0, CityNameInfo);
    868872    if CityDlg.Visible then
    869873    begin
     
    871875      CityDlg.Invalidate;
    872876    end;
    873     result := true;
     877    Result := True;
    874878  end
    875879  else
    876     result := false;
     880    Result := False;
    877881end;
    878882
     
    890894    ModelNameInfo.mix := mix;
    891895    ModelNameInfo.NewName := InputDlg.EInput.Text;
    892     Server(cSetModelName, me, 0, ModelNameInfo);
     896    if ModelNameInfo.GetCommandDataSize > CommandDataMaxSize then
     897      Delete(ModelNameInfo.NewName, Length(ModelNameInfo.NewName) -
     898        (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt);
     899    Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize),
     900      me, 0, ModelNameInfo);
    893901    if UnitStatDlg.Visible then
    894902    begin
Note: See TracChangeset for help on using the changeset viewer.