Changeset 457 for trunk/LocalPlayer/Help.pas
- Timestamp:
- Nov 27, 2023, 12:10:57 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Help.pas
r456 r457 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; … … 61 86 62 87 THistItems = class(TObjectList<THistItem>) 63 function AddNew(Kind ,No, Pos: Integer; SearchContent: string): THistItem;88 function AddNew(Kind: TLinkCategory; No, Pos: Integer; SearchContent: string): THistItem; 64 89 end; 65 90 … … 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: TBitmap; 127 ExtPic: TBitmap; 128 TerrIcon: TBitmap; 103 129 ScrollBar: TPVScrollbar; 104 130 NoMap: TIsoMap; … … 106 132 procedure PaintTerrIcon(X, Y, xSrc, ySrc: Integer); 107 133 procedure ScrollBarUpdate(Sender: TObject); 108 procedure Line( ca: TCanvas; I: Integer; lit: Boolean);134 procedure Line(ACanvas: TCanvas; I: Integer; Lit: Boolean); 109 135 procedure Prepare(sbPos: Integer = 0); 110 136 procedure ShowNewContentProcExecute(NewMode: TWindowMode; HelpContext: string); … … 117 143 Difficulty: Integer; 118 144 procedure ClearHistory; 119 procedure ShowNewContent(NewMode: TWindowMode; Category ,Index: Integer);145 procedure ShowNewContent(NewMode: TWindowMode; Category: TLinkCategory; Index: Integer); 120 146 function TextIndex(Item: string): Integer; 121 147 end; … … 138 164 139 165 THelpLineInfo = class 140 Format: Byte;166 Format: TTextFormat; 141 167 Picpix: Byte; 142 Link: Word; 168 Category: TLinkCategory; 169 Index: Integer; 170 CrossLink: Boolean; 143 171 procedure Assign(Source: THelpLineInfo); 144 172 end; 145 173 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; 174 TSeeAlso = record 175 Kind: TLinkCategory; 176 No: Integer; 177 SeeKind: TLinkCategory; 178 SeeNo: Integer; 179 end; 213 180 214 181 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; 182 SeeAlso: array[0..13] of TSeeAlso = ((Kind: hkImp; no: imWalls; SeeKind: hkFeature; 250 183 SeeNo: mcArtillery), (Kind: hkImp; no: imHydro; SeeKind: hkImp; 251 184 SeeNo: woHoover), (Kind: hkImp; no: imWalls; SeeKind: hkImp; … … 262 195 SeeKind: hkFeature; SeeNo: mcDefense)); 263 196 264 nTerrainHelp = 14; 265 TerrainHelp: array [0 .. nTerrainHelp - 1] of Integer = (fGrass, fGrass + 12, 197 TerrainHelp: array[0..13] of Integer = (fGrass, fGrass + 12, 266 198 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, 199 fDesert, 3 * 12 { DeadLands }, fShore, fOcean); 200 201 JobHelp: array[0..7] of Integer = (jRoad, jRR, jCanal, jIrr, 271 202 jFarm, jMine, jFort, jBase); 203 204 { THelpLineInfo } 205 206 procedure THelpLineInfo.Assign(Source: THelpLineInfo); 207 begin 208 Format := Source.Format; 209 PicPix := Source.PicPix; 210 Category := Source.Category; 211 Index := Source.Index; 212 end; 213 214 { THistItem } 215 216 procedure THistItem.Assign(Source: THistItem); 217 begin 218 Kind := Source.Kind; 219 No := Source.No; 220 Pos := Source.Pos; 221 SearchContent := Source.SearchContent; 222 end; 223 224 { THistItems } 225 226 function THistItems.AddNew(Kind: TLinkCategory; No, Pos: Integer; SearchContent: string 227 ): THistItem; 228 begin 229 Result := THistItem.Create; 230 Result.Kind := Kind; 231 Result.No := No; 232 Result.Pos := Pos; 233 Result.SearchContent := SearchContent; 234 Add(Result); 235 end; 236 237 procedure THyperText.AddLine(S: String; Format: TTextFormat; Picpix: Integer; 238 LinkCategory: TLinkCategory = hkNoLink; LinkIndex: Integer = 0; 239 CrossLink: Boolean = False); 240 var 241 HelpLineInfo: THelpLineInfo; 242 begin 243 HelpLineInfo := THelpLineInfo.Create; 244 HelpLineInfo.Format := Format; 245 HelpLineInfo.Picpix := Picpix; 246 HelpLineInfo.Category := LinkCategory; 247 HelpLineInfo.Index := LinkIndex; 248 HelpLineInfo.CrossLink := CrossLink; 249 AddObject(S, HelpLineInfo); 250 end; 251 252 procedure THyperText.LineFeed; 253 begin 254 AddLine; 255 end; 256 257 procedure THyperText.AppendList(Source: THyperText); 258 var 259 I: Integer; 260 HelpLineInfo: THelpLineInfo; 261 begin 262 for I := 0 to Source.Count - 1 do begin 263 HelpLineInfo := THelpLineInfo.Create; 264 HelpLineInfo.Assign(THelpLineInfo(Source.Objects[I])); 265 AddObject(Source.Strings[I], HelpLineInfo); 266 end; 267 end; 272 268 273 269 procedure THelpDlg.FormCreate(Sender: TObject); … … 365 361 if Sel <> -1 then begin 366 362 Line(Canvas, Sel, False); 367 Sel := -1 363 Sel := -1; 368 364 end; 369 365 end; … … 380 376 end; 381 377 382 procedure THelpDlg.Line( ca: TCanvas; I: Integer; lit: Boolean);378 procedure THelpDlg.Line(ACanvas: TCanvas; I: Integer; Lit: Boolean); 383 379 var 384 TextColor, X, Y: Integer; 380 TextColor: TColor; 381 X, Y: Integer; 385 382 TextSize: TSize; 386 383 S: string; … … 391 388 X := x0[I]; 392 389 Y := 2 + I * 24; 393 if ca= Canvas then390 if ACanvas = Canvas then 394 391 begin 395 392 X := X + SideFrame; 396 Y := Y + WideFrame 393 Y := Y + WideFrame; 397 394 end; 398 395 if THelpLineInfo(MainText.Objects[ScrollBar.Position + I]).Format 399 396 in [pkCaption, pkBigTer, pkRightIcon, pkBigFeature] then 400 397 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 BitBltCanvas( ca, X, Y - 4, 24, 24, HGrSystem.Data.Canvas, 1,398 ACanvas.Font.Assign(CaptionFont); 399 { ACanvas.brush.color:=CaptionColor; 400 ACanvas.FillRect(rect(X,I*24,X+24,I*24+24)); 401 ACanvas.Brush.Color:=$FFFFFF; 402 ACanvas.FrameRect(rect(X+1,I*24+1,X+24-1,I*24+24-1)); 403 ACanvas.Brush.Style:=bsClear; } 404 BitBltCanvas(ACanvas, X, Y - 4, 24, 24, HGrSystem.Data.Canvas, 1, 408 405 146); 409 BiColorTextOut( ca, $FFFFFF, $7F007F, X + 10 - ca.Textwidth(S[1]) div 2,406 BiColorTextOut(ACanvas, $FFFFFF, $7F007F, X + 10 - ACanvas.Textwidth(S[1]) div 2, 410 407 Y - 3, S[1]); 411 BiColorTextOut( ca, CaptionColor, $7F007F, X + 24, Y - 3, Copy(S, 2, 255));412 ca.Font.Assign(UniFont[ftNormal]);408 BiColorTextOut(ACanvas, CaptionColor, $7F007F, X + 24, Y - 3, Copy(S, 2, 255)); 409 ACanvas.Font.Assign(UniFont[ftNormal]); 413 410 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]); 411 else if THelpLineInfo(MainText.Objects[ScrollBar.Position + I]).Format = pkSection then 412 begin 413 ACanvas.Font.Assign(CaptionFont); 414 BiColorTextOut(ACanvas, CaptionColor, $7F007F, X, Y - 3, S); 415 ACanvas.Font.Assign(UniFont[ftNormal]); 420 416 end 421 417 else 422 418 begin 423 if (Kind = hkMisc) and ( no = miscMain) then424 ca.Font.Assign(CaptionFont);419 if (Kind = hkMisc) and (No = Integer(miscMain)) then 420 ACanvas.Font.Assign(CaptionFont); 425 421 TextColor := Colors.Canvas.Pixels[clkMisc, cliPaperText]; 426 if ca= Canvas then422 if ACanvas = Canvas then 427 423 begin 428 TextSize.cx := BiColorTextWidth( ca, S);429 TextSize.cy := ca.TextHeight(S);424 TextSize.cx := BiColorTextWidth(ACanvas, S); 425 TextSize.cy := ACanvas.TextHeight(S); 430 426 if Y + TextSize.cy >= WideFrame + InnerHeight then 431 427 TextSize.cy := WideFrame + InnerHeight - Y; 432 FillSeamless( ca, X, Y, TextSize.cx, TextSize.cy, -SideFrame,428 FillSeamless(ACanvas, X, Y, TextSize.cx, TextSize.cy, -SideFrame, 433 429 ScrollBar.Position * 24 - WideFrame, Paper); 434 430 end; 435 BiColorTextOut( ca, TextColor, $7F007F, X, Y, S);431 BiColorTextOut(ACanvas, TextColor, $7F007F, X, Y, S); 436 432 if lit then 437 with cado433 with ACanvas do 438 434 begin 439 Assert( ca= Canvas);435 Assert(ACanvas = Canvas); 440 436 Pen.Color := TextColor; 441 437 MoveTo(X + 1, Y + TextSize.cy - 2); 442 438 LineTo(X + TextSize.cx, Y + TextSize.cy - 2); 443 439 end; 444 if (Kind = hkMisc) and ( no = miscMain) then445 ca.Font.Assign(UniFont[ftNormal]);440 if (Kind = hkMisc) and (No = Integer(miscMain)) then 441 ACanvas.Font.Assign(UniFont[ftNormal]); 446 442 end; 447 443 end; … … 493 489 end; 494 490 end; 495 if Sum < MaxSum then begin // no saturation491 if Sum < MaxSum then begin // No saturation 496 492 Sum := 1 shl 22 - (MaxSum - Sum) * (256 - CoalPtr.Pixel^.B * 2); 497 493 PaintPtr.Pixel^.B := Min(PaintPtr.Pixel^.B * Sum shr 22, 255); … … 559 555 begin 560 556 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + I]); 561 if HelpLineInfo.Link <> 0then557 if (HelpLineInfo.Category <> hkNoLink) or (HelpLineInfo.Index <> 0) then 562 558 begin 563 if (Kind = hkMisc) and ( no = miscSearchResult) then559 if (Kind = hkMisc) and (No = Integer(miscSearchResult)) then 564 560 Sprite(OffScreen, HGrSystem, 18, 9 + I * 24, 8, 8, 90, 16) 565 561 else if HelpLineInfo.Format in [pkSmallIcon_AsPreq, pkAdvIcon_AsPreq] 566 562 then 567 563 Sprite(OffScreen, HGrSystem, 12, I * 24 + 5, 14, 14, 65, 20) 568 else if HelpLineInfo. Link and (hkCrossLink shl 8) <> 0then564 else if HelpLineInfo.CrossLink then 569 565 Sprite(OffScreen, HGrSystem, 12, I * 24 + 5, 14, 14, 80, 1) 570 else if not((Kind = hkMisc) and ( no = miscMain)) then566 else if not((Kind = hkMisc) and (No = Integer(miscMain))) then 571 567 Sprite(OffScreen, HGrSystem, 10, I * 24 + 6, 14, 14, 65, 1); 572 568 x0[I] := 24; … … 873 869 begin 874 870 Sel := -1; 875 SmartUpdateContent(True) 871 SmartUpdateContent(True); 876 872 end; 877 873 … … 887 883 begin 888 884 MainText.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon, I, 889 hkAdv + hkCrossLink, I);885 hkAdv, I, True); 890 886 end; 891 887 … … 893 889 begin 894 890 MainText.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon_AsPreq, I, 895 hkAdv + hkCrossLink, I);891 hkAdv, I, True); 896 892 end; 897 893 … … 899 895 begin 900 896 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 901 hkImp + hkCrossLink, I);897 hkImp, I, True); 902 898 end; 903 899 … … 905 901 begin 906 902 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon_AsPreq, I, 907 hkImp + hkCrossLink, I);903 hkImp, I, True); 908 904 end; 909 905 … … 920 916 begin 921 917 MainText.AddLine(Phrases.Lookup('FEATURES', I), pkFeature, I, 922 hkFeature + hkCrossLink, I);918 hkFeature, I, True); 923 919 end; 924 920 … … 931 927 MainText.LineFeed; 932 928 FindStdModelPicture(SpecialModelPictureCode[I], pix, Name); 933 MainText.AddLine(Name, pkModel, pix, hkModel + hkCrossLink, I)929 MainText.AddLine(Name, pkModel, pix, hkModel, I, True); 934 930 end; 935 931 … … 951 947 I := 2; 952 948 AddLine(Format(HelpText.Lookup('TECHFORMULA'), [TechFormula_M[I], 953 TechFormula_D[I]])) 949 TechFormula_D[I]])); 954 950 end 955 951 else if Item = 'EXPERIENCE' then … … 967 963 for I := 0 to 3 do 968 964 AddLine(Phrases2.Lookup('AITSTAT', I), pkAITStat, I) 969 end 970 end; 971 972 procedure DecodeItem(S: string; var Category ,Index: Integer);965 end; 966 end; 967 968 procedure DecodeItem(S: string; var Category: TLinkCategory; var Index: Integer); 973 969 var 974 970 I: Integer; … … 986 982 'E': Category := hkInternet; 987 983 'S': Category := hkModel; 988 'C': Index := miscCredits;989 'J': Index := miscJobList;990 'G': Index := miscGovList;984 'C': Index := Integer(miscCredits); 985 'J': Index := Integer(miscJobList); 986 'G': Index := Integer(miscGovList); 991 987 end; 992 988 if (Category <> hkMisc) and (Index = 0) then … … 994 990 end else begin 995 991 Category := hkText; 996 Index := HelpText.Get handle(Copy(S, 1, 255));992 Index := HelpText.GetHandle(Copy(S, 1, 255)); 997 993 end; 998 994 end; … … 1004 1000 L: Integer; 1005 1001 ofs: Integer; 1006 CurrentFormat: Integer;1007 FollowFormat: Integer;1002 CurrentFormat: TTextFormat; 1003 FollowFormat: TTextFormat; 1008 1004 Picpix: Integer; 1009 LinkCategory: Integer; 1005 LinkCategory: TLinkCategory; 1006 CrossLink: Boolean; 1010 1007 LinkIndex: Integer; 1011 1008 RightMargin: Integer; … … 1013 1010 Text: string; 1014 1011 begin 1012 CrossLink := False; 1015 1013 RightMargin := InnerWidth - 16 - GetSystemMetrics(SM_CXVSCROLL); 1016 1014 FollowFormat := pkNormal; … … 1018 1016 begin 1019 1017 Picpix := 0; 1020 LinkCategory := 0;1018 LinkCategory := hkNoLink; 1021 1019 LinkIndex := 0; 1022 1020 if S[1] = '$' then 1023 begin // window caption1021 begin // Window caption 1024 1022 P := 1; 1025 1023 repeat … … 1030 1028 end 1031 1029 else if S[1] = '&' then 1032 begin // standard block1030 begin // Standard block 1033 1031 P := 1; 1034 1032 repeat … … 1039 1037 end 1040 1038 else if S[1] = '@' then 1041 begin // image1039 begin // Image 1042 1040 if (Length(S) >= 2) and (S[2] = '@') then 1043 begin // generate from icon1041 begin // Generate from icon 1044 1042 Picpix := 0; 1045 1043 P := 3; … … 1078 1076 P := 1; 1079 1077 repeat 1080 Inc(P) 1078 Inc(P); 1081 1079 until (P > Length(S)) or (S[P] = '\') or (S[P] = ' '); 1082 1080 DecodeItem(Copy(S, 2, P - 2), LinkCategory, LinkIndex); 1083 CurrentFormat := 0;1081 CurrentFormat := pkNormal; 1084 1082 if (LinkCategory <> hkText) and (LinkIndex < 200) then 1085 1083 // show icon … … 1088 1086 begin 1089 1087 CurrentFormat := pkAdvIcon; 1090 Picpix := LinkIndex 1088 Picpix := LinkIndex; 1091 1089 end; 1092 1090 hkImp: 1093 1091 begin 1094 1092 CurrentFormat := pkSmallIcon; 1095 Picpix := LinkIndex 1093 Picpix := LinkIndex; 1096 1094 end; 1097 1095 hkTer: … … 1103 1101 begin 1104 1102 CurrentFormat := pkFeature; 1105 Picpix := LinkIndex 1103 Picpix := LinkIndex; 1106 1104 end; 1107 1105 hkModel: … … 1113 1111 end; 1114 1112 if S[1] = ':' then 1115 LinkCategory := LinkCategory + hkCrossLink;1113 CrossLink := True; 1116 1114 if (P > Length(S)) or (S[P] = ' ') then 1117 1115 Delete(S, 1, P) … … 1119 1117 Delete(S, 1, P - 1) 1120 1118 end; 1121 '!': // highli ted1119 '!': // highlighted 1122 1120 if (Length(S) >= 2) and (S[2] = '!') then 1123 1121 begin … … 1159 1157 until (P >= Length(S)) or (S[L + 1] = '\'); 1160 1158 Text := Copy(S, 1, L); 1161 if LinkCategory and $3F= hkInternet then begin1159 if LinkCategory = hkInternet then begin 1162 1160 if LinkIndex = 1 then Text := AITemplateManual 1163 1161 else if LinkIndex = 2 then Text := CevoHomepageShort … … 1165 1163 end; 1166 1164 MainText.AddLine(Text, CurrentFormat, Picpix, LinkCategory, 1167 LinkIndex );1165 LinkIndex, CrossLink); 1168 1166 if (L < Length(S)) and (S[L + 1] = '\') then 1169 1167 FollowFormat := pkNormal; 1170 1168 Delete(S, 1, L + 1); 1171 end 1172 end 1169 end; 1170 end; 1173 1171 end; 1174 1172 … … 1223 1221 begin 1224 1222 with MainText do begin 1225 for I := 0 to nJobHelp- 1 do begin1223 for I := 0 to Length(JobHelp) - 1 do begin 1226 1224 if I > 0 then begin 1227 1225 LineFeed; … … 1323 1321 Clear; 1324 1322 Headline := -1; 1325 if ( no >= 200) or not(Kind in [hkAdv, hkImp, hkTer, hkFeature]) then1323 if (No >= 200) or not (Kind in [hkAdv, hkImp, hkTer, hkFeature]) then 1326 1324 LineFeed; 1327 1325 case Kind of 1328 1326 hkText: 1329 AddTextual(HelpText.LookupByHandle( no));1327 AddTextual(HelpText.LookupByHandle(No)); 1330 1328 hkMisc: 1331 1329 begin 1332 case no of1333 miscMain:1330 case No of 1331 Integer(miscMain): 1334 1332 begin 1335 1333 Caption := HelpText.Lookup('HELPTITLE_MAIN'); 1336 1334 AddLine(HelpText.Lookup('HELPTITLE_QUICKSTART'), pkSpecialIcon, 1337 0, { pkBigIcon,22, } hkText, HelpText.Get handle('QUICK'));1335 0, { pkBigIcon,22, } hkText, HelpText.GetHandle('QUICK')); 1338 1336 LineFeed; 1339 1337 AddLine(HelpText.Lookup('HELPTITLE_CONCEPTS'), pkBigIcon, 6, … … 1344 1342 LineFeed; 1345 1343 AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkSpecialIcon, 2, 1346 hkMisc, miscJobList);1344 hkMisc, Integer(miscJobList)); 1347 1345 LineFeed; 1348 1346 AddLine(HelpText.Lookup('HELPTITLE_TECHLIST'), pkBigIcon, 39, … … 1366 1364 LineFeed; 1367 1365 AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkBigIcon, 1368 gDemocracy + 6, hkMisc, miscGovList);1366 gDemocracy + 6, hkMisc, Integer(miscGovList)); 1369 1367 LineFeed; 1370 1368 AddLine(HelpText.Lookup('HELPTITLE_KEYS'), pkBigIcon, 2, hkText, … … 1375 1373 LineFeed; 1376 1374 AddLine(HelpText.Lookup('HELPTITLE_CREDITS'), pkBigIcon, 22, 1377 hkMisc, miscCredits);1375 hkMisc, Integer(miscCredits)); 1378 1376 end; 1379 miscCredits:1377 Integer(miscCredits): 1380 1378 begin 1381 1379 AddItem('CREDITS'); … … 1390 1388 AddItem('AUTHOR'); 1391 1389 end; 1392 miscJobList:1390 Integer(miscJobList): 1393 1391 begin 1394 1392 Caption := HelpText.Lookup('HELPTITLE_JOBLIST'); … … 1399 1397 AddItem('TERIMPCITY'); 1400 1398 end; 1401 miscGovList:1399 Integer(miscGovList): 1402 1400 begin 1403 1401 Caption := HelpText.Lookup('HELPTITLE_GOVLIST'); … … 1425 1423 end; 1426 1424 end; 1427 miscSearchResult:1425 Integer(miscSearchResult): 1428 1426 begin 1429 1427 Caption := HelpText.Lookup('HELPTITLE_SEARCHRESULTS'); … … 1431 1429 MainText.AppendList(SearchResult); 1432 1430 end; 1433 end; // case no1431 end; // case No 1434 1432 end; 1435 1433 1436 1434 hkAdv: 1437 if no = 200 then1435 if No = 200 then 1438 1436 begin // complete advance list 1439 1437 Caption := HelpText.Lookup('HELPTITLE_TECHLIST'); … … 1469 1467 else // single advance 1470 1468 begin 1471 Caption := Phrases.Lookup('ADVANCES', no);1469 Caption := Phrases.Lookup('ADVANCES', No); 1472 1470 LineFeed; 1473 AddLine(Phrases.Lookup('ADVANCES', no), pkCaption);1474 if no in FutureTech then1471 AddLine(Phrases.Lookup('ADVANCES', No), pkCaption); 1472 if No in FutureTech then 1475 1473 begin 1476 1474 AddLine(HelpText.Lookup('HELPSPEC_FUTURE')); 1477 1475 LineFeed; 1478 if no = futResearchTechnology then1476 if No = futResearchTechnology then 1479 1477 AddItem('FUTURETECHHELP100') 1480 1478 else … … 1483 1481 else 1484 1482 AddLine(HelpText.Lookup('HELPSPEC_ADV')); 1485 if AdvPreq[ no, 2] <> preNone then1483 if AdvPreq[No, 2] <> preNone then 1486 1484 NextSection('PREREQALT') 1487 1485 else 1488 1486 NextSection('PREREQ'); 1489 1487 for I := 0 to 2 do 1490 if AdvPreq[ no, I] <> preNone then1491 AddPreqAdv(AdvPreq[ no, I]);1488 if AdvPreq[No, I] <> preNone then 1489 AddPreqAdv(AdvPreq[No, I]); 1492 1490 NextSection('GOVALLOW'); 1493 1491 for I := 2 to nGov - 1 do 1494 if GovPreq[I] = no then1492 if GovPreq[I] = No then 1495 1493 AddLine(Phrases.Lookup('GOVERNMENT', I), pkGov, I, 1496 hkMisc + hkCrossLink, miscGovList);1494 hkMisc, Integer(miscGovList), True); 1497 1495 NextSection('BUILDALLOW'); 1498 1496 for I := 0 to nWonder - 1 do 1499 if Imp[I].Preq = no then1497 if Imp[I].Preq = No then 1500 1498 AddImprovement(I); 1501 1499 for I := nWonder to nImp - 1 do 1502 if (Imp[I].Preq = no) and (Imp[I].Kind <> ikCommon) then1500 if (Imp[I].Preq = No) and (Imp[I].Kind <> ikCommon) then 1503 1501 AddImprovement(I); 1504 1502 for I := nWonder to nImp - 1 do 1505 if (Imp[I].Preq = no) and (Imp[I].Kind = ikCommon) then1503 if (Imp[I].Preq = No) and (Imp[I].Kind = ikCommon) then 1506 1504 AddImprovement(I); 1507 1505 NextSection('MODELALLOW'); 1508 1506 for I := 0 to nSpecialModel - 1 do 1509 if SpecialModelPreq[I] = no then1507 if SpecialModelPreq[I] = No then 1510 1508 AddModel(I); 1511 1509 NextSection('FEATALLOW'); 1512 1510 for I := 0 to nFeature - 1 do 1513 if Feature[I].Preq = no then1511 if Feature[I].Preq = No then 1514 1512 AddFeature(I); 1515 1513 NextSection('FOLLOWADV'); 1516 1514 for I := 0 to nAdv - 1 do 1517 if (AdvPreq[I, 0] = no) or (AdvPreq[I, 1] = no) or1518 (AdvPreq[I, 2] = no) then1515 if (AdvPreq[I, 0] = No) or (AdvPreq[I, 1] = No) or 1516 (AdvPreq[I, 2] = No) then 1519 1517 AddAdvance(I); 1520 1518 NextSection('UPGRADEALLOW'); 1521 1519 for Domain := 0 to nDomains - 1 do 1522 1520 for I := 1 to nUpgrade - 1 do 1523 if upgrade[Domain, I].Preq = no then1521 if upgrade[Domain, I].Preq = No then 1524 1522 begin 1525 1523 if upgrade[Domain, I].Strength > 0 then … … 1531 1529 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, I].Trans] 1532 1530 ), pkDomain, Domain); 1533 if no in FutureTech then1531 if No in FutureTech then 1534 1532 AddLine(Format(HelpText.Lookup('COSTUP'), 1535 1533 [upgrade[Domain, I].Cost]), pkNormal_Dot) … … 1540 1538 NextSection('EXPIRATION'); 1541 1539 for I := 0 to nWonder - 1 do 1542 if (Imp[I].Preq <> preNA) and (Imp[I].Expiration = no) then1540 if (Imp[I].Preq <> preNA) and (Imp[I].Expiration = No) then 1543 1541 AddImprovement(I); 1544 1542 NextSection('ADVEFFECT'); 1545 S := HelpText.LookupByHandle(hADVHELP, no);1543 S := HelpText.LookupByHandle(hADVHELP, No); 1546 1544 if S <> '*' then 1547 1545 AddTextual(S); 1548 1546 NextSection('SEEALSO'); 1549 CheckSeeAlso := True 1547 CheckSeeAlso := True; 1550 1548 end; 1551 1549 1552 1550 hkImp: 1553 if no = 200 then1551 if No = 200 then 1554 1552 begin // complete city improvement list 1555 1553 Caption := HelpText.Lookup('HELPTITLE_IMPLIST'); … … 1566 1564 FreeAndNil(List); 1567 1565 end 1568 else if no = 201 then1566 else if No = 201 then 1569 1567 begin // complete nat. project list 1570 1568 Caption := HelpText.Lookup('HELPTITLE_UNIQUELIST'); … … 1582 1580 AddLine(Phrases.Lookup('IMPROVEMENTS',I),pkSmallIcon,I,hkImp,I); } 1583 1581 end 1584 else if no = 202 then1582 else if No = 202 then 1585 1583 begin // complete wonder list 1586 1584 Caption := HelpText.Lookup('HELPTITLE_WONDERLIST'); … … 1593 1591 else 1594 1592 begin // single building 1595 Caption := Phrases.Lookup('IMPROVEMENTS', no);1593 Caption := Phrases.Lookup('IMPROVEMENTS', No); 1596 1594 LineFeed; 1597 AddLine(Phrases.Lookup('IMPROVEMENTS', no), pkRightIcon, no);1598 case Imp[ no].Kind of1595 AddLine(Phrases.Lookup('IMPROVEMENTS', No), pkRightIcon, No); 1596 case Imp[No].Kind of 1599 1597 ikWonder: AddLine(HelpText.Lookup('HELPSPEC_WONDER')); 1600 1598 ikCommon: AddLine(HelpText.Lookup('HELPSPEC_IMP')); … … 1603 1601 AddLine(HelpText.Lookup('HELPSPEC_NAT')) 1604 1602 end; 1605 if Imp[ no].Kind <> ikShipPart then begin1603 if Imp[No].Kind <> ikShipPart then begin 1606 1604 NextSection('EFFECT'); 1607 AddTextual(HelpText.LookupByHandle(hIMPHELP, no));1605 AddTextual(HelpText.LookupByHandle(hIMPHELP, No)); 1608 1606 end; 1609 if no = woSun then begin1607 if No = woSun then begin 1610 1608 AddFeature(mcFirst); 1611 1609 AddFeature(mcWill); 1612 1610 AddFeature(mcAcademy); 1613 1611 end; 1614 if ( no < nWonder) and not Phrases2FallenBackToEnglish then1612 if (No < nWonder) and not Phrases2FallenBackToEnglish then 1615 1613 begin 1616 1614 LineFeed; 1617 if Imp[ no].Expiration >= 0 then1615 if Imp[No].Expiration >= 0 then 1618 1616 AddTextual(Phrases2.Lookup('HELP_WONDERMORALE1')) 1619 1617 else 1620 1618 AddTextual(Phrases2.Lookup('HELP_WONDERMORALE2')); 1621 1619 end; 1622 if Imp[ no].Preq <> preNone then1620 if Imp[No].Preq <> preNone then 1623 1621 begin 1624 1622 NextSection('PREREQ'); 1625 AddPreqAdv(Imp[ no].Preq);1623 AddPreqAdv(Imp[No].Preq); 1626 1624 end; 1627 1625 NextSection('COSTS'); 1628 1626 if Difficulty = 0 then 1629 S := Format(HelpText.Lookup('BUILDCOST'), [Imp[ no].Cost])1627 S := Format(HelpText.Lookup('BUILDCOST'), [Imp[No].Cost]) 1630 1628 else 1631 1629 S := Format(HelpText.Lookup('BUILDCOST'), 1632 [Imp[ no].Cost * BuildCostMod[Difficulty] div 12]);1630 [Imp[No].Cost * BuildCostMod[Difficulty] div 12]); 1633 1631 AddLine(S); 1634 if Imp[ no].Maint > 0 then1635 AddLine(Format(HelpText.Lookup('MAINTCOST'), [Imp[ no].Maint]));1632 if Imp[No].Maint > 0 then 1633 AddLine(Format(HelpText.Lookup('MAINTCOST'), [Imp[No].Maint])); 1636 1634 J := 0; 1637 1635 for I := 0 to nImpReplacement - 1 do 1638 if ImpReplacement[I].NewImp = no then1636 if ImpReplacement[I].NewImp = No then 1639 1637 begin 1640 1638 if J = 0 then … … 1646 1644 AddImprovement(ImpReplacement[I].OldImp); 1647 1645 end; 1648 if Imp[ no].Kind = ikShipPart then1646 if Imp[No].Kind = ikShipPart then 1649 1647 begin 1650 1648 LineFeed; 1651 if no = imShipComp then1649 if No = imShipComp then 1652 1650 I := 1 1653 else if no = imShipPow then1651 else if No = imShipPow then 1654 1652 I := 2 1655 else { if no=imShipHab then }1653 else { if No=imShipHab then } 1656 1654 I := 3; 1657 1655 AddLine(Format(HelpText.Lookup('RAREREQUIRED'), 1658 1656 [Phrases.Lookup('TERRAIN', 3 * 12 + I)]), pkTer, 3 * 12 + I); 1659 1657 end; 1660 if ( no < nWonder) and (Imp[no].Expiration >= 0) then1658 if (No < nWonder) and (Imp[No].Expiration >= 0) then 1661 1659 begin 1662 1660 NextSection('EXPIRATION'); 1663 1661 S := Format(HelpText.Lookup('EXPWITH'), 1664 [Phrases.Lookup('ADVANCES', Imp[ no].Expiration)]);1665 if no = woPyramids then1662 [Phrases.Lookup('ADVANCES', Imp[No].Expiration)]); 1663 if No = woPyramids then 1666 1664 S := S + ' ' + HelpText.Lookup('EXPSLAVE'); 1667 1665 AddTextual(S); 1668 1666 end; 1669 1667 NextSection('SEEALSO'); 1670 if ( no < nWonder) and (Imp[no].Expiration >= 0) then1668 if (No < nWonder) and (Imp[No].Expiration >= 0) then 1671 1669 AddImprovement(woEiffel); 1672 1670 for I := 0 to nImpReplacement - 1 do 1673 if ImpReplacement[I].OldImp = no then1671 if ImpReplacement[I].OldImp = No then 1674 1672 AddImprovement(ImpReplacement[I].NewImp); 1675 if no = imSupermarket then1673 if No = imSupermarket then 1676 1674 AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 1677 hkMisc + hkCrossLink, miscJobList);1675 hkMisc, Integer(miscJobList), True); 1678 1676 CheckSeeAlso := True; 1679 1677 end; 1680 1678 1681 1679 hkTer: 1682 if no = 200 then1680 if No = 200 then 1683 1681 begin // complete terrain type list 1684 1682 Caption := HelpText.Lookup('HELPTITLE_TERLIST'); 1685 1683 // AddLine(HelpText.Lookup('HELPTITLE_TERLIST'),pkSection); 1686 for I := 0 to nTerrainHelp- 1 do1684 for I := 0 to Length(TerrainHelp) - 1 do 1687 1685 AddTerrain(TerrainHelp[I]); 1688 1686 end 1689 1687 else 1690 1688 begin // sigle terrain type 1691 TerrType := no mod 12;1689 TerrType := No mod 12; 1692 1690 if TerrType = fJungle then 1693 1691 TerrType := fForest; 1694 TerrSubType := no div 12;1695 if no = 3 * 12 then1692 TerrSubType := No div 12; 1693 if No = 3 * 12 then 1696 1694 begin 1697 1695 TerrType := fDesert; … … 1700 1698 with Terrain[TerrType] do 1701 1699 begin 1702 Caption := Phrases.Lookup('TERRAIN', no);1700 Caption := Phrases.Lookup('TERRAIN', No); 1703 1701 LineFeed; 1704 AddLine(Phrases.Lookup('TERRAIN', no), pkBigTer, no);1702 AddLine(Phrases.Lookup('TERRAIN', No), pkBigTer, No); 1705 1703 AddLine(HelpText.Lookup('HELPSPEC_TER')); 1706 1704 LineFeed; … … 1708 1706 AddLine(Format(HelpText.Lookup('RESPROD'), 1709 1707 [ProdRes[TerrSubType]])); 1710 if ( no < 3 * 12) and (MineEff > 0) then1708 if (No < 3 * 12) and (MineEff > 0) then 1711 1709 MainText[Count - 1] := MainText[Count - 1] + ' ' + 1712 1710 Format(HelpText.Lookup('MOREMINE'), [MineEff]); … … 1714 1712 AddLine(Format(HelpText.Lookup('RESFOOD'), 1715 1713 [FoodRes[TerrSubType]])); 1716 if ( no < 3 * 12) and (IrrEff > 0) then1714 if (No < 3 * 12) and (IrrEff > 0) then 1717 1715 MainText[Count - 1] := MainText[Count - 1] + ' ' + 1718 1716 Format(HelpText.Lookup('MOREIRR'), [IrrEff]); … … 1728 1726 else 1729 1727 AddLine(HelpText.Lookup('MOVEPLAIN')); 1730 if no = 3 * 12 then1728 if No = 3 * 12 then 1731 1729 begin 1732 1730 LineFeed; 1733 1731 AddTextual(HelpText.Lookup('DEADLANDS')); 1734 1732 end; 1735 if (TerrType = fDesert) and ( no <> fDesert + 12) then1733 if (TerrType = fDesert) and (No <> fDesert + 12) then 1736 1734 begin 1737 1735 LineFeed; … … 1743 1741 AddTextual(Format(HelpText.Lookup('HOSTILE'), [ArcticThurst])); 1744 1742 end; 1745 if ( no < 3 * 12) and (TransTerrain >= 0) then1743 if (No < 3 * 12) and (TransTerrain >= 0) then 1746 1744 begin 1747 1745 LineFeed; … … 1752 1750 AddLine(Format(HelpText.Lookup('TRAFO'), 1753 1751 [Phrases.Lookup('TERRAIN', I)]), pkTer, I, 1754 hkTer + hkCrossLink, I);1755 if no = fSwamp + 12 then1752 hkTer, I, True); 1753 if No = fSwamp + 12 then 1756 1754 begin 1757 1755 LineFeed; 1758 1756 AddLine(Format(HelpText.Lookup('TRAFO'), 1759 1757 [Phrases.Lookup('TERRAIN', TransTerrain + 24)]), pkTer, 1760 TransTerrain + 24, hkTer + hkCrossLink, TransTerrain + 24);1758 TransTerrain + 24, hkTer, TransTerrain + 24, True); 1761 1759 end 1762 1760 else if I = fGrass then … … 1765 1763 AddLine(Format(HelpText.Lookup('TRAFO'), 1766 1764 [Phrases.Lookup('TERRAIN', fGrass + 12)]), pkTer, fGrass + 12, 1767 hkTer + hkCrossLink, fGrass + 12);1765 hkTer, fGrass + 12, True); 1768 1766 end; 1769 1767 end; 1770 1768 NextSection('SPECIAL'); 1771 if no = 3 * 12 then1769 if No = 3 * 12 then 1772 1770 begin 1773 1771 LineFeed; … … 1780 1778 end; 1781 1779 end 1782 else if ( no < 12) and (no <> fGrass) and (no <> fOcean) then1780 else if (No < 12) and (No <> fGrass) and (No <> fOcean) then 1783 1781 begin 1784 1782 LineFeed; 1785 1783 for Special := 1 to 2 do 1786 if ( no <> fArctic) and (no <> fSwamp) or (Special < 2) then1784 if (No <> fArctic) and (No <> fSwamp) or (Special < 2) then 1787 1785 begin 1788 1786 if Special > 1 then 1789 1787 LineFeed; 1790 AddLine(Phrases.Lookup('TERRAIN', no + Special * 12), pkTer,1791 no + Special * 12);1788 AddLine(Phrases.Lookup('TERRAIN', No + Special * 12), pkTer, 1789 No + Special * 12); 1792 1790 I := FoodRes[Special] - FoodRes[0]; 1793 1791 if I <> 0 then … … 1804 1802 end; 1805 1803 end; 1806 if no = 3 * 12 then1804 if No = 3 * 12 then 1807 1805 begin 1808 1806 LineFeed; 1809 1807 AddTextual(HelpText.Lookup('RARE')); 1810 1808 end; 1811 if ( no < 3 * 12) and (TerrType in [fDesert, fArctic]) then1809 if (No < 3 * 12) and (TerrType in [fDesert, fArctic]) then 1812 1810 begin 1813 1811 NextSection('SEEALSO'); 1814 1812 AddImprovement(woGardens); 1815 CheckSeeAlso := True 1813 CheckSeeAlso := True; 1816 1814 end; 1817 1815 end; … … 1819 1817 1820 1818 hkFeature: 1821 if no = 200 then1819 if No = 200 then 1822 1820 begin // complete feature list 1823 1821 Caption := HelpText.Lookup('HELPTITLE_FEATURELIST'); … … 1857 1855 else 1858 1856 begin // single feature 1859 Caption := Phrases.Lookup('FEATURES', no);1857 Caption := Phrases.Lookup('FEATURES', No); 1860 1858 LineFeed; 1861 AddLine(Phrases.Lookup('FEATURES', no), pkBigFeature, no);1862 if no < mcFirstNonCap then1859 AddLine(Phrases.Lookup('FEATURES', No), pkBigFeature, No); 1860 if No < mcFirstNonCap then 1863 1861 AddLine(HelpText.Lookup('HELPSPEC_CAP')) 1864 else if no in AutoFeature then1862 else if No in AutoFeature then 1865 1863 AddLine(HelpText.Lookup('HELPSPEC_STANDARD')) 1866 1864 else 1867 1865 AddLine(HelpText.Lookup('HELPSPEC_FEATURE')); 1868 1866 NextSection('EFFECT'); 1869 AddTextual(HelpText.LookupByHandle(hFEATUREHELP, no));1870 if (Feature[ no].Weight <> 0) or (Feature[no].Cost <> 0) then1867 AddTextual(HelpText.LookupByHandle(hFEATUREHELP, No)); 1868 if (Feature[No].Weight <> 0) or (Feature[No].Cost <> 0) then 1871 1869 begin 1872 1870 NextSection('COSTS'); 1873 S := IntToStr(Feature[ no].Cost);1874 if Feature[ no].Cost >= 0 then1871 S := IntToStr(Feature[No].Cost); 1872 if Feature[No].Cost >= 0 then 1875 1873 S := '+' + S; 1876 1874 AddLine(Format(HelpText.Lookup('COSTBASE'), [S])); 1877 if Feature[ no].Weight > 0 then1875 if Feature[No].Weight > 0 then 1878 1876 begin 1879 1877 AddLine(Format(HelpText.Lookup('WEIGHT'), 1880 ['+' + IntToStr(Feature[ no].Weight)]));1881 if no = mcDefense then1878 ['+' + IntToStr(Feature[No].Weight)])); 1879 if No = mcDefense then 1882 1880 AddLine(Format(HelpText.Lookup('WEIGHT'), ['+2']), 1883 1881 pkDomain, dGround); 1884 1882 end; 1885 1883 end; 1886 if Feature[ no].Preq <> preNone then1884 if Feature[No].Preq <> preNone then 1887 1885 begin 1888 1886 LineFeed; 1889 if Feature[ no].Preq = preSun then1887 if Feature[No].Preq = preSun then 1890 1888 AddPreqImp(woSun) // sun tsu feature 1891 1889 else 1892 AddPreqAdv(Feature[ no].Preq);1890 AddPreqAdv(Feature[No].Preq); 1893 1891 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1894 1892 [MainText[Count - 1]]); … … 1910 1908 end; 1911 1909 if CheckSeeAlso then 1912 for I := 0 to nSeeAlso- 1 do1913 if (SeeAlso[I].Kind = Kind) and (SeeAlso[I]. no = no) then1910 for I := 0 to Length(SeeAlso) - 1 do 1911 if (SeeAlso[I].Kind = Kind) and (SeeAlso[I].No = No) then 1914 1912 case SeeAlso[I].SeeKind of 1915 1913 hkImp: AddImprovement(SeeAlso[I].SeeNo); … … 1926 1924 ScrollBar.SetPos(sbPos); 1927 1925 BackBtn.Visible := HistItems.Count > 1; 1928 TopBtn.Visible := (HistItems.Count > 1) or (Kind <> hkMisc) or ( no <> miscMain);1926 TopBtn.Visible := (HistItems.Count > 1) or (Kind <> hkMisc) or (No <> Integer(miscMain)); 1929 1927 Sel := -1; 1930 1928 end; // with MainText 1931 1929 end; 1932 1930 1933 procedure THelpDlg.ShowNewContent(NewMode: TWindowMode; Category, Index: Integer); 1934 begin 1935 if (Category <> Kind) or (Index <> no) or (Category = hkMisc) and 1936 (Index = miscSearchResult) then begin 1931 procedure THelpDlg.ShowNewContent(NewMode: TWindowMode; Category: TLinkCategory; 1932 Index: Integer); 1933 begin 1934 if (Category <> Kind) or (Index <> No) or (Category = hkMisc) and 1935 (Index = Integer(miscSearchResult)) then begin 1937 1936 if HistItems.Count = MaxHist then HistItems.Delete(0); 1938 1937 if HistItems.Count = 0 then … … 1941 1940 end; 1942 1941 Kind := Category; 1943 no := Index;1942 No := Index; 1944 1943 SearchContent := NewSearchContent; 1945 1944 Prepare; … … 1962 1961 Sel := -1; 1963 1962 if (Sel + i0 >= MainText.Count) or (Sel >= 0) and 1964 (THelpLineInfo(MainText.Objects[Sel + i0]).Link = 0) then 1963 (THelpLineInfo(MainText.Objects[Sel + i0]).Category = hkNoLink) and 1964 (THelpLineInfo(MainText.Objects[Sel + i0]).Index = 0)then 1965 1965 Sel := -1; 1966 1966 if Sel <> Sel0 then … … 1978 1978 if Sel >= 0 then 1979 1979 with THelpLineInfo(MainText.Objects[Sel + ScrollBar.Position]) do 1980 if Link shr 8 and $3F= hkInternet then1981 case Link and $FFof1980 if Category = hkInternet then 1981 case Index of 1982 1982 1: OpenDocument(HomeDir + AITemplateFileName); 1983 1983 2: OpenURL(CevoHomepage); … … 1986 1986 else 1987 1987 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); 1988 if Index < 0 then Exit; // invalid link; 1989 ShowNewContent(FWindowMode, Category, Index); 1994 1990 end; 1995 1991 end; … … 2003 1999 HistItem.Assign(HistItems.Last); 2004 2000 HistItems.Delete(HistItems.Count - 1); 2005 if (HistItem.Kind = hkMisc) and (HistItem.No = miscSearchResult) and2001 if (HistItem.Kind = hkMisc) and (HistItem.No = Integer(miscSearchResult)) and 2006 2002 (HistItem.SearchContent <> SearchContent) then 2007 2003 begin … … 2010 2006 end; 2011 2007 Kind := HistItem.Kind; 2012 no := HistItem.No;2008 No := HistItem.No; 2013 2009 Prepare(HistItem.Pos); 2014 2010 OffscreenPaint; … … 2022 2018 while HistItems.Count > 1 do HistItems.Delete(HistItems.Count - 1); 2023 2019 Kind := hkMisc; 2024 no := miscMain;2020 No := Integer(miscMain); 2025 2021 Prepare; 2026 2022 OffscreenPaint; … … 2036 2032 function THelpDlg.TextIndex(Item: string): Integer; 2037 2033 begin 2038 Result := HelpText.Get handle(Item);2034 Result := HelpText.GetHandle(Item); 2039 2035 end; 2040 2036 … … 2064 2060 1: 2065 2061 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 2062 ShowNewContent(FWindowMode, Category, Index); 2063 else begin 2072 2064 NewSearchContent := InputDlg.EInput.Text; 2073 ShowNewContent(FWindowMode, hkMisc, miscSearchResult);2065 ShowNewContent(FWindowMode, hkMisc, Integer(miscSearchResult)); 2074 2066 end; 2075 2067 end; … … 2081 2073 H, I, PrevHandle, PrevIndex, P, RightMargin: Integer; 2082 2074 S: string; 2083 mADVHELP, mIMPHELP, mFEATUREHELP: set of 0 ..255;2075 mADVHELP, mIMPHELP, mFEATUREHELP: set of 0..255; 2084 2076 bGOVHELP, bSPECIALMODEL, bJOBHELP: Boolean; 2085 2077 begin … … 2092 2084 bJOBHELP := False; 2093 2085 2094 // search in generic reference2086 // Search in generic reference 2095 2087 SearchString := UpperCase(SearchString); 2096 2088 for I := 0 to 35 + 4 do begin … … 2099 2091 if I < 36 then 2100 2092 SearchResult.AddLine(S + ' ' + HelpText.Lookup('HELPSPEC_TER'), 2101 pkNormal, 0, hkTer + hkCrossLink, I)2093 pkNormal, 0, hkTer, I, True) 2102 2094 else 2103 2095 begin 2104 2096 SearchResult.AddLine(Phrases.Lookup('TERRAIN', 36) + ' ' + 2105 2097 HelpText.Lookup('HELPSPEC_TER'), pkNormal, 0, 2106 hkTer + hkCrossLink, 36);2098 hkTer, 36, True); 2107 2099 if I > 36 then 2108 2100 SearchResult.AddLine(Phrases.Lookup('IMPROVEMENTS', 2109 2101 imShipComp + I - 37) + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'), 2110 pkNormal, 0, hkImp + hkCrossLink, imShipComp + I - 37);2102 pkNormal, 0, hkImp, imShipComp + I - 37, True); 2111 2103 Break; 2112 2104 end; 2113 2105 end; 2114 for I := 0 to nJobHelp- 1 do2106 for I := 0 to Length(JobHelp) - 1 do 2115 2107 if Pos(SearchString, UpperCase(Phrases.Lookup('JOBRESULT', JobHelp[I]))) > 0 2116 2108 then 2117 2109 begin 2118 2110 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 2119 hkMisc + hkCrossLink, miscJobList);2111 hkMisc, Integer(miscJobList), True); 2120 2112 bJOBHELP := True; 2121 2113 Break; … … 2130 2122 else 2131 2123 S := S + ' ' + HelpText.Lookup('HELPSPEC_ADV'); 2132 SearchResult.AddLine(S, pkNormal, 0, hkAdv + hkCrossLink, I);2124 SearchResult.AddLine(S, pkNormal, 0, hkAdv, I, True); 2133 2125 Include(mADVHELP, I); 2134 2126 end; … … 2140 2132 begin 2141 2133 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkNormal, 0, 2142 hkModel + hkCrossLink, 0);2134 hkModel, 0, True); 2143 2135 bSPECIALMODEL := True; 2144 2136 Break; … … 2156 2148 else 2157 2149 S := S + ' ' + HelpText.Lookup('HELPSPEC_FEATURE'); 2158 SearchResult.AddLine(S, pkNormal, 0, hkFeature + hkCrossLink, I);2150 SearchResult.AddLine(S, pkNormal, 0, hkFeature, I, True); 2159 2151 Include(mFEATUREHELP, I); 2160 2152 end; … … 2175 2167 S := S + ' ' + HelpText.Lookup('HELPSPEC_NAT') 2176 2168 end; 2177 SearchResult.AddLine(S, pkNormal, 0, hkImp + hkCrossLink, I);2169 SearchResult.AddLine(S, pkNormal, 0, hkImp, I, True); 2178 2170 Include(mIMPHELP, I); 2179 2171 end … … 2183 2175 begin 2184 2176 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkNormal, 0, 2185 hkMisc + hkCrossLink, miscGovList);2177 hkMisc, Integer(miscGovList), True); 2186 2178 bGOVHELP := True; 2187 2179 Break; 2188 2180 end; 2189 2181 2190 // full text search2182 // Full text search 2191 2183 H := -1; 2192 2184 repeat … … 2205 2197 else 2206 2198 S := S + ' ' + HelpText.Lookup('HELPSPEC_ADV'); 2207 SearchResult.AddLine(S, pkNormal, 0, hkAdv + hkCrossLink, I)2199 SearchResult.AddLine(S, pkNormal, 0, hkAdv, I, True); 2208 2200 end; 2209 2201 end … … 2224 2216 S := S + ' ' + HelpText.Lookup('HELPSPEC_NAT') 2225 2217 end; 2226 SearchResult.AddLine(S, pkNormal, 0, hkImp + hkCrossLink, I)2218 SearchResult.AddLine(S, pkNormal, 0, hkImp, I, True); 2227 2219 end; 2228 2220 end … … 2239 2231 else 2240 2232 S := S + ' ' + HelpText.Lookup('HELPSPEC_FEATURE'); 2241 SearchResult.AddLine(S, pkNormal, 0, hkFeature + hkCrossLink, I);2233 SearchResult.AddLine(S, pkNormal, 0, hkFeature, I, True); 2242 2234 end; 2243 2235 end … … 2246 2238 if (I >= 0) and (H <> PrevHandle) and not bGOVHELP then 2247 2239 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkNormal, 0, 2248 hkMisc + hkCrossLink, miscGovList)2240 hkMisc, Integer(miscGovList), True); 2249 2241 end 2250 2242 else if H = hSPECIALMODEL then … … 2252 2244 if (I >= 0) and (H <> PrevHandle) and not bSPECIALMODEL then 2253 2245 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkNormal, 2254 0, hkModel + hkCrossLink, 0)2246 0, hkModel, 0, True); 2255 2247 end 2256 2248 else if H = hJOBHELP then … … 2258 2250 if (I >= 0) and (H <> PrevHandle) and not bJOBHELP then 2259 2251 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 2260 hkMisc + hkCrossLink, miscJobList)2252 hkMisc, Integer(miscJobList), True); 2261 2253 end 2262 2254 else if { (h<>hMAIN) and } (H <> PrevHandle) then … … 2266 2258 if P > 0 then 2267 2259 begin 2268 S := Copy(S, P + 1, maxint);2260 S := Copy(S, P + 1, MaxInt); 2269 2261 P := Pos('\', S); 2270 2262 if P > 0 then 2271 2263 S := Copy(S, 1, P - 1); 2272 SearchResult.AddLine(S, pkNormal, 0, hkText + hkCrossLink, H);2264 SearchResult.AddLine(S, pkNormal, 0, hkText, H, True); 2273 2265 end; 2274 2266 end; 2275 2276 2277 // cut lines to fit to window2278 2279 2280 2281 2282 2283 2284 2285 2286 2267 until False; 2268 2269 // Cut lines to fit to window 2270 RightMargin := InnerWidth - 16 - GetSystemMetrics(SM_CXVSCROLL); 2271 OffScreen.Canvas.Font.Assign(UniFont[ftNormal]); 2272 for I := 0 to SearchResult.Count - 1 do 2273 begin 2274 while BiColorTextWidth(OffScreen.Canvas, SearchResult[I]) > 2275 RightMargin - 32 do 2276 SearchResult[I] := Copy(SearchResult[I], 1, Length(SearchResult[I]) - 1) 2277 end; 2278 end; 2287 2279 2288 2280 end.
Note:
See TracChangeset
for help on using the changeset viewer.