Changeset 465 for branches/highdpi/LocalPlayer/Help.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Help.pas
r412 r465 7 7 UDpiControls, Protocol, ScreenTools, BaseWin, StringTables, Math, LCLIntf, LCLType, 8 8 Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, 9 ButtonB, PVSB, Types, fgl, IsoEngine;9 ButtonB, PVSB, Types, Generics.Collections, IsoEngine; 10 10 11 11 const 12 12 MaxHist = 16; 13 13 14 { link categories } 15 hkNoLink = 0; 16 hkAdv = 1; 17 hkImp = 2; 18 hkTer = 3; 19 hkFeature = 4; 20 hkInternet = 5; 21 hkModel = 6; 22 hkMisc = 7; 23 hkCrossLink = $40; 24 hkText = $80; 25 26 liInvalid = $3FFF; // link index indicates invalid link 27 28 { link indices for category hkMisc } 29 miscMain = 0; 30 miscCredits = 1; 31 miscGovList = 2; 32 miscJobList = 3; 33 miscSearchResult = 7; 34 35 fJungle = 8; // pseudo terrain 14 fJungle = 8; // Pseudo terrain 36 15 37 16 type 17 { Link categories } 18 TLinkCategory = ( 19 hkNoLink, 20 hkAdv, 21 hkImp, 22 hkTer, 23 hkFeature , 24 hkInternet, 25 hkModel, 26 hkMisc, 27 hkText); 28 29 { Link indices for category hkMisc } 30 TMiscLinkIndex = ( 31 miscMain, 32 miscCredits, 33 miscGovList, 34 miscJobList, 35 miscSearchResult); 36 37 TTextFormat = ( 38 pkNormal, 39 pkCaption, 40 pkSmallIcon, 41 pkBigIcon, 42 pkAdvIcon, 43 pkTer, 44 pkBigTer, 45 pkFeature, 46 pkDot, 47 pkNormal_Dot, 48 pkDomain, 49 pkSection, 50 pkBigFeature, 51 pkExp, 52 pkAITStat, 53 pkExternal, 54 pkModel, 55 pkNormal_64, 56 pkIllu, 57 pkLogo, 58 pkTerImp, 59 pkRightIcon, 60 pkAdvIcon_AsPreq, 61 pkSmallIcon_AsPreq, 62 pkSpecialIcon, 63 pkGov); 38 64 39 65 { THyperText } … … 41 67 THyperText = class(TStringList) 42 68 public 43 procedure AddLine( s: String = ''; Format: integer = 0; Picpix: Integer = 0;44 LinkCategory: integer = 0; LinkIndex: integer = 0);69 procedure AddLine(S: String = ''; Format: TTextFormat = pkNormal; Picpix: Integer = 0; 70 LinkCategory: TLinkCategory = hkNoLink; LinkIndex: Integer = 0; CrossLink: Boolean = False); 45 71 procedure LineFeed; 46 72 procedure AppendList(Source: THyperText); 47 destructor Destroy; override;48 73 end; 49 74 … … 51 76 52 77 THistItem = class 53 Kind: Integer;78 Kind: TLinkCategory; 54 79 No: Integer; 55 80 Pos: Integer; … … 60 85 { THistItems } 61 86 62 THistItems = class(T FPGObjectList<THistItem>)63 function AddNew(Kind ,No, Pos: Integer; SearchContent: string): THistItem;87 THistItems = class(TObjectList<THistItem>) 88 function AddNew(Kind: TLinkCategory; No, Pos: Integer; SearchContent: string): THistItem; 64 89 end; 65 90 … … 78 103 procedure CloseBtnClick(Sender: TObject); 79 104 procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 80 x, y: integer);105 X, Y: Integer); 81 106 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 82 Shift: TShiftState; x, y: integer);107 Shift: TShiftState; X, Y: Integer); 83 108 procedure BackBtnClick(Sender: TObject); 84 109 procedure TopBtnClick(Sender: TObject); … … 89 114 procedure OffscreenPaint; override; 90 115 private 91 Kind: Integer;92 no: Integer;116 Kind: TLinkCategory; 117 No: Integer; 93 118 Sel: Integer; 94 119 CaptionColor: Integer; … … 100 125 SearchResult: THyperText; 101 126 HelpText: TStringTable; 102 ExtPic, TerrIcon: TDpiBitmap; 127 ExtPic: TDpiBitmap; 128 TerrIcon: TDpiBitmap; 103 129 ScrollBar: TPVScrollbar; 104 130 NoMap: TIsoMap; 105 131 x0: array [-2..180] of Integer; 106 procedure PaintTerrIcon( x, y, xSrc, ySrc: Integer);132 procedure PaintTerrIcon(X, Y, xSrc, ySrc: Integer); 107 133 procedure ScrollBarUpdate(Sender: TObject); 108 procedure Line( ca: TDpiCanvas; i: Integer; lit: Boolean);134 procedure Line(ACanvas: TDpiCanvas; I: Integer; Lit: Boolean); 109 135 procedure Prepare(sbPos: Integer = 0); 110 procedure ShowNewContentProcExecute(NewMode: Integer; HelpContext: string);136 procedure ShowNewContentProcExecute(NewMode: TWindowMode; HelpContext: string); 111 137 procedure WaterSign(x0, y0, iix: Integer); 112 138 procedure Search(SearchString: string); … … 117 143 Difficulty: Integer; 118 144 procedure ClearHistory; 119 procedure ShowNewContent(NewMode , Category,Index: Integer);145 procedure ShowNewContent(NewMode: TWindowMode; Category: TLinkCategory; Index: Integer); 120 146 function TextIndex(Item: string): Integer; 121 147 end; 122 148 123 var124 HelpDlg: THelpDlg;125 126 149 127 150 implementation 128 151 129 152 uses 130 Directories, ClientTools, Term, Tribes, Inp, Messg, UPixelPointer, Global,131 UKeyBindings;153 Directories, ClientTools, Term, Tribes, Inp, Messg, PixelPointer, Global, 154 KeyBindings; 132 155 133 156 {$R *.lfm} … … 138 161 139 162 THelpLineInfo = class 140 Format: Byte;163 Format: TTextFormat; 141 164 Picpix: Byte; 142 Link: Word; 165 Category: TLinkCategory; 166 Index: Integer; 167 CrossLink: Boolean; 143 168 procedure Assign(Source: THelpLineInfo); 144 169 end; 145 170 146 { THelpLineInfo } 147 148 procedure THelpLineInfo.Assign(Source: THelpLineInfo); 149 begin 150 Format := Source.Format; 151 PicPix := Source.PicPix; 152 Link := Source.Link; 153 end; 154 155 { THistItem } 156 157 procedure THistItem.Assign(Source: THistItem); 158 begin 159 Kind := Source.Kind; 160 No := Source.No; 161 Pos := Source.Pos; 162 SearchContent := Source.SearchContent; 163 end; 164 165 { THistItems } 166 167 function THistItems.AddNew(Kind, No, Pos: Integer; SearchContent: string 168 ): THistItem; 169 begin 170 Result := THistItem.Create; 171 Result.Kind := Kind; 172 Result.No := No; 173 Result.Pos := Pos; 174 Result.SearchContent := SearchContent; 175 Add(Result); 176 end; 177 178 procedure THyperText.AddLine(s: String; Format: integer; Picpix: integer; 179 LinkCategory: integer; LinkIndex: integer); 180 var 181 HelpLineInfo: THelpLineInfo; 182 begin 183 HelpLineInfo := THelpLineInfo.Create; 184 if LinkIndex < 0 then 185 LinkIndex := liInvalid; 186 HelpLineInfo.Format := Format; 187 HelpLineInfo.Picpix := Picpix; 188 HelpLineInfo.Link := LinkCategory shl 8 + LinkIndex; 189 AddObject(s, TObject(HelpLineInfo)); 190 end; 191 192 procedure THyperText.LineFeed; 193 begin 194 AddLine; 195 end; 196 197 procedure THyperText.AppendList(Source: THyperText); 198 var 199 I: Integer; 200 HelpLineInfo: THelpLineInfo; 201 begin 202 for I := 0 to Source.Count - 1 do begin 203 HelpLineInfo := THelpLineInfo.Create; 204 HelpLineInfo.Assign(THelpLineInfo(Source.Objects[I])); 205 AddObject(Source.Strings[I], HelpLineInfo); 206 end; 207 end; 208 209 destructor THyperText.Destroy; 210 begin 211 inherited; 212 end; 171 TSeeAlso = record 172 Kind: TLinkCategory; 173 No: Integer; 174 SeeKind: TLinkCategory; 175 SeeNo: Integer; 176 end; 213 177 214 178 const 215 { text formats } 216 pkNormal = 0; 217 pkCaption = 1; 218 pkSmallIcon = 2; 219 pkBigIcon = 3; 220 pkAdvIcon = 4; 221 pkTer = 5; 222 pkBigTer = 6; 223 pkFeature = 7; 224 pkDot = 8; 225 pkNormal_Dot = 9; 226 pkDomain = 10; 227 pkSection = 11; 228 pkBigFeature = 12; 229 pkExp = 13; 230 pkAITStat = 14; 231 pkExternal = 15; 232 pkModel = 16; 233 pkNormal_64 = 17; 234 pkIllu = 18; 235 pkLogo = 19; 236 pkTerImp = 20; 237 pkRightIcon = 21; 238 pkAdvIcon_AsPreq = 22; 239 pkSmallIcon_AsPreq = 23; 240 pkSpecialIcon = 24; 241 pkGov = 25; 242 243 nSeeAlso = 14; 244 SeeAlso: array [0 .. nSeeAlso - 1] of record 245 Kind: Integer; 246 no: Integer; 247 SeeKind: Integer; 248 SeeNo: Integer; 249 end = ((Kind: hkImp; no: imWalls; SeeKind: hkFeature; 179 SeeAlso: array[0..13] of TSeeAlso = ((Kind: hkImp; no: imWalls; SeeKind: hkFeature; 250 180 SeeNo: mcArtillery), (Kind: hkImp; no: imHydro; SeeKind: hkImp; 251 181 SeeNo: woHoover), (Kind: hkImp; no: imWalls; SeeKind: hkImp; … … 262 192 SeeKind: hkFeature; SeeNo: mcDefense)); 263 193 264 nTerrainHelp = 14; 265 TerrainHelp: array [0 .. nTerrainHelp - 1] of integer = (fGrass, fGrass + 12, 194 TerrainHelp: array[0..13] of Integer = (fGrass, fGrass + 12, 266 195 fPrairie, fForest, fJungle, fHills, fMountains, fSwamp, fTundra, fArctic, 267 fDesert, 3 * 12 { DeadLands } , fShore, fOcean); 268 269 nJobHelp = 8; 270 JobHelp: array [0 .. nJobHelp - 1] of integer = (jRoad, jRR, jCanal, jIrr, 196 fDesert, 3 * 12 { DeadLands }, fShore, fOcean); 197 198 JobHelp: array[0..7] of Integer = (jRoad, jRR, jCanal, jIrr, 271 199 jFarm, jMine, jFort, jBase); 272 200 201 { THelpLineInfo } 202 203 procedure THelpLineInfo.Assign(Source: THelpLineInfo); 204 begin 205 Format := Source.Format; 206 PicPix := Source.PicPix; 207 Category := Source.Category; 208 Index := Source.Index; 209 end; 210 211 { THistItem } 212 213 procedure THistItem.Assign(Source: THistItem); 214 begin 215 Kind := Source.Kind; 216 No := Source.No; 217 Pos := Source.Pos; 218 SearchContent := Source.SearchContent; 219 end; 220 221 { THistItems } 222 223 function THistItems.AddNew(Kind: TLinkCategory; No, Pos: Integer; SearchContent: string 224 ): THistItem; 225 begin 226 Result := THistItem.Create; 227 Result.Kind := Kind; 228 Result.No := No; 229 Result.Pos := Pos; 230 Result.SearchContent := SearchContent; 231 Add(Result); 232 end; 233 234 procedure THyperText.AddLine(S: String; Format: TTextFormat; Picpix: Integer; 235 LinkCategory: TLinkCategory = hkNoLink; LinkIndex: Integer = 0; 236 CrossLink: Boolean = False); 237 var 238 HelpLineInfo: THelpLineInfo; 239 begin 240 HelpLineInfo := THelpLineInfo.Create; 241 HelpLineInfo.Format := Format; 242 HelpLineInfo.Picpix := Picpix; 243 HelpLineInfo.Category := LinkCategory; 244 HelpLineInfo.Index := LinkIndex; 245 HelpLineInfo.CrossLink := CrossLink; 246 AddObject(S, HelpLineInfo); 247 end; 248 249 procedure THyperText.LineFeed; 250 begin 251 AddLine; 252 end; 253 254 procedure THyperText.AppendList(Source: THyperText); 255 var 256 I: Integer; 257 HelpLineInfo: THelpLineInfo; 258 begin 259 for I := 0 to Source.Count - 1 do begin 260 HelpLineInfo := THelpLineInfo.Create; 261 HelpLineInfo.Assign(THelpLineInfo(Source.Objects[I])); 262 AddObject(Source.Strings[I], HelpLineInfo); 263 end; 264 end; 265 273 266 procedure THelpDlg.FormCreate(Sender: TObject); 274 267 begin 275 inherited;276 268 NoMap := TIsoMap.Create; 277 269 … … 280 272 CaptionLeft := BackBtn.Left + BackBtn.Width; 281 273 CaptionRight := SearchBtn.Left; 282 inc(ModalFrameIndent, 29);274 Inc(ModalFrameIndent, 29); 283 275 MainText := THyperText.Create; 284 276 MainText.OwnsObjects := True; … … 290 282 291 283 HelpText := TStringTable.Create; 292 HelpText.LoadFromFile(LocalizedFilePath('Help' + DirectorySeparator + ' help.txt'));284 HelpText.LoadFromFile(LocalizedFilePath('Help' + DirectorySeparator + 'Help.txt')); 293 285 hADVHELP := HelpText.Gethandle('ADVHELP'); 294 286 hIMPHELP := HelpText.Gethandle('IMPHELP'); … … 316 308 end; 317 309 318 procedure THelpDlg.ShowNewContentProcExecute(NewMode: Integer;310 procedure THelpDlg.ShowNewContentProcExecute(NewMode: TWindowMode; 319 311 HelpContext: string); 320 312 begin 321 HelpDlg.ShowNewContent(NewMode, hkText, 322 HelpDlg.TextIndex(HelpContext)) 313 ShowNewContent(NewMode, hkText, TextIndex(HelpContext)); 323 314 end; 324 315 … … 356 347 if ScrollBar.Process(Msg) then begin 357 348 Sel := -1; 358 SmartUpdateContent( true)349 SmartUpdateContent(True) 359 350 end; 360 351 } … … 364 355 begin 365 356 if Sel <> -1 then begin 366 Line(Canvas, Sel, false);367 Sel := -1 357 Line(Canvas, Sel, False); 358 Sel := -1; 368 359 end; 369 360 end; … … 380 371 end; 381 372 382 procedure THelpDlg.Line( ca: TDpiCanvas; i: Integer; lit: Boolean);373 procedure THelpDlg.Line(ACanvas: TDpiCanvas; I: Integer; Lit: Boolean); 383 374 var 384 TextColor, x, y: Integer; 375 TextColor: TColor; 376 X, Y: Integer; 385 377 TextSize: TSize; 386 s: string;387 begin 388 s := MainText[ScrollBar.Position + i];389 if s= '' then378 S: string; 379 begin 380 S := MainText[ScrollBar.Position + I]; 381 if S = '' then 390 382 Exit; 391 x := x0[i];392 y := 2 + i* 24;393 if ca= Canvas then394 begin 395 x := x+ SideFrame;396 y := y + WideFrame397 end; 398 if THelpLineInfo(MainText.Objects[ScrollBar.Position + i]).Format383 X := x0[I]; 384 Y := 2 + I * 24; 385 if ACanvas = Canvas then 386 begin 387 X := X + SideFrame; 388 Y := Y + WideFrame; 389 end; 390 if THelpLineInfo(MainText.Objects[ScrollBar.Position + I]).Format 399 391 in [pkCaption, pkBigTer, pkRightIcon, pkBigFeature] then 400 392 begin 401 ca.Font.Assign(CaptionFont);402 { ca.brush.color:=CaptionColor;403 ca.FillRect(rect(x,i*24,x+24,i*24+24));404 ca.brush.color:=$FFFFFF;405 ca.FrameRect(rect(x+1,i*24+1,x+24-1,i*24+24-1));406 ca.Brush.Style:=bsClear; }407 DpiBit Canvas(ca, x, y- 4, 24, 24, HGrSystem.Data.Canvas, 1,393 ACanvas.Font.Assign(CaptionFont); 394 { ACanvas.brush.color:=CaptionColor; 395 ACanvas.FillRect(rect(X,I*24,X+24,I*24+24)); 396 ACanvas.Brush.Color:=$FFFFFF; 397 ACanvas.FrameRect(rect(X+1,I*24+1,X+24-1,I*24+24-1)); 398 ACanvas.Brush.Style:=bsClear; } 399 DpiBitBltCanvas(ACanvas, X, Y - 4, 24, 24, HGrSystem.Data.Canvas, 1, 408 400 146); 409 BiColorTextOut( ca, $FFFFFF, $7F007F, x + 10 - ca.Textwidth(s[1]) div 2,410 y - 3, s[1]);411 BiColorTextOut( ca, CaptionColor, $7F007F, x + 24, y - 3, copy(s, 2, 255));412 ca.Font.Assign(UniFont[ftNormal]);401 BiColorTextOut(ACanvas, $FFFFFF, $7F007F, X + 10 - ACanvas.Textwidth(S[1]) div 2, 402 Y - 3, S[1]); 403 BiColorTextOut(ACanvas, CaptionColor, $7F007F, X + 24, Y - 3, Copy(S, 2, 255)); 404 ACanvas.Font.Assign(UniFont[ftNormal]); 413 405 end 414 else if THelpLineInfo(MainText.Objects[ScrollBar.Position + i]).Format = pkSection 415 then 416 begin 417 ca.Font.Assign(CaptionFont); 418 BiColorTextOut(ca, CaptionColor, $7F007F, x, y - 3, s); 419 ca.Font.Assign(UniFont[ftNormal]); 406 else if THelpLineInfo(MainText.Objects[ScrollBar.Position + I]).Format = pkSection then 407 begin 408 ACanvas.Font.Assign(CaptionFont); 409 BiColorTextOut(ACanvas, CaptionColor, $7F007F, X, Y - 3, S); 410 ACanvas.Font.Assign(UniFont[ftNormal]); 420 411 end 421 412 else 422 413 begin 423 if (Kind = hkMisc) and ( no = miscMain) then424 ca.Font.Assign(CaptionFont);414 if (Kind = hkMisc) and (No = Integer(miscMain)) then 415 ACanvas.Font.Assign(CaptionFont); 425 416 TextColor := Colors.Canvas.Pixels[clkMisc, cliPaperText]; 426 if ca= Canvas then417 if ACanvas = Canvas then 427 418 begin 428 TextSize.cx := BiColorTextWidth( ca, s);429 TextSize.cy := ca.TextHeight(s);430 if y+ TextSize.cy >= WideFrame + InnerHeight then431 TextSize.cy := WideFrame + InnerHeight - y;432 FillSeamless( ca, x, y, TextSize.cx, TextSize.cy, -SideFrame,419 TextSize.cx := BiColorTextWidth(ACanvas, S); 420 TextSize.cy := ACanvas.TextHeight(S); 421 if Y + TextSize.cy >= WideFrame + InnerHeight then 422 TextSize.cy := WideFrame + InnerHeight - Y; 423 FillSeamless(ACanvas, X, Y, TextSize.cx, TextSize.cy, -SideFrame, 433 424 ScrollBar.Position * 24 - WideFrame, Paper); 434 425 end; 435 BiColorTextOut( ca, TextColor, $7F007F, x, y, s);426 BiColorTextOut(ACanvas, TextColor, $7F007F, X, Y, S); 436 427 if lit then 437 with cado428 with ACanvas do 438 429 begin 439 Assert( ca= Canvas);430 Assert(ACanvas = Canvas); 440 431 Pen.Color := TextColor; 441 MoveTo( x + 1, y+ TextSize.cy - 2);442 LineTo( x + TextSize.cx, y+ TextSize.cy - 2);432 MoveTo(X + 1, Y + TextSize.cy - 2); 433 LineTo(X + TextSize.cx, Y + TextSize.cy - 2); 443 434 end; 444 if (Kind = hkMisc) and ( no = miscMain) then445 ca.Font.Assign(UniFont[ftNormal]);446 end; 447 end; 448 449 procedure THelpDlg.WaterSign(x0, y0, iix: integer);435 if (Kind = hkMisc) and (No = Integer(miscMain)) then 436 ACanvas.Font.Assign(UniFont[ftNormal]); 437 end; 438 end; 439 440 procedure THelpDlg.WaterSign(x0, y0, iix: Integer); 450 441 const 451 442 nHeaven = 28; 452 443 MaxSum = 9 * 9 * 255 * 75 div 100; 453 444 var 454 x, y, dx, dy, xSrc, ySrc, Sum, xx: integer;455 Heaven: array [0..nHeaven] of integer;445 X, Y, dx, dy, xSrc, ySrc, Sum, xx: Integer; 446 Heaven: array [0..nHeaven] of Integer; 456 447 PaintPtr: TPixelPointer; 457 448 CoalPtr: TPixelPointer; … … 467 458 xSrc := iix mod 7 * xSizeBig; 468 459 ySrc := (iix div 7 + 1) * ySizeBig; 469 PaintPtr := PixelPointer(OffScreen, ScaleToNative(x0), ScaleToNative(y0));470 CoalPtr := PixelPointer(Templates.Data, ScaleToNative(xCoal), ScaleToNative(yCoal));460 PaintPtr := TPixelPointer.Create(OffScreen, ScaleToNative(x0), ScaleToNative(y0)); 461 CoalPtr := TPixelPointer.Create(Templates.Data, ScaleToNative(xCoal), ScaleToNative(yCoal)); 471 462 for dy := -1 to 1 do 472 ImpPtr[dy] := PixelPointer(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc));473 for y:= 0 to ScaleToNative(ySizeBig) * 2 - 1 do begin474 if ((ScaleToNative(y0) + y) >= 0) and ((ScaleToNative(y0) + y) < ScaleToNative(InnerHeight)) then begin463 ImpPtr[dy] := TPixelPointer.Create(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc)); 464 for Y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do begin 465 if ((ScaleToNative(y0) + Y) >= 0) and ((ScaleToNative(y0) + Y) < ScaleToNative(InnerHeight)) then begin 475 466 for dy := -1 to 1 do 476 if ((Max( y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(y+ ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then477 ImpPtr[dy].SetXY(0, Max( y+ ScaleToNative(dy), 0) shr 1);478 for x:= 0 to ScaleToNative(xSizeBig * 2) - 1 do begin467 if ((Max(Y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(Y + ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then 468 ImpPtr[dy].SetXY(0, Max(Y + ScaleToNative(dy), 0) shr 1); 469 for X := 0 to ScaleToNative(xSizeBig * 2) - 1 do begin 479 470 Sum := 0; 480 471 for dx := -1 to 1 do begin 481 xx := Max(( x+ ScaleToNative(dx)), 0) shr 1;472 xx := Max((X + ScaleToNative(dx)), 0) shr 1; 482 473 for dy := -1 to 1 do begin 483 474 ImpPtr[dy].SetX(xx); 484 if (( y + ScaleToNative(dy)) shr 1 < 0) or ((y+ ScaleToNative(dy)) shr 1 >= ScaleToNative(ySizeBig)) or485 (( x + ScaleToNative(dx)) shr 1 < 0) or ((x+ ScaleToNative(dx)) shr 1 >= ScaleToNative(xSizeBig)) or486 (( y+ ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and475 if ((Y + ScaleToNative(dy)) shr 1 < 0) or ((Y + ScaleToNative(dy)) shr 1 >= ScaleToNative(ySizeBig)) or 476 ((X + ScaleToNative(dx)) shr 1 < 0) or ((X + ScaleToNative(dx)) shr 1 >= ScaleToNative(xSizeBig)) or 477 ((Y + ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and 487 478 (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 + 488 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative( y+ ScaleToNative(dy))) shr 1]) then479 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(Y + ScaleToNative(dy))) shr 1]) then 489 480 Sum := Sum + 9 * 255 490 481 else … … 493 484 end; 494 485 end; 495 if Sum < MaxSum then begin // no saturation486 if Sum < MaxSum then begin // No saturation 496 487 Sum := 1 shl 22 - (MaxSum - Sum) * (256 - CoalPtr.Pixel^.B * 2); 497 488 PaintPtr.Pixel^.B := Min(PaintPtr.Pixel^.B * Sum shr 22, 255); … … 510 501 end; 511 502 512 procedure THelpDlg.PaintTerrIcon( x, y, xSrc, ySrc: integer);503 procedure THelpDlg.PaintTerrIcon(X, Y, xSrc, ySrc: Integer); 513 504 begin 514 505 with NoMap do begin 515 Frame(OffScreen.Canvas, x - 1, y - 1, x + xSizeBig, y+ ySizeBig,506 Frame(OffScreen.Canvas, X - 1, Y - 1, X + xSizeBig, Y + ySizeBig, 516 507 $000000, $000000); 517 508 if 2 * yyt < 40 then begin 518 Sprite(OffScreen, HGrTerrain, x, y, 56, 2 * yyt, xSrc, ySrc);519 Sprite(OffScreen, HGrTerrain, x, y+ 2 * yyt, 56, 40 - 2 * yyt,509 Sprite(OffScreen, HGrTerrain, X, Y, 56, 2 * yyt, xSrc, ySrc); 510 Sprite(OffScreen, HGrTerrain, X, Y + 2 * yyt, 56, 40 - 2 * yyt, 520 511 xSrc, ySrc); 521 512 end else 522 Sprite(OffScreen, HGrTerrain, x, y, 56, 40, xSrc, ySrc);523 Sprite(OffScreen, HGrTerrain, x, y, xxt, yyt, xSrc + xxt, ySrc + yyt);524 Sprite(OffScreen, HGrTerrain, x, y+ yyt, xxt, 40 - yyt, xSrc + xxt, ySrc);525 Sprite(OffScreen, HGrTerrain, x + xxt, y, 56 - xxt, yyt, xSrc, ySrc + yyt);526 Sprite(OffScreen, HGrTerrain, x + xxt, y+ yyt, 56 - xxt, 40 - yyt,513 Sprite(OffScreen, HGrTerrain, X, Y, 56, 40, xSrc, ySrc); 514 Sprite(OffScreen, HGrTerrain, X, Y, xxt, yyt, xSrc + xxt, ySrc + yyt); 515 Sprite(OffScreen, HGrTerrain, X, Y + yyt, xxt, 40 - yyt, xSrc + xxt, ySrc); 516 Sprite(OffScreen, HGrTerrain, X + xxt, Y, 56 - xxt, yyt, xSrc, ySrc + yyt); 517 Sprite(OffScreen, HGrTerrain, X + xxt, Y + yyt, 56 - xxt, 40 - yyt, 527 518 xSrc, ySrc); 528 519 end; … … 531 522 procedure THelpDlg.OffscreenPaint; 532 523 var 533 i, j, yl, srcno, ofs, cnt, y: Integer;534 s: string;524 I, J, yl, srcno, ofs, cnt, Y: Integer; 525 S: string; 535 526 HelpLineInfo: THelpLineInfo; 536 527 begin … … 542 533 begin 543 534 Font.Assign(UniFont[ftNormal]); 544 for i:= -ScrollBar.Position to InnerHeight div 24 do545 if ScrollBar.Position + i< MainText.Count then535 for I := -ScrollBar.Position to InnerHeight div 24 do 536 if ScrollBar.Position + I < MainText.Count then 546 537 begin 547 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + i]);538 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + I]); 548 539 if HelpLineInfo.Format = pkExternal then 549 540 begin 550 541 yl := ExtPic.Height; 551 if 4 + i* 24 + yl > InnerHeight then552 yl := InnerHeight - (4 + i* 24);553 DpiBit Canvas(OffScreen.Canvas, 8, 4 + i* 24, ExtPic.Width, yl, ExtPic.Canvas,542 if 4 + I * 24 + yl > InnerHeight then 543 yl := InnerHeight - (4 + I * 24); 544 DpiBitBltCanvas(OffScreen.Canvas, 8, 4 + I * 24, ExtPic.Width, yl, ExtPic.Canvas, 554 545 0, 0); 555 546 end; 556 547 end; 557 for i:= -2 to InnerHeight div 24 do558 if (ScrollBar.Position + i >= 0) and (ScrollBar.Position + i< MainText.Count) then548 for I := -2 to InnerHeight div 24 do 549 if (ScrollBar.Position + I >= 0) and (ScrollBar.Position + I < MainText.Count) then 559 550 begin 560 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + i]);561 if HelpLineInfo.Link <> 0then551 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + I]); 552 if (HelpLineInfo.Category <> hkNoLink) or (HelpLineInfo.Index <> 0) then 562 553 begin 563 if (Kind = hkMisc) and ( no = miscSearchResult) then564 Sprite(OffScreen, HGrSystem, 18, 9 + i* 24, 8, 8, 90, 16)554 if (Kind = hkMisc) and (No = Integer(miscSearchResult)) then 555 Sprite(OffScreen, HGrSystem, 18, 9 + I * 24, 8, 8, 90, 16) 565 556 else if HelpLineInfo.Format in [pkSmallIcon_AsPreq, pkAdvIcon_AsPreq] 566 557 then 567 Sprite(OffScreen, HGrSystem, 12, i* 24 + 5, 14, 14, 65, 20)568 else if HelpLineInfo. Link and (hkCrossLink shl 8) <> 0then569 Sprite(OffScreen, HGrSystem, 12, i* 24 + 5, 14, 14, 80, 1)570 else if not((Kind = hkMisc) and ( no = miscMain)) then571 Sprite(OffScreen, HGrSystem, 10, i* 24 + 6, 14, 14, 65, 1);572 x0[ i] := 24;558 Sprite(OffScreen, HGrSystem, 12, I * 24 + 5, 14, 14, 65, 20) 559 else if HelpLineInfo.CrossLink then 560 Sprite(OffScreen, HGrSystem, 12, I * 24 + 5, 14, 14, 80, 1) 561 else if not((Kind = hkMisc) and (No = Integer(miscMain))) then 562 Sprite(OffScreen, HGrSystem, 10, I * 24 + 6, 14, 14, 65, 1); 563 x0[I] := 24; 573 564 end 574 565 else 575 x0[ i] := 0;566 x0[I] := 0; 576 567 case HelpLineInfo.Format of 577 568 pkLogo: 578 569 begin 579 Server(sGetVersion, 0, 0, j);580 s := Format('%d.%d.%d', [j shr 16 and $FF, jshr 8 and $FF,581 jand $FF]);582 PaintLogo(OffScreen.Canvas, (InnerWidth - 122) div 2, i* 24 + 1,570 Server(sGetVersion, 0, 0, J); 571 S := Format('%d.%d.%d', [J shr 16 and $FF, J shr 8 and $FF, 572 J and $FF]); 573 PaintLogo(OffScreen.Canvas, (InnerWidth - 122) div 2, I * 24 + 1, 583 574 HGrSystem.Data.Canvas.Pixels[95, 1], $000000); 584 575 Font.Assign(UniFont[ftSmall]); 585 576 BiColorTextOut(OffScreen.Canvas, $000000, $7F007F, 586 (InnerWidth - Textwidth( s)) div 2, i * 24 + 26, s);577 (InnerWidth - Textwidth(S)) div 2, I * 24 + 26, S); 587 578 Font.Assign(UniFont[ftNormal]); 588 579 end; 589 580 pkSmallIcon, pkSmallIcon_AsPreq: 590 581 begin 591 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,592 8 + xSizeSmall + x0[ i], 2 + 20 + i* 24, $000000, $000000);582 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 583 8 + xSizeSmall + x0[I], 2 + 20 + I * 24, $000000, $000000); 593 584 if HelpLineInfo.Picpix = imPalace then 594 DpiBit Canvas(OffScreen.Canvas, 8 + x0[i], 2 + i* 24,585 DpiBitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, 595 586 xSizeSmall, ySizeSmall, SmallImp.Canvas, 596 587 0 * xSizeSmall, 1 * ySizeSmall) 597 588 else 598 DpiBit Canvas(OffScreen.Canvas, 8 + x0[i], 2 + i* 24,589 DpiBitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, 599 590 xSizeSmall, ySizeSmall, SmallImp.Canvas, 600 591 HelpLineInfo.Picpix mod 7 * xSizeSmall, 601 592 (HelpLineInfo.Picpix + SystemIconLines * 7) div 7 * 602 593 ySizeSmall); 603 x0[ i] := x0[i] + (8 + 8 + 36);594 x0[I] := x0[I] + (8 + 8 + 36); 604 595 end; 605 596 pkBigIcon: 606 597 begin 607 FrameImage(OffScreen.Canvas, BigImp, x0[ i] + 12, i* 24 - 7, 56,598 FrameImage(OffScreen.Canvas, BigImp, x0[I] + 12, I * 24 - 7, 56, 608 599 40, HelpLineInfo.Picpix mod 7 * xSizeBig, 609 600 HelpLineInfo.Picpix div 7 * ySizeBig); 610 x0[ i] := 64 + 8 + 8 + x0[i];601 x0[I] := 64 + 8 + 8 + x0[I]; 611 602 end; 612 603 pkSpecialIcon: … … 615 606 0: 616 607 FrameImage(OffScreen.Canvas, HGrSystem2.Data, 617 12 + x0[ i], -7 + i* 24, 56, 40, 137, 127);608 12 + x0[I], -7 + I * 24, 56, 40, 137, 127); 618 609 1: 619 610 with NoMap do begin 620 PaintTerrIcon(12 + x0[ i], -7 + i* 24,611 PaintTerrIcon(12 + x0[I], -7 + I * 24, 621 612 1 + 3 * (xxt * 2 + 1), 1 + yyt); 622 613 if 2 * yyt < 40 then 623 Sprite(OffScreen, HGrTerrain, 12 + x0[ i], -7 + 4 + i* 24,614 Sprite(OffScreen, HGrTerrain, 12 + x0[I], -7 + 4 + I * 24, 624 615 56, 2 * yyt, 1 + 3 * (xxt * 2 + 1) + xxt - 28, 625 616 1 + yyt + 1 * (yyt * 3 + 1)) 626 617 else 627 Sprite(OffScreen, HGrTerrain, 12 + x0[ i],628 -7 + 4 + i* 24 - 4, 56, 40, 1 + 3 * (xxt * 2 + 1) + xxt618 Sprite(OffScreen, HGrTerrain, 12 + x0[I], 619 -7 + 4 + I * 24 - 4, 56, 40, 1 + 3 * (xxt * 2 + 1) + xxt 629 620 - 28, 1 + yyt + 1 * (yyt * 3 + 1) + yyt - 20); 630 621 end; 631 622 2: 632 623 with NoMap do begin 633 PaintTerrIcon(12 + x0[ i], -7 + i* 24,624 PaintTerrIcon(12 + x0[I], -7 + I * 24, 634 625 1 + 7 * (xxt * 2 + 1), 1 + yyt + 4 * (yyt * 3 + 1)); 635 626 if 2 * yyt < 40 then 636 Sprite(OffScreen, HGrTerrain, 12 + x0[ i], -7 + 4 + i* 24,627 Sprite(OffScreen, HGrTerrain, 12 + x0[I], -7 + 4 + I * 24, 637 628 56, 32, 1 + 4 * (xxt * 2 + 1) + xxt - 28, 638 629 1 + yyt + 12 * (yyt * 3 + 1) + yyt - 16) 639 630 else 640 Sprite(OffScreen, HGrTerrain, 12 + x0[ i], -7 + 4 + i* 24,631 Sprite(OffScreen, HGrTerrain, 12 + x0[I], -7 + 4 + I * 24, 641 632 56, 32, 1 + 4 * (xxt * 2 + 1) + xxt - 28, 642 633 1 + yyt + 12 * (yyt * 3 + 1) + yyt - 16) 643 634 end; 644 635 end; 645 x0[ i] := 64 + 8 + 8 + x0[i];636 x0[I] := 64 + 8 + 8 + x0[I]; 646 637 end; 647 638 pkDomain: 648 639 begin 649 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,650 8 + 36 + x0[ i], 2 + 20 + i* 24, $000000, $000000);651 Dump(OffScreen, HGrSystem, 8 + x0[ i], 2 + i* 24, 36, 20,640 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 641 8 + 36 + x0[I], 2 + 20 + I * 24, $000000, $000000); 642 Dump(OffScreen, HGrSystem, 8 + x0[I], 2 + I * 24, 36, 20, 652 643 75 + HelpLineInfo.Picpix * 37, 295); 653 x0[ i] := x0[i] + (8 + 8 + 36);644 x0[I] := x0[I] + (8 + 8 + 36); 654 645 end; 655 646 pkAdvIcon, pkAdvIcon_AsPreq: 656 647 begin 657 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,658 8 + xSizeSmall + x0[ i], 2 + ySizeSmall + i* 24,648 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 649 8 + xSizeSmall + x0[I], 2 + ySizeSmall + I * 24, 659 650 $000000, $000000); 660 651 if AdvIcon[HelpLineInfo.Picpix] < 84 then 661 DpiBit Canvas(OffScreen.Canvas, 8 + x0[i], 2 + i* 24,652 DpiBitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, 662 653 xSizeSmall, ySizeSmall, SmallImp.Canvas, 663 654 (AdvIcon[HelpLineInfo.Picpix] + SystemIconLines * 7) mod 7 * … … 665 656 7) div 7 * ySizeSmall) 666 657 else 667 Dump(OffScreen, HGrSystem, 8 + x0[ i], 2 + i* 24, 36, 20,658 Dump(OffScreen, HGrSystem, 8 + x0[I], 2 + I * 24, 36, 20, 668 659 1 + (AdvIcon[HelpLineInfo.Picpix] - 84) mod 8 * 37, 669 660 295 + (AdvIcon[HelpLineInfo.Picpix] - 84) div 8 * 21); 670 j:= AdvValue[HelpLineInfo.Picpix] div 1000;671 DpiBit Canvas(OffScreen.Canvas, x0[i] + 4, 4 + i* 24, 14, 14,672 HGrSystem.Mask.Canvas, 127 + j* 15, 85, SRCAND);673 Sprite(OffScreen, HGrSystem, x0[ i] + 3, 3 + i* 24, 14, 14,674 127 + j* 15, 85);675 x0[ i] := x0[i] + (8 + 8 + 36);661 J := AdvValue[HelpLineInfo.Picpix] div 1000; 662 DpiBitBltCanvas(OffScreen.Canvas, x0[I] + 4, 4 + I * 24, 14, 14, 663 HGrSystem.Mask.Canvas, 127 + J * 15, 85, SRCAND); 664 Sprite(OffScreen, HGrSystem, x0[I] + 3, 3 + I * 24, 14, 14, 665 127 + J * 15, 85); 666 x0[I] := x0[I] + (8 + 8 + 36); 676 667 end; 677 668 pkRightIcon: 678 669 begin 679 670 if Imp[HelpLineInfo.Picpix].Kind <> ikWonder then 680 ImpImage(OffScreen.Canvas, InnerWidth - (40 + xSizeBig), i* 24,671 ImpImage(OffScreen.Canvas, InnerWidth - (40 + xSizeBig), I * 24, 681 672 HelpLineInfo.Picpix, gDespotism) 682 673 else 683 WaterSign(InnerWidth - (40 + 2 * xSizeBig), i* 24 - 8,674 WaterSign(InnerWidth - (40 + 2 * xSizeBig), I * 24 - 8, 684 675 HelpLineInfo.Picpix + 7); 685 x0[ i] := x0[i] + 8;676 x0[I] := x0[I] + 8; 686 677 end; 687 678 pkIllu: 688 WaterSign(8, i* 24 - 8, HelpLineInfo.Picpix);679 WaterSign(8, I * 24 - 8, HelpLineInfo.Picpix); 689 680 pkBigFeature: 690 681 begin 691 682 cnt := 0; 692 for j:= nDomains - 1 downto 0 do693 if 1 shl jand Feature[HelpLineInfo.Picpix].Domains <> 0 then683 for J := nDomains - 1 downto 0 do 684 if 1 shl J and Feature[HelpLineInfo.Picpix].Domains <> 0 then 694 685 begin 695 inc(cnt);686 Inc(cnt); 696 687 Dump(OffScreen, HGrSystem, InnerWidth - 38 - 38 * cnt, 697 i * 24 + 1, 36, 20, 75 + j* 37, 295);698 ScreenTools.Frame(OffScreen.Canvas, InnerWidth - 39 - 38 * cnt, i* 24,699 InnerWidth - 2 - 38 * cnt, i* 24 + 21, $000000, $000000);688 I * 24 + 1, 36, 20, 75 + J * 37, 295); 689 ScreenTools.Frame(OffScreen.Canvas, InnerWidth - 39 - 38 * cnt, I * 24, 690 InnerWidth - 2 - 38 * cnt, I * 24 + 21, $000000, $000000); 700 691 end; 701 692 DarkGradient(OffScreen.Canvas, InnerWidth - 38 - 38 * cnt, 702 i* 24 + 23, cnt * 38 - 2, 1);693 I * 24 + 23, cnt * 38 - 2, 1); 703 694 ofs := InnerWidth - (39 + 7) - 19 * cnt; 704 695 with OffScreen.Canvas do 705 696 begin 706 Brush. color := $C0C0C0;707 FrameRect(Rect(ofs, 1 + 23 + i* 24, ofs + 14,708 15 + 23 + i* 24));697 Brush.Color := $C0C0C0; 698 FrameRect(Rect(ofs, 1 + 23 + I * 24, ofs + 14, 699 15 + 23 + I * 24)); 709 700 Brush.Style := bsClear; 710 Sprite(OffScreen, HGrSystem, ofs + 2, 3 + 23 + i* 24, 10, 10,701 Sprite(OffScreen, HGrSystem, ofs + 2, 3 + 23 + I * 24, 10, 10, 711 702 66 + HelpLineInfo.Picpix mod 11 * 11, 712 703 137 + HelpLineInfo.Picpix div 11 * 11); 713 704 end; 714 x0[ i] := x0[i] + 8;705 x0[I] := x0[I] + 8; 715 706 end; 716 707 pkTer, pkBigTer: 717 708 with NoMap do begin 718 709 if HelpLineInfo.Format = pkBigTer then 719 y := i* 24 - 3 + yyt710 Y := I * 24 - 3 + yyt 720 711 else 721 y := i* 24 + 13;712 Y := I * 24 + 13; 722 713 if HelpLineInfo.Picpix >= 3 * 12 then 723 714 srcno := 2 * 9 + 6 … … 730 721 if HelpLineInfo.Format = pkTer then 731 722 begin 732 ofs := x0[ i] + 8;733 x0[ i] := 2 * xxt + 8 + ofs;723 ofs := x0[I] + 8; 724 x0[I] := 2 * xxt + 8 + ofs; 734 725 end 735 726 else 736 727 begin 737 728 ofs := InnerWidth - (2 * xxt + 38); 738 x0[ i] := x0[i] + 8;729 x0[I] := x0[I] + 8; 739 730 end; 740 731 if srcno >= fJungle then 741 732 begin 742 Sprite(OffScreen, HGrTerrain, ofs + 4, y- yyt + 2, xxt * 2 - 8,733 Sprite(OffScreen, HGrTerrain, ofs + 4, Y - yyt + 2, xxt * 2 - 8, 743 734 yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1), 744 735 3 + yyt + 2 * (yyt * 3 + 1)); 745 Sprite(OffScreen, HGrTerrain, ofs, y- 2 * yyt, xxt * 2,736 Sprite(OffScreen, HGrTerrain, ofs, Y - 2 * yyt, xxt * 2, 746 737 yyt * 3 - 2, 1 + srcno mod 9 * (xxt * 2 + 1), 747 738 1 + srcno div 9 * (yyt * 3 + 1)); 748 739 end 749 740 else 750 Sprite(OffScreen, HGrTerrain, ofs + 4, y- yyt + 2, xxt * 2 - 8,741 Sprite(OffScreen, HGrTerrain, ofs + 4, Y - yyt + 2, xxt * 2 - 8, 751 742 yyt * 2 - 4, 5 + srcno mod 9 * (xxt * 2 + 1), 752 743 3 + yyt + srcno div 9 * (yyt * 3 + 1)); 753 744 if HelpLineInfo.Picpix >= 3 * 12 then { rare resource } 754 Sprite(OffScreen, HGrTerrain, ofs, y- 2 * yyt, xxt * 2,745 Sprite(OffScreen, HGrTerrain, ofs, Y - 2 * yyt, xxt * 2, 755 746 yyt * 3, 1 + 8 * (xxt * 2 + 1), 756 747 1 + (HelpLineInfo.Picpix - 2 * 12) * (yyt * 3 + 1)) … … 764 755 srcno := 18 + 8 + (HelpLineInfo.Picpix mod 12 - 9) * 18; 765 756 srcno := srcno + HelpLineInfo.Picpix div 12 * 9; 766 Sprite(OffScreen, HGrTerrain, ofs, y- 2 * yyt, xxt * 2,757 Sprite(OffScreen, HGrTerrain, ofs, Y - 2 * yyt, xxt * 2, 767 758 yyt * 3, 1 + srcno mod 9 * (xxt * 2 + 1), 768 759 1 + srcno div 9 * (yyt * 3 + 1)); … … 774 765 if HelpLineInfo.Picpix = 5 then 775 766 begin // display mine on hills 776 Sprite(OffScreen, HGrTerrain, ofs + 4, i* 24 + 13 - yyt,767 Sprite(OffScreen, HGrTerrain, ofs + 4, I * 24 + 13 - yyt, 777 768 xxt * 2 - 8, yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1), 778 769 3 + yyt + 2 * (yyt * 3 + 1)); … … 781 772 else 782 773 srcno := fPrairie; // display on prairie 783 Sprite(OffScreen, HGrTerrain, ofs + 4, i* 24 + 13 - yyt,774 Sprite(OffScreen, HGrTerrain, ofs + 4, I * 24 + 13 - yyt, 784 775 xxt * 2 - 8, yyt * 2 - 4, 5 + srcno mod 9 * (xxt * 2 + 1), 785 776 3 + yyt + srcno div 9 * (yyt * 3 + 1)); 786 777 if HelpLineInfo.Picpix = 12 then { river } 787 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - yyt, xxt * 2,778 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - yyt, xxt * 2, 788 779 yyt * 2, 1 + 5 * (xxt * 2 + 1), 1 + yyt + 13 * (yyt * 3 + 1)) 789 780 else if HelpLineInfo.Picpix >= 3 then { improvement 2 } 790 781 begin 791 782 if HelpLineInfo.Picpix = 6 then 792 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,783 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 793 784 xxt * 2, yyt * 3, 1 + 7 * (xxt * 2 + 1), 794 785 1 + 12 * (yyt * 3 + 1)); 795 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,786 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 796 787 xxt * 2, yyt * 3, 1 + (HelpLineInfo.Picpix - 3) * 797 788 (xxt * 2 + 1), 1 + 12 * (yyt * 3 + 1)) … … 799 790 else { improvement 1 } 800 791 begin 801 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,792 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 802 793 xxt * 2, yyt * 3, 1 + 2 * (xxt * 2 + 1), 803 794 1 + (9 + HelpLineInfo.Picpix) * (yyt * 3 + 1)); 804 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,795 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 805 796 xxt * 2, yyt * 3, 1 + 5 * (xxt * 2 + 1), 806 797 1 + (9 + HelpLineInfo.Picpix) * (yyt * 3 + 1)) 807 798 end; 808 x0[ i] := x0[i] + 8;799 x0[I] := x0[I] + 8; 809 800 end; 810 801 pkModel: 811 802 begin 812 FrameImage(OffScreen.Canvas, BigImp, x0[ i] + 12, i* 24 - 7,803 FrameImage(OffScreen.Canvas, BigImp, x0[I] + 12, I * 24 - 7, 813 804 56, 40, 0, 0); 814 Sprite(OffScreen, HGrStdUnits, x0[ i] + 8, i* 24 - 11, 64, 44,805 Sprite(OffScreen, HGrStdUnits, x0[I] + 8, I * 24 - 11, 64, 44, 815 806 1 + HelpLineInfo.Picpix mod 10 * 65, 816 807 1 + HelpLineInfo.Picpix div 10 * 49); 817 x0[ i] := 64 + 8 + 8 + x0[i];808 x0[I] := 64 + 8 + 8 + x0[I]; 818 809 end; 819 810 pkFeature: 820 811 begin 821 DarkGradient(OffScreen.Canvas, x0[ i] + 8 - 1,822 7 + i* 24 - 3, 16, 1);823 ScreenTools.Frame(OffScreen.Canvas, x0[ i] + 8, 7 + i * 24 - 2, x0[i] + 8 + 13,824 7 + i* 24 - 2 + 13, $C0C0C0, $C0C0C0);825 Sprite(OffScreen, HGrSystem, x0[ i] + 8 + 2, 7 + i* 24, 10, 10,812 DarkGradient(OffScreen.Canvas, x0[I] + 8 - 1, 813 7 + I * 24 - 3, 16, 1); 814 ScreenTools.Frame(OffScreen.Canvas, x0[I] + 8, 7 + I * 24 - 2, x0[I] + 8 + 13, 815 7 + I * 24 - 2 + 13, $C0C0C0, $C0C0C0); 816 Sprite(OffScreen, HGrSystem, x0[I] + 8 + 2, 7 + I * 24, 10, 10, 826 817 66 + HelpLineInfo.Picpix mod 11 * 11, 827 818 137 + HelpLineInfo.Picpix div 11 * 11); 828 x0[ i] := x0[i] + 8 + 8 + 2 + 13;819 x0[I] := x0[I] + 8 + 8 + 2 + 13; 829 820 end; 830 821 pkExp: 831 822 begin 832 ScreenTools.Frame(OffScreen.Canvas, 20 - 1, 8 - 4 + i* 24, 20 + 12,833 8 + 11 + i* 24, $000000, $000000);834 Dump(OffScreen, HGrSystem, 20, 8 - 3 + i* 24, 12, 14,823 ScreenTools.Frame(OffScreen.Canvas, 20 - 1, 8 - 4 + I * 24, 20 + 12, 824 8 + 11 + I * 24, $000000, $000000); 825 Dump(OffScreen, HGrSystem, 20, 8 - 3 + I * 24, 12, 14, 835 826 121 + HelpLineInfo.Picpix * 13, 28); 836 x0[ i] := 20 + 8 + 11;827 x0[I] := 20 + 8 + 11; 837 828 end; 838 829 pkAITStat: 839 830 begin 840 Sprite(OffScreen, HGrSystem, 20, 6 + i* 24, 14, 14,831 Sprite(OffScreen, HGrSystem, 20, 6 + I * 24, 14, 14, 841 832 1 + HelpLineInfo.Picpix * 15, 316); 842 x0[ i] := 20 + 8 + 11;833 x0[I] := 20 + 8 + 11; 843 834 end; 844 835 pkGov: 845 836 begin 846 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,847 8 + xSizeSmall + x0[ i], 2 + 20 + i* 24, $000000, $000000);848 DpiBit Canvas(OffScreen.Canvas, 8 + x0[i], 2 + i* 24, xSizeSmall,837 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 838 8 + xSizeSmall + x0[I], 2 + 20 + I * 24, $000000, $000000); 839 DpiBitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, xSizeSmall, 849 840 ySizeSmall, SmallImp.Canvas, (HelpLineInfo.Picpix - 1) * 850 841 xSizeSmall, ySizeSmall); 851 x0[ i] := x0[i] + (8 + 8 + 36);842 x0[I] := x0[I] + (8 + 8 + 36); 852 843 end; 853 844 pkDot: 854 845 begin 855 Sprite(OffScreen, HGrSystem, x0[ i] + 18, 9 + i* 24, 8,846 Sprite(OffScreen, HGrSystem, x0[I] + 18, 9 + I * 24, 8, 856 847 8, 81, 16); 857 x0[ i] := 20 + 8 + 4;848 x0[I] := 20 + 8 + 4; 858 849 end; 859 850 pkNormal_Dot: 860 x0[ i] := 20 + 8 + 4;851 x0[I] := 20 + 8 + 4; 861 852 pkNormal_64: 862 x0[ i] := 64 + 8 + 8;853 x0[I] := 64 + 8 + 8; 863 854 else 864 x0[ i] := x0[i] + 8;855 x0[I] := x0[I] + 8; 865 856 end; 866 Self.Line(OffScreen.Canvas, i, False)857 Self.Line(OffScreen.Canvas, I, False) 867 858 end; 868 859 end; … … 873 864 begin 874 865 Sel := -1; 875 SmartUpdateContent( true)876 end; 877 878 procedure THelpDlg.Prepare(sbPos: integer = 0);866 SmartUpdateContent(True); 867 end; 868 869 procedure THelpDlg.Prepare(sbPos: Integer = 0); 879 870 var 880 i, j, Special, Domain, Headline, TerrType, TerrSubType: integer;881 s: string;882 ps: pchar;871 I, J, Special, Domain, Headline, TerrType, TerrSubType: Integer; 872 S: string; 873 ps: PChar; 883 874 List: THyperText; 884 875 CheckSeeAlso: Boolean; 885 876 886 procedure AddAdvance( i: integer);887 begin 888 MainText.AddLine(Phrases.Lookup('ADVANCES', i), pkAdvIcon, i,889 hkAdv + hkCrossLink, i);890 end; 891 892 procedure AddPreqAdv( i: integer);893 begin 894 MainText.AddLine(Phrases.Lookup('ADVANCES', i), pkAdvIcon_AsPreq, i,895 hkAdv + hkCrossLink, i);896 end; 897 898 procedure AddImprovement( i: integer);899 begin 900 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,901 hkImp + hkCrossLink, i);902 end; 903 904 procedure AddPreqImp( i: integer);905 begin 906 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon_AsPreq, i,907 hkImp + hkCrossLink, i);908 end; 909 910 procedure AddTerrain( i: integer);877 procedure AddAdvance(I: Integer); 878 begin 879 MainText.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon, I, 880 hkAdv, I, True); 881 end; 882 883 procedure AddPreqAdv(I: Integer); 884 begin 885 MainText.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon_AsPreq, I, 886 hkAdv, I, True); 887 end; 888 889 procedure AddImprovement(I: Integer); 890 begin 891 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 892 hkImp, I, True); 893 end; 894 895 procedure AddPreqImp(I: Integer); 896 begin 897 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon_AsPreq, I, 898 hkImp, I, True); 899 end; 900 901 procedure AddTerrain(I: Integer); 911 902 begin 912 903 if MainText.Count > 1 then … … 914 905 MainText.LineFeed; 915 906 end; 916 MainText.AddLine(Phrases.Lookup('TERRAIN', i), pkTer, i, hkTer, i);917 end; 918 919 procedure AddFeature( i: integer);920 begin 921 MainText.AddLine(Phrases.Lookup('FEATURES', i), pkFeature, i,922 hkFeature + hkCrossLink, i);923 end; 924 925 procedure AddModel( i: integer);907 MainText.AddLine(Phrases.Lookup('TERRAIN', I), pkTer, I, hkTer, I); 908 end; 909 910 procedure AddFeature(I: Integer); 911 begin 912 MainText.AddLine(Phrases.Lookup('FEATURES', I), pkFeature, I, 913 hkFeature, I, True); 914 end; 915 916 procedure AddModel(I: Integer); 926 917 var 927 pix: integer;918 pix: Integer; 928 919 Name: string; 929 920 begin 930 921 if MainText.Count > 1 then 931 922 MainText.LineFeed; 932 FindStdModelPicture(SpecialModelPictureCode[ i], pix, Name);933 MainText.AddLine(Name, pkModel, pix, hkModel + hkCrossLink, i)923 FindStdModelPicture(SpecialModelPictureCode[I], pix, Name); 924 MainText.AddLine(Name, pkModel, pix, hkModel, I, True); 934 925 end; 935 926 936 927 procedure AddStandardBlock(Item: string); 937 928 var 938 i: integer;929 I: Integer; 939 930 begin 940 931 with MainText do … … 947 938 else if Item = 'TECHFORMULA' then 948 939 begin 949 i:= Difficulty;950 if i= 0 then951 i:= 2;952 AddLine(Format(HelpText.Lookup('TECHFORMULA'), [TechFormula_M[ i],953 TechFormula_D[ i]]))940 I := Difficulty; 941 if I = 0 then 942 I := 2; 943 AddLine(Format(HelpText.Lookup('TECHFORMULA'), [TechFormula_M[I], 944 TechFormula_D[I]])); 954 945 end 955 946 else if Item = 'EXPERIENCE' then 956 for i:= 0 to nExp - 1 do957 AddLine(Phrases.Lookup('EXPERIENCE', i), pkExp, i)947 for I := 0 to nExp - 1 do 948 AddLine(Phrases.Lookup('EXPERIENCE', I), pkExp, I) 958 949 else if Item = 'MODERN' then 959 for i:= 1 to 3 do950 for I := 1 to 3 do 960 951 begin 961 952 LineFeed; 962 AddLine(Phrases.Lookup('TERRAIN', 3 * 12 + i), pkTer, 3 * 12 + i);953 AddLine(Phrases.Lookup('TERRAIN', 3 * 12 + I), pkTer, 3 * 12 + I); 963 954 end 964 955 else if Item = 'SAVED' then 965 956 AddLine(DataDir + 'Saved', pkNormal) 966 957 else if Item = 'AITSTAT' then 967 for i:= 0 to 3 do968 AddLine(Phrases2.Lookup('AITSTAT', i), pkAITStat, i)969 end 970 end; 971 972 procedure DecodeItem( s: string; var Category,Index: Integer);958 for I := 0 to 3 do 959 AddLine(Phrases2.Lookup('AITSTAT', I), pkAITStat, I) 960 end; 961 end; 962 963 procedure DecodeItem(S: string; var Category: TLinkCategory; var Index: Integer); 973 964 var 974 i: Integer;975 begin 976 if (Length( s) > 0) and (s[1] = ':') then begin965 I: Integer; 966 begin 967 if (Length(S) > 0) and (S[1] = ':') then begin 977 968 Category := hkMisc; 978 969 Index := 0; 979 for i := 3 to length(s) do980 Index := Index * 10 + Ord( s[i]) - 48;981 case s[2] of970 for I := 3 to Length(S) do 971 Index := Index * 10 + Ord(S[I]) - 48; 972 case S[2] of 982 973 'A': Category := hkAdv; 983 974 'B': Category := hkImp; … … 986 977 'E': Category := hkInternet; 987 978 'S': Category := hkModel; 988 'C': Index := miscCredits;989 'J': Index := miscJobList;990 'G': Index := miscGovList;979 'C': Index := Integer(miscCredits); 980 'J': Index := Integer(miscJobList); 981 'G': Index := Integer(miscGovList); 991 982 end; 992 983 if (Category <> hkMisc) and (Index = 0) then … … 994 985 end else begin 995 986 Category := hkText; 996 Index := HelpText.Get handle(Copy(s, 1, 255));987 Index := HelpText.GetHandle(Copy(S, 1, 255)); 997 988 end; 998 989 end; 999 990 1000 procedure AddTextual( s: string);991 procedure AddTextual(S: string); 1001 992 var 1002 i: Integer;1003 p: Integer;1004 l: Integer;993 I: Integer; 994 P: Integer; 995 L: Integer; 1005 996 ofs: Integer; 1006 CurrentFormat: Integer;1007 FollowFormat: Integer;997 CurrentFormat: TTextFormat; 998 FollowFormat: TTextFormat; 1008 999 Picpix: Integer; 1009 LinkCategory: Integer; 1000 LinkCategory: TLinkCategory; 1001 CrossLink: Boolean; 1010 1002 LinkIndex: Integer; 1011 1003 RightMargin: Integer; … … 1013 1005 Text: string; 1014 1006 begin 1007 CrossLink := False; 1015 1008 RightMargin := InnerWidth - 16 - DpiGetSystemMetrics(SM_CXVSCROLL); 1016 1009 FollowFormat := pkNormal; 1017 while s<> '' do1010 while S <> '' do 1018 1011 begin 1019 1012 Picpix := 0; 1020 LinkCategory := 0;1013 LinkCategory := hkNoLink; 1021 1014 LinkIndex := 0; 1022 if s[1] = '$' then1023 begin // window caption1024 p:= 1;1015 if S[1] = '$' then 1016 begin // Window caption 1017 P := 1; 1025 1018 repeat 1026 inc(p)1027 until ( p > Length(s)) or (s[p] = '\');1028 Caption := Copy( s, 2, p- 2);1029 Delete( s, 1, p);1019 Inc(P); 1020 until (P > Length(S)) or (S[P] = '\'); 1021 Caption := Copy(S, 2, P - 2); 1022 Delete(S, 1, P); 1030 1023 end 1031 else if s[1] = '&' then1032 begin // standard block1033 p:= 1;1024 else if S[1] = '&' then 1025 begin // Standard block 1026 P := 1; 1034 1027 repeat 1035 inc(p)1036 until ( p > Length(s)) or (s[p] = '\');1037 AddStandardBlock(Copy( s, 2, p- 2));1038 Delete( s, 1, p);1028 Inc(P); 1029 until (P > Length(S)) or (S[P] = '\'); 1030 AddStandardBlock(Copy(S, 2, P - 2)); 1031 Delete(S, 1, P); 1039 1032 end 1040 else if s[1] = '@' then1041 begin // image1042 if (Length( s) >= 2) and (s[2] = '@') then1043 begin // generate from icon1033 else if S[1] = '@' then 1034 begin // Image 1035 if (Length(S) >= 2) and (S[2] = '@') then 1036 begin // Generate from icon 1044 1037 Picpix := 0; 1045 p:= 3;1046 while ( p <= Length(s)) and (s[p] <> '\') do1038 P := 3; 1039 while (P <= Length(S)) and (S[P] <> '\') do 1047 1040 begin 1048 Picpix := Picpix * 10 + Ord( s[p]) - 48;1049 inc(p)1041 Picpix := Picpix * 10 + Ord(S[P]) - 48; 1042 Inc(P); 1050 1043 end; 1051 1044 if (Picpix < 0) or (Picpix >= nImp) then … … 1057 1050 else 1058 1051 begin // external image 1059 p:= 1;1052 P := 1; 1060 1053 repeat 1061 Inc( p)1062 until ( p > Length(s)) or (s[p] = '\');1054 Inc(P); 1055 until (P > Length(S)) or (S[P] = '\'); 1063 1056 if LoadGraphicFile(ExtPic, LocalizedFilePath('Help' + 1064 DirectorySeparator + Copy( s, 2, p- 2)) + '.png') then1057 DirectorySeparator + Copy(S, 2, P - 2)) + '.png') then 1065 1058 begin 1066 1059 MainText.AddLine('', pkExternal); 1067 for i:= 0 to (ExtPic.Height - 12) div 24 do1060 for I := 0 to (ExtPic.Height - 12) div 24 do 1068 1061 MainText.LineFeed; 1069 1062 end; 1070 1063 end; 1071 Delete( s, 1, p);1064 Delete(S, 1, P); 1072 1065 end 1073 1066 else 1074 1067 begin 1075 case s[1] of1068 case S[1] of 1076 1069 ':', ';': 1077 1070 begin // link 1078 p:= 1;1071 P := 1; 1079 1072 repeat 1080 inc(p)1081 until ( p > Length(s)) or (s[p] = '\') or (s[p] = ' ');1082 DecodeItem(Copy( s, 2, p- 2), LinkCategory, LinkIndex);1083 CurrentFormat := 0;1073 Inc(P); 1074 until (P > Length(S)) or (S[P] = '\') or (S[P] = ' '); 1075 DecodeItem(Copy(S, 2, P - 2), LinkCategory, LinkIndex); 1076 CurrentFormat := pkNormal; 1084 1077 if (LinkCategory <> hkText) and (LinkIndex < 200) then 1085 1078 // show icon … … 1088 1081 begin 1089 1082 CurrentFormat := pkAdvIcon; 1090 Picpix := LinkIndex 1083 Picpix := LinkIndex; 1091 1084 end; 1092 1085 hkImp: 1093 1086 begin 1094 1087 CurrentFormat := pkSmallIcon; 1095 Picpix := LinkIndex 1088 Picpix := LinkIndex; 1096 1089 end; 1097 1090 hkTer: … … 1103 1096 begin 1104 1097 CurrentFormat := pkFeature; 1105 Picpix := LinkIndex 1098 Picpix := LinkIndex; 1106 1099 end; 1107 1100 hkModel: … … 1112 1105 end; 1113 1106 end; 1114 if s[1] = ':' then1115 LinkCategory := LinkCategory + hkCrossLink;1116 if ( p > Length(s)) or (s[p] = ' ') then1117 Delete( s, 1, p)1107 if S[1] = ':' then 1108 CrossLink := True; 1109 if (P > Length(S)) or (S[P] = ' ') then 1110 Delete(S, 1, P) 1118 1111 else 1119 Delete( s, 1, p- 1)1120 end; 1121 '!': // highli ted1122 if (Length( s) >= 2) and (s[2] = '!') then1112 Delete(S, 1, P - 1) 1113 end; 1114 '!': // highlighted 1115 if (Length(S) >= 2) and (S[2] = '!') then 1123 1116 begin 1124 1117 if MainText.Count > 1 then … … 1126 1119 FollowFormat := pkCaption; 1127 1120 CurrentFormat := pkCaption; 1128 Delete( s, 1, 2);1121 Delete(S, 1, 2); 1129 1122 end 1130 1123 else … … 1132 1125 FollowFormat := pkSection; 1133 1126 CurrentFormat := pkSection; 1134 Delete( s, 1, 1);1127 Delete(S, 1, 1); 1135 1128 end; 1136 1129 '-': … … 1138 1131 FollowFormat := pkNormal_Dot; 1139 1132 CurrentFormat := pkDot; 1140 Delete( s, 1, 1);1133 Delete(S, 1, 1); 1141 1134 end; 1142 1135 else … … 1147 1140 else 1148 1141 ofs := 8; 1149 p:= 0;1142 P := 0; 1150 1143 repeat 1151 1144 repeat 1152 Inc( p)1153 until ( p > Length(s)) or (s[p] = ' ') or (s[p] = '\');1154 if (BiColorTextWidth(OffScreen.Canvas, Copy( s, 1, p- 1)) <=1145 Inc(P) 1146 until (P > Length(S)) or (S[P] = ' ') or (S[P] = '\'); 1147 if (BiColorTextWidth(OffScreen.Canvas, Copy(S, 1, P - 1)) <= 1155 1148 RightMargin - ofs) then 1156 l := p- 11149 L := P - 1 1157 1150 else 1158 1151 Break; 1159 until ( p >= Length(s)) or (s[l+ 1] = '\');1160 Text := Copy( s, 1, l);1161 if LinkCategory and $3f= hkInternet then begin1152 until (P >= Length(S)) or (S[L + 1] = '\'); 1153 Text := Copy(S, 1, L); 1154 if LinkCategory = hkInternet then begin 1162 1155 if LinkIndex = 1 then Text := AITemplateManual 1163 1156 else if LinkIndex = 2 then Text := CevoHomepageShort … … 1165 1158 end; 1166 1159 MainText.AddLine(Text, CurrentFormat, Picpix, LinkCategory, 1167 LinkIndex );1168 if ( l < Length(s)) and (s[l+ 1] = '\') then1160 LinkIndex, CrossLink); 1161 if (L < Length(S)) and (S[L + 1] = '\') then 1169 1162 FollowFormat := pkNormal; 1170 Delete( s, 1, l+ 1);1171 end 1172 end 1163 Delete(S, 1, L + 1); 1164 end; 1165 end; 1173 1166 end; 1174 1167 … … 1178 1171 end; 1179 1172 1180 procedure AddModelText( i: Integer);1173 procedure AddModelText(I: Integer); 1181 1174 var 1182 1175 pix: Integer; 1183 s: string;1176 S: string; 1184 1177 begin 1185 1178 with MainText do begin … … 1188 1181 LineFeed; 1189 1182 end; 1190 FindStdModelPicture(SpecialModelPictureCode[ i], pix, s);1191 AddLine( s, pkSection);1192 AddLine(Format(HelpText.Lookup('STRENGTH'), [SpecialModel[ i].Attack,1193 SpecialModel[ i].Defense]), pkNormal_64);1183 FindStdModelPicture(SpecialModelPictureCode[I], pix, S); 1184 AddLine(S, pkSection); 1185 AddLine(Format(HelpText.Lookup('STRENGTH'), [SpecialModel[I].Attack, 1186 SpecialModel[I].Defense]), pkNormal_64); 1194 1187 AddLine(Format(HelpText.Lookup('SPEED'), 1195 [MovementToString(SpecialModel[ i].Speed)]), pkModel, pix);1188 [MovementToString(SpecialModel[I].Speed)]), pkModel, pix); 1196 1189 if Difficulty = 0 then 1197 AddLine(Format(HelpText.Lookup('BUILDCOST'), [SpecialModel[ i].Cost]),1190 AddLine(Format(HelpText.Lookup('BUILDCOST'), [SpecialModel[I].Cost]), 1198 1191 pkNormal_64) 1199 1192 else 1200 1193 AddLine(Format(HelpText.Lookup('BUILDCOST'), 1201 [SpecialModel[ i].Cost * BuildCostMod[Difficulty] div 12]),1194 [SpecialModel[I].Cost * BuildCostMod[Difficulty] div 12]), 1202 1195 pkNormal_64); 1203 s := HelpText.LookupByHandle(hSPECIALMODEL, i);1204 if ( s <> '') and (s<> '*') then1205 AddTextual( s);1206 if SpecialModelPreq[ i] >= 0 then1207 AddPreqAdv(SpecialModelPreq[ i])1208 else if SpecialModelPreq[ i] = preLighthouse then1196 S := HelpText.LookupByHandle(hSPECIALMODEL, I); 1197 if (S <> '') and (S <> '*') then 1198 AddTextual(S); 1199 if SpecialModelPreq[I] >= 0 then 1200 AddPreqAdv(SpecialModelPreq[I]) 1201 else if SpecialModelPreq[I] = preLighthouse then 1209 1202 AddPreqImp(woLighthouse) 1210 else if SpecialModelPreq[ i] = preBuilder then1203 else if SpecialModelPreq[I] = preBuilder then 1211 1204 AddPreqImp(woPyramids) 1212 else if SpecialModelPreq[ i] = preLeo then1205 else if SpecialModelPreq[I] = preLeo then 1213 1206 AddPreqImp(woLeo); 1214 if SpecialModelPreq[ i] <> preNone then1207 if SpecialModelPreq[I] <> preNone then 1215 1208 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1216 1209 [MainText[Count - 1]]); … … 1220 1213 procedure AddJobList; 1221 1214 var 1222 i, JobCost: Integer;1215 I, JobCost: Integer; 1223 1216 begin 1224 1217 with MainText do begin 1225 for i := 0 to nJobHelp- 1 do begin1226 if i> 0 then begin1218 for I := 0 to Length(JobHelp) - 1 do begin 1219 if I > 0 then begin 1227 1220 LineFeed; 1228 1221 LineFeed; 1229 1222 end; 1230 AddLine(Phrases.Lookup('JOBRESULT', JobHelp[ i]), pkSection);1223 AddLine(Phrases.Lookup('JOBRESULT', JobHelp[I]), pkSection); 1231 1224 AddLine; 1232 AddLine('', pkTerImp, i);1225 AddLine('', pkTerImp, I); 1233 1226 AddLine; 1234 AddTextual(HelpText.LookupByHandle(hJOBHELP, i));1227 AddTextual(HelpText.LookupByHandle(hJOBHELP, I)); 1235 1228 JobCost := -1; 1236 case JobHelp[ i] of1229 case JobHelp[I] of 1237 1230 jCanal: JobCost := CanalWork; 1238 1231 jFort: JobCost := FortWork; … … 1244 1237 else 1245 1238 AddTextual(HelpText.Lookup('JOBCOSTVAR')); 1246 if JobPreq[JobHelp[ i]] <> preNone then begin1247 AddPreqAdv(JobPreq[JobHelp[ i]]);1239 if JobPreq[JobHelp[I]] <> preNone then begin 1240 AddPreqAdv(JobPreq[JobHelp[I]]); 1248 1241 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1249 1242 [MainText[Count - 1]]); … … 1255 1248 procedure AddGraphicCredits; 1256 1249 var 1257 i: Integer;1258 s: string;1250 I: Integer; 1251 S: string; 1259 1252 sr: TSearchRec; 1260 1253 List, Plus: TStringList; … … 1271 1264 1272 1265 List.Sort; 1273 i:= 1;1274 while i< List.Count do1275 if List[ i] = List[i- 1] then1276 List.Delete( i)1266 I := 1; 1267 while I < List.Count do 1268 if List[I] = List[I - 1] then 1269 List.Delete(I) 1277 1270 else 1278 Inc( i);1279 1280 for i:= 0 to List.Count - 1 do begin1281 s := List[i];1282 while BiColorTextWidth(OffScreen.Canvas, s) > InnerWidth - 16 -1271 Inc(I); 1272 1273 for I := 0 to List.Count - 1 do begin 1274 S := List[I]; 1275 while BiColorTextWidth(OffScreen.Canvas, S) > InnerWidth - 16 - 1283 1276 DpiGetSystemMetrics(SM_CXVSCROLL) do 1284 Delete( s, length(s), 1);1285 MainText.AddLine( s);1277 Delete(S, Length(S), 1); 1278 MainText.AddLine(S); 1286 1279 end; 1287 1280 FreeAndNil(List); … … 1290 1283 procedure AddSoundCredits; 1291 1284 var 1292 i: Integer;1293 s: string;1285 I: Integer; 1286 S: string; 1294 1287 List: TStringList; 1295 1288 begin 1296 1289 List := TStringList.Create; 1297 1290 List.LoadFromFile(GetSoundsDir + DirectorySeparator + 'sound.credits.txt'); 1298 for i:= 0 to List.Count - 1 do begin1299 s := List[i];1300 while BiColorTextWidth(OffScreen.Canvas, s) > InnerWidth - 16 -1291 for I := 0 to List.Count - 1 do begin 1292 S := List[I]; 1293 while BiColorTextWidth(OffScreen.Canvas, S) > InnerWidth - 16 - 1301 1294 DpiGetSystemMetrics(SM_CXVSCROLL) do 1302 Delete( s, length(s), 1);1303 MainText.AddLine( s);1295 Delete(S, Length(S), 1); 1296 MainText.AddLine(S); 1304 1297 end; 1305 1298 FreeAndNil(List); … … 1323 1316 Clear; 1324 1317 Headline := -1; 1325 if ( no >= 200) or not(Kind in [hkAdv, hkImp, hkTer, hkFeature]) then1318 if (No >= 200) or not (Kind in [hkAdv, hkImp, hkTer, hkFeature]) then 1326 1319 LineFeed; 1327 1320 case Kind of 1328 1321 hkText: 1329 AddTextual(HelpText.LookupByHandle( no));1322 AddTextual(HelpText.LookupByHandle(No)); 1330 1323 hkMisc: 1331 1324 begin 1332 case no of1333 miscMain:1325 case No of 1326 Integer(miscMain): 1334 1327 begin 1335 1328 Caption := HelpText.Lookup('HELPTITLE_MAIN'); 1336 1329 AddLine(HelpText.Lookup('HELPTITLE_QUICKSTART'), pkSpecialIcon, 1337 0, { pkBigIcon,22, } hkText, HelpText.Get handle('QUICK'));1330 0, { pkBigIcon,22, } hkText, HelpText.GetHandle('QUICK')); 1338 1331 LineFeed; 1339 1332 AddLine(HelpText.Lookup('HELPTITLE_CONCEPTS'), pkBigIcon, 6, … … 1344 1337 LineFeed; 1345 1338 AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkSpecialIcon, 2, 1346 hkMisc, miscJobList);1339 hkMisc, Integer(miscJobList)); 1347 1340 LineFeed; 1348 1341 AddLine(HelpText.Lookup('HELPTITLE_TECHLIST'), pkBigIcon, 39, 1349 1342 hkAdv, 200); 1350 1343 LineFeed; 1351 FindStdModelPicture(SpecialModelPictureCode[6], i, s);1352 AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkModel, i,1344 FindStdModelPicture(SpecialModelPictureCode[6], I, S); 1345 AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkModel, I, 1353 1346 hkModel, 0); 1354 1347 LineFeed; … … 1366 1359 LineFeed; 1367 1360 AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkBigIcon, 1368 gDemocracy + 6, hkMisc, miscGovList);1361 gDemocracy + 6, hkMisc, Integer(miscGovList)); 1369 1362 LineFeed; 1370 1363 AddLine(HelpText.Lookup('HELPTITLE_KEYS'), pkBigIcon, 2, hkText, … … 1375 1368 LineFeed; 1376 1369 AddLine(HelpText.Lookup('HELPTITLE_CREDITS'), pkBigIcon, 22, 1377 hkMisc, miscCredits);1370 hkMisc, Integer(miscCredits)); 1378 1371 end; 1379 miscCredits:1372 Integer(miscCredits): 1380 1373 begin 1381 1374 AddItem('CREDITS'); … … 1390 1383 AddItem('AUTHOR'); 1391 1384 end; 1392 miscJobList:1385 Integer(miscJobList): 1393 1386 begin 1394 1387 Caption := HelpText.Lookup('HELPTITLE_JOBLIST'); … … 1399 1392 AddItem('TERIMPCITY'); 1400 1393 end; 1401 miscGovList:1394 Integer(miscGovList): 1402 1395 begin 1403 1396 Caption := HelpText.Lookup('HELPTITLE_GOVLIST'); 1404 for i:= 1 to nGov do1397 for I := 1 to nGov do 1405 1398 begin 1406 AddLine(Phrases.Lookup('GOVERNMENT', imod nGov), pkSection);1399 AddLine(Phrases.Lookup('GOVERNMENT', I mod nGov), pkSection); 1407 1400 LineFeed; 1408 if i= nGov then1401 if I = nGov then 1409 1402 AddLine('', pkBigIcon, 7 * SystemIconLines + imPalace) 1410 1403 else 1411 AddLine('', pkBigIcon, i+ 6);1404 AddLine('', pkBigIcon, I + 6); 1412 1405 LineFeed; 1413 AddTextual(HelpText.LookupByHandle(hGOVHELP, imod nGov));1414 if imod nGov >= 2 then1406 AddTextual(HelpText.LookupByHandle(hGOVHELP, I mod nGov)); 1407 if I mod nGov >= 2 then 1415 1408 begin 1416 AddPreqAdv(GovPreq[ imod nGov]);1409 AddPreqAdv(GovPreq[I mod nGov]); 1417 1410 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1418 1411 [MainText[Count - 1]]); 1419 1412 end; 1420 if i< nGov then1413 if I < nGov then 1421 1414 begin 1422 1415 LineFeed; … … 1425 1418 end; 1426 1419 end; 1427 miscSearchResult:1420 Integer(miscSearchResult): 1428 1421 begin 1429 1422 Caption := HelpText.Lookup('HELPTITLE_SEARCHRESULTS'); … … 1431 1424 MainText.AppendList(SearchResult); 1432 1425 end; 1433 end; // case no1426 end; // case No 1434 1427 end; 1435 1428 1436 1429 hkAdv: 1437 if no = 200 then1430 if No = 200 then 1438 1431 begin // complete advance list 1439 1432 Caption := HelpText.Lookup('HELPTITLE_TECHLIST'); 1440 1433 List := THyperText.Create; 1441 1434 List.OwnsObjects := True; 1442 for j:= 0 to 3 do1435 for J := 0 to 3 do 1443 1436 begin 1444 if j> 0 then1437 if J > 0 then 1445 1438 begin 1446 1439 LineFeed; 1447 1440 LineFeed; 1448 1441 end; 1449 AddLine(HelpText.Lookup('TECHAGE', j), pkSection);1450 if j= 1 then1442 AddLine(HelpText.Lookup('TECHAGE', J), pkSection); 1443 if J = 1 then 1451 1444 AddLine(Phrases.Lookup('ADVANCES', adScience) + ' ' + 1452 1445 HelpText.Lookup('BASETECH'), pkAdvIcon, adScience, hkAdv, 1453 1446 adScience); 1454 if j= 2 then1447 if J = 2 then 1455 1448 AddLine(Phrases.Lookup('ADVANCES', adMassProduction) + ' ' + 1456 1449 HelpText.Lookup('BASETECH'), pkAdvIcon, adMassProduction, hkAdv, 1457 1450 adMassProduction); 1458 1451 List.Clear; 1459 for i:= 0 to nAdv - 1 do1460 if ( i <> adScience) and (i<> adMassProduction) and1461 (AdvValue[ i] div 1000 = j) then1462 List.AddLine(Phrases.Lookup('ADVANCES', i), pkAdvIcon, i,1463 hkAdv, i);1452 for I := 0 to nAdv - 1 do 1453 if (I <> adScience) and (I <> adMassProduction) and 1454 (AdvValue[I] div 1000 = J) then 1455 List.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon, I, 1456 hkAdv, I); 1464 1457 List.Sort; 1465 1458 AppendList(List); … … 1469 1462 else // single advance 1470 1463 begin 1471 Caption := Phrases.Lookup('ADVANCES', no);1464 Caption := Phrases.Lookup('ADVANCES', No); 1472 1465 LineFeed; 1473 AddLine(Phrases.Lookup('ADVANCES', no), pkCaption);1474 if no in FutureTech then1466 AddLine(Phrases.Lookup('ADVANCES', No), pkCaption); 1467 if No in FutureTech then 1475 1468 begin 1476 1469 AddLine(HelpText.Lookup('HELPSPEC_FUTURE')); 1477 1470 LineFeed; 1478 if no = futResearchTechnology then1471 if No = futResearchTechnology then 1479 1472 AddItem('FUTURETECHHELP100') 1480 1473 else … … 1483 1476 else 1484 1477 AddLine(HelpText.Lookup('HELPSPEC_ADV')); 1485 if AdvPreq[ no, 2] <> preNone then1478 if AdvPreq[No, 2] <> preNone then 1486 1479 NextSection('PREREQALT') 1487 1480 else 1488 1481 NextSection('PREREQ'); 1489 for i:= 0 to 2 do1490 if AdvPreq[ no, i] <> preNone then1491 AddPreqAdv(AdvPreq[ no, i]);1482 for I := 0 to 2 do 1483 if AdvPreq[No, I] <> preNone then 1484 AddPreqAdv(AdvPreq[No, I]); 1492 1485 NextSection('GOVALLOW'); 1493 for i:= 2 to nGov - 1 do1494 if GovPreq[ i] = no then1495 AddLine(Phrases.Lookup('GOVERNMENT', i), pkGov, i,1496 hkMisc + hkCrossLink, miscGovList);1486 for I := 2 to nGov - 1 do 1487 if GovPreq[I] = No then 1488 AddLine(Phrases.Lookup('GOVERNMENT', I), pkGov, I, 1489 hkMisc, Integer(miscGovList), True); 1497 1490 NextSection('BUILDALLOW'); 1498 for i:= 0 to nWonder - 1 do1499 if Imp[ i].Preq = no then1500 AddImprovement( i);1501 for i:= nWonder to nImp - 1 do1502 if (Imp[ i].Preq = no) and (Imp[i].Kind <> ikCommon) then1503 AddImprovement( i);1504 for i:= nWonder to nImp - 1 do1505 if (Imp[ i].Preq = no) and (Imp[i].Kind = ikCommon) then1506 AddImprovement( i);1491 for I := 0 to nWonder - 1 do 1492 if Imp[I].Preq = No then 1493 AddImprovement(I); 1494 for I := nWonder to nImp - 1 do 1495 if (Imp[I].Preq = No) and (Imp[I].Kind <> ikCommon) then 1496 AddImprovement(I); 1497 for I := nWonder to nImp - 1 do 1498 if (Imp[I].Preq = No) and (Imp[I].Kind = ikCommon) then 1499 AddImprovement(I); 1507 1500 NextSection('MODELALLOW'); 1508 for i:= 0 to nSpecialModel - 1 do1509 if SpecialModelPreq[ i] = no then1510 AddModel( i);1501 for I := 0 to nSpecialModel - 1 do 1502 if SpecialModelPreq[I] = No then 1503 AddModel(I); 1511 1504 NextSection('FEATALLOW'); 1512 for i:= 0 to nFeature - 1 do1513 if Feature[ i].Preq = no then1514 AddFeature( i);1505 for I := 0 to nFeature - 1 do 1506 if Feature[I].Preq = No then 1507 AddFeature(I); 1515 1508 NextSection('FOLLOWADV'); 1516 for i:= 0 to nAdv - 1 do1517 if (AdvPreq[ i, 0] = no) or (AdvPreq[i, 1] = no) or1518 (AdvPreq[ i, 2] = no) then1519 AddAdvance( i);1509 for I := 0 to nAdv - 1 do 1510 if (AdvPreq[I, 0] = No) or (AdvPreq[I, 1] = No) or 1511 (AdvPreq[I, 2] = No) then 1512 AddAdvance(I); 1520 1513 NextSection('UPGRADEALLOW'); 1521 1514 for Domain := 0 to nDomains - 1 do 1522 for i:= 1 to nUpgrade - 1 do1523 if upgrade[Domain, i].Preq = no then1515 for I := 1 to nUpgrade - 1 do 1516 if upgrade[Domain, I].Preq = No then 1524 1517 begin 1525 if upgrade[Domain, i].Strength > 0 then1518 if upgrade[Domain, I].Strength > 0 then 1526 1519 AddLine(Format(HelpText.Lookup('STRENGTHUP'), 1527 1520 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, 1528 i].Strength]), pkDomain, Domain);1529 if upgrade[Domain, i].Trans > 0 then1521 I].Strength]), pkDomain, Domain); 1522 if upgrade[Domain, I].Trans > 0 then 1530 1523 AddLine(Format(HelpText.Lookup('TRANSUP'), 1531 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, i].Trans]1524 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, I].Trans] 1532 1525 ), pkDomain, Domain); 1533 if no in FutureTech then1526 if No in FutureTech then 1534 1527 AddLine(Format(HelpText.Lookup('COSTUP'), 1535 [upgrade[Domain, i].Cost]), pkNormal_Dot)1528 [upgrade[Domain, I].Cost]), pkNormal_Dot) 1536 1529 else 1537 1530 AddLine(Format(HelpText.Lookup('COSTMIN'), 1538 [upgrade[Domain, i].Cost]), pkNormal_Dot)1531 [upgrade[Domain, I].Cost]), pkNormal_Dot) 1539 1532 end; 1540 1533 NextSection('EXPIRATION'); 1541 for i:= 0 to nWonder - 1 do1542 if (Imp[ i].Preq <> preNA) and (Imp[i].Expiration = no) then1543 AddImprovement( i);1534 for I := 0 to nWonder - 1 do 1535 if (Imp[I].Preq <> preNA) and (Imp[I].Expiration = No) then 1536 AddImprovement(I); 1544 1537 NextSection('ADVEFFECT'); 1545 s := HelpText.LookupByHandle(hADVHELP, no);1546 if s<> '*' then1547 AddTextual( s);1538 S := HelpText.LookupByHandle(hADVHELP, No); 1539 if S <> '*' then 1540 AddTextual(S); 1548 1541 NextSection('SEEALSO'); 1549 CheckSeeAlso := true1542 CheckSeeAlso := True; 1550 1543 end; 1551 1544 1552 1545 hkImp: 1553 if no = 200 then1546 if No = 200 then 1554 1547 begin // complete city improvement list 1555 1548 Caption := HelpText.Lookup('HELPTITLE_IMPLIST'); … … 1557 1550 List := THyperText.Create; 1558 1551 List.OwnsObjects := True; 1559 for i:= nWonder to nImp - 1 do1560 if ( i <> imTrGoods) and (Imp[i].Preq <> preNA) and1561 (Imp[ i].Kind = ikCommon) then1562 List.AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon,1563 i, hkImp, i);1552 for I := nWonder to nImp - 1 do 1553 if (I <> imTrGoods) and (Imp[I].Preq <> preNA) and 1554 (Imp[I].Kind = ikCommon) then 1555 List.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, 1556 I, hkImp, I); 1564 1557 List.Sort; 1565 1558 AppendList(List); 1566 1559 FreeAndNil(List); 1567 1560 end 1568 else if no = 201 then1561 else if No = 201 then 1569 1562 begin // complete nat. project list 1570 1563 Caption := HelpText.Lookup('HELPTITLE_UNIQUELIST'); 1571 1564 // AddLine(HelpText.Lookup('HELPTITLE_UNIQUELIST'),pkSection); 1572 for i:= nWonder to nImp - 1 do1573 if (Imp[ i].Preq <> preNA) and1574 ((Imp[ i].Kind = ikNatLocal) or (Imp[i].Kind = ikNatGlobal)) then1575 AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,1576 hkImp, i);1565 for I := nWonder to nImp - 1 do 1566 if (Imp[I].Preq <> preNA) and 1567 ((Imp[I].Kind = ikNatLocal) or (Imp[I].Kind = ikNatGlobal)) then 1568 AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 1569 hkImp, I); 1577 1570 { LineFeed; 1578 1571 LineFeed; 1579 1572 AddLine(HelpText.Lookup('HELPTITLE_SHIPPARTLIST'),pkSection); 1580 for i:= nWonder to nImp-1 do1581 if (Imp[ i].Preq<>preNA) and (Imp[i].Kind=ikShipPart) then1582 AddLine(Phrases.Lookup('IMPROVEMENTS', i),pkSmallIcon,i,hkImp,i); }1573 for I:= nWonder to nImp-1 do 1574 if (Imp[I].Preq<>preNA) and (Imp[I].Kind=ikShipPart) then 1575 AddLine(Phrases.Lookup('IMPROVEMENTS',I),pkSmallIcon,I,hkImp,I); } 1583 1576 end 1584 else if no = 202 then1577 else if No = 202 then 1585 1578 begin // complete wonder list 1586 1579 Caption := HelpText.Lookup('HELPTITLE_WONDERLIST'); 1587 1580 // AddLine(HelpText.Lookup('HELPTITLE_WONDERLIST'),pkSection); 1588 for i:= 0 to nWonder - 1 do1589 if Imp[ i].Preq <> preNA then1590 AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,1591 hkImp, i);1581 for I := 0 to nWonder - 1 do 1582 if Imp[I].Preq <> preNA then 1583 AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 1584 hkImp, I); 1592 1585 end 1593 1586 else 1594 1587 begin // single building 1595 Caption := Phrases.Lookup('IMPROVEMENTS', no);1588 Caption := Phrases.Lookup('IMPROVEMENTS', No); 1596 1589 LineFeed; 1597 AddLine(Phrases.Lookup('IMPROVEMENTS', no), pkRightIcon, no);1598 case Imp[ no].Kind of1590 AddLine(Phrases.Lookup('IMPROVEMENTS', No), pkRightIcon, No); 1591 case Imp[No].Kind of 1599 1592 ikWonder: AddLine(HelpText.Lookup('HELPSPEC_WONDER')); 1600 1593 ikCommon: AddLine(HelpText.Lookup('HELPSPEC_IMP')); … … 1603 1596 AddLine(HelpText.Lookup('HELPSPEC_NAT')) 1604 1597 end; 1605 if Imp[ no].Kind <> ikShipPart then begin1598 if Imp[No].Kind <> ikShipPart then begin 1606 1599 NextSection('EFFECT'); 1607 AddTextual(HelpText.LookupByHandle(hIMPHELP, no));1600 AddTextual(HelpText.LookupByHandle(hIMPHELP, No)); 1608 1601 end; 1609 if no = woSun then begin1602 if No = woSun then begin 1610 1603 AddFeature(mcFirst); 1611 1604 AddFeature(mcWill); 1612 1605 AddFeature(mcAcademy); 1613 1606 end; 1614 if ( no < nWonder) and not Phrases2FallenBackToEnglish then1607 if (No < nWonder) and not Phrases2FallenBackToEnglish then 1615 1608 begin 1616 1609 LineFeed; 1617 if Imp[ no].Expiration >= 0 then1610 if Imp[No].Expiration >= 0 then 1618 1611 AddTextual(Phrases2.Lookup('HELP_WONDERMORALE1')) 1619 1612 else 1620 1613 AddTextual(Phrases2.Lookup('HELP_WONDERMORALE2')); 1621 1614 end; 1622 if Imp[ no].Preq <> preNone then1615 if Imp[No].Preq <> preNone then 1623 1616 begin 1624 1617 NextSection('PREREQ'); 1625 AddPreqAdv(Imp[ no].Preq);1618 AddPreqAdv(Imp[No].Preq); 1626 1619 end; 1627 1620 NextSection('COSTS'); 1628 1621 if Difficulty = 0 then 1629 s := Format(HelpText.Lookup('BUILDCOST'), [Imp[no].Cost])1622 S := Format(HelpText.Lookup('BUILDCOST'), [Imp[No].Cost]) 1630 1623 else 1631 s:= Format(HelpText.Lookup('BUILDCOST'),1632 [Imp[ no].Cost * BuildCostMod[Difficulty] div 12]);1633 AddLine( s);1634 if Imp[ no].Maint > 0 then1635 AddLine(Format(HelpText.Lookup('MAINTCOST'), [Imp[ no].Maint]));1636 j:= 0;1637 for i:= 0 to nImpReplacement - 1 do1638 if ImpReplacement[ i].NewImp = no then1639 begin 1640 if j= 0 then1624 S := Format(HelpText.Lookup('BUILDCOST'), 1625 [Imp[No].Cost * BuildCostMod[Difficulty] div 12]); 1626 AddLine(S); 1627 if Imp[No].Maint > 0 then 1628 AddLine(Format(HelpText.Lookup('MAINTCOST'), [Imp[No].Maint])); 1629 J := 0; 1630 for I := 0 to nImpReplacement - 1 do 1631 if ImpReplacement[I].NewImp = No then 1632 begin 1633 if J = 0 then 1641 1634 begin 1642 1635 NextSection('REPLACE'); 1643 1636 AddItem('REPLACETEXT'); 1644 j:= 1;1637 J := 1; 1645 1638 end; 1646 AddImprovement(ImpReplacement[ i].OldImp);1647 end; 1648 if Imp[ no].Kind = ikShipPart then1639 AddImprovement(ImpReplacement[I].OldImp); 1640 end; 1641 if Imp[No].Kind = ikShipPart then 1649 1642 begin 1650 1643 LineFeed; 1651 if no = imShipComp then1652 i:= 11653 else if no = imShipPow then1654 i:= 21655 else { if no=imShipHab then }1656 i:= 3;1644 if No = imShipComp then 1645 I := 1 1646 else if No = imShipPow then 1647 I := 2 1648 else { if No=imShipHab then } 1649 I := 3; 1657 1650 AddLine(Format(HelpText.Lookup('RAREREQUIRED'), 1658 [Phrases.Lookup('TERRAIN', 3 * 12 + i)]), pkTer, 3 * 12 + i);1651 [Phrases.Lookup('TERRAIN', 3 * 12 + I)]), pkTer, 3 * 12 + I); 1659 1652 end; 1660 if ( no < nWonder) and (Imp[no].Expiration >= 0) then1653 if (No < nWonder) and (Imp[No].Expiration >= 0) then 1661 1654 begin 1662 1655 NextSection('EXPIRATION'); 1663 s:= Format(HelpText.Lookup('EXPWITH'),1664 [Phrases.Lookup('ADVANCES', Imp[ no].Expiration)]);1665 if no = woPyramids then1666 s := s+ ' ' + HelpText.Lookup('EXPSLAVE');1667 AddTextual( s);1656 S := Format(HelpText.Lookup('EXPWITH'), 1657 [Phrases.Lookup('ADVANCES', Imp[No].Expiration)]); 1658 if No = woPyramids then 1659 S := S + ' ' + HelpText.Lookup('EXPSLAVE'); 1660 AddTextual(S); 1668 1661 end; 1669 1662 NextSection('SEEALSO'); 1670 if ( no < nWonder) and (Imp[no].Expiration >= 0) then1663 if (No < nWonder) and (Imp[No].Expiration >= 0) then 1671 1664 AddImprovement(woEiffel); 1672 for i:= 0 to nImpReplacement - 1 do1673 if ImpReplacement[ i].OldImp = no then1674 AddImprovement(ImpReplacement[ i].NewImp);1675 if no = imSupermarket then1665 for I := 0 to nImpReplacement - 1 do 1666 if ImpReplacement[I].OldImp = No then 1667 AddImprovement(ImpReplacement[I].NewImp); 1668 if No = imSupermarket then 1676 1669 AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 1677 hkMisc + hkCrossLink, miscJobList);1678 CheckSeeAlso := true;1670 hkMisc, Integer(miscJobList), True); 1671 CheckSeeAlso := True; 1679 1672 end; 1680 1673 1681 1674 hkTer: 1682 if no = 200 then1675 if No = 200 then 1683 1676 begin // complete terrain type list 1684 1677 Caption := HelpText.Lookup('HELPTITLE_TERLIST'); 1685 1678 // AddLine(HelpText.Lookup('HELPTITLE_TERLIST'),pkSection); 1686 for i := 0 to nTerrainHelp- 1 do1687 AddTerrain(TerrainHelp[ i]);1679 for I := 0 to Length(TerrainHelp) - 1 do 1680 AddTerrain(TerrainHelp[I]); 1688 1681 end 1689 1682 else 1690 1683 begin // sigle terrain type 1691 TerrType := no mod 12;1684 TerrType := No mod 12; 1692 1685 if TerrType = fJungle then 1693 1686 TerrType := fForest; 1694 TerrSubType := no div 12;1695 if no = 3 * 12 then1687 TerrSubType := No div 12; 1688 if No = 3 * 12 then 1696 1689 begin 1697 1690 TerrType := fDesert; … … 1700 1693 with Terrain[TerrType] do 1701 1694 begin 1702 Caption := Phrases.Lookup('TERRAIN', no);1695 Caption := Phrases.Lookup('TERRAIN', No); 1703 1696 LineFeed; 1704 AddLine(Phrases.Lookup('TERRAIN', no), pkBigTer, no);1697 AddLine(Phrases.Lookup('TERRAIN', No), pkBigTer, No); 1705 1698 AddLine(HelpText.Lookup('HELPSPEC_TER')); 1706 1699 LineFeed; … … 1708 1701 AddLine(Format(HelpText.Lookup('RESPROD'), 1709 1702 [ProdRes[TerrSubType]])); 1710 if ( no < 3 * 12) and (MineEff > 0) then1703 if (No < 3 * 12) and (MineEff > 0) then 1711 1704 MainText[Count - 1] := MainText[Count - 1] + ' ' + 1712 1705 Format(HelpText.Lookup('MOREMINE'), [MineEff]); … … 1714 1707 AddLine(Format(HelpText.Lookup('RESFOOD'), 1715 1708 [FoodRes[TerrSubType]])); 1716 if ( no < 3 * 12) and (IrrEff > 0) then1709 if (No < 3 * 12) and (IrrEff > 0) then 1717 1710 MainText[Count - 1] := MainText[Count - 1] + ' ' + 1718 1711 Format(HelpText.Lookup('MOREIRR'), [IrrEff]); … … 1728 1721 else 1729 1722 AddLine(HelpText.Lookup('MOVEPLAIN')); 1730 if no = 3 * 12 then1723 if No = 3 * 12 then 1731 1724 begin 1732 1725 LineFeed; 1733 1726 AddTextual(HelpText.Lookup('DEADLANDS')); 1734 1727 end; 1735 if (TerrType = fDesert) and ( no <> fDesert + 12) then1728 if (TerrType = fDesert) and (No <> fDesert + 12) then 1736 1729 begin 1737 1730 LineFeed; … … 1743 1736 AddTextual(Format(HelpText.Lookup('HOSTILE'), [ArcticThurst])); 1744 1737 end; 1745 if ( no < 3 * 12) and (TransTerrain >= 0) then1738 if (No < 3 * 12) and (TransTerrain >= 0) then 1746 1739 begin 1747 1740 LineFeed; 1748 i:= TransTerrain;1749 if (TerrType <> fGrass) and ( i<> fGrass) then1750 i := i+ TerrSubType * 12;1741 I := TransTerrain; 1742 if (TerrType <> fGrass) and (I <> fGrass) then 1743 I := I + TerrSubType * 12; 1751 1744 // trafo to same Special resource group 1752 1745 AddLine(Format(HelpText.Lookup('TRAFO'), 1753 [Phrases.Lookup('TERRAIN', i)]), pkTer, i,1754 hkTer + hkCrossLink, i);1755 if no = fSwamp + 12 then1746 [Phrases.Lookup('TERRAIN', I)]), pkTer, I, 1747 hkTer, I, True); 1748 if No = fSwamp + 12 then 1756 1749 begin 1757 1750 LineFeed; 1758 1751 AddLine(Format(HelpText.Lookup('TRAFO'), 1759 1752 [Phrases.Lookup('TERRAIN', TransTerrain + 24)]), pkTer, 1760 TransTerrain + 24, hkTer + hkCrossLink, TransTerrain + 24);1753 TransTerrain + 24, hkTer, TransTerrain + 24, True); 1761 1754 end 1762 else if i= fGrass then1755 else if I = fGrass then 1763 1756 begin 1764 1757 LineFeed; 1765 1758 AddLine(Format(HelpText.Lookup('TRAFO'), 1766 1759 [Phrases.Lookup('TERRAIN', fGrass + 12)]), pkTer, fGrass + 12, 1767 hkTer + hkCrossLink, fGrass + 12);1760 hkTer, fGrass + 12, True); 1768 1761 end; 1769 1762 end; 1770 1763 NextSection('SPECIAL'); 1771 if no = 3 * 12 then1764 if No = 3 * 12 then 1772 1765 begin 1773 1766 LineFeed; … … 1780 1773 end; 1781 1774 end 1782 else if ( no < 12) and (no <> fGrass) and (no <> fOcean) then1775 else if (No < 12) and (No <> fGrass) and (No <> fOcean) then 1783 1776 begin 1784 1777 LineFeed; 1785 1778 for Special := 1 to 2 do 1786 if ( no <> fArctic) and (no <> fSwamp) or (Special < 2) then1779 if (No <> fArctic) and (No <> fSwamp) or (Special < 2) then 1787 1780 begin 1788 1781 if Special > 1 then 1789 1782 LineFeed; 1790 AddLine(Phrases.Lookup('TERRAIN', no + Special * 12), pkTer,1791 no + Special * 12);1792 i:= FoodRes[Special] - FoodRes[0];1793 if i<> 0 then1783 AddLine(Phrases.Lookup('TERRAIN', No + Special * 12), pkTer, 1784 No + Special * 12); 1785 I := FoodRes[Special] - FoodRes[0]; 1786 if I <> 0 then 1794 1787 MainText[Count - 1] := MainText[Count - 1] + 1795 Format(HelpText.Lookup('SPECIALFOOD'), [ i]);1796 i:= ProdRes[Special] - ProdRes[0];1797 if i<> 0 then1788 Format(HelpText.Lookup('SPECIALFOOD'), [I]); 1789 I := ProdRes[Special] - ProdRes[0]; 1790 if I <> 0 then 1798 1791 MainText[Count - 1] := MainText[Count - 1] + 1799 Format(HelpText.Lookup('SPECIALPROD'), [ i]);1800 i:= TradeRes[Special] - TradeRes[0];1801 if i<> 0 then1792 Format(HelpText.Lookup('SPECIALPROD'), [I]); 1793 I := TradeRes[Special] - TradeRes[0]; 1794 if I <> 0 then 1802 1795 MainText[Count - 1] := MainText[Count - 1] + 1803 Format(HelpText.Lookup('SPECIALTRADE'), [ i]);1796 Format(HelpText.Lookup('SPECIALTRADE'), [I]); 1804 1797 end; 1805 1798 end; 1806 if no = 3 * 12 then1799 if No = 3 * 12 then 1807 1800 begin 1808 1801 LineFeed; 1809 1802 AddTextual(HelpText.Lookup('RARE')); 1810 1803 end; 1811 if ( no < 3 * 12) and (TerrType in [fDesert, fArctic]) then1804 if (No < 3 * 12) and (TerrType in [fDesert, fArctic]) then 1812 1805 begin 1813 1806 NextSection('SEEALSO'); 1814 1807 AddImprovement(woGardens); 1815 CheckSeeAlso := true1808 CheckSeeAlso := True; 1816 1809 end; 1817 1810 end; … … 1819 1812 1820 1813 hkFeature: 1821 if no = 200 then1814 if No = 200 then 1822 1815 begin // complete feature list 1823 1816 Caption := HelpText.Lookup('HELPTITLE_FEATURELIST'); … … 1837 1830 end; 1838 1831 List.Clear; 1839 for i:= 0 to nFeature - 1 do1840 if Feature[ i].Preq <> preNA then1832 for I := 0 to nFeature - 1 do 1833 if Feature[I].Preq <> preNA then 1841 1834 begin 1842 if i< mcFirstNonCap then1843 j:= 01844 else if iin AutoFeature then1845 j:= 21835 if I < mcFirstNonCap then 1836 J := 0 1837 else if I in AutoFeature then 1838 J := 2 1846 1839 else 1847 j:= 1;1848 if j= Special then1849 List.AddLine(Phrases.Lookup('FEATURES', i), pkFeature, i,1850 hkFeature, i);1840 J := 1; 1841 if J = Special then 1842 List.AddLine(Phrases.Lookup('FEATURES', I), pkFeature, I, 1843 hkFeature, I); 1851 1844 end; 1852 1845 List.Sort; … … 1857 1850 else 1858 1851 begin // single feature 1859 Caption := Phrases.Lookup('FEATURES', no);1852 Caption := Phrases.Lookup('FEATURES', No); 1860 1853 LineFeed; 1861 AddLine(Phrases.Lookup('FEATURES', no), pkBigFeature, no);1862 if no < mcFirstNonCap then1854 AddLine(Phrases.Lookup('FEATURES', No), pkBigFeature, No); 1855 if No < mcFirstNonCap then 1863 1856 AddLine(HelpText.Lookup('HELPSPEC_CAP')) 1864 else if no in AutoFeature then1857 else if No in AutoFeature then 1865 1858 AddLine(HelpText.Lookup('HELPSPEC_STANDARD')) 1866 1859 else 1867 1860 AddLine(HelpText.Lookup('HELPSPEC_FEATURE')); 1868 1861 NextSection('EFFECT'); 1869 AddTextual(HelpText.LookupByHandle(hFEATUREHELP, no));1870 if (Feature[ no].Weight <> 0) or (Feature[no].Cost <> 0) then1862 AddTextual(HelpText.LookupByHandle(hFEATUREHELP, No)); 1863 if (Feature[No].Weight <> 0) or (Feature[No].Cost <> 0) then 1871 1864 begin 1872 1865 NextSection('COSTS'); 1873 s := IntToStr(Feature[no].Cost);1874 if Feature[ no].Cost >= 0 then1875 s := '+' + s;1876 AddLine(Format(HelpText.Lookup('COSTBASE'), [ s]));1877 if Feature[ no].Weight > 0 then1866 S := IntToStr(Feature[No].Cost); 1867 if Feature[No].Cost >= 0 then 1868 S := '+' + S; 1869 AddLine(Format(HelpText.Lookup('COSTBASE'), [S])); 1870 if Feature[No].Weight > 0 then 1878 1871 begin 1879 1872 AddLine(Format(HelpText.Lookup('WEIGHT'), 1880 ['+' + IntToStr(Feature[ no].Weight)]));1881 if no = mcDefense then1873 ['+' + IntToStr(Feature[No].Weight)])); 1874 if No = mcDefense then 1882 1875 AddLine(Format(HelpText.Lookup('WEIGHT'), ['+2']), 1883 1876 pkDomain, dGround); 1884 1877 end; 1885 1878 end; 1886 if Feature[ no].Preq <> preNone then1879 if Feature[No].Preq <> preNone then 1887 1880 begin 1888 1881 LineFeed; 1889 if Feature[ no].Preq = preSun then1882 if Feature[No].Preq = preSun then 1890 1883 AddPreqImp(woSun) // sun tsu feature 1891 1884 else 1892 AddPreqAdv(Feature[ no].Preq);1885 AddPreqAdv(Feature[No].Preq); 1893 1886 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1894 1887 [MainText[Count - 1]]); … … 1901 1894 begin 1902 1895 Caption := HelpText.Lookup('HELPTITLE_MODELLIST'); 1903 for i:= 0 to nSpecialModel - 1 do1904 if i<> 2 then1905 AddModelText( i);1896 for I := 0 to nSpecialModel - 1 do 1897 if I <> 2 then 1898 AddModelText(I); 1906 1899 LineFeed; 1907 1900 AddItem('MODELNOTE'); … … 1910 1903 end; 1911 1904 if CheckSeeAlso then 1912 for i := 0 to nSeeAlso- 1 do1913 if (SeeAlso[ i].Kind = Kind) and (SeeAlso[i].no = no) then1914 case SeeAlso[ i].SeeKind of1915 hkImp: AddImprovement(SeeAlso[ i].SeeNo);1916 hkAdv: AddAdvance(SeeAlso[ i].SeeNo);1917 hkFeature: AddFeature(SeeAlso[ i].SeeNo);1905 for I := 0 to Length(SeeAlso) - 1 do 1906 if (SeeAlso[I].Kind = Kind) and (SeeAlso[I].No = No) then 1907 case SeeAlso[I].SeeKind of 1908 hkImp: AddImprovement(SeeAlso[I].SeeNo); 1909 hkAdv: AddAdvance(SeeAlso[I].SeeNo); 1910 hkFeature: AddFeature(SeeAlso[I].SeeNo); 1918 1911 end; 1919 1912 if (Headline >= 0) and (Count = Headline + 1) then … … 1926 1919 ScrollBar.SetPos(sbPos); 1927 1920 BackBtn.Visible := HistItems.Count > 1; 1928 TopBtn.Visible := (HistItems.Count > 1) or (Kind <> hkMisc) or ( no <> miscMain);1921 TopBtn.Visible := (HistItems.Count > 1) or (Kind <> hkMisc) or (No <> Integer(miscMain)); 1929 1922 Sel := -1; 1930 1923 end; // with MainText 1931 1924 end; 1932 1925 1933 procedure THelpDlg.ShowNewContent(NewMode, Category, Index: Integer); 1934 begin 1935 if (Category <> Kind) or (Index <> no) or (Category = hkMisc) and 1936 (Index = miscSearchResult) then begin 1926 procedure THelpDlg.ShowNewContent(NewMode: TWindowMode; Category: TLinkCategory; 1927 Index: Integer); 1928 begin 1929 if (Category <> Kind) or (Index <> No) or (Category = hkMisc) and 1930 (Index = Integer(miscSearchResult)) then begin 1937 1931 if HistItems.Count = MaxHist then HistItems.Delete(0); 1938 1932 if HistItems.Count = 0 then … … 1941 1935 end; 1942 1936 Kind := Category; 1943 no := Index;1937 No := Index; 1944 1938 SearchContent := NewSearchContent; 1945 1939 Prepare; … … 1949 1943 1950 1944 procedure THelpDlg.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 1951 x, y: integer);1945 X, Y: Integer); 1952 1946 var 1953 1947 i0, Sel0: Integer; 1954 1948 begin 1955 y := y- WideFrame;1949 Y := Y - WideFrame; 1956 1950 i0 := ScrollBar.Position; 1957 1951 Sel0 := Sel; 1958 if ( x >= SideFrame) and (x < SideFrame + InnerWidth) and (y>= 0) and1959 ( y < InnerHeight) and (ymod 24 >= 8) then1960 Sel := ydiv 241952 if (X >= SideFrame) and (X < SideFrame + InnerWidth) and (Y >= 0) and 1953 (Y < InnerHeight) and (Y mod 24 >= 8) then 1954 Sel := Y div 24 1961 1955 else 1962 1956 Sel := -1; 1963 1957 if (Sel + i0 >= MainText.Count) or (Sel >= 0) and 1964 (THelpLineInfo(MainText.Objects[Sel + i0]).Link = 0) then 1958 (THelpLineInfo(MainText.Objects[Sel + i0]).Category = hkNoLink) and 1959 (THelpLineInfo(MainText.Objects[Sel + i0]).Index = 0)then 1965 1960 Sel := -1; 1966 1961 if Sel <> Sel0 then … … 1974 1969 1975 1970 procedure THelpDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 1976 Shift: TShiftState; x, y: integer);1971 Shift: TShiftState; X, Y: Integer); 1977 1972 begin 1978 1973 if Sel >= 0 then 1979 1974 with THelpLineInfo(MainText.Objects[Sel + ScrollBar.Position]) do 1980 if Link shr 8 and $3F= hkInternet then1981 case Link and $FFof1975 if Category = hkInternet then 1976 case Index of 1982 1977 1: OpenDocument(HomeDir + AITemplateFileName); 1983 1978 2: OpenURL(CevoHomepage); … … 1986 1981 else 1987 1982 begin 1988 if (Link >= $8000) and (Link and $3FFF = liInvalid) then 1989 exit; // invalid link; 1990 if Link >= $8000 then 1991 ShowNewContent(FWindowMode, hkText, Link and $3FFF) 1992 else 1993 ShowNewContent(FWindowMode, Link shr 8 and $3F, Link and $FF); 1983 if Index < 0 then Exit; // invalid link; 1984 ShowNewContent(FWindowMode, Category, Index); 1994 1985 end; 1995 1986 end; … … 2003 1994 HistItem.Assign(HistItems.Last); 2004 1995 HistItems.Delete(HistItems.Count - 1); 2005 if (HistItem.Kind = hkMisc) and (HistItem.No = miscSearchResult) and1996 if (HistItem.Kind = hkMisc) and (HistItem.No = Integer(miscSearchResult)) and 2006 1997 (HistItem.SearchContent <> SearchContent) then 2007 1998 begin … … 2010 2001 end; 2011 2002 Kind := HistItem.Kind; 2012 no := HistItem.No;2003 No := HistItem.No; 2013 2004 Prepare(HistItem.Pos); 2014 2005 OffscreenPaint; … … 2022 2013 while HistItems.Count > 1 do HistItems.Delete(HistItems.Count - 1); 2023 2014 Kind := hkMisc; 2024 no := miscMain;2015 No := Integer(miscMain); 2025 2016 Prepare; 2026 2017 OffscreenPaint; … … 2036 2027 function THelpDlg.TextIndex(Item: string): Integer; 2037 2028 begin 2038 Result := HelpText.Get handle(Item);2029 Result := HelpText.GetHandle(Item); 2039 2030 end; 2040 2031 … … 2064 2055 1: 2065 2056 with THelpLineInfo(SearchResult.Objects[0]) do 2066 if Link >= $8000 then 2067 ShowNewContent(FWindowMode, hkText, Link and $3FFF) 2068 else 2069 ShowNewContent(FWindowMode, Link shr 8 and $3F, Link and $FF); 2070 else 2071 begin 2057 ShowNewContent(FWindowMode, Category, Index); 2058 else begin 2072 2059 NewSearchContent := InputDlg.EInput.Text; 2073 ShowNewContent(FWindowMode, hkMisc, miscSearchResult);2060 ShowNewContent(FWindowMode, hkMisc, Integer(miscSearchResult)); 2074 2061 end; 2075 2062 end; … … 2079 2066 procedure THelpDlg.Search(SearchString: string); 2080 2067 var 2081 h, i, PrevHandle, PrevIndex, p, RightMargin: Integer;2082 s: string;2083 mADVHELP, mIMPHELP, mFEATUREHELP: set of 0 ..255;2068 H, I, PrevHandle, PrevIndex, P, RightMargin: Integer; 2069 S: string; 2070 mADVHELP, mIMPHELP, mFEATUREHELP: set of 0..255; 2084 2071 bGOVHELP, bSPECIALMODEL, bJOBHELP: Boolean; 2085 2072 begin … … 2092 2079 bJOBHELP := False; 2093 2080 2094 // search in generic reference2081 // Search in generic reference 2095 2082 SearchString := UpperCase(SearchString); 2096 for i:= 0 to 35 + 4 do begin2097 s := Phrases.Lookup('TERRAIN', i);2098 if pos(SearchString, UpperCase(s)) > 0 then2099 if i< 36 then2100 SearchResult.AddLine( s+ ' ' + HelpText.Lookup('HELPSPEC_TER'),2101 pkNormal, 0, hkTer + hkCrossLink, i)2083 for I := 0 to 35 + 4 do begin 2084 S := Phrases.Lookup('TERRAIN', I); 2085 if Pos(SearchString, UpperCase(S)) > 0 then 2086 if I < 36 then 2087 SearchResult.AddLine(S + ' ' + HelpText.Lookup('HELPSPEC_TER'), 2088 pkNormal, 0, hkTer, I, True) 2102 2089 else 2103 2090 begin 2104 2091 SearchResult.AddLine(Phrases.Lookup('TERRAIN', 36) + ' ' + 2105 2092 HelpText.Lookup('HELPSPEC_TER'), pkNormal, 0, 2106 hkTer + hkCrossLink, 36);2107 if i> 36 then2093 hkTer, 36, True); 2094 if I > 36 then 2108 2095 SearchResult.AddLine(Phrases.Lookup('IMPROVEMENTS', 2109 imShipComp + i- 37) + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'),2110 pkNormal, 0, hkImp + hkCrossLink, imShipComp + i - 37);2096 imShipComp + I - 37) + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'), 2097 pkNormal, 0, hkImp, imShipComp + I - 37, True); 2111 2098 Break; 2112 2099 end; 2113 2100 end; 2114 for i := 0 to nJobHelp- 1 do2115 if pos(SearchString, UpperCase(Phrases.Lookup('JOBRESULT', JobHelp[i]))) > 02101 for I := 0 to Length(JobHelp) - 1 do 2102 if Pos(SearchString, UpperCase(Phrases.Lookup('JOBRESULT', JobHelp[I]))) > 0 2116 2103 then 2117 2104 begin 2118 2105 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 2119 hkMisc + hkCrossLink, miscJobList);2106 hkMisc, Integer(miscJobList), True); 2120 2107 bJOBHELP := True; 2121 2108 Break; 2122 2109 end; 2123 for i:= 0 to nAdv - 1 do2124 begin 2125 s := Phrases.Lookup('ADVANCES', i);2126 if pos(SearchString, UpperCase(s)) > 0 then2110 for I := 0 to nAdv - 1 do 2111 begin 2112 S := Phrases.Lookup('ADVANCES', I); 2113 if Pos(SearchString, UpperCase(S)) > 0 then 2127 2114 begin 2128 if iin FutureTech then2129 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FUTURE')2115 if I in FutureTech then 2116 S := S + ' ' + HelpText.Lookup('HELPSPEC_FUTURE') 2130 2117 else 2131 s := s+ ' ' + HelpText.Lookup('HELPSPEC_ADV');2132 SearchResult.AddLine( s, pkNormal, 0, hkAdv + hkCrossLink, i);2133 include(mADVHELP, i);2118 S := S + ' ' + HelpText.Lookup('HELPSPEC_ADV'); 2119 SearchResult.AddLine(S, pkNormal, 0, hkAdv, I, True); 2120 Include(mADVHELP, I); 2134 2121 end; 2135 2122 end; 2136 for i:= 0 to nSpecialModel - 1 do2137 begin 2138 FindStdModelPicture(SpecialModelPictureCode[ i], h, s);2139 if pos(SearchString, UpperCase(s)) > 0 then2123 for I := 0 to nSpecialModel - 1 do 2124 begin 2125 FindStdModelPicture(SpecialModelPictureCode[I], H, S); 2126 if Pos(SearchString, UpperCase(S)) > 0 then 2140 2127 begin 2141 2128 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkNormal, 0, 2142 hkModel + hkCrossLink, 0);2129 hkModel, 0, True); 2143 2130 bSPECIALMODEL := True; 2144 2131 Break; 2145 2132 end; 2146 2133 end; 2147 for i:= 0 to nFeature - 1 do2148 begin 2149 s := Phrases.Lookup('FEATURES', i);2150 if Pos(SearchString, UpperCase( s)) > 0 then2134 for I := 0 to nFeature - 1 do 2135 begin 2136 S := Phrases.Lookup('FEATURES', I); 2137 if Pos(SearchString, UpperCase(S)) > 0 then 2151 2138 begin 2152 if i< mcFirstNonCap then2153 s := s+ ' ' + HelpText.Lookup('HELPSPEC_CAP')2154 else if iin AutoFeature then2155 s := s+ ' ' + HelpText.Lookup('HELPSPEC_STANDARD')2139 if I < mcFirstNonCap then 2140 S := S + ' ' + HelpText.Lookup('HELPSPEC_CAP') 2141 else if I in AutoFeature then 2142 S := S + ' ' + HelpText.Lookup('HELPSPEC_STANDARD') 2156 2143 else 2157 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FEATURE');2158 SearchResult.AddLine( s, pkNormal, 0, hkFeature + hkCrossLink, i);2159 Include(mFEATUREHELP, i);2144 S := S + ' ' + HelpText.Lookup('HELPSPEC_FEATURE'); 2145 SearchResult.AddLine(S, pkNormal, 0, hkFeature, I, True); 2146 Include(mFEATUREHELP, I); 2160 2147 end; 2161 2148 end; 2162 for i:= 0 to nImp - 1 do2163 begin 2164 s := Phrases.Lookup('IMPROVEMENTS', i);2165 if Pos(SearchString, UpperCase( s)) > 0 then2149 for I := 0 to nImp - 1 do 2150 begin 2151 S := Phrases.Lookup('IMPROVEMENTS', I); 2152 if Pos(SearchString, UpperCase(S)) > 0 then 2166 2153 begin 2167 case Imp[ i].Kind of2154 case Imp[I].Kind of 2168 2155 ikWonder: 2169 s := s+ ' ' + HelpText.Lookup('HELPSPEC_WONDER');2156 S := S + ' ' + HelpText.Lookup('HELPSPEC_WONDER'); 2170 2157 ikCommon: 2171 s := s+ ' ' + HelpText.Lookup('HELPSPEC_IMP');2158 S := S + ' ' + HelpText.Lookup('HELPSPEC_IMP'); 2172 2159 ikShipPart: 2173 s := s+ ' ' + HelpText.Lookup('HELPSPEC_SHIPPART');2160 S := S + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'); 2174 2161 else 2175 s := s+ ' ' + HelpText.Lookup('HELPSPEC_NAT')2162 S := S + ' ' + HelpText.Lookup('HELPSPEC_NAT') 2176 2163 end; 2177 SearchResult.AddLine( s, pkNormal, 0, hkImp + hkCrossLink, i);2178 Include(mIMPHELP, i);2164 SearchResult.AddLine(S, pkNormal, 0, hkImp, I, True); 2165 Include(mIMPHELP, I); 2179 2166 end 2180 2167 end; 2181 for i:= 0 to nGov - 1 do2182 if Pos(SearchString, UpperCase(Phrases.Lookup('GOVERNMENT', i))) > 0 then2168 for I := 0 to nGov - 1 do 2169 if Pos(SearchString, UpperCase(Phrases.Lookup('GOVERNMENT', I))) > 0 then 2183 2170 begin 2184 2171 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkNormal, 0, 2185 hkMisc + hkCrossLink, miscGovList);2172 hkMisc, Integer(miscGovList), True); 2186 2173 bGOVHELP := True; 2187 2174 Break; 2188 2175 end; 2189 2176 2190 // full text search2191 h:= -1;2177 // Full text search 2178 H := -1; 2192 2179 repeat 2193 PrevHandle := h;2194 PrevIndex := i;2195 if not HelpText.Search(SearchString, h, i) then2180 PrevHandle := H; 2181 PrevIndex := I; 2182 if not HelpText.Search(SearchString, H, I) then 2196 2183 Break; 2197 if h= hADVHELP then2184 if H = hADVHELP then 2198 2185 begin 2199 if ( i >= 0) and ((i <> PrevIndex) or (h<> PrevHandle)) and2200 not( iin mADVHELP) then2186 if (I >= 0) and ((I <> PrevIndex) or (H <> PrevHandle)) and 2187 not(I in mADVHELP) then 2201 2188 begin 2202 s := Phrases.Lookup('ADVANCES', i);2203 if iin FutureTech then2204 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FUTURE')2189 S := Phrases.Lookup('ADVANCES', I); 2190 if I in FutureTech then 2191 S := S + ' ' + HelpText.Lookup('HELPSPEC_FUTURE') 2205 2192 else 2206 s := s+ ' ' + HelpText.Lookup('HELPSPEC_ADV');2207 SearchResult.AddLine( s, pkNormal, 0, hkAdv + hkCrossLink, i)2193 S := S + ' ' + HelpText.Lookup('HELPSPEC_ADV'); 2194 SearchResult.AddLine(S, pkNormal, 0, hkAdv, I, True); 2208 2195 end; 2209 2196 end 2210 else if h= hIMPHELP then2197 else if H = hIMPHELP then 2211 2198 begin 2212 if ( i >= 0) and ((i <> PrevIndex) or (h<> PrevHandle)) and2213 not( iin mIMPHELP) then2199 if (I >= 0) and ((I <> PrevIndex) or (H <> PrevHandle)) and 2200 not(I in mIMPHELP) then 2214 2201 begin 2215 s := Phrases.Lookup('IMPROVEMENTS', i);2216 case Imp[ i].Kind of2202 S := Phrases.Lookup('IMPROVEMENTS', I); 2203 case Imp[I].Kind of 2217 2204 ikWonder: 2218 s := s+ ' ' + HelpText.Lookup('HELPSPEC_WONDER');2205 S := S + ' ' + HelpText.Lookup('HELPSPEC_WONDER'); 2219 2206 ikCommon: 2220 s := s+ ' ' + HelpText.Lookup('HELPSPEC_IMP');2207 S := S + ' ' + HelpText.Lookup('HELPSPEC_IMP'); 2221 2208 ikShipPart: 2222 s := s+ ' ' + HelpText.Lookup('HELPSPEC_SHIPPART');2209 S := S + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'); 2223 2210 else 2224 s := s+ ' ' + HelpText.Lookup('HELPSPEC_NAT')2211 S := S + ' ' + HelpText.Lookup('HELPSPEC_NAT') 2225 2212 end; 2226 SearchResult.AddLine( s, pkNormal, 0, hkImp + hkCrossLink, i)2213 SearchResult.AddLine(S, pkNormal, 0, hkImp, I, True); 2227 2214 end; 2228 2215 end 2229 else if h= hFEATUREHELP then2216 else if H = hFEATUREHELP then 2230 2217 begin 2231 if ( i >= 0) and ((i <> PrevIndex) or (h<> PrevHandle)) and2232 not( iin mFEATUREHELP) then2218 if (I >= 0) and ((I <> PrevIndex) or (H <> PrevHandle)) and 2219 not(I in mFEATUREHELP) then 2233 2220 begin 2234 s := Phrases.Lookup('FEATURES', i);2235 if i< mcFirstNonCap then2236 s := s+ ' ' + HelpText.Lookup('HELPSPEC_CAP')2237 else if iin AutoFeature then2238 s := s+ ' ' + HelpText.Lookup('HELPSPEC_STANDARD')2221 S := Phrases.Lookup('FEATURES', I); 2222 if I < mcFirstNonCap then 2223 S := S + ' ' + HelpText.Lookup('HELPSPEC_CAP') 2224 else if I in AutoFeature then 2225 S := S + ' ' + HelpText.Lookup('HELPSPEC_STANDARD') 2239 2226 else 2240 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FEATURE');2241 SearchResult.AddLine( s, pkNormal, 0, hkFeature + hkCrossLink, i);2227 S := S + ' ' + HelpText.Lookup('HELPSPEC_FEATURE'); 2228 SearchResult.AddLine(S, pkNormal, 0, hkFeature, I, True); 2242 2229 end; 2243 2230 end 2244 else if h= hGOVHELP then2231 else if H = hGOVHELP then 2245 2232 begin 2246 if ( i >= 0) and (h<> PrevHandle) and not bGOVHELP then2233 if (I >= 0) and (H <> PrevHandle) and not bGOVHELP then 2247 2234 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkNormal, 0, 2248 hkMisc + hkCrossLink, miscGovList)2235 hkMisc, Integer(miscGovList), True); 2249 2236 end 2250 else if h= hSPECIALMODEL then2237 else if H = hSPECIALMODEL then 2251 2238 begin 2252 if ( i >= 0) and (h<> PrevHandle) and not bSPECIALMODEL then2239 if (I >= 0) and (H <> PrevHandle) and not bSPECIALMODEL then 2253 2240 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkNormal, 2254 0, hkModel + hkCrossLink, 0)2241 0, hkModel, 0, True); 2255 2242 end 2256 else if h= hJOBHELP then2243 else if H = hJOBHELP then 2257 2244 begin 2258 if ( i >= 0) and (h<> PrevHandle) and not bJOBHELP then2245 if (I >= 0) and (H <> PrevHandle) and not bJOBHELP then 2259 2246 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 2260 hkMisc + hkCrossLink, miscJobList)2247 hkMisc, Integer(miscJobList), True); 2261 2248 end 2262 else if { (h<>hMAIN) and } ( h<> PrevHandle) then2249 else if { (h<>hMAIN) and } (H <> PrevHandle) then 2263 2250 begin 2264 s := HelpText.LookupByHandle(h);2265 p := Pos('$', s);2266 if p> 0 then2251 S := HelpText.LookupByHandle(H); 2252 P := Pos('$', S); 2253 if P > 0 then 2267 2254 begin 2268 s := Copy(s, p + 1, maxint);2269 p := Pos('\', s);2270 if p> 0 then2271 s := Copy(s, 1, p- 1);2272 SearchResult.AddLine( s, pkNormal, 0, hkText + hkCrossLink, h);2255 S := Copy(S, P + 1, MaxInt); 2256 P := Pos('\', S); 2257 if P > 0 then 2258 S := Copy(S, 1, P - 1); 2259 SearchResult.AddLine(S, pkNormal, 0, hkText, H, True); 2273 2260 end; 2274 2261 end; 2275 2276 2277 // cut lines to fit to window2278 2279 2280 for i:= 0 to SearchResult.Count - 1 do2281 2282 while BiColorTextWidth(OffScreen.Canvas, SearchResult[i]) >2283 2284 SearchResult[i] := copy(SearchResult[i], 1, length(SearchResult[i]) - 1)2285 2286 2262 until False; 2263 2264 // Cut lines to fit to window 2265 RightMargin := InnerWidth - 16 - DpiGetSystemMetrics(SM_CXVSCROLL); 2266 OffScreen.Canvas.Font.Assign(UniFont[ftNormal]); 2267 for I := 0 to SearchResult.Count - 1 do 2268 begin 2269 while BiColorTextWidth(OffScreen.Canvas, SearchResult[I]) > 2270 RightMargin - 32 do 2271 SearchResult[I] := Copy(SearchResult[I], 1, Length(SearchResult[I]) - 1) 2272 end; 2273 end; 2287 2274 2288 2275 end.
Note:
See TracChangeset
for help on using the changeset viewer.