Changeset 438 for trunk/LocalPlayer/Term.pas
- Timestamp:
- May 18, 2022, 11:12:29 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r435 r438 403 403 404 404 type 405 406 { TTribeInfo } 407 405 408 TTribeInfo = record 406 409 trix: integer; 407 410 FileName: ShortString; 408 end; 411 function GetCommandDataSize: Byte; 412 end; 413 414 { TCityNameInfo } 409 415 410 416 TCityNameInfo = record 411 417 ID: integer; 412 418 NewName: ShortString; 413 end; 419 function GetCommandDataSize: Byte; 420 end; 421 422 { TModelNameInfo } 414 423 415 424 TModelNameInfo = record 416 425 mix: integer; 417 426 NewName: ShortString; 427 function GetCommandDataSize: Byte; 418 428 end; 419 429 … … 574 584 IsControl: boolean = false); 575 585 procedure HelpOnTerrain(Loc: Integer; NewMode: TWindowMode); 586 function AlignUp(Value, Alignment: Integer): Integer; 576 587 577 588 … … 581 592 Directories, CityScreen, Draft, MessgEx, Select, CityType, Help, 582 593 UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, UPixelPointer, Sound, 583 Battle, Rates, TechTree, Registry, Global, UKeyBindings ;594 Battle, Rates, TechTree, Registry, Global, UKeyBindings, CmdList; 584 595 585 596 {$R *.lfm} … … 760 771 end; 761 772 773 function AlignUp(Value, Alignment: Integer): Integer; 774 begin 775 Result := Value or (Alignment - 1); 776 end; 777 762 778 { *** tribe management procedures *** } 763 779 … … 812 828 Tribe[p].SetModelPicture(Picture, IsNew) 813 829 else if IsNew then 814 Server(cSetNewModelPicture, 0, 0, Picture) 830 Server(CommandWithData(cSetNewModelPicture, Picture.GetCommandDataSize), 831 0, 0, Picture) 815 832 else 816 Server(cSetModelPicture, 0, 0, Picture) 833 Server(CommandWithData(cSetModelPicture, Picture.GetCommandDataSize), 834 0, 0, Picture) 817 835 else 818 836 with Tribe[p].ModelPicture[mix] do … … 961 979 ModelNameInfo.mix := MyData.ToldModels; 962 980 ModelNameInfo.NewName := EInput.Text; 963 Server(cSetModelName, me, 0, ModelNameInfo); 981 if ModelNameInfo.GetCommandDataSize > CommandDataMaxSize then 982 Delete(ModelNameInfo.NewName, Length(ModelNameInfo.NewName) - 983 (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt); 984 Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize), 985 me, 0, ModelNameInfo); 964 986 end; 965 987 end; … … 972 994 inc(MyData.ToldModels); 973 995 end; 996 end; 997 998 { TTribeInfo } 999 1000 function TTribeInfo.GetCommandDataSize: Byte; 1001 begin 1002 Result := SizeOf(trix) + 1 + Length(FileName) 1003 end; 1004 1005 { TModelNameInfo } 1006 1007 function TModelNameInfo.GetCommandDataSize: Byte; 1008 begin 1009 Result := SizeOf(mix) + 1 + Length(NewName); 1010 end; 1011 1012 { TCityNameInfo } 1013 1014 function TCityNameInfo.GetCommandDataSize: Byte; 1015 begin 1016 Result := SizeOf(ID) + 1 + Length(NewName); 974 1017 end; 975 1018 … … 2731 2774 CreateTribe(TribeInfo.trix, TribeInfo.FileName, false) 2732 2775 else 2733 Server(cSetTribe, 0, 0, TribeInfo); 2776 Server(CommandWithData(cSetTribe, TribeInfo.GetCommandDataSize), 2777 0, 0, TribeInfo); 2734 2778 end; 2735 2779 … … 2745 2789 CreateTribe(TribeInfo.trix, TribeInfo.FileName, false) 2746 2790 else 2747 Server(cSetTribe, 0, 0, TribeInfo); 2791 Server(CommandWithData(cSetTribe, TribeInfo.GetCommandDataSize), 2792 0, 0, TribeInfo); 2748 2793 end; 2749 2794 end; … … 3445 3490 else 3446 3491 if Command >= cClientEx then 3447 case Command of3492 case Command and (not Integer(CommandDataElementCountMask)) of 3448 3493 cSetTribe: 3449 3494 with TTribeInfo(Data) do begin
Note:
See TracChangeset
for help on using the changeset viewer.