Changeset 465 for branches/highdpi/LocalPlayer/Select.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Select.pas
r378 r465 5 5 6 6 uses 7 UDpiControls, Protocol, ClientTools, Term, ScreenTools, IsoEngine, PVSB, BaseWin,7 UDpiControls, Protocol, ClientTools, ScreenTools, PVSB, BaseWin, 8 8 LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, 9 9 ExtCtrls, ButtonB, ButtonBase, Menus, Types; … … 27 27 ToggleBtn: TButtonB; 28 28 Popup: TDpiPopupMenu; 29 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 29 30 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; 30 31 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 31 32 procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 32 x, y: integer);33 X, Y: Integer); 33 34 procedure FormCreate(Sender: TObject); 34 35 procedure FormDestroy(Sender: TObject); 35 36 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 36 Shift: TShiftState; x, y: integer);37 Shift: TShiftState; X, Y: Integer); 37 38 procedure FormPaint(Sender: TObject); 38 39 procedure CloseBtnClick(Sender: TObject); 39 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);40 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 40 41 procedure FormShow(Sender: TObject); 41 42 procedure ModeBtnClick(Sender: TObject); 42 43 procedure ToggleBtnClick(Sender: TObject); 43 procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);44 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 44 45 procedure PlayerClick(Sender: TObject); 45 46 private … … 49 50 cixProject: Integer; 50 51 pView: Integer; 51 Sel : Integer;52 Selected: Integer; 52 53 DispLines: Integer; 53 54 Layer: Integer; … … 55 56 TechNameSpace: Integer; 56 57 ScienceNation: Integer; 57 sb: TPVScrollbar; 58 Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer; 59 code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer; 60 Column: array [0 .. nPl - 1] of integer; 58 ScrollBar: TPVScrollbar; 59 Lines: array [0 .. MaxLayer - 1] of Integer; 60 FirstShrinkedLine: array [0 .. MaxLayer - 1] of Integer; 61 Code: array [0 .. MaxLayer - 1, 0 .. 4095] of Integer; 62 Column: array [0 .. nPl - 1] of Integer; 61 63 Closable: Boolean; 62 64 MultiPage: Boolean; … … 64 66 procedure ScrollBarUpdate(Sender: TObject); 65 67 procedure InitLines; 66 procedure line(ca: TDpiCanvas; l: integer; NonText, lit: boolean);67 function RenameCity(cix: integer): boolean;68 function RenameModel(mix: integer): boolean;68 procedure Line(ca: TDpiCanvas; L: Integer; NonText, lit: Boolean); 69 function RenameCity(cix: Integer): Boolean; 70 function RenameModel(mix: Integer): Boolean; 69 71 procedure OnScroll(var Msg: TMessage); message WM_VSCROLL; 70 72 procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE; 71 73 public 72 result: integer;73 function OnlyChoice(TestKind: TListKind): integer;74 Result: Integer; 75 function OnlyChoice(TestKind: TListKind): Integer; 74 76 // -2=empty, -1=ambiguous, other=only choice 75 77 procedure OffscreenPaint; override; 76 procedure ShowNewContent(NewMode: integer; ListKind: TListKind);77 procedure ShowNewContent_CityProject(NewMode , cix: integer);78 procedure ShowNewContent_MilReport(NewMode , p: integer);78 procedure ShowNewContent(NewMode: TWindowMode; ListKind: TListKind); 79 procedure ShowNewContent_CityProject(NewMode: TWindowMode; cix: Integer); 80 procedure ShowNewContent_MilReport(NewMode: TWindowMode; P: Integer); 79 81 procedure EcoChange; 80 82 procedure TechChange; … … 90 92 adAll = $10000; 91 93 92 var93 ListDlg: TListDlg;94 ModalSelectDlg: TModalSelectDlg;95 96 94 97 95 implementation 98 96 99 97 uses 100 CityScreen, Help, UnitStat, Tribes, Inp;98 Term, CityScreen, Help, UnitStat, Tribes, Inp, CmdList; 101 99 102 100 {$R *.lfm} … … 111 109 inherited; 112 110 Canvas.Font.Assign(UniFont[ftNormal]); 113 sb:= TPVScrollbar.Create(Self);114 sb.SetBorderSpacing(36, 10, 36);115 sb.OnUpdate := ScrollBarUpdate;111 ScrollBar := TPVScrollbar.Create(Self); 112 ScrollBar.SetBorderSpacing(36, 10, 36); 113 ScrollBar.OnUpdate := ScrollBarUpdate; 116 114 InitButtons; 117 115 Kind := kMission; … … 127 125 procedure TListDlg.FormDestroy(Sender: TObject); 128 126 begin 129 FreeAndNil( sb);127 FreeAndNil(ScrollBar); 130 128 FreeAndNil(ScienceNationDotBuffer); 131 129 end; … … 133 131 procedure TListDlg.CloseBtnClick(Sender: TObject); 134 132 begin 135 Closable := true;133 Closable := True; 136 134 Close; 137 135 end; 138 136 139 procedure TListDlg.FormCloseQuery(Sender: TObject; var CanClose: boolean);137 procedure TListDlg.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 140 138 begin 141 139 CanClose := Closable or not(Kind in MustChooseKind); … … 145 143 begin 146 144 { TODO: Handled by MouseWheel event 147 if sb.Process(Msg) then begin148 Sel := -2;149 SmartUpdateContent( true);145 if ScrollBar.Process(Msg) then begin 146 Selected := -2; 147 SmartUpdateContent(True); 150 148 end; 151 149 } … … 154 152 procedure TListDlg.OnMouseLeave(var Msg: TMessage); 155 153 begin 156 if not Closable and (Sel <> -2) then157 begin 158 line(Canvas, Sel, false, false);159 Sel := -2;154 if not Closable and (Selected <> -2) then 155 begin 156 Line(Canvas, Selected, False, False); 157 Selected := -2; 160 158 end; 161 159 end; … … 163 161 procedure TListDlg.FormPaint(Sender: TObject); 164 162 var 165 s: string;163 S: string; 166 164 begin 167 165 inherited; 168 166 Canvas.Font.Assign(UniFont[ftNormal]); 169 if Sel <> -2 then170 line(Canvas, Sel, false, true);171 s:= '';167 if Selected <> -2 then 168 Line(Canvas, Selected, False, True); 169 S := ''; 172 170 if (Kind = kAdvance) and (MyData.FarTech <> adNone) then 173 s:= Format(Phrases.Lookup('TECHFOCUS'),171 S := Format(Phrases.Lookup('TECHFOCUS'), 174 172 [Phrases.Lookup('ADVANCES', MyData.FarTech)]) 175 173 else if Kind = kModels then 176 s := Tribe[me].TPhrase('SHORTNAME')174 S := Tribe[Me].TPhrase('SHORTNAME') 177 175 else if Kind = kEModels then 178 s:= Tribe[pView].TPhrase('SHORTNAME') + ' (' +176 S := Tribe[pView].TPhrase('SHORTNAME') + ' (' + 179 177 TurnToString(MyRO.EnemyReport[pView].TurnOfMilReport) + ')'; 180 if s<> '' then178 if S <> '' then 181 179 LoweredTextOut(Canvas, -1, MainTexture, 182 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, 31, s);180 (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, 31, S); 183 181 if not MultiPage and (Kind in [kProject, kAdvance, kFarAdvance]) and not Phrases2FallenBackToEnglish 184 182 then 185 183 begin 186 s:= Phrases2.Lookup('SHIFTCLICK');184 S := Phrases2.Lookup('SHIFTCLICK'); 187 185 LoweredTextOut(Canvas, -2, MainTexture, 188 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, ClientHeight - 29, s);189 end; 190 end; 191 192 procedure TListDlg. line(ca: TDpiCanvas; l: integer; NonText, lit: boolean);186 (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, ClientHeight - 29, S); 187 end; 188 end; 189 190 procedure TListDlg.Line(ca: TDpiCanvas; L: Integer; NonText, lit: Boolean); 193 191 // paint a line 194 192 195 procedure DisplayProject( x, y, pix: integer);193 procedure DisplayProject(X, Y, pix: Integer); 196 194 begin 197 195 if pix and (cpType or cpImp) = 0 then 198 with Tribe[ me].ModelPicture[pix and cpIndex] do199 Sprite( offscreen, HGr, x, y, 64, 48, pix mod 10 * 65 + 1,196 with Tribe[Me].ModelPicture[pix and cpIndex] do 197 Sprite(Offscreen, HGr, X, Y, 64, 48, pix mod 10 * 65 + 1, 200 198 pix div 10 * 49 + 1) 201 199 else 202 200 begin 203 Frame( offscreen.Canvas, x + (16 - 1), y + (16 - 2), x+ (16 + xSizeSmall),204 y+ (16 - 1 + ySizeSmall), MainTexture.ColorBevelLight,201 Frame(Offscreen.Canvas, X + (16 - 1), Y + (16 - 2), X + (16 + xSizeSmall), 202 Y + (16 - 1 + ySizeSmall), MainTexture.ColorBevelLight, 205 203 MainTexture.ColorBevelShade); 206 204 if pix and cpType = 0 then 207 205 if (pix and cpIndex = imPalace) and (MyRO.Government <> gAnarchy) then 208 DpiBit Canvas(offscreen.Canvas, x + 16, y+ (16 - 1), xSizeSmall,206 DpiBitBltCanvas(Offscreen.Canvas, X + 16, Y + (16 - 1), xSizeSmall, 209 207 ySizeSmall, SmallImp.Canvas, (MyRO.Government - 1) * 210 208 xSizeSmall, ySizeSmall) 211 209 else 212 DpiBit Canvas(offscreen.Canvas, x + 16, y+ (16 - 1), xSizeSmall,210 DpiBitBltCanvas(Offscreen.Canvas, X + 16, Y + (16 - 1), xSizeSmall, 213 211 ySizeSmall, SmallImp.Canvas, pix and cpIndex mod 7 * 214 212 xSizeSmall, (pix and cpIndex + SystemIconLines * 7) div 7 * 215 213 ySizeSmall) 216 214 else 217 DpiBit Canvas(offscreen.Canvas, x + 16, y+ (16 - 1), xSizeSmall,215 DpiBitBltCanvas(Offscreen.Canvas, X + 16, Y + (16 - 1), xSizeSmall, 218 216 ySizeSmall, SmallImp.Canvas, (3 + pix and cpIndex) * 219 217 xSizeSmall, 0); … … 221 219 end; 222 220 223 procedure ReplaceText( x, y, Color: integer; s: string);221 procedure ReplaceText(X, Y, Color: Integer; S: string); 224 222 var 225 223 TextSize: TSize; … … 227 225 if ca = Canvas then 228 226 begin 229 TextSize.cx := BiColorTextWidth(ca, s);230 TextSize.cy := ca.TextHeight( s);231 if y+ TextSize.cy >= TitleHeight + InnerHeight then232 TextSize.cy := TitleHeight + InnerHeight - y;233 Fill(ca, x, y, TextSize.cx, TextSize.cy, (Maintexture.Width - ClientWidth)227 TextSize.cx := BiColorTextWidth(ca, S); 228 TextSize.cy := ca.TextHeight(S); 229 if Y + TextSize.cy >= TitleHeight + InnerHeight then 230 TextSize.cy := TitleHeight + InnerHeight - Y; 231 Fill(ca, X, Y, TextSize.cx, TextSize.cy, (Maintexture.Width - ClientWidth) 234 232 div 2, (Maintexture.Height - ClientHeight) div 2); 235 233 end; 236 LoweredTextOut(ca, Color, MainTexture, x, y, s);234 LoweredTextOut(ca, Color, MainTexture, X, Y, S); 237 235 end; 238 236 239 237 var 240 icon, ofs, x, y, y0, lix, i, j, TextColor, Available, first, test,241 FutureCount, growth, TrueFood, TrueProd: integer;238 icon, ofs, X, Y, y0, lix, I, J, TextColor, Available, first, Test, 239 FutureCount, growth, TrueFood, TrueProd: Integer; 242 240 CityReport: TCityReportNew; 243 241 mox: ^TModelInfo; 244 s, number: string;245 CanGrow: boolean;246 begin 247 lix := code[Layer, sb.Position + l];248 y0 := 2 + ( l+ 1) * LineDistance;249 if sb.Position + l>= FirstShrinkedLine[Layer] then250 ofs := ( sb.Position + l- FirstShrinkedLine[Layer]) and 1 * 33242 S, number: string; 243 CanGrow: Boolean; 244 begin 245 lix := Code[Layer, ScrollBar.Position + L]; 246 y0 := 2 + (L + 1) * LineDistance; 247 if ScrollBar.Position + L >= FirstShrinkedLine[Layer] then 248 ofs := (ScrollBar.Position + L - FirstShrinkedLine[Layer]) and 1 * 33 251 249 else { if FirstShrinkedLine[Layer]<Lines[Layer] then } 252 250 ofs := 33; … … 255 253 with MyCity[lix] do 256 254 begin 257 x:= 104 - 76;258 y:= y0;255 X := 104 - 76; 256 Y := y0; 259 257 if ca = Canvas then 260 258 begin 261 x := x+ SideFrame;262 y := y+ TitleHeight;259 X := X + SideFrame; 260 Y := Y + TitleHeight; 263 261 end; 264 262 if lit then … … 266 264 else 267 265 TextColor := -1; 268 s:= CityName(ID);269 while BiColorTextWidth(ca, s) > CityNameSpace do270 delete(s, length(s), 1);271 ReplaceText( x + 15, y, TextColor, s);266 S := CityName(ID); 267 while BiColorTextWidth(ca, S) > CityNameSpace do 268 Delete(S, Length(S), 1); 269 ReplaceText(X + 15, Y, TextColor, S); 272 270 273 271 if NonText then 274 with offscreen.Canvas do272 with Offscreen.Canvas do 275 273 begin // city size 276 brush.Color := $000000;277 fillrect(rect(x - 4 - 11, y + 1, x - 4 + 13, y+ 21));278 brush.Color := $FFFFFF;279 fillrect(rect(x - 4 - 12, y, x - 4 + 12, y+ 20));280 brush.style := bsClear;274 Brush.Color := $000000; 275 FillRect(rect(X - 4 - 11, Y + 1, X - 4 + 13, Y + 21)); 276 Brush.Color := $FFFFFF; 277 FillRect(rect(X - 4 - 12, Y, X - 4 + 12, Y + 20)); 278 Brush.style := bsClear; 281 279 Font.Color := $000000; 282 s := inttostr(MyCity[lix].Size);283 TextOut( x - 4 - textwidth(s) div 2, y, s);280 S := IntToStr(MyCity[lix].Size); 281 TextOut(X - 4 - textwidth(S) div 2, Y, S); 284 282 end; 285 283 … … 287 285 begin 288 286 first := -1; 289 for j:= 0 to nCityEventPriority - 1 do290 if (Flags and CityRepMask and CityEventPriority[ j] <> 0) then291 begin 292 first := j;293 Break 287 for J := 0 to nCityEventPriority - 1 do 288 if (Flags and CityRepMask and CityEventPriority[J] <> 0) then 289 begin 290 first := J; 291 Break; 294 292 end; 295 293 if first >= 0 then 296 294 begin 297 i:= 0;298 test := 1;299 while test < CityEventPriority[first] do300 begin 301 inc(i);302 inc(test, test)303 end; 304 s := CityEventName(i);295 I := 0; 296 Test := 1; 297 while Test < CityEventPriority[first] do 298 begin 299 Inc(I); 300 Inc(Test, Test); 301 end; 302 S := CityEventName(I); 305 303 { if CityEventPriority[first]=chNoGrowthWarning then 306 304 if Built[imAqueduct]=0 then 307 s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)])308 else begin s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); i:=17 end; }309 ReplaceText( x + (CityNameSpace + 4 + 40 + 18 + 8), y, TextColor, s);305 S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)]) 306 else begin S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); I:=17 end; } 307 ReplaceText(X + (CityNameSpace + 4 + 40 + 18 + 8), Y, TextColor, S); 310 308 if NonText then 311 309 begin 312 Sprite( offscreen, HGrSystem, 105 - 76 + CityNameSpace + 4 + 40,313 y0 + 1, 18, 18, 1 + i mod 3 * 19, 1 + idiv 3 * 19);314 x:= InnerWidth - 26;315 for j:= nCityEventPriority - 1 downto first + 1 do316 if (Flags and CityRepMask and CityEventPriority[ j] <> 0) then310 Sprite(Offscreen, HGrSystem, 105 - 76 + CityNameSpace + 4 + 40, 311 y0 + 1, 18, 18, 1 + I mod 3 * 19, 1 + I div 3 * 19); 312 X := InnerWidth - 26; 313 for J := nCityEventPriority - 1 downto first + 1 do 314 if (Flags and CityRepMask and CityEventPriority[J] <> 0) then 317 315 begin 318 i:= 0;319 test := 1;320 while test < CityEventPriority[j] do316 I := 0; 317 Test := 1; 318 while Test < CityEventPriority[J] do 321 319 begin 322 inc(i);323 inc(test, test)320 Inc(I); 321 Inc(Test, Test); 324 322 end; 325 if (CityEventPriority[ j] = chNoGrowthWarning) and323 if (CityEventPriority[J] = chNoGrowthWarning) and 326 324 (Built[imAqueduct] > 0) then 327 i:= 17;328 Sprite( offscreen, HGrSystem, x, y0 + 1, 18, 18,329 1 + i mod 3 * 19, 1 + idiv 3 * 19);330 dec(x, 20)331 end 332 end 333 end 325 I := 17; 326 Sprite(Offscreen, HGrSystem, X, y0 + 1, 18, 18, 327 1 + I mod 3 * 19, 1 + I div 3 * 19); 328 Dec(X, 20); 329 end; 330 end; 331 end; 334 332 end 335 333 else … … 338 336 CityReport.HypoTaxRate := -1; 339 337 CityReport.HypoLuxuryRate := -1; 340 Server(sGetCityReportNew, me, lix, CityReport);338 Server(sGetCityReportNew, Me, lix, CityReport); 341 339 TrueFood := Food; 342 340 TrueProd := Prod; 343 if supervising then341 if Supervising then 344 342 begin // normalize city from after-turn state 345 dec(TrueFood, CityReport.FoodSurplus);343 Dec(TrueFood, CityReport.FoodSurplus); 346 344 if TrueFood < 0 then 347 345 TrueFood := 0; // shouldn't happen 348 dec(TrueProd, CityReport.Production);346 Dec(TrueProd, CityReport.Production); 349 347 if TrueProd < 0 then 350 348 TrueProd := 0; // shouldn't happen 351 349 end; 352 350 353 s:= ''; // disorder info351 S := ''; // disorder info 354 352 if Flags and chCaptured <> 0 then 355 s:= Phrases.Lookup('CITYEVENTS', 14)353 S := Phrases.Lookup('CITYEVENTS', 14) 356 354 else if CityReport.HappinessBalance < 0 then 357 s:= Phrases.Lookup('CITYEVENTS', 0);358 if s<> '' then355 S := Phrases.Lookup('CITYEVENTS', 0); 356 if S <> '' then 359 357 begin { disorder } 360 358 if NonText then 361 359 begin 362 DarkGradient( offscreen.Canvas, 99 + 31 + CityNameSpace + 4,360 DarkGradient(Offscreen.Canvas, 99 + 31 + CityNameSpace + 4, 363 361 y0 + 2, 131, 3); 364 362 ca.Font.Assign(UniFont[ftSmall]); 365 RisedTextout( offscreen.Canvas, 103 + CityNameSpace + 4 + 31,366 y0 + 1, s);363 RisedTextout(Offscreen.Canvas, 103 + CityNameSpace + 4 + 31, 364 y0 + 1, S); 367 365 ca.Font.Assign(UniFont[ftNormal]); 368 end 366 end; 369 367 end 370 368 else 371 369 begin 372 370 { s:=IntToStr(CityReport.FoodSurplus); 373 ReplaceText( x+(CityNameSpace+4+48)-BiColorTextWidth(ca,s),y,TextColor,s); }374 s := inttostr(CityReport.Science);375 ReplaceText( x+ CityNameSpace + 4 + 370 + 48 - BiColorTextWidth(ca,376 s), y, TextColor, s);377 s := inttostr(CityReport.Production);378 ReplaceText( x + CityNameSpace + 4 + 132 - BiColorTextWidth(ca, s), y,379 TextColor, s);371 ReplaceText(X+(CityNameSpace+4+48)-BiColorTextWidth(ca,S),Y,TextColor,S); } 372 S := IntToStr(CityReport.Science); 373 ReplaceText(X + CityNameSpace + 4 + 370 + 48 - BiColorTextWidth(ca, 374 S), Y, TextColor, S); 375 S := IntToStr(CityReport.Production); 376 ReplaceText(X + CityNameSpace + 4 + 132 - BiColorTextWidth(ca, S), Y, 377 TextColor, S); 380 378 if NonText then 381 379 begin 382 380 // Sprite(offscreen,HGrSystem,x+CityNameSpace+4+333+1,y+6,10,10,66,115); 383 Sprite( offscreen, HGrSystem, x+ CityNameSpace + 4 + 370 + 48 + 1,384 y+ 6, 10, 10, 77, 126);385 Sprite( offscreen, HGrSystem, x + CityNameSpace + 4 + 132 + 1, y+ 6,381 Sprite(Offscreen, HGrSystem, X + CityNameSpace + 4 + 370 + 48 + 1, 382 Y + 6, 10, 10, 77, 126); 383 Sprite(Offscreen, HGrSystem, X + CityNameSpace + 4 + 132 + 1, Y + 6, 386 384 10, 10, 88, 115); 387 end 388 end; 389 s := inttostr(CityTaxBalance(lix, CityReport));390 ReplaceText( x + CityNameSpace + 4 + 370 - BiColorTextWidth(ca, s), y,391 TextColor, s);385 end; 386 end; 387 S := IntToStr(CityTaxBalance(lix, CityReport)); 388 ReplaceText(X + CityNameSpace + 4 + 370 - BiColorTextWidth(ca, S), Y, 389 TextColor, S); 392 390 // if Project and (cpImp+cpIndex)<>cpImp+imTrGoods then 393 391 // ReplaceText(x+CityNameSpace+4+333+1,y,TextColor,Format('%d/%d',[TrueProd,CityReport.ProjectCost])); 394 392 if NonText then 395 393 begin 396 Sprite( offscreen, HGrSystem, x + CityNameSpace + 4 + 370 + 1, y+ 6,394 Sprite(Offscreen, HGrSystem, X + CityNameSpace + 4 + 370 + 1, Y + 6, 397 395 10, 10, 132, 115); 398 396 … … 402 400 ((Size < NeedAqueductSize) or (Built[imAqueduct] = 1) and 403 401 (Size < NeedSewerSize) or (Built[imSewer] = 1)); 404 PaintRelativeProgressBar( offscreen.Canvas, 1, x+ 15 + CityNameSpace +405 4, y+ 7, 68, TrueFood, CutCityFoodSurplus(CityReport.FoodSurplus,402 PaintRelativeProgressBar(Offscreen.Canvas, 1, X + 15 + CityNameSpace + 403 4, Y + 7, 68, TrueFood, CutCityFoodSurplus(CityReport.FoodSurplus, 406 404 (MyRO.Government <> gAnarchy) and (Flags and chCaptured = 0), 407 405 MyRO.Government, Size), CityReport.Storage, CanGrow, MainTexture); … … 409 407 if Project <> cpImp + imTrGoods then 410 408 begin 411 DisplayProject(ofs + 104 - 76 + x- 28 + CityNameSpace + 4 + 206 -409 DisplayProject(ofs + 104 - 76 + X - 28 + CityNameSpace + 4 + 206 - 412 410 60, y0 - 15, Project); 413 411 … … 417 415 (Flags and chCaptured <> 0) then 418 416 growth := 0; 419 PaintRelativeProgressBar( offscreen.Canvas, 4,420 x + CityNameSpace + 4 + 304 - 60 + 9, y+ 7, 68, TrueProd, growth,421 CityReport.ProjectCost, true, MainTexture);422 end; 423 end 417 PaintRelativeProgressBar(Offscreen.Canvas, 4, 418 X + CityNameSpace + 4 + 304 - 60 + 9, Y + 7, 68, TrueProd, growth, 419 CityReport.ProjectCost, True, MainTexture); 420 end; 421 end; 424 422 end; 425 423 end 426 424 else if Kind in [kModels, kEModels] then 427 425 begin 428 x:= 104;429 y:= y0;426 X := 104; 427 Y := y0; 430 428 if ca = Canvas then 431 429 begin 432 x := x+ SideFrame;433 y := y + TitleHeight430 X := X + SideFrame; 431 Y := Y + TitleHeight; 434 432 end; 435 433 if lit then … … 440 438 begin 441 439 Available := 0; 442 for j:= 0 to MyRO.nUn - 1 do443 if (MyUn[ j].Loc >= 0) and (MyUn[j].mix = lix) then444 inc(Available);440 for J := 0 to MyRO.nUn - 1 do 441 if (MyUn[J].Loc >= 0) and (MyUn[J].mix = lix) then 442 Inc(Available); 445 443 if MainScreen.mNames.Checked then 446 s := Tribe[me].ModelName[lix]444 S := Tribe[Me].ModelName[lix] 447 445 else 448 s := Format(Tribe[me].TPhrase('GENMODEL'), [lix]);446 S := Format(Tribe[Me].TPhrase('GENMODEL'), [lix]); 449 447 if NonText then 450 448 DisplayProject(8 + ofs, y0 - 15, lix); … … 454 452 Available := MyRO.EnemyReport[pView].UnCount[lix]; 455 453 if MainScreen.mNames.Checked then 456 s:= Tribe[pView].ModelName[lix]454 S := Tribe[pView].ModelName[lix] 457 455 else 458 s:= Format(Tribe[pView].TPhrase('GENMODEL'), [lix]);456 S := Format(Tribe[pView].TPhrase('GENMODEL'), [lix]); 459 457 if NonText then 460 458 with Tribe[pView].ModelPicture[lix] do 461 Sprite( offscreen, HGr, 8 + ofs, y0 - 15, 64, 48, pix mod 10 * 65 + 1,459 Sprite(Offscreen, HGr, 8 + ofs, y0 - 15, 64, 48, pix mod 10 * 65 + 1, 462 460 pix div 10 * 49 + 1); 463 461 end; 464 462 if Available > 0 then 465 ReplaceText( x + 32 - BiColorTextWidth(ca, inttostr(Available)), y,466 TextColor, inttostr(Available));467 ReplaceText( x + 40, y, TextColor, s);463 ReplaceText(X + 32 - BiColorTextWidth(ca, IntToStr(Available)), Y, 464 TextColor, IntToStr(Available)); 465 ReplaceText(X + 40, Y, TextColor, S); 468 466 end 469 467 else … … 472 470 kAllEModels, kChooseEModel: 473 471 if lix = mixAll then 474 s:= Phrases.Lookup('PRICECAT_ALLMODEL')472 S := Phrases.Lookup('PRICECAT_ALLMODEL') 475 473 else 476 474 begin … … 478 476 if MainScreen.mNames.Checked then 479 477 begin 480 s:= Tribe[mox.Owner].ModelName[mox.mix];481 if (Kind = kAllEModels) and ( code[1, sb.Position + l] = 0) then482 s := Format(Tribe[mox.Owner].TPhrase('OWNED'), [s]);478 S := Tribe[mox.Owner].ModelName[mox.mix]; 479 if (Kind = kAllEModels) and (Code[1, ScrollBar.Position + L] = 0) then 480 S := Format(Tribe[mox.Owner].TPhrase('OWNED'), [S]); 483 481 end 484 482 else 485 s:= Format(Tribe[mox.Owner].TPhrase('GENMODEL'), [mox.mix]);483 S := Format(Tribe[mox.Owner].TPhrase('GENMODEL'), [mox.mix]); 486 484 if NonText then 487 485 with Tribe[mox.Owner].ModelPicture[mox.mix] do 488 Sprite( offscreen, HGr, 8 + ofs, y0 - 15, 64, 48,486 Sprite(Offscreen, HGr, 8 + ofs, y0 - 15, 64, 48, 489 487 pix mod 10 * 65 + 1, pix div 10 * 49 + 1); 490 488 end; 491 489 kChooseModel: 492 490 if lix = mixAll then 493 s:= Phrases.Lookup('PRICECAT_ALLMODEL')491 S := Phrases.Lookup('PRICECAT_ALLMODEL') 494 492 else 495 493 begin 496 s := Tribe[me].ModelName[lix];494 S := Tribe[Me].ModelName[lix]; 497 495 if NonText then 498 496 DisplayProject(8 + ofs, y0 - 15, lix); … … 501 499 begin 502 500 if lix and cpType <> 0 then 503 s:= Phrases.Lookup('CITYTYPE', lix and cpIndex)501 S := Phrases.Lookup('CITYTYPE', lix and cpIndex) 504 502 else if lix and cpImp = 0 then 505 503 with MyModel[lix and cpIndex] do 506 504 begin 507 s := Tribe[me].ModelName[lix and cpIndex];505 S := Tribe[Me].ModelName[lix and cpIndex]; 508 506 if lix and cpConscripts <> 0 then 509 s := Format(Phrases.Lookup('CONSCRIPTS'), [s]);507 S := Format(Phrases.Lookup('CONSCRIPTS'), [S]); 510 508 end 511 509 else 512 510 begin 513 s:= Phrases.Lookup('IMPROVEMENTS', lix and cpIndex);511 S := Phrases.Lookup('IMPROVEMENTS', lix and cpIndex); 514 512 if (Imp[lix and cpIndex].Kind in [ikNatLocal, ikNatGlobal]) and 515 513 (MyRO.NatBuilt[lix and cpIndex] > 0) or … … 517 515 (MyCity[cixProject].Built[imPower] + MyCity[cixProject].Built 518 516 [imHydro] + MyCity[cixProject].Built[imNuclear] > 0) then 519 s := Format(Phrases.Lookup('NATEXISTS'), [s]);517 S := Format(Phrases.Lookup('NATEXISTS'), [S]); 520 518 end; 521 519 if NonText then … … 525 523 begin 526 524 if lix = adAll then 527 s:= Phrases.Lookup('PRICECAT_ALLTECH')525 S := Phrases.Lookup('PRICECAT_ALLTECH') 528 526 else 529 527 begin 530 528 if lix = adNexus then 531 s:= Phrases.Lookup('NEXUS')529 S := Phrases.Lookup('NEXUS') 532 530 else if lix = adNone then 533 s:= Phrases.Lookup('NOFARTECH')531 S := Phrases.Lookup('NOFARTECH') 534 532 else if lix = adMilitary then 535 s:= Phrases.Lookup('INITUNIT')533 S := Phrases.Lookup('INITUNIT') 536 534 else 537 535 begin 538 s:= Phrases.Lookup('ADVANCES', lix);536 S := Phrases.Lookup('ADVANCES', lix); 539 537 if (Kind = kAdvance) and (lix in FutureTech) then 540 538 if MyRO.Tech[lix] < tsApplicable then 541 s := s+ ' 1'539 S := S + ' 1' 542 540 else 543 s := s + ' ' + inttostr(MyRO.Tech[lix] + 1);541 S := S + ' ' + IntToStr(MyRO.Tech[lix] + 1); 544 542 end; 545 if BiColorTextWidth(ca, s) > TechNameSpace + 8 then543 if BiColorTextWidth(ca, S) > TechNameSpace + 8 then 546 544 begin 547 545 repeat 548 delete(s, length(s), 1);549 until BiColorTextWidth(ca, s) <= TechNameSpace + 5;550 s := s+ '.';546 Delete(S, Length(S), 1); 547 until BiColorTextWidth(ca, S) <= TechNameSpace + 5; 548 S := S + '.'; 551 549 end; 552 550 … … 555 553 if lix = adNexus then 556 554 begin 557 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36),555 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36), 558 556 y0 + 20, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 559 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20, 223, 295)557 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 223, 295) 560 558 end 561 559 else if lix = adNone then 562 560 begin 563 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36),561 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36), 564 562 y0 + 20, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 565 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20, 260, 295)563 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 260, 295) 566 564 end 567 565 else if lix = adMilitary then 568 566 begin 569 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36),567 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36), 570 568 y0 + 20, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 571 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20, 38, 295)569 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 38, 295) 572 570 end 573 571 else 574 572 begin 575 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1,573 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, 576 574 (8 + 16 + xSizeSmall), y0 + ySizeSmall, 577 575 MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 578 576 if AdvIcon[lix] < 84 then 579 DpiBit Canvas(offscreen.Canvas, (8 + 16), y0, xSizeSmall,577 DpiBitBltCanvas(Offscreen.Canvas, (8 + 16), y0, xSizeSmall, 580 578 ySizeSmall, SmallImp.Canvas, 581 579 (AdvIcon[lix] + SystemIconLines * 7) mod 7 * xSizeSmall, … … 583 581 ySizeSmall) 584 582 else 585 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20,583 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 586 584 1 + (AdvIcon[lix] - 84) mod 8 * 37, 587 585 295 + (AdvIcon[lix] - 84) div 8 * 21); 588 j:= AdvValue[lix] div 1000;589 DpiBit Canvas(offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14,590 HGrSystem.Mask.Canvas, 127 + j* 15,586 J := AdvValue[lix] div 1000; 587 DpiBitBltCanvas(Offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14, 588 HGrSystem.Mask.Canvas, 127 + J * 15, 591 589 85, SRCAND); 592 Sprite( offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14,593 127 + j* 15, 85);590 Sprite(Offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14, 591 127 + J * 15, 85); 594 592 end; 595 593 end; … … 598 596 if NonText and (Kind in [kAdvance, kScience]) then 599 597 begin // show research state 600 for j:= 0 to nColumn - 1 do598 for J := 0 to nColumn - 1 do 601 599 begin 602 600 FutureCount := 0; 603 if j= 0 then // own science601 if J = 0 then // own science 604 602 if lix = MyRO.ResearchTech then 605 603 begin 606 Server(sGetTechCost, me, 0, icon);604 Server(sGetTechCost, Me, 0, icon); 607 605 icon := 4 + MyRO.Research * 4 div icon; 608 606 if icon > 4 + 3 then … … 623 621 icon := -1 624 622 else 625 with MyRO.EnemyReport[Column[ j]]^ do // enemy science626 if (MyRO.Alive and (1 shl Column[ j]) <> 0) and623 with MyRO.EnemyReport[Column[J]]^ do // enemy science 624 if (MyRO.Alive and (1 shl Column[J]) <> 0) and 627 625 (TurnOfCivilReport >= 0) and (lix = ResearchTech) and 628 626 ((lix = adMilitary) or (lix in FutureTech) or … … 631 629 icon := 4 + ResearchDone div 25; 632 630 if icon > 4 + 3 then 633 icon := 4 + 3 631 icon := 4 + 3; 634 632 end 635 633 else if lix = adMilitary then … … 647 645 icon := -1; 648 646 if icon >= 0 then 649 Sprite( offscreen, HGrSystem, 104 - 33 + 15 + 3 + TechNameSpace +650 24 * j, y0 + 3, 14, 14, 67 + icon * 15, 85)647 Sprite(Offscreen, HGrSystem, 104 - 33 + 15 + 3 + TechNameSpace + 648 24 * J, y0 + 3, 14, 14, 67 + icon * 15, 85) 651 649 else if (Kind = kScience) and (FutureCount > 0) then 652 650 begin 653 number := inttostr(FutureCount);654 RisedTextout(ca, 104 - 33 + 15 + 10 + TechNameSpace + 24 * j-651 number := IntToStr(FutureCount); 652 RisedTextout(ca, 104 - 33 + 15 + 10 + TechNameSpace + 24 * J - 655 653 BiColorTextWidth(ca, number) div 2, y0, number); 656 end 657 end 654 end; 655 end; 658 656 end; 659 657 end; // kAdvance, kScience 660 658 kTribe: 661 s:= TribeNames[lix];659 S := TribeNames[lix]; 662 660 kShipPart: 663 661 begin 664 s:= Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' +665 inttostr(MyRO.Ship[me].Parts[lix]) + ')';662 S := Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' + 663 IntToStr(MyRO.Ship[Me].Parts[lix]) + ')'; 666 664 if NonText then 667 665 DisplayProject(8 + ofs, y0 - 15, cpImp + imShipComp + lix); … … 669 667 kEShipPart: 670 668 begin 671 s:= Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' +672 inttostr(MyRO.Ship[DipMem[me].pContact].Parts[lix]) + ')';669 S := Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' + 670 IntToStr(MyRO.Ship[DipMem[Me].pContact].Parts[lix]) + ')'; 673 671 if NonText then 674 672 DisplayProject(8 + ofs, y0 - 15, cpImp + imShipComp + lix); … … 676 674 kGov: 677 675 begin 678 s:= Phrases.Lookup('GOVERNMENT', lix);676 S := Phrases.Lookup('GOVERNMENT', lix); 679 677 if NonText then 680 678 begin 681 Frame( offscreen.Canvas, 8 + 16 - 1, y0 - 15 + (16 - 2),679 Frame(Offscreen.Canvas, 8 + 16 - 1, y0 - 15 + (16 - 2), 682 680 8 + 16 + xSizeSmall, y0 - 15 + (16 - 1 + ySizeSmall), 683 681 MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 684 DpiBit Canvas(offscreen.Canvas, 8 + 16, y0 - 15 + (16 - 1),682 DpiBitBltCanvas(Offscreen.Canvas, 8 + 16, y0 - 15 + (16 - 1), 685 683 xSizeSmall, ySizeSmall, SmallImp.Canvas, 686 684 (lix - 1) * xSizeSmall, ySizeSmall); 687 end 685 end; 688 686 end; 689 687 kMission: 690 s:= Phrases.Lookup('SPYMISSION', lix);688 S := Phrases.Lookup('SPYMISSION', lix); 691 689 end; 692 690 case Kind of 693 691 kTribe, kMission: // center text 694 692 if Lines[0] > MaxLines then 695 x:= (InnerWidth - DpiGetSystemMetrics(SM_CXVSCROLL)) div 2 -696 BiColorTextWidth(ca, s) div 2693 X := (InnerWidth - DpiGetSystemMetrics(SM_CXVSCROLL)) div 2 - 694 BiColorTextWidth(ca, S) div 2 697 695 else 698 x := InnerWidth div 2 - BiColorTextWidth(ca, s) div 2;696 X := InnerWidth div 2 - BiColorTextWidth(ca, S) div 2; 699 697 kAdvance, kFarAdvance, kScience, kChooseTech, kChooseETech, 700 698 kStealTech, kGov: 701 x:= 104 - 33;699 X := 104 - 33; 702 700 kAllEModels: 703 x:= 104;701 X := 104; 704 702 else 705 x:= 104 + 15;703 X := 104 + 15; 706 704 end; 707 y:= y0;705 Y := y0; 708 706 if ca = Canvas then 709 707 begin 710 x := x+ SideFrame;711 y := y + TitleHeight708 X := X + SideFrame; 709 Y := Y + TitleHeight; 712 710 end; 713 711 if lit then … … 716 714 TextColor := -1; 717 715 { if Kind=kTribe then ReplaceText_Tribe(x,y,TextColor, 718 integer(TribeNames.Objects[lix]),s)719 else } ReplaceText( x, y, TextColor, s);720 end 716 Integer(TribeNames.Objects[lix]),S) 717 else } ReplaceText(X, Y, TextColor, S); 718 end; 721 719 end; 722 720 723 721 procedure TListDlg.OffscreenPaint; 724 722 var 725 i, j: integer;723 I, J: Integer; 726 724 begin 727 725 case Kind of 728 726 kCities: 729 Caption := Tribe[ me].TPhrase('TITLE_CITIES');727 Caption := Tribe[Me].TPhrase('TITLE_CITIES'); 730 728 kCityEvents: 731 729 Caption := Format(Phrases.Lookup('TITLE_EVENTS'), … … 734 732 735 733 inherited; 736 offscreen.Canvas.Font.Assign(UniFont[ftNormal]);734 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 737 735 FillOffscreen(0, 0, InnerWidth, InnerHeight); 738 with offscreen.Canvas do736 with Offscreen.Canvas do 739 737 begin 740 738 if Kind = kScience then 741 for i:= 1 to nColumn - 1 do739 for I := 1 to nColumn - 1 do 742 740 begin 743 741 Pen.Color := $000000; 744 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * i, 0);745 LineTo(104 - 33 + 15 + TechNameSpace + 24 * i, InnerHeight);746 MoveTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * i, 0);747 LineTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * i, InnerHeight);748 if MyRO.EnemyReport[Column[ i]].TurnOfCivilReport >= MyRO.Turn - 1 then749 begin 750 brush.Color := Tribe[Column[i]].Color;751 fillrect(rect(104 - 33 + 14 + TechNameSpace + 24 * i+ 1 * 2, 0,752 104 - 33 + 17 + TechNameSpace + 24 * i+ 8 * 2, InnerHeight));753 brush.style := bsClear;742 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * I, 0); 743 LineTo(104 - 33 + 15 + TechNameSpace + 24 * I, InnerHeight); 744 MoveTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * I, 0); 745 LineTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * I, InnerHeight); 746 if MyRO.EnemyReport[Column[I]].TurnOfCivilReport >= MyRO.Turn - 1 then 747 begin 748 Brush.Color := Tribe[Column[I]].Color; 749 FillRect(rect(104 - 33 + 14 + TechNameSpace + 24 * I + 1 * 2, 0, 750 104 - 33 + 17 + TechNameSpace + 24 * I + 8 * 2, InnerHeight)); 751 Brush.style := bsClear; 754 752 end 755 753 else 756 754 begin // colored player columns 757 Pen.Color := Tribe[Column[ i]].Color;758 for j:= 1 to 8 do759 begin 760 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * i + j* 2, 0);761 LineTo(104 - 33 + 15 + TechNameSpace + 24 * i + j* 2, InnerHeight);762 end 763 end; 764 end; 765 766 for i:= -1 to DispLines do767 if ( i + sb.Position >= 0) and (i + sb.Position < Lines[Layer]) then768 Self. line(offscreen.Canvas, i, true, false)755 Pen.Color := Tribe[Column[I]].Color; 756 for J := 1 to 8 do 757 begin 758 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * I + J * 2, 0); 759 LineTo(104 - 33 + 15 + TechNameSpace + 24 * I + J * 2, InnerHeight); 760 end; 761 end; 762 end; 763 764 for I := -1 to DispLines do 765 if (I + ScrollBar.Position >= 0) and (I + ScrollBar.Position < Lines[Layer]) then 766 Self.Line(Offscreen.Canvas, I, True, False); 769 767 end; 770 768 MarkUsedOffscreen(InnerWidth, 8 + 48 + DispLines * LineDistance); … … 772 770 773 771 procedure TListDlg.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 774 x, y: integer);772 X, Y: Integer); 775 773 var 776 i0, Sel0, iColumn, OldScienceNation, xScreen: integer;777 s: string;778 begin 779 y := y- TitleHeight;780 i0 := sb.Position;781 Sel0 := Sel ;782 if ( x >= SideFrame) and (x < SideFrame + InnerWidth) and (y>= 0) and783 ( y < InnerHeight) and (y mod LineDistance >= 4) and (ymod LineDistance < 20)774 i0, Sel0, iColumn, OldScienceNation, xScreen: Integer; 775 S: string; 776 begin 777 Y := Y - TitleHeight; 778 i0 := ScrollBar.Position; 779 Sel0 := Selected; 780 if (X >= SideFrame) and (X < SideFrame + InnerWidth) and (Y >= 0) and 781 (Y < InnerHeight) and (Y mod LineDistance >= 4) and (Y mod LineDistance < 20) 784 782 then 785 Sel := ydiv LineDistance - 1783 Selected := Y div LineDistance - 1 786 784 else 787 Sel := -2;788 if (Sel < -1) or (Sel > DispLines) or (Sel+ i0 < 0) or789 (Sel + i0 >= Lines[Layer]) then790 Sel := -2;791 if Sel <> Sel0 then785 Selected := -2; 786 if (Selected < -1) or (Selected > DispLines) or (Selected + i0 < 0) or 787 (Selected + i0 >= Lines[Layer]) then 788 Selected := -2; 789 if Selected <> Sel0 then 792 790 begin 793 791 if Sel0 <> -2 then 794 line(Canvas, Sel0, false, false);795 if Sel <> -2 then796 line(Canvas, Sel, false, true)792 Line(Canvas, Sel0, False, False); 793 if Selected <> -2 then 794 Line(Canvas, Selected, False, True); 797 795 end; 798 796 … … 801 799 OldScienceNation := ScienceNation; 802 800 ScienceNation := -1; 803 if ( x>= SideFrame + (104 - 33 + 15 + TechNameSpace)) and804 (( x- SideFrame - (104 - 33 + 15 + TechNameSpace)) mod 24 <= 18) and805 ( y >= 0) and (y< InnerHeight) then801 if (X >= SideFrame + (104 - 33 + 15 + TechNameSpace)) and 802 ((X - SideFrame - (104 - 33 + 15 + TechNameSpace)) mod 24 <= 18) and 803 (Y >= 0) and (Y < InnerHeight) then 806 804 begin 807 iColumn := ( x- SideFrame - (104 - 33 + 15 + TechNameSpace)) div 24;805 iColumn := (X - SideFrame - (104 - 33 + 15 + TechNameSpace)) div 24; 808 806 if (iColumn >= 1) and (iColumn < nColumn) then 809 807 ScienceNation := Column[iColumn]; … … 816 814 if ScienceNation >= 0 then 817 815 begin 818 s:= Tribe[ScienceNation].TPhrase('SHORTNAME');816 S := Tribe[ScienceNation].TPhrase('SHORTNAME'); 819 817 if MyRO.Alive and (1 shl ScienceNation) = 0 then 820 s := Format(Phrases.Lookup('SCIENCEREPORT_EXTINCT'), [s]) // extinct818 S := Format(Phrases.Lookup('SCIENCEREPORT_EXTINCT'), [S]) // extinct 821 819 else if MyRO.EnemyReport[ScienceNation].TurnOfCivilReport < MyRO.Turn - 1 822 820 then 823 s := s+ ' (' + TurnToString(MyRO.EnemyReport[ScienceNation]821 S := S + ' (' + TurnToString(MyRO.EnemyReport[ScienceNation] 824 822 .TurnOfCivilReport) + ')'; // old report 825 xScreen := (ClientWidth - BiColorTextWidth(Canvas, s)) div 2;823 xScreen := (ClientWidth - BiColorTextWidth(Canvas, S)) div 2; 826 824 LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10, 827 ClientHeight - 29, s);828 DpiBit Canvas(ScienceNationDotBuffer.Canvas, 0, 0, ScienceNationDot.Width,825 ClientHeight - 29, S); 826 DpiBitBltCanvas(ScienceNationDotBuffer.Canvas, 0, 0, ScienceNationDot.Width, 829 827 ScienceNationDot.Height, Canvas, xScreen - 10, ClientHeight - 27); 830 828 ImageOp_BCC(ScienceNationDotBuffer, Templates.Data, Point(0, 0), 831 829 ScienceNationDot.BoundsRect, MainTexture.ColorBevelShade, Tribe[ScienceNation].Color); 832 DpiBit Canvas(Canvas, xScreen - 10, ClientHeight - 27, ScienceNationDot.Width,830 DpiBitBltCanvas(Canvas, xScreen - 10, ClientHeight - 27, ScienceNationDot.Width, 833 831 ScienceNationDot.Height, ScienceNationDotBuffer.Canvas, 0, 0); 834 832 end; … … 840 838 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 841 839 begin 842 if sb.ProcessMouseWheel(WheelDelta) then begin840 if ScrollBar.ProcessMouseWheel(WheelDelta) then begin 843 841 PaintBox1MouseMove(nil, [], MousePos.X - Left, 844 842 MousePos.Y - Top); … … 846 844 end; 847 845 848 function TListDlg.RenameCity(cix: integer): boolean; 846 procedure TListDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction); 847 begin 848 //Gtk2Fix; 849 end; 850 851 function TListDlg.RenameCity(cix: Integer): Boolean; 849 852 var 850 853 CityNameInfo: TCityNameInfo; … … 859 862 CityNameInfo.ID := MyCity[cix].ID; 860 863 CityNameInfo.NewName := InputDlg.EInput.Text; 861 Server(cSetCityName + (length(CityNameInfo.NewName) + 8) div 4, me, 0, 862 CityNameInfo); 863 if CityDlg.Visible then 864 if CityNameInfo.GetCommandDataSize > CommandDataMaxSize then 865 Delete(CityNameInfo.NewName, Length(CityNameInfo.NewName) - 866 (CityNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt); 867 Server(CommandWithData(cSetCityName, CityNameInfo.GetCommandDataSize), 868 Me, 0, CityNameInfo); 869 if MainScreen.CityDlg.Visible then 864 870 begin 865 CityDlg.FormShow(nil);866 CityDlg.Invalidate;871 MainScreen.CityDlg.FormShow(nil); 872 MainScreen.CityDlg.Invalidate; 867 873 end; 868 result := true;874 Result := True; 869 875 end 870 876 else 871 result := false;872 end; 873 874 function TListDlg.RenameModel(mix: integer): boolean;877 Result := False; 878 end; 879 880 function TListDlg.RenameModel(mix: Integer): Boolean; 875 881 var 876 882 ModelNameInfo: TModelNameInfo; 877 883 begin 878 884 InputDlg.Caption := Phrases.Lookup('TITLE_MODELNAME'); 879 InputDlg.EInput.Text := Tribe[ me].ModelName[mix];885 InputDlg.EInput.Text := Tribe[Me].ModelName[mix]; 880 886 InputDlg.CenterToRect(BoundsRect); 881 887 InputDlg.ShowModal; 882 888 if (InputDlg.ModalResult = mrOK) and (InputDlg.EInput.Text <> '') and 883 (InputDlg.EInput.Text <> Tribe[ me].ModelName[mix]) then889 (InputDlg.EInput.Text <> Tribe[Me].ModelName[mix]) then 884 890 begin 885 891 ModelNameInfo.mix := mix; 886 892 ModelNameInfo.NewName := InputDlg.EInput.Text; 887 Server(cSetModelName + (length(ModelNameInfo.NewName) + 1 + 4 + 3) div 4, 888 me, 0, ModelNameInfo); 889 if UnitStatDlg.Visible then 893 if ModelNameInfo.GetCommandDataSize > CommandDataMaxSize then 894 Delete(ModelNameInfo.NewName, Length(ModelNameInfo.NewName) - 895 (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt); 896 Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize), 897 Me, 0, ModelNameInfo); 898 if MainScreen.UnitStatDlg.Visible then 890 899 begin 891 UnitStatDlg.FormShow(nil);892 UnitStatDlg.Invalidate;900 MainScreen.UnitStatDlg.FormShow(nil); 901 MainScreen.UnitStatDlg.Invalidate; 893 902 end; 894 result := true;903 Result := True; 895 904 end 896 905 else 897 result := false;906 Result := False; 898 907 end; 899 908 900 909 procedure TListDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 901 Shift: TShiftState; x, y: integer);910 Shift: TShiftState; X, Y: Integer); 902 911 var 903 lix: integer;904 begin 905 if sb.Position + Sel>= 0 then906 lix := code[Layer, sb.Position + Sel];912 lix: Integer; 913 begin 914 if ScrollBar.Position + Selected >= 0 then 915 lix := Code[Layer, ScrollBar.Position + Selected]; 907 916 if Kind in [kScience, kCities, kCityEvents, kModels, kEModels, kAllEModels] 908 917 then 909 include(Shift, ssShift); // don't close list window918 Include(Shift, ssShift); // don't close list window 910 919 if (ssLeft in Shift) and not(ssShift in Shift) then 911 920 begin 912 if Sel <> -2 then921 if Selected <> -2 then 913 922 begin 914 result := lix;915 Closable := true;923 Result := lix; 924 Closable := True; 916 925 Close; 917 926 end; … … 919 928 else if (ssLeft in Shift) and (ssShift in Shift) then 920 929 begin // show help/info popup 921 if Sel <> -2 then930 if Selected <> -2 then 922 931 case Kind of 923 932 kCities: 924 933 MainScreen.ZoomToCity(MyCity[lix].Loc); 925 934 kCityEvents: 926 MainScreen.ZoomToCity(MyCity[lix].Loc, false, MyCity[lix].Flags and935 MainScreen.ZoomToCity(MyCity[lix].Loc, False, MyCity[lix].Flags and 927 936 CityRepMask); 928 937 kModels, kChooseModel: 929 938 if lix <> mixAll then 930 UnitStatDlg.ShowNewContent_OwnModel(FWindowMode or 931 wmPersistent, lix); 939 MainScreen.UnitStatDlg.ShowNewContent_OwnModel(wmPersistent, lix); 932 940 kEModels: 933 UnitStatDlg.ShowNewContent_EnemyModel(FWindowMode orwmPersistent,934 code[1, sb.Position + Sel]);941 MainScreen.UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, 942 Code[1, ScrollBar.Position + Selected]); 935 943 kAllEModels, kChooseEModel: 936 944 if lix <> mixAll then 937 UnitStatDlg.ShowNewContent_EnemyModel(FWindowMode or 938 wmPersistent, lix); 945 MainScreen.UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, lix); 939 946 kAdvance, kFarAdvance, kScience, kChooseTech, kChooseETech, kStealTech: 940 947 if lix = adMilitary then 941 HelpDlg.ShowNewContent(FWindowMode orwmPersistent, hkText,942 HelpDlg.TextIndex('MILRES'))948 MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkText, 949 MainScreen.HelpDlg.TextIndex('MILRES')) 943 950 else if lix < adMilitary then 944 HelpDlg.ShowNewContent(FWindowMode orwmPersistent, hkAdv, lix);951 MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkAdv, lix); 945 952 kProject: 946 953 if lix = cpImp + imTrGoods then 947 HelpDlg.ShowNewContent(FWindowMode orwmPersistent, hkText,948 HelpDlg.TextIndex('TRADINGGOODS'))954 MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkText, 955 MainScreen.HelpDlg.TextIndex('TRADINGGOODS')) 949 956 else if lix and (cpImp + cpType) = 0 then 950 UnitStatDlg.ShowNewContent_OwnModel(FWindowMode orwmPersistent,957 MainScreen.UnitStatDlg.ShowNewContent_OwnModel(wmPersistent, 951 958 lix and cpIndex) 952 959 else if (lix and cpType = 0) and (lix <> cpImp + imTrGoods) then 953 HelpDlg.ShowNewContent(FWindowMode orwmPersistent, hkImp,960 MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkImp, 954 961 lix and cpIndex); 955 962 kGov: 956 HelpDlg.ShowNewContent(FWindowMode orwmPersistent, hkMisc,957 miscGovList);963 MainScreen.HelpDlg.ShowNewContent(wmPersistent, hkMisc, 964 Integer(miscGovList)); 958 965 kShipPart, kEShipPart: 959 966 ; … … 962 969 else if ssRight in Shift then 963 970 begin 964 if Sel <> -2 then971 if Selected <> -2 then 965 972 case Kind of 966 973 kCities, kCityEvents: … … 976 983 procedure TListDlg.InitLines; 977 984 var 978 required: array [0 .. nAdv - 1] of integer;979 980 procedure TryAddImpLine(Layer, Project: integer);981 begin 982 if Server(sSetCityProject - sExecute, me, cixProject, Project) >= rExecuted985 required: array [0 .. nAdv - 1] of Integer; 986 987 procedure TryAddImpLine(Layer, Project: Integer); 988 begin 989 if Server(sSetCityProject - sExecute, Me, cixProject, Project) >= rExecuted 983 990 then 984 991 begin 985 code[Layer, Lines[Layer]] := Project;986 inc(Lines[Layer]);992 Code[Layer, Lines[Layer]] := Project; 993 Inc(Lines[Layer]); 987 994 end; 988 995 end; … … 990 997 procedure SortTechs; 991 998 var 992 i, j, swap: integer;999 I, J, swap: Integer; 993 1000 begin // sort by advancedness 994 for i:= 0 to Lines[0] - 2 do995 if code[0, i] < adMilitary then996 for j := i+ 1 to Lines[0] - 1 do997 if AdvValue[ code[0, i]] * nAdv + code[0, i] < AdvValue[code[0, j]] *998 nAdv + code[0, j] then999 begin 1000 swap := code[0, i];1001 code[0, i] := code[0, j];1002 code[0, j] := swap;1001 for I := 0 to Lines[0] - 2 do 1002 if Code[0, I] < adMilitary then 1003 for J := I + 1 to Lines[0] - 1 do 1004 if AdvValue[Code[0, I]] * nAdv + Code[0, I] < AdvValue[Code[0, J]] * 1005 nAdv + Code[0, J] then 1006 begin 1007 swap := Code[0, I]; 1008 Code[0, I] := Code[0, J]; 1009 Code[0, J] := swap; 1003 1010 end; 1004 1011 end; … … 1006 1013 procedure SortCities; 1007 1014 var 1008 i, j, swap: integer;1009 begin 1010 for i:= 0 to Lines[0] - 2 do1011 for j := i+ 1 to Lines[0] - 1 do1012 if CityName(MyCity[ code[0, i]].ID) > CityName(MyCity[code[0, j]].ID)1015 I, J, swap: Integer; 1016 begin 1017 for I := 0 to Lines[0] - 2 do 1018 for J := I + 1 to Lines[0] - 1 do 1019 if CityName(MyCity[Code[0, I]].ID) > CityName(MyCity[Code[0, J]].ID) 1013 1020 then 1014 1021 begin 1015 swap := code[0, i];1016 code[0, i] := code[0, j];1017 code[0, j] := swap;1022 swap := Code[0, I]; 1023 Code[0, I] := Code[0, J]; 1024 Code[0, J] := swap; 1018 1025 end; 1019 1026 end; 1020 1027 1021 1028 function ModelSortValue(const mi: TModelInfo; 1022 MixPlayers: boolean = false): integer;1023 begin 1024 result := (mi.Domain + 1) shl 28 - mi.mix;1029 MixPlayers: Boolean = False): Integer; 1030 begin 1031 Result := (mi.Domain + 1) shl 28 - mi.mix; 1025 1032 if MixPlayers then 1026 dec(result, ModelCode(mi) shl 16);1033 Dec(Result, ModelCode(mi) shl 16); 1027 1034 end; 1028 1035 1029 1036 procedure SortModels; 1030 1037 var 1031 i, j, swap: integer;1038 I, J, swap: Integer; 1032 1039 begin // sort by code[2] 1033 for i:= 0 to Lines[0] - 2 do1034 for j := i+ 1 to Lines[0] - 1 do1035 if code[2, i] > code[2, j] then1036 begin 1037 swap := code[0, i];1038 code[0, i] := code[0, j];1039 code[0, j] := swap;1040 swap := code[1, i];1041 code[1, i] := code[1, j];1042 code[1, j] := swap;1043 swap := code[2, i];1044 code[2, i] := code[2, j];1045 code[2, j] := swap;1046 end; 1047 end; 1048 1049 procedure MarkPreqs( i: integer);1050 begin 1051 required[ i] := 1;1052 if MyRO.Tech[ i] < tsSeen then1040 for I := 0 to Lines[0] - 2 do 1041 for J := I + 1 to Lines[0] - 1 do 1042 if Code[2, I] > Code[2, J] then 1043 begin 1044 swap := Code[0, I]; 1045 Code[0, I] := Code[0, J]; 1046 Code[0, J] := swap; 1047 swap := Code[1, I]; 1048 Code[1, I] := Code[1, J]; 1049 Code[1, J] := swap; 1050 swap := Code[2, I]; 1051 Code[2, I] := Code[2, J]; 1052 Code[2, J] := swap; 1053 end; 1054 end; 1055 1056 procedure MarkPreqs(I: Integer); 1057 begin 1058 required[I] := 1; 1059 if MyRO.Tech[I] < tsSeen then 1053 1060 begin 1054 if (AdvPreq[ i, 0] >= 0) then1055 MarkPreqs(AdvPreq[ i, 0]);1056 if (AdvPreq[ i, 1] >= 0) then1057 MarkPreqs(AdvPreq[ i, 1]);1061 if (AdvPreq[I, 0] >= 0) then 1062 MarkPreqs(AdvPreq[I, 0]); 1063 if (AdvPreq[I, 1] >= 0) then 1064 MarkPreqs(AdvPreq[I, 1]); 1058 1065 end; 1059 1066 end; 1060 1067 1061 1068 var 1062 Loc1, i, j, p1, dx, dy, mix, emix, EnemyType, TestEnemyType: integer;1069 Loc1, I, J, p1, dx, dy, mix, emix, EnemyType, TestEnemyType: Integer; 1063 1070 mi: TModelInfo; 1064 1071 PPicture, PTestPicture: ^TModelPicture; 1065 ModelOk: array [0 .. 4095] of boolean;1066 ok: boolean;1067 begin 1068 for i:= 0 to MaxLayer - 1 do1069 begin 1070 Lines[ i] := 0;1071 FirstShrinkedLine[ i] := MaxInt;1072 ModelOk: array [0 .. 4095] of Boolean; 1073 ok: Boolean; 1074 begin 1075 for I := 0 to MaxLayer - 1 do 1076 begin 1077 Lines[I] := 0; 1078 FirstShrinkedLine[I] := MaxInt; 1072 1079 end; 1073 1080 case Kind of … … 1075 1082 begin 1076 1083 // improvements 1077 code[0, 0] := cpImp + imTrGoods;1084 Code[0, 0] := cpImp + imTrGoods; 1078 1085 Lines[0] := 1; 1079 for i:= nWonder to nImp - 1 do1080 if Imp[ i].Kind = ikCommon then1081 TryAddImpLine(0, i+ cpImp);1082 for i:= nWonder to nImp - 1 do1083 if not(Imp[ i].Kind in [ikCommon, ikTrGoods]) and1084 ((MyRO.NatBuilt[ i] = 0) or (Imp[i].Kind = ikNatLocal)) then1085 TryAddImpLine(0, i+ cpImp);1086 for i:= 0 to nCityType - 1 do1087 if MyData.ImpOrder[ i, 0] >= 0 then1088 begin 1089 code[0, Lines[0]] := cpType + i;1090 inc(Lines[0]);1086 for I := nWonder to nImp - 1 do 1087 if Imp[I].Kind = ikCommon then 1088 TryAddImpLine(0, I + cpImp); 1089 for I := nWonder to nImp - 1 do 1090 if not(Imp[I].Kind in [ikCommon, ikTrGoods]) and 1091 ((MyRO.NatBuilt[I] = 0) or (Imp[I].Kind = ikNatLocal)) then 1092 TryAddImpLine(0, I + cpImp); 1093 for I := 0 to nCityType - 1 do 1094 if MyData.ImpOrder[I, 0] >= 0 then 1095 begin 1096 Code[0, Lines[0]] := cpType + I; 1097 Inc(Lines[0]); 1091 1098 end; 1092 1099 1093 1100 // wonders 1094 for i:= 0 to nWonder - 1 do1095 TryAddImpLine(1, i+ cpImp);1101 for I := 0 to nWonder - 1 do 1102 TryAddImpLine(1, I + cpImp); 1096 1103 1097 1104 // units 1098 for i:= 0 to MyRO.nModel - 1 do1105 for I := 0 to MyRO.nModel - 1 do 1099 1106 begin 1100 1107 { if MyModel[i].Kind=mkSlaves then 1101 ok:= MyRO.Wonder[woPyramids].EffectiveOwner= me1102 else } if MyModel[ i].Domain = dSea then1103 begin 1104 ok := false;1108 ok:= MyRO.Wonder[woPyramids].EffectiveOwner=Me 1109 else } if MyModel[I].Domain = dSea then 1110 begin 1111 ok := False; 1105 1112 for dx := -2 to 2 do 1106 1113 for dy := -2 to 2 do … … 1111 1118 ((MyMap[Loc1] and fTerrain = fShore) or 1112 1119 (MyMap[Loc1] and fCanal > 0)) then 1113 ok := true;1120 ok := True; 1114 1121 end; 1115 1122 end 1116 1123 else 1117 ok := true;1124 ok := True; 1118 1125 if ok then 1119 1126 begin 1120 if MyModel[ i].Status and msObsolete = 0 then1127 if MyModel[I].Status and msObsolete = 0 then 1121 1128 begin 1122 code[2, Lines[2]] := i;1123 inc(Lines[2]);1129 Code[2, Lines[2]] := I; 1130 Inc(Lines[2]); 1124 1131 end; 1125 if MyModel[ i].Status and msAllowConscripts <> 0 then1132 if MyModel[I].Status and msAllowConscripts <> 0 then 1126 1133 begin 1127 code[2, Lines[2]] := i+ cpConscripts;1128 inc(Lines[2]);1134 Code[2, Lines[2]] := I + cpConscripts; 1135 Inc(Lines[2]); 1129 1136 end; 1130 1137 end; … … 1140 1147 MarkPreqs(MyData.FarTech); 1141 1148 end; 1142 for i:= 0 to nAdv - 1 do1143 if (( i in FutureTech) or (MyRO.Tech[i] < tsApplicable)) and1144 (Server(sSetResearch - sExecute, me, i, nil^) >= rExecuted) and1145 ((MyData.FarTech = adNone) or (required[ i] > 0)) then1146 begin 1147 code[0, Lines[0]] := i;1148 inc(Lines[0]);1149 for I := 0 to nAdv - 1 do 1150 if ((I in FutureTech) or (MyRO.Tech[I] < tsApplicable)) and 1151 (Server(sSetResearch - sExecute, Me, I, nil^) >= rExecuted) and 1152 ((MyData.FarTech = adNone) or (required[I] > 0)) then 1153 begin 1154 Code[0, Lines[0]] := I; 1155 Inc(Lines[0]); 1149 1156 end; 1150 1157 SortTechs; 1151 1158 if Lines[0] = 0 then // no more techs -- offer nexus 1152 1159 begin 1153 code[0, Lines[0]] := adNexus;1154 inc(Lines[0]);1155 end; 1156 ok := false;1157 for i:= 0 to nDomains - 1 do1158 if (upgrade[ i, 0].Preq = preNone) or1159 (MyRO.Tech[upgrade[ i, 0].Preq] >= tsApplicable) then1160 ok := true;1160 Code[0, Lines[0]] := adNexus; 1161 Inc(Lines[0]); 1162 end; 1163 ok := False; 1164 for I := 0 to nDomains - 1 do 1165 if (upgrade[I, 0].Preq = preNone) or 1166 (MyRO.Tech[upgrade[I, 0].Preq] >= tsApplicable) then 1167 ok := True; 1161 1168 if ok then { new unit class } 1162 1169 begin 1163 code[0, Lines[0]] := adMilitary;1164 inc(Lines[0]);1170 Code[0, Lines[0]] := adMilitary; 1171 Inc(Lines[0]); 1165 1172 end; 1166 1173 end; 1167 1174 kFarAdvance: 1168 1175 begin 1169 code[0, Lines[0]] := adNone;1170 inc(Lines[0]);1171 for i:= 0 to nAdv - 1 do1172 if not( i in FutureTech) and (MyRO.Tech[i] < tsApplicable) and1173 ((AdvValue[ i] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and1174 ((AdvValue[ i] < 1000) or (MyRO.Tech[adScience] > tsNA)) then1175 begin 1176 code[0, Lines[0]] := i;1177 inc(Lines[0]);1176 Code[0, Lines[0]] := adNone; 1177 Inc(Lines[0]); 1178 for I := 0 to nAdv - 1 do 1179 if not(I in FutureTech) and (MyRO.Tech[I] < tsApplicable) and 1180 ((AdvValue[I] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and 1181 ((AdvValue[I] < 1000) or (MyRO.Tech[adScience] > tsNA)) then 1182 begin 1183 Code[0, Lines[0]] := I; 1184 Inc(Lines[0]); 1178 1185 end; 1179 1186 SortTechs; … … 1181 1188 kChooseTech: 1182 1189 begin 1183 for i:= 0 to nAdv - 1 do1184 if not( i in FutureTech) and (MyRO.Tech[i] >= tsApplicable) and1185 (MyRO.EnemyReport[DipMem[ me].pContact].Tech[i] < tsSeen) then1186 begin 1187 code[0, Lines[0]] := i;1188 inc(Lines[0]);1190 for I := 0 to nAdv - 1 do 1191 if not(I in FutureTech) and (MyRO.Tech[I] >= tsApplicable) and 1192 (MyRO.EnemyReport[DipMem[Me].pContact].Tech[I] < tsSeen) then 1193 begin 1194 Code[0, Lines[0]] := I; 1195 Inc(Lines[0]); 1189 1196 end; 1190 1197 SortTechs; 1191 1198 // if Lines[0]>1 then 1192 1199 begin 1193 code[0, Lines[0]] := adAll;1194 inc(Lines[0]);1200 Code[0, Lines[0]] := adAll; 1201 Inc(Lines[0]); 1195 1202 end; 1196 1203 end; 1197 1204 kChooseETech: 1198 1205 begin 1199 for i:= 0 to nAdv - 1 do1200 if not( i in FutureTech) and (MyRO.Tech[i] < tsSeen) and1201 (MyRO.EnemyReport[DipMem[ me].pContact].Tech[i] >= tsApplicable) then1202 begin 1203 code[0, Lines[0]] := i;1204 inc(Lines[0]);1206 for I := 0 to nAdv - 1 do 1207 if not(I in FutureTech) and (MyRO.Tech[I] < tsSeen) and 1208 (MyRO.EnemyReport[DipMem[Me].pContact].Tech[I] >= tsApplicable) then 1209 begin 1210 Code[0, Lines[0]] := I; 1211 Inc(Lines[0]); 1205 1212 end; 1206 1213 SortTechs; 1207 1214 // if Lines[0]>1 then 1208 1215 begin 1209 code[0, Lines[0]] := adAll;1210 inc(Lines[0]);1216 Code[0, Lines[0]] := adAll; 1217 Inc(Lines[0]); 1211 1218 end; 1212 1219 end; 1213 1220 kStealTech: 1214 1221 begin 1215 for i:= 0 to nAdv - 1 do1216 if Server(sStealTech - sExecute, me, i, nil^) >= rExecuted then1217 begin 1218 code[0, Lines[0]] := i;1219 inc(Lines[0]);1222 for I := 0 to nAdv - 1 do 1223 if Server(sStealTech - sExecute, Me, I, nil^) >= rExecuted then 1224 begin 1225 Code[0, Lines[0]] := I; 1226 Inc(Lines[0]); 1220 1227 end; 1221 1228 SortTechs; … … 1223 1230 kScience: 1224 1231 begin 1225 Column[0] := me;1232 Column[0] := Me; 1226 1233 nColumn := 1; 1227 1234 for EnemyType := 0 to 2 do … … 1241 1248 begin 1242 1249 Column[nColumn] := p1; 1243 inc(nColumn);1250 Inc(nColumn); 1244 1251 end; 1245 1252 end; 1246 for i:= 0 to nAdv - 1 do1247 begin 1248 ok := (MyRO.Tech[ i] <> tsNA) or (MyRO.ResearchTech = i);1249 for j:= 1 to nColumn - 1 do1250 with MyRO.EnemyReport[Column[ j]]^ do1251 if (Tech[ i] <> tsNA) or (TurnOfCivilReport >= 0) and1252 (ResearchTech = i) then1253 ok := true;1253 for I := 0 to nAdv - 1 do 1254 begin 1255 ok := (MyRO.Tech[I] <> tsNA) or (MyRO.ResearchTech = I); 1256 for J := 1 to nColumn - 1 do 1257 with MyRO.EnemyReport[Column[J]]^ do 1258 if (Tech[I] <> tsNA) or (TurnOfCivilReport >= 0) and 1259 (ResearchTech = I) then 1260 ok := True; 1254 1261 if ok then 1255 1262 begin 1256 code[0, Lines[0]] := i;1257 inc(Lines[0]);1263 Code[0, Lines[0]] := I; 1264 Inc(Lines[0]); 1258 1265 end; 1259 1266 end; … … 1261 1268 1262 1269 ok := MyRO.ResearchTech = adMilitary; 1263 for j:= 1 to nColumn - 1 do1264 with MyRO.EnemyReport[Column[ j]]^ do1265 if (MyRO.Alive and (1 shl Column[ j]) <> 0) and1270 for J := 1 to nColumn - 1 do 1271 with MyRO.EnemyReport[Column[J]]^ do 1272 if (MyRO.Alive and (1 shl Column[J]) <> 0) and 1266 1273 (TurnOfCivilReport >= 0) and (ResearchTech = adMilitary) then 1267 ok := true;1274 ok := True; 1268 1275 if ok then 1269 1276 begin 1270 code[0, Lines[0]] := adMilitary;1271 inc(Lines[0]);1277 Code[0, Lines[0]] := adMilitary; 1278 Inc(Lines[0]); 1272 1279 end 1273 1280 end; … … 1275 1282 begin 1276 1283 if ClientMode < scContact then 1277 for i:= 0 to MyRO.nCity - 1 do1278 if MyCity[ i].Loc >= 0 then1284 for I := 0 to MyRO.nCity - 1 do 1285 if MyCity[I].Loc >= 0 then 1279 1286 begin 1280 code[0, Lines[0]] := i;1281 inc(Lines[0]);1287 Code[0, Lines[0]] := I; 1288 Inc(Lines[0]); 1282 1289 end; 1283 1290 SortCities; … … 1286 1293 kCityEvents: 1287 1294 begin 1288 for i:= 0 to MyRO.nCity - 1 do1289 if (MyCity[ i].Loc >= 0) and (MyCity[i].Flags and CityRepMask <> 0)1295 for I := 0 to MyRO.nCity - 1 do 1296 if (MyCity[I].Loc >= 0) and (MyCity[I].Flags and CityRepMask <> 0) 1290 1297 then 1291 1298 begin 1292 code[0, Lines[0]] := i;1293 inc(Lines[0]);1299 Code[0, Lines[0]] := I; 1300 Inc(Lines[0]); 1294 1301 end; 1295 1302 SortCities; … … 1298 1305 { kChooseECity: 1299 1306 begin 1300 for i:=0 to MyRO.nEnemyCity-1 do1301 if (MyRO.EnemyCity[ i].Loc>=0)1302 and (MyRO.EnemyCity[ i].owner=DipMem[me].pContact) then1303 begin code[0,Lines[0]]:=i; inc(Lines[0]); end;1307 for I:=0 to MyRO.nEnemyCity-1 do 1308 if (MyRO.EnemyCity[I].Loc>=0) 1309 and (MyRO.EnemyCity[I].owner=DipMem[Me].pContact) then 1310 begin Code[0,Lines[0]]:=I; Inc(Lines[0]); end; 1304 1311 FirstShrinkedLine:=0 1305 1312 end; } … … 1308 1315 for mix := 0 to MyRO.nModel - 1 do 1309 1316 begin 1310 code[0, mix] := mix;1311 MakeModelInfo( me, mix, MyModel[mix], mi);1312 code[2, mix] := ModelSortValue(mi);1317 Code[0, mix] := mix; 1318 MakeModelInfo(Me, mix, MyModel[mix], mi); 1319 Code[2, mix] := ModelSortValue(mi); 1313 1320 end; 1314 1321 Lines[0] := MyRO.nModel; … … 1320 1327 for mix := 3 to MyRO.nModel - 1 do 1321 1328 begin // check if opponent already has this model 1322 MakeModelInfo( me, mix, MyModel[mix], mi);1323 ok := true;1329 MakeModelInfo(Me, mix, MyModel[mix], mi); 1330 ok := True; 1324 1331 for emix := 0 to MyRO.nEnemyModel - 1 do 1325 if (MyRO.EnemyModel[emix].Owner = DipMem[ me].pContact) and1332 if (MyRO.EnemyModel[emix].Owner = DipMem[Me].pContact) and 1326 1333 IsSameModel(MyRO.EnemyModel[emix], mi) then 1327 ok := false;1334 ok := False; 1328 1335 if ok then 1329 1336 begin 1330 code[0, Lines[0]] := mix;1331 MakeModelInfo( me, mix, MyModel[mix], mi);1332 code[2, Lines[0]] := ModelSortValue(mi);1333 inc(Lines[0]);1337 Code[0, Lines[0]] := mix; 1338 MakeModelInfo(Me, mix, MyModel[mix], mi); 1339 Code[2, Lines[0]] := ModelSortValue(mi); 1340 Inc(Lines[0]); 1334 1341 end; 1335 1342 end; … … 1337 1344 // if Lines[0]>1 then 1338 1345 begin 1339 code[0, Lines[0]] := mixAll;1340 inc(Lines[0]);;1346 Code[0, Lines[0]] := mixAll; 1347 Inc(Lines[0]);; 1341 1348 end; 1342 1349 FirstShrinkedLine[0] := 0; … … 1345 1352 begin 1346 1353 if MyRO.TestFlags and tfUncover <> 0 then 1347 Server(sGetModels, me, 0, nil^);1354 Server(sGetModels, Me, 0, nil^); 1348 1355 for emix := 0 to MyRO.nEnemyModel - 1 do 1349 ModelOk[emix] := MyRO.EnemyModel[emix].Owner = DipMem[ me].pContact;1356 ModelOk[emix] := MyRO.EnemyModel[emix].Owner = DipMem[Me].pContact; 1350 1357 for mix := 0 to MyRO.nModel - 1 do 1351 1358 begin // don't list models I already have 1352 MakeModelInfo( me, mix, MyModel[mix], mi);1359 MakeModelInfo(Me, mix, MyModel[mix], mi); 1353 1360 for emix := 0 to MyRO.nEnemyModel - 1 do 1354 1361 ModelOk[emix] := ModelOk[emix] and … … 1358 1365 if ModelOk[emix] then 1359 1366 begin 1360 if not Assigned(Tribe[DipMem[ me].pContact].ModelPicture1367 if not Assigned(Tribe[DipMem[Me].pContact].ModelPicture 1361 1368 [MyRO.EnemyModel[emix].mix].HGr) then 1362 1369 InitEnemyModel(emix); 1363 code[0, Lines[0]] := emix;1364 code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix]);1365 inc(Lines[0]);1370 Code[0, Lines[0]] := emix; 1371 Code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix]); 1372 Inc(Lines[0]); 1366 1373 end; 1367 1374 SortModels; 1368 1375 // if not IsMilReportNew(DipMem[me].pContact) or (Lines[0]>1) then 1369 1376 begin 1370 code[0, Lines[0]] := mixAll;1371 inc(Lines[0]);1377 Code[0, Lines[0]] := mixAll; 1378 Inc(Lines[0]); 1372 1379 end; 1373 1380 FirstShrinkedLine[0] := 0; … … 1375 1382 kEModels: 1376 1383 begin 1377 for i:= 0 to MyRO.EnemyReport[pView].nModelCounted - 1 do1378 begin 1379 code[1, Lines[0]] := MyRO.nEnemyModel - 1;1380 while ( code[1, Lines[0]] >= 0) and1381 not((MyRO.EnemyModel[ code[1, Lines[0]]].Owner = pView) and1382 (MyRO.EnemyModel[ code[1, Lines[0]]].mix = i)) do1383 dec(code[1, Lines[0]]);1384 if not Assigned(Tribe[pView].ModelPicture[ i].HGr) then1385 InitEnemyModel( code[1, Lines[0]]);1386 code[0, Lines[0]] := i;1387 code[2, Lines[0]] :=1388 ModelSortValue(MyRO.EnemyModel[ code[1, Lines[0]]]);1389 inc(Lines[0]);1384 for I := 0 to MyRO.EnemyReport[pView].nModelCounted - 1 do 1385 begin 1386 Code[1, Lines[0]] := MyRO.nEnemyModel - 1; 1387 while (Code[1, Lines[0]] >= 0) and 1388 not((MyRO.EnemyModel[Code[1, Lines[0]]].Owner = pView) and 1389 (MyRO.EnemyModel[Code[1, Lines[0]]].mix = I)) do 1390 Dec(Code[1, Lines[0]]); 1391 if not Assigned(Tribe[pView].ModelPicture[I].HGr) then 1392 InitEnemyModel(Code[1, Lines[0]]); 1393 Code[0, Lines[0]] := I; 1394 Code[2, Lines[0]] := 1395 ModelSortValue(MyRO.EnemyModel[Code[1, Lines[0]]]); 1396 Inc(Lines[0]); 1390 1397 end; 1391 1398 SortModels; … … 1394 1401 kAllEModels: 1395 1402 begin 1396 if (MyRO.TestFlags and tfUncover <> 0) or (G.Difficulty[ me] = 0) then1397 Server(sGetModels, me, 0, nil^);1403 if (MyRO.TestFlags and tfUncover <> 0) or (G.Difficulty[Me] = 0) then 1404 Server(sGetModels, Me, 0, nil^); 1398 1405 for emix := 0 to MyRO.nEnemyModel - 1 do 1399 1406 if (MyRO.EnemyModel[emix].mix >= 3) and … … 1405 1412 if not Assigned(PPicture.HGr) then 1406 1413 InitEnemyModel(emix); 1407 ok := true;1414 ok := True; 1408 1415 if MainScreen.mNames.Checked then 1409 for j:= 0 to Lines[0] - 1 do1416 for J := 0 to Lines[0] - 1 do 1410 1417 begin 1411 PTestPicture := @Tribe[MyRO.EnemyModel[ code[0, j]].Owner]1412 .ModelPicture[MyRO.EnemyModel[ code[0, j]].mix];1418 PTestPicture := @Tribe[MyRO.EnemyModel[Code[0, J]].Owner] 1419 .ModelPicture[MyRO.EnemyModel[Code[0, J]].mix]; 1413 1420 if (PPicture.HGr = PTestPicture.HGr) and 1414 1421 (PPicture.pix = PTestPicture.pix) and 1415 1422 (ModelHash(MyRO.EnemyModel[emix]) 1416 = ModelHash(MyRO.EnemyModel[ code[0, j]])) then1423 = ModelHash(MyRO.EnemyModel[Code[0, J]])) then 1417 1424 begin 1418 code[1, j] := 1;1419 ok := false;1425 Code[1, J] := 1; 1426 ok := False; 1420 1427 Break; 1421 1428 end; … … 1423 1430 if ok then 1424 1431 begin 1425 code[0, Lines[0]] := emix;1426 code[1, Lines[0]] := 0;1427 code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], true);1428 inc(Lines[0]);1432 Code[0, Lines[0]] := emix; 1433 Code[1, Lines[0]] := 0; 1434 Code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], True); 1435 Inc(Lines[0]); 1429 1436 end; 1430 1437 end; … … 1433 1440 end; 1434 1441 kTribe: 1435 for i:= 0 to TribeNames.Count - 1 do1436 begin 1437 code[0, Lines[0]] := i;1438 inc(Lines[0]);1442 for I := 0 to TribeNames.Count - 1 do 1443 begin 1444 Code[0, Lines[0]] := I; 1445 Inc(Lines[0]); 1439 1446 end; 1440 1447 (* kDeliver: 1441 if MyRO.Treaty[DipMem[ me].pContact]<trAlliance then1448 if MyRO.Treaty[DipMem[Me].pContact]<trAlliance then 1442 1449 begin // suggest next treaty level 1443 code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[me].pContact]+1;1444 inc(Lines[0]);1445 end; 1446 if MyRO.Treaty[DipMem[ me].pContact]=trNone then1450 Code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]+1; 1451 Inc(Lines[0]); 1452 end; 1453 if MyRO.Treaty[DipMem[Me].pContact]=trNone then 1447 1454 begin // suggest peace 1448 code[0,Lines[0]]:=opTreaty+trPeace;1449 inc(Lines[0]);1450 end; 1451 if MyRO.Treaty[DipMem[ me].pContact]>trNone then1455 Code[0,Lines[0]]:=opTreaty+trPeace; 1456 Inc(Lines[0]); 1457 end; 1458 if MyRO.Treaty[DipMem[Me].pContact]>trNone then 1452 1459 begin // suggest next treaty level 1453 code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[me].pContact]-1;1454 inc(Lines[0]);1460 Code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]-1; 1461 Inc(Lines[0]); 1455 1462 end; *) 1456 1463 kShipPart: 1457 1464 begin 1458 1465 Lines[0] := 0; 1459 for i:= 0 to nShipPart - 1 do1460 if MyRO.Ship[ me].Parts[i] > 0 then1461 begin 1462 code[0, Lines[0]] := i;1463 inc(Lines[0]);1466 for I := 0 to nShipPart - 1 do 1467 if MyRO.Ship[Me].Parts[I] > 0 then 1468 begin 1469 Code[0, Lines[0]] := I; 1470 Inc(Lines[0]); 1464 1471 end; 1465 1472 end; … … 1467 1474 begin 1468 1475 Lines[0] := 0; 1469 for i:= 0 to nShipPart - 1 do1470 if MyRO.Ship[DipMem[ me].pContact].Parts[i] > 0 then1471 begin 1472 code[0, Lines[0]] := i;1473 inc(Lines[0]);1476 for I := 0 to nShipPart - 1 do 1477 if MyRO.Ship[DipMem[Me].pContact].Parts[I] > 0 then 1478 begin 1479 Code[0, Lines[0]] := I; 1480 Inc(Lines[0]); 1474 1481 end; 1475 1482 end; 1476 1483 kGov: 1477 for i:= 1 to nGov - 1 do1478 if (GovPreq[ i] <> preNA) and1479 ((GovPreq[ i] = preNone) or (MyRO.Tech[GovPreq[i]] >= tsApplicable))1484 for I := 1 to nGov - 1 do 1485 if (GovPreq[I] <> preNA) and 1486 ((GovPreq[I] = preNone) or (MyRO.Tech[GovPreq[I]] >= tsApplicable)) 1480 1487 then 1481 1488 begin 1482 code[0, Lines[0]] := i;1483 inc(Lines[0]);1489 Code[0, Lines[0]] := I; 1490 Inc(Lines[0]); 1484 1491 end; 1485 1492 kMission: 1486 for i:= 0 to nSpyMission - 1 do1487 begin 1488 code[0, Lines[0]] := i;1489 inc(Lines[0]);1493 for I := 0 to nSpyMission - 1 do 1494 begin 1495 Code[0, Lines[0]] := I; 1496 Inc(Lines[0]); 1490 1497 end; 1491 1498 end; … … 1494 1501 if Lines[0] + Lines[1] + Lines[2] <= MaxLines then 1495 1502 begin 1496 for i:= 0 to Lines[1] - 1 do // add wonders to first page1497 begin 1498 code[0, Lines[0]] := code[1, i];1499 inc(Lines[0]);1503 for I := 0 to Lines[1] - 1 do // add wonders to first page 1504 begin 1505 Code[0, Lines[0]] := Code[1, I]; 1506 Inc(Lines[0]); 1500 1507 end; 1501 1508 Lines[1] := 0; 1502 1509 FirstShrinkedLine[0] := Lines[0]; 1503 for i:= 0 to Lines[2] - 1 do // add models to first page1504 begin 1505 code[0, Lines[0]] := code[2, i];1506 inc(Lines[0]);1510 for I := 0 to Lines[2] - 1 do // add models to first page 1511 begin 1512 Code[0, Lines[0]] := Code[2, I]; 1513 Inc(Lines[0]); 1507 1514 end; 1508 1515 Lines[2] := 0; 1509 1516 end; 1510 end; // InitLines1511 1512 function TListDlg.OnlyChoice(TestKind: TListKind): integer;1517 end; 1518 1519 function TListDlg.OnlyChoice(TestKind: TListKind): Integer; 1513 1520 begin 1514 1521 Kind := TestKind; 1515 1522 InitLines; 1516 1523 if Lines[0] = 0 then 1517 result := -21524 Result := -2 1518 1525 else if Lines[0] > 1 then 1519 result := -11526 Result := -1 1520 1527 else 1521 result := code[0, 0];1528 Result := Code[0, 0]; 1522 1529 end; 1523 1530 1524 1531 procedure TListDlg.FormShow(Sender: TObject); 1525 1532 var 1526 i: integer;1527 begin 1528 result := -1;1529 Closable := false;1533 I: Integer; 1534 begin 1535 Result := -1; 1536 Closable := False; 1530 1537 1531 1538 if Kind = kTribe then … … 1543 1550 InitLines; 1544 1551 1545 MultiPage := false;1546 for i:= 1 to MaxLayer - 1 do1547 if Lines[ i] > 0 then1548 MultiPage := true;1552 MultiPage := False; 1553 for I := 1 to MaxLayer - 1 do 1554 if Lines[I] > 0 then 1555 MultiPage := True; 1549 1556 WideBottom := MultiPage or (Kind = kScience) or 1550 1557 not Phrases2FallenBackToEnglish and … … 1552 1559 if (Kind = kAdvance) and (MyData.FarTech <> adNone) or (Kind = kModels) or 1553 1560 (Kind = kEModels) then begin 1554 sb.SetBorderSpacing(56, 10, 10);1561 ScrollBar.SetBorderSpacing(56, 10, 10); 1555 1562 TitleHeight := WideFrame + 20; 1556 1563 end else begin 1557 sb.SetBorderSpacing(36, 10, 34);1564 ScrollBar.SetBorderSpacing(36, 10, 34); 1558 1565 TitleHeight := WideFrame; 1559 1566 end; 1560 1567 1561 1568 DispLines := Lines[0]; 1562 for i:= 0 to MaxLayer - 1 do1563 if Lines[ i] > DispLines then1564 DispLines := Lines[ i];1569 for I := 0 to MaxLayer - 1 do 1570 if Lines[I] > DispLines then 1571 DispLines := Lines[I]; 1565 1572 if WideBottom then 1566 1573 begin … … 1577 1584 ClientHeight := InnerHeight + TitleHeight + NarrowFrame; 1578 1585 end; 1579 assert(ClientHeight <= Maintexture.Height);1586 Assert(ClientHeight <= Maintexture.Height); 1580 1587 1581 1588 TechNameSpace := 224; … … 1615 1622 CaptionRight := CloseBtn.Left; 1616 1623 { TODO: 1617 SetWindowPos( sb.ScrollBar.Handle, 0, SideFrame + InnerWidth - DpiGetSystemMetrics(SM_CXVSCROLL),1624 SetWindowPos(ScrollBar.ScrollBar.Handle, 0, SideFrame + InnerWidth - DpiGetSystemMetrics(SM_CXVSCROLL), 1618 1625 TitleHeight, DpiGetSystemMetrics(SM_CXVSCROLL), LineDistance * DispLines + 48, 1619 1626 SWP_NOZORDER or SWP_NOREDRAW); … … 1638 1645 Layer0Btn.Top := ClientHeight - 31; 1639 1646 Layer0Btn.Left := ClientWidth div 2 - (12 + 29); 1640 Layer0Btn.Down := true;1647 Layer0Btn.Down := True; 1641 1648 Layer1Btn.Top := ClientHeight - 31; 1642 1649 Layer1Btn.Left := ClientWidth div 2 - (12 - 29); 1643 Layer1Btn.Down := false;1650 Layer1Btn.Down := False; 1644 1651 Layer2Btn.Top := ClientHeight - 31; 1645 1652 Layer2Btn.Left := ClientWidth div 2 - 12; 1646 Layer2Btn.Down := false;1653 Layer2Btn.Down := False; 1647 1654 end; 1648 1655 1649 1656 Layer := 0; 1650 Sel := -2;1657 Selected := -2; 1651 1658 ScienceNation := -1; 1652 sb.Init(Lines[Layer] - 1, DispLines);1659 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1653 1660 1654 1661 OffscreenPaint; 1655 1662 end; 1656 1663 1657 procedure TListDlg.ShowNewContent(NewMode: integer; ListKind: TListKind);1664 procedure TListDlg.ShowNewContent(NewMode: TWindowMode; ListKind: TListKind); 1658 1665 var 1659 i: integer;1660 ShowFocus, forceclose: boolean;1666 I: Integer; 1667 ShowFocus, forceclose: Boolean; 1661 1668 begin 1662 1669 forceclose := (ListKind <> Kind) and … … 1722 1729 if Kind = kAdvance then // show focus button? 1723 1730 if MyData.FarTech <> adNone then 1724 ShowFocus := true1731 ShowFocus := True 1725 1732 else 1726 1733 begin 1727 ShowFocus := false;1728 for i:= 0 to nAdv - 1 do1729 if not( i in FutureTech) and (MyRO.Tech[i] < tsApplicable) and1730 ((AdvValue[ i] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and1731 ((AdvValue[ i] < 1000) or (MyRO.Tech[adScience] > tsNA)) and1732 (Server(sSetResearch - sExecute, me, i, nil^) < rExecuted) then1733 ShowFocus := true;1734 ShowFocus := False; 1735 for I := 0 to nAdv - 1 do 1736 if not(I in FutureTech) and (MyRO.Tech[I] < tsApplicable) and 1737 ((AdvValue[I] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and 1738 ((AdvValue[I] < 1000) or (MyRO.Tech[adScience] > tsNA)) and 1739 (Server(sSetResearch - sExecute, Me, I, nil^) < rExecuted) then 1740 ShowFocus := True; 1734 1741 end; 1735 ToggleBtn.Visible := (Kind = kCities) and not supervising or (Kind = kAdvance)1742 ToggleBtn.Visible := (Kind = kCities) and not Supervising or (Kind = kAdvance) 1736 1743 and ShowFocus or (Kind = kModels) or (Kind = kEModels); 1737 1744 CloseBtn.Visible := not(Kind in MustChooseKind); 1738 1745 1739 1746 inherited ShowNewContent(NewMode, forceclose); 1740 end; // ShowNewContent1741 1742 procedure TListDlg.ShowNewContent_CityProject(NewMode , cix: integer);1747 end; 1748 1749 procedure TListDlg.ShowNewContent_CityProject(NewMode: TWindowMode; cix: Integer); 1743 1750 begin 1744 1751 cixProject := cix; … … 1746 1753 end; 1747 1754 1748 procedure TListDlg.ShowNewContent_MilReport(NewMode , p: integer);1749 begin 1750 pView := p;1751 if p = me then1755 procedure TListDlg.ShowNewContent_MilReport(NewMode: TWindowMode; P: Integer); 1756 begin 1757 pView := P; 1758 if P = Me then 1752 1759 ShowNewContent(NewMode, kModels) 1753 1760 else … … 1757 1764 procedure TListDlg.PlayerClick(Sender: TObject); 1758 1765 begin 1759 if TComponent(Sender).Tag = me then1766 if TComponent(Sender).Tag = Me then 1760 1767 Kind := kModels 1761 1768 else … … 1765 1772 end; 1766 1773 InitLines; 1767 Sel := -2;1768 sb.Init(Lines[Layer] - 1, DispLines);1774 Selected := -2; 1775 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1769 1776 OffscreenPaint; 1770 1777 Invalidate; … … 1778 1785 Layer := TComponent(Sender).Tag; 1779 1786 1780 Sel := -2;1781 sb.Init(Lines[Layer] - 1, DispLines);1787 Selected := -2; 1788 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1782 1789 SmartUpdateContent; 1783 1790 end; … … 1785 1792 procedure TListDlg.ToggleBtnClick(Sender: TObject); 1786 1793 var 1787 p1: integer;1788 m: TDpiMenuItem;1794 p1: Integer; 1795 M: TDpiMenuItem; 1789 1796 begin 1790 1797 case Kind of 1791 1798 kAdvance: 1792 1799 begin 1793 result := adFar;1794 Closable := true;1800 Result := adFar; 1801 Closable := True; 1795 1802 Close; 1796 1803 end; … … 1807 1814 begin 1808 1815 EmptyMenu(Popup.Items); 1809 if G.Difficulty[ me] > 0 then1810 begin 1811 m:= TDpiMenuItem.Create(Popup);1812 m.RadioItem := true;1813 m.Caption := Tribe[me].TPhrase('SHORTNAME');1814 m.Tag := me;1815 m.OnClick := PlayerClick;1816 if G.Difficulty[Me] > 0 then 1817 begin 1818 M := TDpiMenuItem.Create(Popup); 1819 M.RadioItem := True; 1820 M.Caption := Tribe[Me].TPhrase('SHORTNAME'); 1821 M.Tag := Me; 1822 M.OnClick := PlayerClick; 1816 1823 if Kind = kModels then 1817 m.Checked := true;1818 Popup.Items.Add( m);1824 M.Checked := True; 1825 Popup.Items.Add(M); 1819 1826 end; 1820 1827 for p1 := 0 to nPl - 1 do 1821 if (p1 <> me) and (MyRO.EnemyReport[p1] <> nil) and1828 if (p1 <> Me) and (MyRO.EnemyReport[p1] <> nil) and 1822 1829 (MyRO.EnemyReport[p1].TurnOfMilReport >= 0) then 1823 1830 begin 1824 m:= TDpiMenuItem.Create(Popup);1825 m.RadioItem := true;1826 m.Caption := Tribe[p1].TPhrase('SHORTNAME');1827 m.Tag := p1;1828 m.OnClick := PlayerClick;1831 M := TDpiMenuItem.Create(Popup); 1832 M.RadioItem := True; 1833 M.Caption := Tribe[p1].TPhrase('SHORTNAME'); 1834 M.Tag := p1; 1835 M.OnClick := PlayerClick; 1829 1836 if (Kind = kEModels) and (p1 = pView) then 1830 m.Checked := true;1831 Popup.Items.Add( m);1837 M.Checked := True; 1838 Popup.Items.Add(M); 1832 1839 end; 1833 1840 Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top + … … 1837 1844 end; 1838 1845 1839 procedure TListDlg.FormKeyDown(Sender: TObject; var Key: word;1846 procedure TListDlg.FormKeyDown(Sender: TObject; var Key: Word; 1840 1847 Shift: TShiftState); 1841 1848 begin … … 1876 1883 procedure TListDlg.RemoveUnit; 1877 1884 begin 1878 if ListDlg.Visible and (Kind = kModels) then1885 if Visible and (Kind = kModels) then 1879 1886 SmartUpdateContent; 1880 1887 end; … … 1882 1889 procedure TListDlg.ScrollBarUpdate(Sender: TObject); 1883 1890 begin 1884 Sel := -2;1885 SmartUpdateContent( true);1891 Selected := -2; 1892 SmartUpdateContent(True); 1886 1893 end; 1887 1894
Note:
See TracChangeset
for help on using the changeset viewer.