Changeset 414 for trunk/LocalPlayer/Term.pas
- Timestamp:
- Nov 17, 2021, 1:18:21 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r387 r414 368 368 369 369 TPriceSet = set of $00 .. $FF; 370 TFormAction = (faClose, faEnable, faDisable, faUpdate, faSmartUpdateContent); 370 371 371 372 const … … 536 537 lxmax_xxx = 130; 537 538 LeftPanelWidth = 70; 538 LeftPanelWidth_Editor = 46;539 539 overlap = PanelHeight - MidPanelHeight; 540 540 yTroop = PanelHeight - 83; 541 541 xPalace = 66; 542 542 yPalace = 24; // 120; 543 xAdvisor = 108;544 yAdvisor = 48; 543 { xAdvisor = 108; 544 yAdvisor = 48;} 545 545 xUnitText = 80; 546 PaperShade = 3;547 546 BlinkOnTime = 12; 548 547 BlinkOffTime = 6; … … 1096 1095 ChosenResearch := ModalSelectDlg.result; 1097 1096 // can be researched immediately 1098 MyData.FarTech := adNone 1097 MyData.FarTech := adNone; 1099 1098 end; 1100 1099 end; … … 1106 1105 ListDlg.TechChange; 1107 1106 result := true; 1107 end; 1108 1109 procedure ApplyToVisibleForms(FormAction: TFormAction); 1110 var 1111 I: Integer; 1112 Form: TForm; 1113 begin 1114 for I := 0 to Screen.FormCount - 1 do begin 1115 Form := Screen.Forms[I]; 1116 if Form.Visible and (Form is TBufferedDrawDlg) then begin 1117 case FormAction of 1118 faClose: Form.Close; 1119 faEnable: Form.Enabled := True; 1120 faDisable: Form.Enabled := False; 1121 faUpdate: begin 1122 if @Form.OnShow <> nil then Form.OnShow(nil); 1123 Form.Invalidate; 1124 Form.Update; 1125 end; 1126 faSmartUpdateContent: TBufferedDrawDlg(Form).SmartUpdateContent(False); 1127 end; 1128 end; 1129 end; 1108 1130 end; 1109 1131 … … 1149 1171 if G.RO[DipMem[me].pContact] <> nil then 1150 1172 begin // close windows for next player 1151 for i := 0 to Screen.FormCount - 1 do 1152 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) 1153 then 1154 Screen.Forms[i].Close; 1173 ApplyToVisibleForms(faClose); 1155 1174 end 1156 1175 else … … 1165 1184 1166 1185 function TMainScreen.OfferCall(var Offer: TOffer): integer; 1167 var1168 i: integer;1169 1186 begin 1170 1187 result := Server(scDipOffer, me, 0, Offer); … … 1177 1194 if G.RO[DipMem[me].pContact] <> nil then 1178 1195 begin // close windows for next player 1179 for i := 0 to Screen.FormCount - 1 do 1180 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) 1181 then 1182 Screen.Forms[i].Close; 1196 ApplyToVisibleForms(faClose); 1183 1197 end 1184 1198 else … … 1851 1865 begin 1852 1866 NewAgeCenterTo := -1; 1853 Loc1 := dLoc(Loc1, -dx, -dy) 1867 Loc1 := dLoc(Loc1, -dx, -dy); 1854 1868 end 1855 1869 else … … 1859 1873 end 1860 1874 end; 1861 Centre(Loc1) 1862 end; 1863 1864 for i := 0 to Screen.FormCount - 1 do 1865 if Screen.Forms[i] is TBufferedDrawDlg then 1866 Screen.Forms[i].Enabled := true; 1875 Centre(Loc1); 1876 end; 1877 1878 ApplyToVisibleForms(faEnable); 1867 1879 1868 1880 if ClientMode <> cResume then … … 1875 1887 // first turn after anarchy -- don't show despotism palace! 1876 1888 Update; 1877 for i := 0 to Screen.FormCount - 1 do 1878 if (Screen.Forms[i].Visible) and (Screen.Forms[i] is TBufferedDrawDlg) 1879 then 1880 begin 1881 if @Screen.Forms[i].OnShow <> nil then 1882 Screen.Forms[i].OnShow(nil); 1883 Screen.Forms[i].Invalidate; 1884 Screen.Forms[i].Update; 1885 end; 1889 ApplyToVisibleForms(faUpdate); 1886 1890 1887 1891 if MyRO.Happened and phGameEnd <> 0 then … … 2708 2712 SaveSettings; 2709 2713 CityDlg.CloseAction := None; 2710 for i := 0 to Screen.FormCount - 1 do 2711 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) 2712 then 2713 Screen.Forms[i].Close; 2714 ApplyToVisibleForms(faClose); 2714 2715 if LogDlg.Visible then 2715 2716 LogDlg.Close; … … 3759 3760 3760 3761 var 3761 i,p1, uix, cix, CenterLoc: integer;3762 p1, uix, cix, CenterLoc: integer; 3762 3763 MsgItem: string; 3763 3764 CityReport: TCityReport; … … 3767 3768 result := false; 3768 3769 if ClientMode >= scDipOffer then 3769 exit; 3770 3771 if supervising and (me <> 0) then 3772 begin 3773 for i := 0 to Screen.FormCount - 1 do 3774 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then 3775 Screen.Forms[i].Close; // close windows 3770 Exit; 3771 3772 if supervising and (me <> 0) then begin 3773 ApplyToVisibleForms(faClose); 3776 3774 ItsMeAgain(0); 3777 3775 end; … … 3915 3913 3916 3914 CityDlg.CloseAction := None; 3917 if IsMultiPlayerGame then 3918 begin // close windows for next player 3919 for i := 0 to Screen.FormCount - 1 do 3920 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then 3921 Screen.Forms[i].Close; 3922 end 3923 else 3924 begin 3915 if IsMultiPlayerGame then begin 3916 // Close windows for next player 3917 ApplyToVisibleForms(faClose); 3918 end else begin 3925 3919 if CityDlg.Visible then 3926 3920 CityDlg.Close; … … 3928 3922 UnitStatDlg.Close; 3929 3923 end; 3930 for i := 0 to Screen.FormCount - 1 do 3931 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then 3932 Screen.Forms[i].Enabled := false; 3924 ApplyToVisibleForms(faDisable); 3933 3925 3934 3926 if Server(sTurn, pTurn, 0, nil^) >= rExecuted then … … 5900 5892 ShowModal; 5901 5893 MyData.ToldWonders[i] := MyRO.Wonder[i]; 5902 end 5894 end; 5903 5895 end; 5904 5896 if CityCaptured and (MyMap[ToLoc] and fCity <> 0) then … … 6415 6407 ((p = 0) or (1 shl p and G.RO[0].Alive <> 0)) then 6416 6408 begin 6417 for i := 0 to Screen.FormCount - 1 do 6418 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then 6419 Screen.Forms[i].Close; // close windows 6409 ApplyToVisibleForms(faClose); 6420 6410 ItsMeAgain(p); 6421 6411 SumCities(TaxSum, ScienceSum); … … 6745 6735 else 6746 6736 if result < rExecuted then 6747 Play('INVALID') 6737 Play('INVALID'); 6748 6738 end; 6749 6739 end; … … 6770 6760 end 6771 6761 else 6772 Server(sAbandonMap, me, 0, nil^) 6762 Server(sAbandonMap, me, 0, nil^); 6773 6763 end 6774 6764 else … … 6781 6771 Server(sResign, 0, 0, nil^); 6782 6772 mrOK: 6783 Server(sBreak, 0, 0, nil^) 6773 Server(sBreak, 0, 0, nil^); 6784 6774 end 6785 6775 end 6786 6776 else 6787 Server(sResign, 0, 0, nil^) 6777 Server(sResign, 0, 0, nil^); 6788 6778 end 6789 6779 else if Sender = mEmpire then … … 6811 6801 CityOptimizer_BeginOfTurn; 6812 6802 RevolutionChanged := true; 6813 end 6803 end; 6814 6804 end 6815 6805 else … … 6834 6824 if RevolutionChanged then 6835 6825 UpdateViews(true); 6836 end 6826 end; 6837 6827 end 6838 6828 else if Sender = mWebsite then … … 6847 6837 MapValid := false; 6848 6838 PaintAllMaps; 6849 end 6839 end; 6850 6840 end 6851 6841 else if Sender = mJump then … … 6871 6861 MyMap[MyUn[UnFocus].Loc] and fTerrain) 6872 6862 else 6873 EnhanceDlg.ShowNewContent(wmPersistent) 6863 EnhanceDlg.ShowNewContent(wmPersistent); 6874 6864 end 6875 6865 else if Sender = mCityTypes then … … 7154 7144 begin 7155 7145 MyUn[uix].Status := MyUn[uix].Status or usWaiting; 7156 NewFocus := uix 7146 NewFocus := uix; 7157 7147 end; 7158 7148 end; … … 7161 7151 SetUnFocus(NewFocus); 7162 7152 SetTroopLoc(Loc); 7163 PanelPaint 7153 PanelPaint; 7164 7154 end; 7165 7155 end 7166 7156 else if Sender = mSelectTransport then 7167 Server(sSelectTransport, me, UnFocus, nil^) 7157 Server(sSelectTransport, me, UnFocus, nil^); 7168 7158 end; 7169 7159 … … 7998 7988 7999 7989 procedure TMainScreen.SetTileSize(TileSize: TTileSize; Loc: Integer; MapPos: TPoint); 8000 var8001 i: integer;8002 7990 begin 8003 7991 MainMap.TileSize := TileSize; … … 8006 7994 SetMapPos(Loc, MapPos); 8007 7995 PaintAllMaps; 8008 for i := 0 to Screen.FormCount - 1 do 8009 if Screen.Forms[i].Visible and (Screen.Forms[i] is TBufferedDrawDlg) then 8010 TBufferedDrawDlg(Screen.Forms[i]).SmartUpdateContent(false); 7996 ApplyToVisibleForms(faSmartUpdateContent); 8011 7997 end; 8012 7998
Note:
See TracChangeset
for help on using the changeset viewer.