Changeset 419
- Timestamp:
- Dec 28, 2021, 3:34:33 PM (3 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.lfm
r387 r419 1 1 object MainScreen: TMainScreen 2 Left = 5162 Left = 469 3 3 Height = 480 4 Top = 8344 Top = 251 5 5 Width = 800 6 6 HorzScrollBar.Visible = False … … 12 12 Constraints.MinHeight = 480 13 13 Constraints.MinWidth = 800 14 DesignTimePPI = 1 4414 DesignTimePPI = 120 15 15 Font.Color = clWindowText 16 16 Font.Height = -13 … … 227 227 Tag = 7 228 228 ShortCut = 112 229 OnClick = MenuClick229 OnClick = mHelpClick 230 230 end 231 231 object mTechTree: TMenuItem 232 232 GroupIndex = 1 233 233 ShortCut = 84 234 OnClick = MenuClick234 OnClick = mTechTreeClick 235 235 end 236 236 object N12: TMenuItem … … 491 491 Tag = 54 492 492 ShortCut = 16458 493 OnClick = MenuClick493 OnClick = mJumpClick 494 494 end 495 495 object mRun: TMenuItem 496 496 Tag = 63 497 497 ShortCut = 16466 498 OnClick = MenuClick498 OnClick = mRunClick 499 499 end 500 500 object mNames: TMenuItem … … 552 552 object mEnhanceDef: TMenuItem 553 553 Tag = 40 554 OnClick = MenuClick554 OnClick = mEnhanceDefClick 555 555 end 556 556 object mCityTypes: TMenuItem 557 557 Tag = 11 558 OnClick = MenuClick558 OnClick = mCityTypesClick 559 559 end 560 560 end … … 563 563 GroupIndex = 1 564 564 ShortCut = 16466 565 OnClick = MenuClick565 OnClick = mRandomMapClick 566 566 end 567 567 object N3: TMenuItem … … 572 572 Tag = 88 573 573 GroupIndex = 1 574 OnClick = MenuClick574 OnClick = mWebsiteClick 575 575 end 576 576 object N2: TMenuItem … … 582 582 GroupIndex = 1 583 583 ShortCut = 16465 584 OnClick = MenuClick584 OnClick = mResignClick 585 585 end 586 586 end … … 592 592 Tag = 72 593 593 ShortCut = 16452 594 OnClick = MenuClick594 OnClick = mDisbandOrUtilizeClick 595 595 end 596 596 object mUtilize: TMenuItem 597 597 ShortCut = 90 598 OnClick = MenuClick598 OnClick = mDisbandOrUtilizeClick 599 599 end 600 600 object N1: TMenuItem … … 603 603 object mcity: TMenuItem 604 604 ShortCut = 66 605 OnClick = MenuClick605 OnClick = mcityClick 606 606 end 607 607 object mPillage: TMenuItem 608 608 Tag = 19 609 609 ShortCut = 16464 610 OnClick = MenuClick610 OnClick = mPillageClick 611 611 end 612 612 object N5: TMenuItem … … 615 615 object mhome: TMenuItem 616 616 ShortCut = 72 617 OnClick = MenuClick617 OnClick = mhomeClick 618 618 end 619 619 object mLoad: TMenuItem 620 620 Tag = 24 621 621 ShortCut = 76 622 OnClick = MenuClick622 OnClick = mLoadClick 623 623 end 624 624 object mUnload: TMenuItem 625 625 Tag = 70 626 626 ShortCut = 85 627 OnClick = MenuClick627 OnClick = mUnloadClick 628 628 end 629 629 object mSelectTransport: TMenuItem 630 630 Tag = 73 631 631 ShortCut = 16468 632 OnClick = MenuClick632 OnClick = mSelectTransportClick 633 633 end 634 634 object mGoOn: TMenuItem 635 635 Tag = 13 636 636 ShortCut = 71 637 OnClick = MenuClick637 OnClick = mGoOnClick 638 638 end 639 639 object mCancel: TMenuItem 640 640 Tag = 1 641 641 ShortCut = 16451 642 OnClick = MenuClick642 OnClick = mCancelClick 643 643 end 644 644 object mRecover: TMenuItem 645 645 Tag = 69 646 646 ShortCut = 86 647 OnClick = MenuClick647 OnClick = mRecoverClick 648 648 end 649 649 object mwait: TMenuItem 650 650 Tag = 25 651 651 ShortCut = 87 652 OnClick = MenuClick652 OnClick = mwaitClick 653 653 end 654 654 object mnoorders: TMenuItem 655 655 Tag = 26 656 656 ShortCut = 32 657 OnClick = MenuClick657 OnClick = mnoordersClick 658 658 end 659 659 object mstay: TMenuItem 660 660 Tag = 22 661 661 ShortCut = 83 662 OnClick = MenuClick662 OnClick = mstayClick 663 663 end 664 664 object mCentre: TMenuItem 665 665 Tag = 12 666 666 ShortCut = 67 667 OnClick = MenuClick667 OnClick = mCentreClick 668 668 end 669 669 object N13: TMenuItem … … 673 673 Tag = 100 674 674 ShortCut = 46 675 OnClick = MenuClick675 OnClick = mPrevUnitClick 676 676 end 677 677 object mNextUnit: TMenuItem 678 678 Tag = 101 679 679 ShortCut = 45 680 OnClick = MenuClick680 OnClick = mNextUnitClick 681 681 end 682 682 end … … 688 688 Tag = 9 689 689 ShortCut = 113 690 OnClick = MenuClick690 OnClick = mUnitStatClick 691 691 end 692 692 object mCityStat: TMenuItem 693 693 Tag = 37 694 694 ShortCut = 114 695 OnClick = MenuClick695 OnClick = mCityStatClick 696 696 end 697 697 object mScienceStat: TMenuItem 698 698 Tag = 38 699 699 ShortCut = 115 700 OnClick = MenuClick700 OnClick = mScienceStatClick 701 701 end 702 702 object mEUnitStat: TMenuItem 703 703 Tag = 50 704 704 ShortCut = 116 705 OnClick = MenuClick705 OnClick = mEUnitStatClick 706 706 end 707 707 object mDiagram: TMenuItem 708 708 Tag = 21 709 709 ShortCut = 117 710 OnClick = MenuClick710 OnClick = mDiagramClick 711 711 end 712 712 object mWonders: TMenuItem 713 713 Tag = 6 714 714 ShortCut = 118 715 OnClick = MenuClick715 OnClick = mWondersClick 716 716 end 717 717 object mShips: TMenuItem 718 718 Tag = 41 719 719 ShortCut = 119 720 OnClick = MenuClick720 OnClick = mShipsClick 721 721 end 722 722 object N4: TMenuItem … … 726 726 Tag = 55 727 727 ShortCut = 120 728 OnClick = MenuClick728 OnClick = mNationsClick 729 729 end 730 730 object mEmpire: TMenuItem 731 731 Tag = 3 732 732 ShortCut = 121 733 OnClick = MenuClick733 OnClick = mEmpireClick 734 734 end 735 735 object mRevolution: TMenuItem 736 736 Tag = 89 737 OnClick = MenuClick737 OnClick = mRevolutionClick 738 738 end 739 739 end … … 751 751 Tag = 273 752 752 ShortCut = 79 753 OnClick = MenuClick753 OnClick = mtransClick 754 754 end 755 755 object mAfforest: TMenuItem 756 756 Tag = 301 757 757 ShortCut = 77 758 OnClick = MenuClick758 OnClick = mAfforestClick 759 759 end 760 760 object mClear: TMenuItem 761 761 Tag = 298 762 762 ShortCut = 73 763 OnClick = MenuClick763 OnClick = mClearClick 764 764 end 765 765 object mfort: TMenuItem 766 766 Tag = 276 767 767 ShortCut = 70 768 OnClick = MenuClick768 OnClick = mfortClick 769 769 end 770 770 object mAirBase: TMenuItem 771 771 Tag = 272 772 772 ShortCut = 65 773 OnClick = MenuClick773 OnClick = mAirBaseClick 774 774 end 775 775 object mCanal: TMenuItem 776 776 Tag = 279 777 777 ShortCut = 78 778 OnClick = MenuClick778 OnClick = mCanalClick 779 779 end 780 780 object mmine: TMenuItem 781 781 Tag = 302 782 782 ShortCut = 77 783 OnClick = MenuClick783 OnClick = mmineClick 784 784 end 785 785 object mFarm: TMenuItem 786 786 Tag = 300 787 787 ShortCut = 73 788 OnClick = MenuClick788 OnClick = mFarmClick 789 789 end 790 790 object mirrigation: TMenuItem 791 791 Tag = 299 792 792 ShortCut = 73 793 OnClick = MenuClick794 end 795 object m rr: TMenuItem793 OnClick = mirrigationClick 794 end 795 object mRailRoad: TMenuItem 796 796 Tag = 297 797 797 ShortCut = 82 798 OnClick = MenuClick798 OnClick = mRailRoadClick 799 799 end 800 800 object mroad: TMenuItem 801 801 Tag = 296 802 802 ShortCut = 82 803 OnClick = MenuClick803 OnClick = mroadClick 804 804 end 805 805 object mpollution: TMenuItem 806 806 Tag = 274 807 807 ShortCut = 80 808 OnClick = MenuClick808 OnClick = mpollutionClick 809 809 end 810 810 object mEnhance: TMenuItem 811 811 Tag = 295 812 812 ShortCut = 69 813 OnClick = MenuClick813 OnClick = mEnhanceClick 814 814 end 815 815 end -
trunk/LocalPlayer/Term.pas
r417 r419 68 68 mWonders: TMenuItem; 69 69 mScienceStat: TMenuItem; 70 mR R: TMenuItem;70 mRailRoad: TMenuItem; 71 71 mClear: TMenuItem; 72 72 mFarm: TMenuItem; … … 181 181 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; 182 182 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 183 procedure mAfforestClick(Sender: TObject); 184 procedure mAirBaseClick(Sender: TObject); 185 procedure mCanalClick(Sender: TObject); 186 procedure mCancelClick(Sender: TObject); 187 procedure mCentreClick(Sender: TObject); 188 procedure mcityClick(Sender: TObject); 189 procedure mCityStatClick(Sender: TObject); 190 procedure mCityTypesClick(Sender: TObject); 191 procedure mClearClick(Sender: TObject); 192 procedure mDiagramClick(Sender: TObject); 193 procedure mEmpireClick(Sender: TObject); 194 procedure mEnhanceClick(Sender: TObject); 195 procedure mEnhanceDefClick(Sender: TObject); 196 procedure mEUnitStatClick(Sender: TObject); 197 procedure mFarmClick(Sender: TObject); 198 procedure mfortClick(Sender: TObject); 199 procedure mGoOnClick(Sender: TObject); 200 procedure mHelpClick(Sender: TObject); 201 procedure mhomeClick(Sender: TObject); 202 procedure mirrigationClick(Sender: TObject); 203 procedure mirrigationDrawItem(Sender: TObject; ACanvas: TCanvas; 204 ARect: TRect; AState: TOwnerDrawState); 205 procedure mJumpClick(Sender: TObject); 206 procedure mLoadClick(Sender: TObject); 207 procedure mmineClick(Sender: TObject); 208 procedure mNationsClick(Sender: TObject); 209 procedure mNextUnitClick(Sender: TObject); 210 procedure mnoordersClick(Sender: TObject); 211 procedure mPillageClick(Sender: TObject); 212 procedure mpollutionClick(Sender: TObject); 213 procedure mPrevUnitClick(Sender: TObject); 214 procedure mRandomMapClick(Sender: TObject); 215 procedure mRecoverClick(Sender: TObject); 216 procedure mResignClick(Sender: TObject); 217 procedure mRevolutionClick(Sender: TObject); 218 procedure mroadClick(Sender: TObject); 219 procedure mRailRoadClick(Sender: TObject); 220 procedure mRunClick(Sender: TObject); 221 procedure mScienceStatClick(Sender: TObject); 222 procedure mSelectTransportClick(Sender: TObject); 223 procedure mShipsClick(Sender: TObject); 224 procedure mstayClick(Sender: TObject); 225 procedure mTechTreeClick(Sender: TObject); 226 procedure mtransClick(Sender: TObject); 227 procedure mUnitStatClick(Sender: TObject); 228 procedure mUnloadClick(Sender: TObject); 229 procedure mwaitClick(Sender: TObject); 230 procedure mWebsiteClick(Sender: TObject); 231 procedure mWondersClick(Sender: TObject); 183 232 procedure Timer1Timer(Sender: TObject); 184 233 procedure MapBoxMouseDown(Sender: TObject; Button: TMouseButton; … … 188 237 Shift: TShiftState; x, y: integer); 189 238 procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState); 190 procedure MenuClick(Sender: TObject);239 procedure mDisbandOrUtilizeClick(Sender: TObject); 191 240 procedure FormResize(Sender: TObject); 192 241 procedure PanelBtnClick(Sender: TObject); … … 276 325 NoMapPanel: TIsoMap; 277 326 function ChooseUnusedTribe: integer; 327 function DoJob(j0: Integer): Integer; 278 328 procedure GetTribeList; 279 329 procedure InitModule; … … 3581 3631 end; 3582 3632 3633 procedure TMainScreen.mAfforestClick(Sender: TObject); 3634 begin 3635 if UnFocus >= 0 then 3636 with TUn(MyUn[UnFocus]) do 3637 DoJob(jAfforest); 3638 end; 3639 3640 procedure TMainScreen.mAirBaseClick(Sender: TObject); 3641 begin 3642 if UnFocus >= 0 then 3643 with TUn(MyUn[UnFocus]) do 3644 DoJob(jBase); 3645 end; 3646 3647 procedure TMainScreen.mCanalClick(Sender: TObject); 3648 begin 3649 if UnFocus >= 0 then 3650 with TUn(MyUn[UnFocus]) do 3651 DoJob(jCanal); 3652 end; 3653 3654 procedure TMainScreen.mCancelClick(Sender: TObject); 3655 begin 3656 if UnFocus >= 0 then 3657 with MyUn[UnFocus] do begin 3658 DestinationMarkON := False; 3659 PaintDestination; 3660 Status := Status and ($FFFF - usRecover - usGoto - usEnhance); 3661 if Job > jNone then 3662 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 3663 end; 3664 end; 3665 3666 procedure TMainScreen.mCentreClick(Sender: TObject); 3667 begin 3668 if UnFocus >= 0 then 3669 with TUn(MyUn[UnFocus]) do begin 3670 Centre(Loc); 3671 PaintAllMaps; 3672 end; 3673 end; 3674 3675 procedure TMainScreen.mcityClick(Sender: TObject); 3676 var 3677 Loc0: Integer; 3678 cix: Integer; 3679 ServerResult: Integer; 3680 begin 3681 if UnFocus >= 0 then 3682 with TUn(MyUn[UnFocus]) do begin 3683 Loc0 := Loc; 3684 if MyMap[Loc] and fCity = 0 then 3685 begin // build city 3686 if DoJob(jCity) = eCity then 3687 begin 3688 MapValid := false; 3689 PaintAll; 3690 ZoomToCity(Loc0, true, chFounded); 3691 end; 3692 end else begin 3693 CityOptimizer_BeforeRemoveUnit(UnFocus); 3694 ServerResult := Server(sAddToCity, me, UnFocus, nil^); 3695 if ServerResult >= rExecuted then 3696 begin 3697 cix := MyRO.nCity - 1; 3698 while (cix >= 0) and (MyCity[cix].Loc <> Loc0) do 3699 dec(cix); 3700 assert(cix >= 0); 3701 CityOptimizer_CityChange(cix); 3702 CityOptimizer_AfterRemoveUnit; // does nothing here 3703 SetTroopLoc(Loc0); 3704 UpdateViews(true); 3705 DestinationMarkON := false; 3706 PaintDestination; 3707 UnFocus := -1; 3708 PaintLoc(Loc0); 3709 NextUnit(UnStartLoc, true); 3710 end 3711 else if ServerResult = eMaxSize then 3712 SimpleMessage(Phrases.Lookup('ADDTOMAXSIZE')); 3713 end; 3714 end; 3715 end; 3716 3717 procedure TMainScreen.mCityStatClick(Sender: TObject); 3718 begin 3719 ListDlg.ShowNewContent(wmPersistent, kCities); 3720 end; 3721 3722 procedure TMainScreen.mCityTypesClick(Sender: TObject); 3723 begin 3724 CityTypeDlg.ShowNewContent(wmModal); 3725 // must be modal because types are not saved before closing 3726 end; 3727 3728 procedure TMainScreen.mClearClick(Sender: TObject); 3729 begin 3730 if UnFocus >= 0 then 3731 with TUn(MyUn[UnFocus]) do 3732 DoJob(jClear); 3733 end; 3734 3735 procedure TMainScreen.mDiagramClick(Sender: TObject); 3736 begin 3737 DiaDlg.ShowNewContent_Charts(wmPersistent); 3738 end; 3739 3740 procedure TMainScreen.mEmpireClick(Sender: TObject); 3741 begin 3742 RatesDlg.ShowNewContent(wmPersistent); 3743 end; 3744 3745 procedure TMainScreen.mEnhanceClick(Sender: TObject); 3746 begin 3747 if UnFocus >= 0 then 3748 with TUn(MyUn[UnFocus]) do 3749 DoJob(-1); 3750 end; 3751 3752 procedure TMainScreen.mEnhanceDefClick(Sender: TObject); 3753 begin 3754 if UnFocus >= 0 then 3755 EnhanceDlg.ShowNewContent(wmPersistent, 3756 MyMap[MyUn[UnFocus].Loc] and fTerrain) 3757 else 3758 EnhanceDlg.ShowNewContent(wmPersistent); 3759 end; 3760 3761 procedure TMainScreen.mEUnitStatClick(Sender: TObject); 3762 begin 3763 if MyRO.nEnemyModel > 0 then 3764 ListDlg.ShowNewContent(wmPersistent, kAllEModels); 3765 end; 3766 3767 procedure TMainScreen.mFarmClick(Sender: TObject); 3768 begin 3769 if UnFocus >= 0 then 3770 with TUn(MyUn[UnFocus]) do 3771 DoJob(jFarm); 3772 end; 3773 3774 procedure TMainScreen.mfortClick(Sender: TObject); 3775 begin 3776 if UnFocus >= 0 then 3777 with TUn(MyUn[UnFocus]) do 3778 DoJob(jFort); 3779 end; 3780 3781 procedure TMainScreen.mGoOnClick(Sender: TObject); 3782 var 3783 Destination: Integer; 3784 begin 3785 if UnFocus >= 0 then 3786 with TUn(MyUn[UnFocus]) do begin 3787 if Status shr 16 = $7FFF then 3788 Destination := maNextCity 3789 else 3790 Destination := Status shr 16; 3791 Status := Status and not(usStay or usRecover) or usWaiting; 3792 MoveToLoc(Destination, true); 3793 end; 3794 end; 3795 3796 procedure TMainScreen.mHelpClick(Sender: TObject); 3797 begin 3798 if ClientMode = cEditMap then 3799 HelpDlg.ShowNewContent(wmPersistent, hkText, HelpDlg.TextIndex('MAPEDIT')) 3800 else 3801 HelpDlg.ShowNewContent(wmPersistent, hkMisc, miscMain); 3802 end; 3803 3804 procedure TMainScreen.mhomeClick(Sender: TObject); 3805 var 3806 cixOldHome: Integer; 3807 begin 3808 if UnFocus >= 0 then 3809 with TUn(MyUn[UnFocus]) do begin 3810 if MyMap[Loc] and fCity <> 0 then 3811 begin 3812 cixOldHome := Home; 3813 if Server(sSetUnitHome, me, UnFocus, nil^) >= rExecuted then 3814 begin 3815 CityOptimizer_CityChange(cixOldHome); 3816 CityOptimizer_CityChange(Home); 3817 UpdateViews(true); 3818 end 3819 else 3820 Play('INVALID'); 3821 end 3822 else 3823 begin 3824 Status := Status and not(usStay or usRecover or usEnhance); 3825 MoveToLoc(maNextCity, true); 3826 end; 3827 end; 3828 end; 3829 3830 procedure TMainScreen.mirrigationClick(Sender: TObject); 3831 begin 3832 if UnFocus >= 0 then 3833 with TUn(MyUn[UnFocus]) do 3834 DoJob(jIrr); 3835 end; 3836 3837 procedure TMainScreen.mirrigationDrawItem(Sender: TObject; ACanvas: TCanvas; 3838 ARect: TRect; AState: TOwnerDrawState); 3839 begin 3840 3841 end; 3842 3843 procedure TMainScreen.mJumpClick(Sender: TObject); 3844 begin 3845 if supervising then 3846 Jump[0] := 20 3847 else 3848 Jump[me] := 20; 3849 EndTurn(true); 3850 end; 3851 3852 procedure TMainScreen.mLoadClick(Sender: TObject); 3853 var 3854 I: Integer; 3855 begin 3856 if UnFocus >= 0 then 3857 with MyUn[UnFocus] do begin 3858 i := Server(sLoadUnit, me, UnFocus, nil^); 3859 if i >= rExecuted then 3860 begin 3861 if MyModel[mix].Domain = dAir then 3862 Play('MOVE_PLANELANDING') 3863 else 3864 Play('MOVE_LOAD'); 3865 DestinationMarkON := false; 3866 PaintDestination; 3867 Status := Status and ($FFFF - usWaiting - usStay - usRecover - usGoto - usEnhance); 3868 NextUnit(UnStartLoc, true); 3869 end 3870 else if i = eNoTime_Load then 3871 if MyModel[mix].Domain = dAir then 3872 SoundMessage(Phrases.Lookup('NOTIMELOADAIR'), 'NOMOVE_TIME') 3873 else 3874 SoundMessage(Format(Phrases.Lookup('NOTIMELOADGROUND'), 3875 [MovementToString(MyModel[mix].speed)]), 'NOMOVE_TIME'); 3876 end; 3877 end; 3878 3879 procedure TMainScreen.mmineClick(Sender: TObject); 3880 begin 3881 if UnFocus >= 0 then 3882 with TUn(MyUn[UnFocus]) do 3883 DoJob(jMine); 3884 end; 3885 3886 procedure TMainScreen.mNationsClick(Sender: TObject); 3887 begin 3888 NatStatDlg.ShowNewContent(wmPersistent); 3889 end; 3890 3891 procedure TMainScreen.mNextUnitClick(Sender: TObject); 3892 begin 3893 if UnFocus >= 0 then 3894 with MyUn[UnFocus] do begin 3895 Status := Status and not usWaiting; 3896 FocusNextUnit(1); 3897 end; 3898 end; 3899 3900 procedure TMainScreen.mnoordersClick(Sender: TObject); 3901 begin 3902 if UnFocus >= 0 then 3903 with MyUn[UnFocus] do begin 3904 Status := Status and not usWaiting; 3905 NextUnit(UnStartLoc, true); 3906 end; 3907 end; 3908 3909 procedure TMainScreen.mPillageClick(Sender: TObject); 3910 begin 3911 DoJob(jPillage); 3912 end; 3913 3914 procedure TMainScreen.mpollutionClick(Sender: TObject); 3915 begin 3916 if UnFocus >= 0 then 3917 with TUn(MyUn[UnFocus]) do 3918 DoJob(jPoll); 3919 end; 3920 3921 procedure TMainScreen.mPrevUnitClick(Sender: TObject); 3922 begin 3923 if UnFocus >= 0 then 3924 with MyUn[UnFocus] do begin 3925 Status := Status and not usWaiting; 3926 FocusNextUnit(-1); 3927 end; 3928 end; 3929 3930 procedure TMainScreen.mRandomMapClick(Sender: TObject); 3931 begin 3932 if not Edited or (SimpleQuery(mkYesNo, Phrases.Lookup('MAP_RANDOM'), '') 3933 = mrOK) then begin 3934 Server(sRandomMap, me, 0, nil^); 3935 Edited := true; 3936 MapValid := false; 3937 PaintAllMaps; 3938 end; 3939 end; 3940 3941 procedure TMainScreen.mRecoverClick(Sender: TObject); 3942 begin 3943 if UnFocus >= 0 then 3944 with MyUn[UnFocus] do begin 3945 DestinationMarkON := false; 3946 PaintDestination; 3947 Status := Status and ($FFFF - usStay - usGoto - usEnhance) or usRecover; 3948 if Job > jNone then 3949 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 3950 NextUnit(UnStartLoc, true); 3951 end; 3952 end; 3953 3954 procedure TMainScreen.mResignClick(Sender: TObject); 3955 var 3956 QueryText: string; 3957 begin 3958 if ClientMode = cEditMap then begin 3959 if Edited then begin 3960 QueryText := Phrases.Lookup('MAP_CLOSE'); 3961 case SimpleQuery(mkYesNoCancel, QueryText, '') of 3962 mrIgnore: Server(sAbandonMap, me, 0, nil^); 3963 mrOK: Server(sSaveMap, me, 0, nil^); 3964 end; 3965 end else 3966 Server(sAbandonMap, me, 0, nil^); 3967 end else begin 3968 if Server(sGetGameChanged, 0, 0, nil^) = eOK then begin 3969 QueryText := Phrases.Lookup('RESIGN'); 3970 case SimpleQuery(mkYesNoCancel, QueryText, '') of 3971 mrIgnore: Server(sResign, 0, 0, nil^); 3972 mrOK: Server(sBreak, 0, 0, nil^); 3973 end; 3974 end else 3975 Server(sResign, 0, 0, nil^); 3976 end; 3977 end; 3978 3979 procedure TMainScreen.mRevolutionClick(Sender: TObject); 3980 var 3981 AltGovs: Boolean; 3982 RevolutionChanged: Boolean; 3983 I: Integer; 3984 begin 3985 AltGovs := false; 3986 for i := 2 to nGov - 1 do 3987 if (GovPreq[i] <> preNA) and 3988 ((GovPreq[i] = preNone) or (MyRO.Tech[GovPreq[i]] >= tsApplicable)) then 3989 AltGovs := true; 3990 3991 if not AltGovs then 3992 SoundMessage(Phrases.Lookup('NOALTGOVS'), 'MSG_DEFAULT') 3993 else 3994 begin 3995 RevolutionChanged := false; 3996 if MyRO.Happened and phChangeGov <> 0 then 3997 begin 3998 ModalSelectDlg.ShowNewContent(wmModal, kGov); 3999 if ModalSelectDlg.result >= 0 then 4000 begin 4001 Play('NEWGOV'); 4002 Server(sSetGovernment, me, ModalSelectDlg.result, nil^); 4003 CityOptimizer_BeginOfTurn; 4004 RevolutionChanged := true; 4005 end; 4006 end 4007 else 4008 with MessgExDlg do 4009 begin // revolution! 4010 MessgExDlg.MessgText := Tribe[me].TPhrase('REVOLUTION'); 4011 MessgExDlg.Kind := mkYesNo; 4012 MessgExDlg.IconKind := mikPureIcon; 4013 MessgExDlg.IconIndex := 72; // anarchy palace 4014 MessgExDlg.ShowModal; 4015 if ModalResult = mrOK then 4016 begin 4017 Play('REVOLUTION'); 4018 Server(sRevolution, me, 0, nil^); 4019 RevolutionChanged := true; 4020 if NatStatDlg.Visible then 4021 NatStatDlg.Close; 4022 if CityDlg.Visible then 4023 CityDlg.Close; 4024 end 4025 end; 4026 if RevolutionChanged then 4027 UpdateViews(true); 4028 end; 4029 end; 4030 4031 procedure TMainScreen.mroadClick(Sender: TObject); 4032 begin 4033 if UnFocus >= 0 then 4034 with TUn(MyUn[UnFocus]) do 4035 DoJob(jRoad); 4036 end; 4037 4038 procedure TMainScreen.mRailRoadClick(Sender: TObject); 4039 begin 4040 if UnFocus >= 0 then 4041 with TUn(MyUn[UnFocus]) do 4042 DoJob(jRR); 4043 end; 4044 4045 procedure TMainScreen.mRunClick(Sender: TObject); 4046 begin 4047 if supervising then 4048 Jump[0] := 999999 4049 else 4050 Jump[me] := 999999; 4051 EndTurn(true); 4052 end; 4053 4054 procedure TMainScreen.mScienceStatClick(Sender: TObject); 4055 begin 4056 ListDlg.ShowNewContent(wmPersistent, kScience); 4057 end; 4058 4059 procedure TMainScreen.mSelectTransportClick(Sender: TObject); 4060 begin 4061 if UnFocus >= 0 then 4062 with TUn(MyUn[UnFocus]) do 4063 Server(sSelectTransport, me, UnFocus, nil^); 4064 end; 4065 4066 procedure TMainScreen.mShipsClick(Sender: TObject); 4067 begin 4068 DiaDlg.ShowNewContent_Ship(wmPersistent); 4069 end; 4070 4071 procedure TMainScreen.mstayClick(Sender: TObject); 4072 begin 4073 if UnFocus >= 0 then 4074 with TUn(MyUn[UnFocus]) do begin 4075 DestinationMarkON := false; 4076 PaintDestination; 4077 Status := Status and ($FFFF - usRecover - usGoto - usEnhance) or usStay; 4078 if Job > jNone then 4079 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 4080 NextUnit(UnStartLoc, true); 4081 end; 4082 end; 4083 4084 procedure TMainScreen.mTechTreeClick(Sender: TObject); 4085 begin 4086 TechTreeDlg.ShowModal; 4087 end; 4088 4089 procedure TMainScreen.mtransClick(Sender: TObject); 4090 begin 4091 if UnFocus >= 0 then 4092 with TUn(MyUn[UnFocus]) do 4093 DoJob(jTrans); 4094 end; 4095 4096 procedure TMainScreen.mUnitStatClick(Sender: TObject); 4097 var 4098 I: Integer; 4099 begin 4100 if G.Difficulty[me] > 0 then 4101 ListDlg.ShowNewContent_MilReport(wmPersistent, me) 4102 else 4103 begin 4104 i := 1; 4105 while (i < nPl) and (1 shl i and MyRO.Alive = 0) do 4106 inc(i); 4107 if i < nPl then 4108 ListDlg.ShowNewContent_MilReport(wmPersistent, i); 4109 end; 4110 end; 4111 4112 procedure TMainScreen.mUnloadClick(Sender: TObject); 4113 var 4114 I: Integer; 4115 OldMaster: Integer; 4116 NewFocus: Integer; 4117 uix: Integer; 4118 begin 4119 if UnFocus >= 0 then 4120 with MyUn[UnFocus] do begin 4121 if Master >= 0 then begin 4122 OldMaster := Master; 4123 i := Server(sUnloadUnit, me, UnFocus, nil^); 4124 if i >= rExecuted then 4125 begin 4126 if MyModel[mix].Domain = dAir then 4127 Play('MOVE_PLANESTART') 4128 else if (MyModel[MyUn[OldMaster].mix].Domain = dAir) and 4129 (MyMap[Loc] and fCity = 0) and (MyMap[Loc] and fTerImp <> tiBase) 4130 then 4131 Play('MOVE_PARACHUTE') 4132 else 4133 Play('MOVE_UNLOAD'); 4134 Status := Status and not usWaiting; 4135 if MyModel[mix].Domain <> dAir then 4136 NextUnit(Loc, true) 4137 else 4138 PanelPaint; 4139 end 4140 else if i = eNoTime_Load then 4141 if MyModel[mix].Domain = dAir then 4142 SoundMessage(Phrases.Lookup('NOTIMELOADAIR'), 'NOMOVE_TIME') 4143 else 4144 SoundMessage(Format(Phrases.Lookup('NOTIMELOADGROUND'), 4145 [MovementToString(MyModel[mix].speed)]), 'NOMOVE_TIME'); 4146 end else begin 4147 NewFocus := -1; 4148 uix := UnFocus; 4149 for i := 1 to MyRO.nUn - 1 do 4150 begin 4151 uix := (uix + MyRO.nUn - 1) mod MyRO.nUn; 4152 if (MyUn[uix].Master = UnFocus) and 4153 (MyUn[uix].Movement = integer(MyModel[MyUn[uix].mix].speed)) then 4154 begin 4155 MyUn[uix].Status := MyUn[uix].Status or usWaiting; 4156 NewFocus := uix; 4157 end; 4158 end; 4159 if NewFocus >= 0 then 4160 begin 4161 SetUnFocus(NewFocus); 4162 SetTroopLoc(Loc); 4163 PanelPaint; 4164 end; 4165 end; 4166 end; 4167 end; 4168 4169 procedure TMainScreen.mwaitClick(Sender: TObject); 4170 begin 4171 if UnFocus >= 0 then 4172 with MyUn[UnFocus] do begin 4173 DestinationMarkON := false; 4174 PaintDestination; 4175 Status := Status and ($FFFF - usStay - usRecover - usGoto - usEnhance) or usWaiting; 4176 end; 4177 NextUnit(-1, false); 4178 end; 4179 4180 procedure TMainScreen.mWebsiteClick(Sender: TObject); 4181 begin 4182 OpenURL(CevoHomepage); 4183 end; 4184 4185 procedure TMainScreen.mWondersClick(Sender: TObject); 4186 begin 4187 WondersDlg.ShowNewContent(wmPersistent); 4188 end; 4189 3583 4190 procedure TMainScreen.FormResize(Sender: TObject); 3584 4191 var … … 3670 4277 CanClose := Closable; 3671 4278 if not Closable and idle and (me = 0) and (ClientMode < scContact) then 3672 MenuClick(mResign);4279 mResign.Click; 3673 4280 end; 3674 4281 … … 5398 6005 MoveToLoc(MouseLoc, true); { goto } 5399 6006 if (UnFocus = uix) and (MyUn[uix].Loc = MouseLoc) then 5400 MenuClick(mEnhance);6007 mEnhance.Click; 5401 6008 end 5402 6009 else if (Button = mbLeft) and (ssShift in Shift) and … … 6465 7072 MTrans.ShortCut := BTrans.ShortCut; 6466 7073 mPollution.ShortCut := BPollution.ShortCut; 6467 mR R.ShortCut := BRailRoad.ShortCut;7074 mRailRoad.ShortCut := BRailRoad.ShortCut; 6468 7075 mRoad.ShortCut := BRailRoad.ShortCut; 6469 7076 mUnload.ShortCut := BUnload.ShortCut; … … 6507 7114 InitPopup(Popup); 6508 7115 if Item.Visible and Item.Enabled then 6509 MenuClick(Item);7116 Item.Click; 6510 7117 end; 6511 7118 … … 6542 7149 6543 7150 if ClientMode = cEditMap then begin 6544 if BResign.Test(ShortCut) then MenuClick(mResign)6545 else if BRandomMap.Test(ShortCut) then MenuClick(mRandomMap)6546 else if BHelp.Test(ShortCut) then MenuClick(mHelp);7151 if BResign.Test(ShortCut) then mResign.Click 7152 else if BRandomMap.Test(ShortCut) then mRandomMap.Click 7153 else if BHelp.Test(ShortCut) then mHelp.Click; 6547 7154 (*if Shift = [ssCtrl] then 6548 7155 case char(Key) of … … 6570 7177 SetFullScreen(FullScreen); 6571 7178 end 6572 else if BHelp.Test(ShortCut) then MenuClick(mHelp)7179 else if BHelp.Test(ShortCut) then mHelp.Click 6573 7180 else if BUnitStat.Test(ShortCut) then MenuClick_Check(StatPopup, mUnitStat) 6574 7181 else if BCityStat.Test(ShortCut) then MenuClick_Check(StatPopup, mCityStat) … … 6592 7199 else if BSetDebugMap9.Test(ShortCut) then SetDebugMap(9) 6593 7200 6594 else if BJump.Test(ShortCut) then MenuClick(mJump)7201 else if BJump.Test(ShortCut) then mJump.Click 6595 7202 else if BDebugMap.Test(ShortCut) then mShowClick(mDebugMap) 6596 7203 else if BLocCodes.Test(ShortCut) then mShowClick(mLocCodes) … … 6601 7208 else if BNames.Test(ShortCut) then mNamesClick(mNames) 6602 7209 else if BResign.Test(ShortCut) then MenuClick_Check(GamePopup, mResign) 6603 else if BRun.Test(ShortCut) then MenuClick(mRun)7210 else if BRun.Test(ShortCut) then mRun.Click 6604 7211 else if BTestMapRepaint.Test(ShortCut) then begin // test map repaint time 6605 7212 Time0 := NowPrecise; … … 6626 7233 else if BMapBtn5.Test(ShortCut) then MapBtnClick(MapBtn5) 6627 7234 else if BMapBtn6.Test(ShortCut) then MapBtnClick(MapBtn6) 6628 else if BTechTree.Test(ShortCut) then MenuClick(mTechTree)6629 else if BWait.Test(ShortCut) then MenuClick(mWait);7235 else if BTechTree.Test(ShortCut) then mTechTree.Click 7236 else if BWait.Test(ShortCut) then mWait.Click; 6630 7237 6631 7238 if UnFocus >= 0 then begin 6632 if BDisbandUnit.Test(ShortCut) then MenuClick(mDisband)7239 if BDisbandUnit.Test(ShortCut) then mDisband.Click 6633 7240 else if BFortify.Test(ShortCut) then MenuClick_Check(TerrainPopup, mFort) 6634 else if BCenterUnit.Test(ShortCut) then MenuClick(mCentre)6635 else if BStay.Test(ShortCut) then MenuClick(mStay)6636 else if BNoOrders.Test(ShortCut) then MenuClick(mNoOrders)6637 else if BPrevUnit.Test(ShortCut) then MenuClick(mPrevUnit)6638 else if BNextUnit.Test(ShortCut) then MenuClick(mNextUnit)7241 else if BCenterUnit.Test(ShortCut) then mCentre.Click 7242 else if BStay.Test(ShortCut) then mStay.Click 7243 else if BNoOrders.Test(ShortCut) then mNoOrders.Click 7244 else if BPrevUnit.Test(ShortCut) then mPrevUnit.Click 7245 else if BNextUnit.Test(ShortCut) then mNextUnit.Click 6639 7246 else if BCancel.Test(ShortCut) then MenuClick_Check(UnitPopup, mCancel) 6640 7247 else if BPillage.Test(ShortCut) then MenuClick_Check(UnitPopup, mPillage) … … 6644 7251 else if BEnhance.Test(ShortCut) then begin 6645 7252 InitPopup(TerrainPopup); 6646 if mEnhance.Visible and mEnhance.Enabled then MenuClick(mEnhance)6647 else MenuClick(mEnhanceDef)7253 if mEnhance.Visible and mEnhance.Enabled then mEnhance.Click 7254 else mEnhanceDef.Click 6648 7255 end 6649 7256 else if BGoOn.Test(ShortCut) then MenuClick_Check(UnitPopup, mGoOn) … … 6651 7258 else if BFarmClearIrrigation.Test(ShortCut) then begin 6652 7259 if JobTest(UnFocus, jFarm, [eTreaty]) then 6653 MenuClick(mFarm)7260 mFarm.Click 6654 7261 else if JobTest(UnFocus, jClear, [eTreaty]) then 6655 MenuClick(mClear)7262 mClear.Click 6656 7263 else MenuClick_Check(TerrainPopup, mIrrigation); 6657 7264 end 6658 7265 else if BLoad.Test(ShortCut) then MenuClick_Check(UnitPopup, mLoad) 6659 7266 else if BAfforestMine.Test(ShortCut) then begin 6660 if JobTest(UnFocus, jAfforest, [eTreaty]) then MenuClick(mAfforest)7267 if JobTest(UnFocus, jAfforest, [eTreaty]) then mAfforest.Click 6661 7268 else MenuClick_Check(TerrainPopup, mMine); 6662 7269 end … … 6665 7272 else if BPollution.Test(ShortCut) then MenuClick_Check(TerrainPopup, mPollution) 6666 7273 else if BRailRoad.Test(ShortCut) then begin 6667 if JobTest(UnFocus, jRR, [eTreaty]) then MenuClick(mRR)7274 if JobTest(UnFocus, jRR, [eTreaty]) then mRailRoad.Click 6668 7275 else MenuClick_Check(TerrainPopup, mRoad); 6669 7276 end … … 6682 7289 end; 6683 7290 6684 procedure TMainScreen.MenuClick(Sender: TObject); 6685 6686 function DoJob(j0: integer): integer; 6687 var 6688 Loc0, Movement0: integer; 6689 begin 6690 with MyUn[UnFocus] do 6691 begin 6692 DestinationMarkON := false; 6693 PaintDestination; 6694 Loc0 := Loc; 6695 Movement0 := Movement; 6696 if j0 < 0 then 6697 result := ProcessEnhancement(UnFocus, MyData.EnhancementJobs) 6698 // terrain enhancement 6699 else 6700 result := Server(sStartJob + j0 shl 4, me, UnFocus, nil^); 6701 if result >= rExecuted then 6702 begin 6703 if result = eDied then 6704 UnFocus := -1; 6705 PaintLoc(Loc0); 6706 if UnFocus >= 0 then 7291 function TMainScreen.DoJob(j0: Integer): Integer; 7292 var 7293 Loc0, Movement0: integer; 7294 begin 7295 with MyUn[UnFocus] do 7296 begin 7297 DestinationMarkON := false; 7298 PaintDestination; 7299 Loc0 := Loc; 7300 Movement0 := Movement; 7301 if j0 < 0 then 7302 result := ProcessEnhancement(UnFocus, MyData.EnhancementJobs) 7303 // terrain enhancement 7304 else 7305 result := Server(sStartJob + j0 shl 4, me, UnFocus, nil^); 7306 if result >= rExecuted then 7307 begin 7308 if result = eDied then 7309 UnFocus := -1; 7310 PaintLoc(Loc0); 7311 if UnFocus >= 0 then 7312 begin 7313 if (j0 < 0) and (result <> eJobDone) then 7314 // multi-turn terrain enhancement 7315 Status := Status and ($FFFF - usStay - usRecover - usGoto) or 7316 usEnhance 7317 else 7318 Status := Status and 7319 ($FFFF - usStay - usRecover - usGoto - usEnhance); 7320 if (Job <> jNone) or (Movement0 < 100) then 6707 7321 begin 6708 if (j0 < 0) and (result <> eJobDone) then 6709 // multi-turn terrain enhancement 6710 Status := Status and ($FFFF - usStay - usRecover - usGoto) or 6711 usEnhance 6712 else 6713 Status := Status and 6714 ($FFFF - usStay - usRecover - usGoto - usEnhance); 6715 if (Job <> jNone) or (Movement0 < 100) then 6716 begin 6717 Status := Status and not usWaiting; 6718 NextUnit(UnStartLoc, true); 6719 end 6720 else 6721 PanelPaint; 7322 Status := Status and not usWaiting; 7323 NextUnit(UnStartLoc, true); 6722 7324 end 6723 7325 else 6724 NextUnit(UnStartLoc, true); 6725 end; 6726 end; 6727 case result of 6728 eNoBridgeBuilding: 6729 SoundMessage(Phrases.Lookup('NOBB'), 'INVALID'); 6730 eNoCityTerrain: 6731 SoundMessage(Phrases.Lookup('NOCITY'), 'INVALID'); 6732 eTreaty: 6733 SoundMessage(Tribe[MyRO.Territory[Loc0]].TPhrase('PEACE_NOWORK'), 6734 'NOMOVE_TREATY'); 6735 else 6736 if result < rExecuted then 6737 Play('INVALID'); 6738 end; 6739 end; 6740 6741 var 6742 i, uix, NewFocus, Loc0, OldMaster, Destination, cix, cixOldHome, 6743 ServerResult: integer; 6744 AltGovs, RevolutionChanged: boolean; 6745 QueryText: string; 6746 6747 begin 6748 if Sender = mResign then 6749 if ClientMode = cEditMap then 6750 begin 6751 if Edited then 6752 begin 6753 QueryText := Phrases.Lookup('MAP_CLOSE'); 6754 case SimpleQuery(mkYesNoCancel, QueryText, '') of 6755 mrIgnore: 6756 Server(sAbandonMap, me, 0, nil^); 6757 mrOK: 6758 Server(sSaveMap, me, 0, nil^); 6759 end 7326 PanelPaint; 6760 7327 end 6761 7328 else 6762 Server(sAbandonMap, me, 0, nil^); 6763 end 7329 NextUnit(UnStartLoc, true); 7330 end; 7331 end; 7332 case result of 7333 eNoBridgeBuilding: 7334 SoundMessage(Phrases.Lookup('NOBB'), 'INVALID'); 7335 eNoCityTerrain: 7336 SoundMessage(Phrases.Lookup('NOCITY'), 'INVALID'); 7337 eTreaty: 7338 SoundMessage(Tribe[MyRO.Territory[Loc0]].TPhrase('PEACE_NOWORK'), 7339 'NOMOVE_TREATY'); 7340 else 7341 if result < rExecuted then 7342 Play('INVALID'); 7343 end; 7344 end; 7345 7346 procedure TMainScreen.mDisbandOrUtilizeClick(Sender: TObject); 7347 var 7348 Loc0: Integer; 7349 begin 7350 if UnFocus >= 0 then 7351 with TUn(MyUn[UnFocus]) do begin 7352 if (Sender = mUtilize) and 7353 not(Server(sRemoveUnit - sExecute, me, UnFocus, nil^) = eUtilized) then 7354 begin 7355 SimpleMessage(Phrases2.Lookup('SHIP_UTILIZE')); 7356 // freight for colony ship is the only case in which the command is 7357 // available to player though not valid 7358 exit; 7359 end; 7360 if (Sender = mUtilize) and (Health < 100) then 7361 if SimpleQuery(mkYesNo, Phrases.Lookup('DAMAGED_UTILIZE'), '') <> mrOK 7362 then 7363 exit; 7364 Loc0 := Loc; 7365 CityOptimizer_BeforeRemoveUnit(UnFocus); 7366 if Server(sRemoveUnit, me, UnFocus, nil^) = eUtilized then 7367 Play('CITY_UTILIZE') 6764 7368 else 6765 begin 6766 if Server(sGetGameChanged, 0, 0, nil^) = eOK then 6767 begin 6768 QueryText := Phrases.Lookup('RESIGN'); 6769 case SimpleQuery(mkYesNoCancel, QueryText, '') of 6770 mrIgnore: 6771 Server(sResign, 0, 0, nil^); 6772 mrOK: 6773 Server(sBreak, 0, 0, nil^); 6774 end 6775 end 6776 else 6777 Server(sResign, 0, 0, nil^); 6778 end 6779 else if Sender = mEmpire then 6780 RatesDlg.ShowNewContent(wmPersistent) 6781 else if Sender = mRevolution then 6782 begin 6783 AltGovs := false; 6784 for i := 2 to nGov - 1 do 6785 if (GovPreq[i] <> preNA) and 6786 ((GovPreq[i] = preNone) or (MyRO.Tech[GovPreq[i]] >= tsApplicable)) then 6787 AltGovs := true; 6788 6789 if not AltGovs then 6790 SoundMessage(Phrases.Lookup('NOALTGOVS'), 'MSG_DEFAULT') 6791 else 6792 begin 6793 RevolutionChanged := false; 6794 if MyRO.Happened and phChangeGov <> 0 then 6795 begin 6796 ModalSelectDlg.ShowNewContent(wmModal, kGov); 6797 if ModalSelectDlg.result >= 0 then 6798 begin 6799 Play('NEWGOV'); 6800 Server(sSetGovernment, me, ModalSelectDlg.result, nil^); 6801 CityOptimizer_BeginOfTurn; 6802 RevolutionChanged := true; 6803 end; 6804 end 6805 else 6806 with MessgExDlg do 6807 begin // revolution! 6808 MessgExDlg.MessgText := Tribe[me].TPhrase('REVOLUTION'); 6809 MessgExDlg.Kind := mkYesNo; 6810 MessgExDlg.IconKind := mikPureIcon; 6811 MessgExDlg.IconIndex := 72; // anarchy palace 6812 MessgExDlg.ShowModal; 6813 if ModalResult = mrOK then 6814 begin 6815 Play('REVOLUTION'); 6816 Server(sRevolution, me, 0, nil^); 6817 RevolutionChanged := true; 6818 if NatStatDlg.Visible then 6819 NatStatDlg.Close; 6820 if CityDlg.Visible then 6821 CityDlg.Close; 6822 end 6823 end; 6824 if RevolutionChanged then 6825 UpdateViews(true); 6826 end; 6827 end 6828 else if Sender = mWebsite then 6829 OpenURL(CevoHomepage) 6830 else if Sender = mRandomMap then 6831 begin 6832 if not Edited or (SimpleQuery(mkYesNo, Phrases.Lookup('MAP_RANDOM'), '') 6833 = mrOK) then 6834 begin 6835 Server(sRandomMap, me, 0, nil^); 6836 Edited := true; 6837 MapValid := false; 6838 PaintAllMaps; 6839 end; 6840 end 6841 else if Sender = mJump then 6842 begin 6843 if supervising then 6844 Jump[0] := 20 6845 else 6846 Jump[me] := 20; 6847 EndTurn(true); 6848 end 6849 else if Sender = mRun then 6850 begin 6851 if supervising then 6852 Jump[0] := 999999 6853 else 6854 Jump[me] := 999999; 6855 EndTurn(true); 6856 end 6857 else if Sender = mEnhanceDef then 6858 begin 6859 if UnFocus >= 0 then 6860 EnhanceDlg.ShowNewContent(wmPersistent, 6861 MyMap[MyUn[UnFocus].Loc] and fTerrain) 6862 else 6863 EnhanceDlg.ShowNewContent(wmPersistent); 6864 end 6865 else if Sender = mCityTypes then 6866 CityTypeDlg.ShowNewContent(wmModal) 6867 // must be modal because types are not saved before closing 6868 else if Sender = mUnitStat then 6869 begin 6870 if G.Difficulty[me] > 0 then 6871 ListDlg.ShowNewContent_MilReport(wmPersistent, me) 6872 else 6873 begin 6874 i := 1; 6875 while (i < nPl) and (1 shl i and MyRO.Alive = 0) do 6876 inc(i); 6877 if i < nPl then 6878 ListDlg.ShowNewContent_MilReport(wmPersistent, i); 6879 end; 6880 end 6881 else if Sender = mEUnitStat then 6882 begin 6883 if MyRO.nEnemyModel > 0 then 6884 ListDlg.ShowNewContent(wmPersistent, kAllEModels); 6885 end 6886 else if Sender = mCityStat then 6887 ListDlg.ShowNewContent(wmPersistent, kCities) 6888 else if Sender = mScienceStat then 6889 ListDlg.ShowNewContent(wmPersistent, kScience) 6890 else if Sender = mNations then 6891 NatStatDlg.ShowNewContent(wmPersistent) 6892 else if Sender = mHelp then 6893 if ClientMode = cEditMap then 6894 HelpDlg.ShowNewContent(wmPersistent, hkText, HelpDlg.TextIndex('MAPEDIT')) 6895 else 6896 HelpDlg.ShowNewContent(wmPersistent, hkMisc, miscMain) 6897 else if Sender = mTechTree then 6898 TechTreeDlg.ShowModal 6899 else if Sender = mWonders then 6900 WondersDlg.ShowNewContent(wmPersistent) 6901 else if Sender = mDiagram then 6902 DiaDlg.ShowNewContent_Charts(wmPersistent) 6903 else if Sender = mShips then 6904 DiaDlg.ShowNewContent_Ship(wmPersistent) 6905 else if Sender = mWait then 6906 begin 6907 if UnFocus >= 0 then 6908 begin 6909 DestinationMarkON := false; 6910 PaintDestination; 6911 MyUn[UnFocus].Status := MyUn[UnFocus].Status and 6912 ($FFFF - usStay - usRecover - usGoto - usEnhance) or usWaiting; 6913 end; 6914 NextUnit(-1, false); 6915 end 6916 else if UnFocus >= 0 then 6917 with TUn(MyUn[UnFocus]) do 6918 if Sender = mGoOn then 6919 begin 6920 if Status shr 16 = $7FFF then 6921 Destination := maNextCity 6922 else 6923 Destination := Status shr 16; 6924 Status := Status and not(usStay or usRecover) or usWaiting; 6925 MoveToLoc(Destination, true); 6926 end 6927 else if Sender = mHome then 6928 if MyMap[Loc] and fCity <> 0 then 6929 begin 6930 cixOldHome := Home; 6931 if Server(sSetUnitHome, me, UnFocus, nil^) >= rExecuted then 6932 begin 6933 CityOptimizer_CityChange(cixOldHome); 6934 CityOptimizer_CityChange(Home); 6935 UpdateViews(true); 6936 end 6937 else 6938 Play('INVALID'); 6939 end 6940 else 6941 begin 6942 Status := Status and not(usStay or usRecover or usEnhance); 6943 MoveToLoc(maNextCity, true) 6944 end 6945 else if Sender = mCentre then 6946 begin 6947 Centre(Loc); 6948 PaintAllMaps; 6949 end 6950 else if Sender = mCity then 6951 begin 6952 Loc0 := Loc; 6953 if MyMap[Loc] and fCity = 0 then 6954 begin // build city 6955 if DoJob(jCity) = eCity then 6956 begin 6957 MapValid := false; 6958 PaintAll; 6959 ZoomToCity(Loc0, true, chFounded); 6960 end; 6961 end 6962 else 6963 begin 6964 CityOptimizer_BeforeRemoveUnit(UnFocus); 6965 ServerResult := Server(sAddToCity, me, UnFocus, nil^); 6966 if ServerResult >= rExecuted then 6967 begin 6968 cix := MyRO.nCity - 1; 6969 while (cix >= 0) and (MyCity[cix].Loc <> Loc0) do 6970 dec(cix); 6971 assert(cix >= 0); 6972 CityOptimizer_CityChange(cix); 6973 CityOptimizer_AfterRemoveUnit; // does nothing here 6974 SetTroopLoc(Loc0); 6975 UpdateViews(true); 6976 DestinationMarkON := false; 6977 PaintDestination; 6978 UnFocus := -1; 6979 PaintLoc(Loc0); 6980 NextUnit(UnStartLoc, true); 6981 end 6982 else if ServerResult = eMaxSize then 6983 SimpleMessage(Phrases.Lookup('ADDTOMAXSIZE')); 6984 end 6985 end 6986 else if Sender = mRoad then 6987 DoJob(jRoad) 6988 else if Sender = mRR then 6989 DoJob(jRR) 6990 else if Sender = mClear then 6991 DoJob(jClear) 6992 else if Sender = mIrrigation then 6993 DoJob(jIrr) 6994 else if Sender = mFarm then 6995 DoJob(jFarm) 6996 else if Sender = mAfforest then 6997 DoJob(jAfforest) 6998 else if Sender = mMine then 6999 DoJob(jMine) 7000 else if Sender = mCanal then 7001 DoJob(jCanal) 7002 else if Sender = MTrans then 7003 DoJob(jTrans) 7004 else if Sender = mFort then 7005 DoJob(jFort) 7006 else if Sender = mAirBase then 7007 DoJob(jBase) 7008 else if Sender = mPollution then 7009 DoJob(jPoll) 7010 else if Sender = mPillage then 7011 DoJob(jPillage) 7012 else if Sender = mEnhance then 7013 DoJob(-1) 7014 else if Sender = mStay then 7015 begin 7016 DestinationMarkON := false; 7017 PaintDestination; 7018 Status := Status and ($FFFF - usRecover - usGoto - usEnhance) or usStay; 7019 if Job > jNone then 7020 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7021 NextUnit(UnStartLoc, true); 7022 end 7023 else if Sender = mRecover then 7024 begin 7025 DestinationMarkON := false; 7026 PaintDestination; 7027 Status := Status and ($FFFF - usStay - usGoto - usEnhance) or usRecover; 7028 if Job > jNone then 7029 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7030 NextUnit(UnStartLoc, true); 7031 end 7032 else if Sender = mNoOrders then 7033 begin 7034 Status := Status and not usWaiting; 7035 NextUnit(UnStartLoc, true); 7036 end 7037 else if Sender = mPrevUnit then 7038 begin 7039 Status := Status and not usWaiting; 7040 FocusNextUnit(-1); 7041 end 7042 else if Sender = mNextUnit then 7043 begin 7044 Status := Status and not usWaiting; 7045 FocusNextUnit(1); 7046 end 7047 else if Sender = mCancel then 7048 begin 7049 DestinationMarkON := false; 7050 PaintDestination; 7051 Status := Status and ($FFFF - usRecover - usGoto - usEnhance); 7052 if Job > jNone then 7053 Server(sStartJob + jNone shl 4, me, UnFocus, nil^); 7054 end 7055 else if (Sender = mDisband) or (Sender = mUtilize) then 7056 begin 7057 if (Sender = mUtilize) and 7058 not(Server(sRemoveUnit - sExecute, me, UnFocus, nil^) = eUtilized) 7059 then 7060 begin 7061 SimpleMessage(Phrases2.Lookup('SHIP_UTILIZE')); 7062 // freight for colony ship is the only case in which the command is 7063 // available to player though not valid 7064 exit 7065 end; 7066 if (Sender = mUtilize) and (Health < 100) then 7067 if SimpleQuery(mkYesNo, Phrases.Lookup('DAMAGED_UTILIZE'), '') <> mrOK 7068 then 7069 exit; 7070 Loc0 := Loc; 7071 CityOptimizer_BeforeRemoveUnit(UnFocus); 7072 if Server(sRemoveUnit, me, UnFocus, nil^) = eUtilized then 7073 Play('CITY_UTILIZE') 7074 else 7075 Play('DISBAND'); 7076 CityOptimizer_AfterRemoveUnit; 7077 SetTroopLoc(Loc0); 7078 UpdateViews(true); 7079 DestinationMarkON := false; 7080 PaintDestination; 7081 UnFocus := -1; 7082 PaintLoc(Loc0); 7083 NextUnit(UnStartLoc, true); 7084 end 7085 else if Sender = mLoad then 7086 begin 7087 i := Server(sLoadUnit, me, UnFocus, nil^); 7088 if i >= rExecuted then 7089 begin 7090 if MyModel[mix].Domain = dAir then 7091 Play('MOVE_PLANELANDING') 7092 else 7093 Play('MOVE_LOAD'); 7094 DestinationMarkON := false; 7095 PaintDestination; 7096 Status := Status and ($FFFF - usWaiting - usStay - usRecover - usGoto 7097 - usEnhance); 7098 NextUnit(UnStartLoc, true); 7099 end 7100 else if i = eNoTime_Load then 7101 if MyModel[mix].Domain = dAir then 7102 SoundMessage(Phrases.Lookup('NOTIMELOADAIR'), 'NOMOVE_TIME') 7103 else 7104 SoundMessage(Format(Phrases.Lookup('NOTIMELOADGROUND'), 7105 [MovementToString(MyModel[mix].speed)]), 'NOMOVE_TIME'); 7106 end 7107 else if Sender = mUnload then 7108 if Master >= 0 then 7109 begin 7110 OldMaster := Master; 7111 i := Server(sUnloadUnit, me, UnFocus, nil^); 7112 if i >= rExecuted then 7113 begin 7114 if MyModel[mix].Domain = dAir then 7115 Play('MOVE_PLANESTART') 7116 else if (MyModel[MyUn[OldMaster].mix].Domain = dAir) and 7117 (MyMap[Loc] and fCity = 0) and (MyMap[Loc] and fTerImp <> tiBase) 7118 then 7119 Play('MOVE_PARACHUTE') 7120 else 7121 Play('MOVE_UNLOAD'); 7122 Status := Status and not usWaiting; 7123 if MyModel[mix].Domain <> dAir then 7124 NextUnit(Loc, true) 7125 else 7126 PanelPaint; 7127 end 7128 else if i = eNoTime_Load then 7129 if MyModel[mix].Domain = dAir then 7130 SoundMessage(Phrases.Lookup('NOTIMELOADAIR'), 'NOMOVE_TIME') 7131 else 7132 SoundMessage(Format(Phrases.Lookup('NOTIMELOADGROUND'), 7133 [MovementToString(MyModel[mix].speed)]), 'NOMOVE_TIME'); 7134 end 7135 else 7136 begin 7137 NewFocus := -1; 7138 uix := UnFocus; 7139 for i := 1 to MyRO.nUn - 1 do 7140 begin 7141 uix := (uix + MyRO.nUn - 1) mod MyRO.nUn; 7142 if (MyUn[uix].Master = UnFocus) and 7143 (MyUn[uix].Movement = integer(MyModel[MyUn[uix].mix].speed)) then 7144 begin 7145 MyUn[uix].Status := MyUn[uix].Status or usWaiting; 7146 NewFocus := uix; 7147 end; 7148 end; 7149 if NewFocus >= 0 then 7150 begin 7151 SetUnFocus(NewFocus); 7152 SetTroopLoc(Loc); 7153 PanelPaint; 7154 end; 7155 end 7156 else if Sender = mSelectTransport then 7157 Server(sSelectTransport, me, UnFocus, nil^); 7369 Play('DISBAND'); 7370 CityOptimizer_AfterRemoveUnit; 7371 SetTroopLoc(Loc0); 7372 UpdateViews(true); 7373 DestinationMarkON := false; 7374 PaintDestination; 7375 UnFocus := -1; 7376 PaintLoc(Loc0); 7377 NextUnit(UnStartLoc, true); 7378 end; 7158 7379 end; 7159 7380 … … 7374 7595 begin 7375 7596 mRoad.Caption := Phrases.Lookup('BTN_BUILDBRIDGE'); 7376 mR R.Caption := Phrases.Lookup('BTN_BUILDRRBRIDGE');7597 mRailRoad.Caption := Phrases.Lookup('BTN_BUILDRRBRIDGE'); 7377 7598 end 7378 7599 else 7379 7600 begin 7380 7601 mRoad.Caption := Phrases.Lookup('BTN_BUILDROAD'); 7381 mR R.Caption := Phrases.Lookup('BTN_BUILDRR');7602 mRailRoad.Caption := Phrases.Lookup('BTN_BUILDRR'); 7382 7603 end; 7383 7604 if Tile and fTerrain = fForest then … … 7394 7615 begin 7395 7616 mRoad.Visible := JobTest(UnFocus, jRoad, [eNoBridgeBuilding, eTreaty]); 7396 mR R.Visible := JobTest(UnFocus, jRR, [eNoBridgeBuilding, eTreaty]);7617 mRailRoad.Visible := JobTest(UnFocus, jRR, [eNoBridgeBuilding, eTreaty]); 7397 7618 mClear.Visible := JobTest(UnFocus, jClear, [eTreaty]); 7398 7619 mIrrigation.Visible := JobTest(UnFocus, jIrr, [eTreaty]);
Note:
See TracChangeset
for help on using the changeset viewer.