Changeset 414 for trunk/LocalPlayer
- Timestamp:
- Nov 17, 2021, 1:18:21 AM (3 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/NatStat.pas
r352 r414 5 5 6 6 uses 7 Protocol, ClientTools, Term, ScreenTools, BaseWin, 8 9 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, 10 ButtonB, ButtonC, Menus, EOTButton; 7 Protocol, ClientTools, Term, ScreenTools, BaseWin, LCLIntf, LCLType, SysUtils, 8 Classes, Graphics, Controls, Forms, ButtonB, ButtonC, Menus, EOTButton; 11 9 12 10 type … … 32 30 procedure ScrollDownBtnClick(Sender: TObject); 33 31 procedure TellAIBtnClick(Sender: TObject); 34 35 32 public 36 33 procedure CheckAge; 37 34 procedure ShowNewContent(NewMode: integer; p: integer = -1); 38 35 procedure EcoChange; 39 40 36 protected 41 37 procedure OffscreenPaint; override; 42 43 38 private 44 39 pView, AgePrepared, LinesDown: integer; … … 305 300 Phrases.Lookup('FREXTINCT')); 306 301 LoweredTextOut(Canvas, -1, MainTexture, xAttrib, yAttrib + 28, 307 TurnToString(CurrentReport.TurnOfCivilReport)) 302 TurnToString(CurrentReport.TurnOfCivilReport)); 308 303 end 309 304 else … … 320 315 s := Phrases.Lookup('FRNOCONTACT'); 321 316 LoweredTextOut(Canvas, -1, MainTexture, 322 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, yRelation + 9, s) 317 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, yRelation + 9, s); 323 318 end 324 319 else if ShowContact then … … 379 374 end; 380 375 inc(y); 381 end 376 end; 382 377 end; 383 378 end … … 403 398 procedure TNatStatDlg.CloseBtnClick(Sender: TObject); 404 399 begin 405 Close 400 Close; 406 401 end; 407 402 … … 421 416 begin 422 417 if MainScreen.ContactRefused(pView, 'FRANARCHY') then 423 SmartUpdateContent 418 SmartUpdateContent; 424 419 end 425 420 else … … 427 422 end 428 423 else 429 Close 424 Close; 430 425 end; 431 426 … … 501 496 end 502 497 else 503 inherited 498 inherited; 504 499 end; 505 500 … … 510 505 SelfReport.Government := MyRO.Government; 511 506 SelfReport.Money := MyRO.Money; 512 SmartUpdateContent 513 end 507 SmartUpdateContent; 508 end; 514 509 end; 515 510 … … 520 515 dec(LinesDown); 521 516 SmartUpdateContent; 522 end 517 end; 523 518 end; 524 519 … … 529 524 inc(LinesDown); 530 525 SmartUpdateContent; 531 end 526 end; 532 527 end; 533 528 … … 540 535 else 541 536 TellAIBtn.ButtonIndex := 2; 542 SmartUpdateContent 537 SmartUpdateContent; 543 538 end; 544 539 -
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.