📄 help.pas
字号:
AddLine;
AddLine;
Headline:=2;
if AdvPreq[no,2]<>preNone then NextSection('PREREQALT')
else NextSection('PREREQ');
for i:=0 to 2 do
if AdvPreq[no,i]<>preNone then AddPreqAdv(AdvPreq[no,i]);
if no in FutureTech then
begin
NextSection('FUTURETECH');
AddItem('FUTURETECHHELP');
end;
NextSection('GOVALLOW');
for i:=2 to nGov-1 do
if GovPreq[i]=no then
AddLine(Phrases.Lookup('GOVERNMENT',i),pkSmallIcon,imPalace,
hkMisc+hkCrossLink,miscGovList);
NextSection('BUILDALLOW');
for i:=0 to 27 do
if Imp[i].Preq=no then AddImp(i);
for i:=28 to nImp-1 do
if (Imp[i].Preq=no) and (Imp[i].Kind<>ikCommon) then AddImp(i);
for i:=28 to nImp-1 do
if (Imp[i].Preq=no) and (Imp[i].Kind=ikCommon) then AddImp(i);
NextSection('MODELALLOW');
for i:=0 to nSpecialModel-1 do
if SpecialModelPreq[i]=no then AddModel(i);
NextSection('FEATALLOW');
for i:=0 to nFeature-1 do if Feature[i].Preq=no then AddFeature(i);
NextSection('FOLLOWADV');
for i:=0 to nAdv-1 do
if (AdvPreq[i,0]=no) or (AdvPreq[i,1]=no) or (AdvPreq[i,2]=no) then
AddAdv(i);
NextSection('UPGRADEALLOW');
for Domain:=0 to nDomains-1 do for i:=1 to nUpgrade-1 do
if upgrade[Domain,i].Preq=no then
begin
if upgrade[Domain,i].Strength>0 then
AddLine(Format(HelpText.Lookup('STRENGTHUP'),
[Phrases.Lookup('DOMAIN',Domain),upgrade[Domain,i].Strength]),
pkDomain,Domain);
if upgrade[Domain,i].Trans>0 then
AddLine(Format(HelpText.Lookup('TRANSUP'),
[Phrases.Lookup('DOMAIN',Domain),upgrade[Domain,i].Trans]),
pkDomain,Domain);
if no in FutureTech then
AddLine(Format(HelpText.Lookup('COSTUP'),
[upgrade[Domain,i].Cost]),pkNormal_Dot)
else
AddLine(Format(HelpText.Lookup('COSTMIN'),
[upgrade[Domain,i].Cost]),pkNormal_Dot)
end;
NextSection('EXPIRATION');
for i:=0 to 27 do
if (Imp[i].Preq<>preNA) and (Imp[i].Expiration=no) then AddImp(i);
NextSection('ADVEFFECT');
s:=HelpText.Lookup('ADVHELP',no);
if s<>'*' then AddText(s);
NextSection('SEEALSO');
CheckSeeAlso:=true
end;
hkImp:
if no=200 then
begin // complete city improvement list
Caption:=HelpText.Lookup('HELPTITLE_IMPLIST');
for i:=28 to nImp-1 do
if (i<>imTrGoods) and (Imp[i].Preq<>preNA) and (Imp[i].Kind=ikCommon) then
AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i);
Sort
end
else if no=201 then
begin // complete nat. project list
Caption:=HelpText.Lookup('HELPTITLE_UNIQUELIST');
for i:=28 to nImp-1 do
if (Imp[i].Preq<>preNA)
and ((Imp[i].Kind=ikNatLocal) or (Imp[i].Kind=ikNatGlobal)) then
AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i);
Sort;
NextSection('HELPTITLE_SHIPPARTLIST');
for i:=28 to nImp-1 do
if (Imp[i].Preq<>preNA) and (Imp[i].Kind=ikShipPart) then
AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i);
end
else if no=202 then
begin // complete wonder list
Caption:=HelpText.Lookup('HELPTITLE_WONDERLIST');
for i:=0 to 27 do if Imp[i].Preq<>preNA then
AddLine(Phrases.Lookup('IMPROVEMENTS',i),pkSmallIcon,i,hkImp,i);
end
else
begin // single building
Caption:=Phrases.Lookup('IMPROVEMENTS',no);
case Imp[no].Kind of
ikWonder: AddLine(HelpText.Lookup('HELPSPEC_WONDER'),pkCenter);
ikCommon: AddLine(HelpText.Lookup('HELPSPEC_IMP'),pkCenter);
ikShipPart: AddLine(HelpText.Lookup('HELPSPEC_SHIPPART'),pkCenter);
else AddLine(HelpText.Lookup('HELPSPEC_NAT'),pkCenter)
end;
AddLine('',pkBigIcon,no);
AddLine;
if Imp[no].Kind<>ikShipPart then
begin
NextSection('EFFECT');
AddText(HelpText.Lookup('IMPHELP',no));
end;
if no=woSun then
begin
AddFeature(mcFirst);
AddFeature(mcWill);
AddFeature(mcAcademy);
end;
if no=woPyramids then AddModel(7);
if no=woLeo then begin AddModel(8); AddModel(9); AddModel(10); end;
if Imp[no].Preq<>preNone then
begin
NextSection('PREREQ');
AddPreqAdv(Imp[no].Preq);
end;
NextSection('COSTS');
s:=Format(HelpText.Lookup('BUILDCOST'),[Imp[no].Cost]);
if Difficulty in [1,3] then
s:=s+' '+Format(HelpText.Lookup('BUILDCOSTDIFF'),
[Imp[no].Cost*BuildCostMod[Difficulty] div 12]);
AddLine(s);
if Imp[no].Maint>0 then
AddLine(Format(HelpText.Lookup('MAINTCOST'),[Imp[no].Maint]));
j:=0;
for i:=0 to nImpReplacement-1 do if ImpReplacement[i].New=no then
begin
if j=0 then
begin NextSection('REPLACE'); AddItem('REPLACETEXT'); j:=1 end;
AddImp(ImpReplacement[i].Old);
end;
if Imp[no].Kind=ikShipPart then
begin
if no=imShipComp then i:=1
else if no=imShipPow then i:=2
else {if no=imShipHab then} i:=3;
AddLine(Format(HelpText.Lookup('RAREREQUIRED'),
[Phrases.Lookup('TERRAIN',3*12+i)]),pkTer,3*12+i);
end;
if (no<28) and (Imp[no].Expiration>=0) then
begin
NextSection('EXPIRATION');
s:=Format(HelpText.Lookup('EXPWITH'),[Phrases.Lookup('ADVANCES',Imp[no].Expiration)]);
if no=woPyramids then s:=s+' '+HelpText.Lookup('EXPSLAVE');
AddText(s);
end;
NextSection('SEEALSO');
if (no<28) and (Imp[no].Expiration>=0) then AddImp(woEiffel);
if Imp[no].Kind=ikShipPart then AddLine(HelpText.Lookup('SEESHIP'),
pkNormal,0,hkText+hkCrossLink,HelpText.GetHandle('SHIP'));
for i:=0 to nImpReplacement-1 do if ImpReplacement[i].Old=no then
AddImp(ImpReplacement[i].New);
CheckSeeAlso:=true
end;
hkTer:
if no=200 then
begin // complete terrain type list
Caption:=HelpText.Lookup('HELPTITLE_TERLIST');
for i:=0 to 11 do
begin
if i<>8 then AddTer(i);
if i=fGrass then AddTer(i+12)
end
end
else
begin // sigle terrain type
TerrType:=no mod 12;
with Terrain[TerrType] do
begin
Caption:=Phrases.Lookup('TERRAIN',no);
AddLine(HelpText.Lookup('HELPSPEC_TER'),pkCenter);
AddLine;
AddLine('',pkBigTer,no);
AddLine;
if (ProdRes[no div 12]>0) or (MineEff>0) then
AddLine(Format(HelpText.Lookup('RESPROD'),[ProdRes[no div 12]]));
if MineEff>0 then
MainText[Count-1]:=MainText[Count-1]+' '
+Format(HelpText.Lookup('MOREMINE'),[MineEff]);
if (FoodRes[no div 12]>0) or (IrrEff>0) then
AddLine(Format(HelpText.Lookup('RESFOOD'),[FoodRes[no div 12]]));
if IrrEff>0 then
MainText[Count-1]:=MainText[Count-1]+' '
+Format(HelpText.Lookup('MOREIRR'),[IrrEff]);
if TradeRes[no div 12]>0 then
AddLine(Format(HelpText.Lookup('RESTRADE'),[TradeRes[no div 12]]));
if (no<12) and (no<>fGrass) then
for special:=1 to 2 do if (no<>fOcean) and ((no<>fGrass) and (no<>fArctic) or (special<2)) then
begin
AddLine;
AddLine(Phrases.Lookup('TERRAIN',no+special*12),pkTer,no+special*12);
i:=Terrain[no].FoodRes[special]-Terrain[no].FoodRes[0];
if i<>0 then
MainText[Count-1]:=MainText[Count-1]+Format(HelpText.Lookup('SPECIALFOOD'),[i]);
i:=Terrain[no].ProdRes[special]-Terrain[no].ProdRes[0];
if i<>0 then
MainText[Count-1]:=MainText[Count-1]+Format(HelpText.Lookup('SPECIALPROD'),[i]);
i:=Terrain[no].TradeRes[special]-Terrain[no].TradeRes[0];
if i<>0 then
MainText[Count-1]:=MainText[Count-1]+Format(HelpText.Lookup('SPECIALTRADE'),[i]);
end;
AddLine;
if TerrType=fDesert then
AddText(Format(HelpText.Lookup('HOSTILE'),[DesertThurst]));
if TerrType=fArctic then
AddText(Format(HelpText.Lookup('HOSTILE'),[ArcticThurst]));
if (TerrType>=fGrass) and (TerrType<>fMountains) then
if MoveCost=2 then
AddLine(HelpText.Lookup('MOVEHEAVY'))
else AddLine(HelpText.Lookup('MOVEPLAIN'));
if Defense>4 then
AddLine(Format(HelpText.Lookup('DEFBONUS'),[(Defense-4)*25]));
if TransTerrain>=0 then
begin
AddLine;
i:=TransTerrain;
if (TerrType<>fGrass) and (i<>fGrass) then
i:=i+no div 12 *12; // trafo to same special resource group
AddLine(Format(HelpText.Lookup('TRAFO'),
[Phrases.Lookup('TERRAIN',i)]),pkTer,i,hkTer+hkCrossLink,i);
if i=fGrass then
begin
AddLine;
AddLine(Format(HelpText.Lookup('TRAFO'),
[Phrases.Lookup('TERRAIN',fGrass+12)]),pkTer,fGrass+12,
hkTer+hkCrossLink,fGrass+12);
end
end;
if TerrType in [fDesert,fArctic] then
begin
NextSection('SEEALSO');
AddImp(woGardens);
CheckSeeAlso:=true
end
end
end;
hkFeature:
if no=200 then
begin // complete feature list
Caption:=HelpText.Lookup('HELPTITLE_FEATURELIST');
for i:=0 to nFeature-1 do if Feature[i].Preq<>preNA then
AddLine(Phrases.Lookup('FEATURES',i),pkFeature,i,hkFeature,i);
Sort
end
else
begin // single feature
Caption:=Phrases.Lookup('FEATURES',no);
if no<mcFirstNonCap then
AddLine(HelpText.Lookup('HELPSPEC_CAP'),pkCenter)
else if no in AutoFeature then
AddLine(HelpText.Lookup('HELPSPEC_STANDARD'),pkCenter)
else AddLine(HelpText.Lookup('HELPSPEC_FEATURE'),pkCenter);
AddLine('',pkBigFeature,no);
NextSection('EFFECT');
AddText(HelpText.Lookup('FEATUREHELP',no));
NextSection('DOMAINS');
for i:=0 to nDomains-1 do if Feature[no].Domains and (1 shl i)<>0 then
AddLine(Phrases.Lookup('DOMAIN',i),pkDomain,i);
if (Feature[no].Weight<>0) or (Feature[no].Cost<>0) then
begin
NextSection('COSTS');
s:=IntToStr(Feature[no].Cost);
if Feature[no].Cost>=0 then s:='+'+s;
AddLine(Format(HelpText.Lookup('COSTBASE'),[s]));
if Feature[no].Weight>0 then
begin
AddLine(Format(HelpText.Lookup('WEIGHT'),
['+'+IntToStr(Feature[no].Weight)]));
if no=mcDefense then
AddLine(Format(HelpText.Lookup('WEIGHT'),['+2']),pkDomain,dGround);
end
end;
if Feature[no].Preq<>preNone then
begin
AddLine;
if Feature[no].Preq=preSun then AddPreqImp(woSun) // sun tsu feature
else AddPreqAdv(Feature[no].Preq);
MainText[Count-1]:=Format(HelpText.Lookup('REQUIRED'),[MainText[Count-1]]);
end;
NextSection('SEEALSO');
CheckSeeAlso:=true
end;
end;
if CheckSeeAlso then
for i:=0 to nSeeAlso-1 do
if (SeeAlso[i].Kind=Kind) and (SeeAlso[i].no=no) then
case SeeAlso[i].SeeKind of
hkImp: AddImp(SeeAlso[i].SeeNo);
hkAdv: AddAdv(SeeAlso[i].SeeNo);
hkFeature: AddFeature(SeeAlso[i].SeeNo);
end;
if (Headline>=0) and (Count=Headline+1) then Delete(Headline)
else AddLine;
InitPVSB(sb,Count-1,InnerHeight div 24);
if sbPos<>0 then
begin
sb.si.npos:=sbPos;
sb.si.FMask:=SIF_POS;
SetScrollInfo(sb.h,SB_CTL,sb.si,true);
end;
Sel:=-1;
OffscreenPaint;
Invalidate;
end // with MainText
end; {Prepare}
procedure THelpDlg.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState;
x, y: integer);
var
i0,Sel0:integer;
begin
y:=y-WideFrame;
i0:=sb.si.npos;
Sel0:=Sel;
if (x>=SideFrame) and (x<SideFrame+InnerWidth) and (y>=0) and (y<InnerHeight)
and (y mod 24>=4) and (y mod 24<20) then
Sel:=y div 24
else Sel:=-1;
if (Sel+i0>=MainText.Count) or (Sel>=0)
and (THelpLineInfo(MainText.Objects[Sel+i0]).Link=0) then Sel:=-1;
if Sel<>Sel0 then with Canvas do
begin
if Sel0<>-1 then line(Canvas,Sel0,false);
if Sel<>-1 then line(Canvas,Sel,true)
end
end;
procedure THelpDlg.PaintBox1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; x, y: integer);
begin
if Sel>=0 then with THelpLineInfo(MainText.Objects[Sel+sb.si.npos]) do
if Link shr 8 and $3F=hkInternet then
case Link and $FF of
1: ShellExecute(Handle,'open',pchar(HomeDir+'AI Developer\aidev.html'),'','',
SW_SHOWNORMAL);
2: ShellExecute(Handle,'open','http://c-evo.org','','',
SW_SHOWNORMAL);
3: ShellExecute(Handle,'open','mailto:steffen@c-evo.org','','',
SW_SHOWNORMAL);
end
else
begin
if (Link>=$8000) and (Link and $3FFF=liInvalid) then
exit; // invalid link;
if nHist=MaxHist then
begin
move(HistKind[2],HistKind[1],4*(nHist-2));
move(HistNo[2],HistNo[1],4*(nHist-2));
move(HistPos[2],HistPos[1],4*(nHist-2));
end
else inc(nHist);
HistKind[nHist-1]:=Kind; HistNo[nHist-1]:=no; HistPos[nHist-1]:=sb.si.npos;
if Link>=$8000 then
begin Kind:=hkText; no:=Link and $3FFF; end
else begin Kind:=Link shr 8 and $3F; no:=Link and $FF; end;
Prepare;
end
end;
procedure THelpDlg.BackBtnClick(Sender: TObject);
begin
if nHist>0 then
begin
dec(nHist);
Kind:=HistKind[nHist]; no:=HistNo[nHist];
Prepare(HistPos[nHist]);
end
end;
procedure THelpDlg.TopBtnClick(Sender: TObject);
begin
nHist:=0;
Kind:=hkText;
no:=HelpText.GetHandle('MAIN');
Prepare;
end;
procedure THelpDlg.FormDeactivate(Sender: TObject);
begin
Close
end;
procedure THelpDlg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ExtPic.Height:=0;
inherited;
end;
procedure THelpDlg.ShowPage(Category, Index: integer; Modal: boolean);
begin
Kind:=Category;
no:=Index;
if Modal then ShowModal else Show
end;
function THelpDlg.TextIndex(Item: string): integer;
begin
result:=HelpText.GetHandle(Item)
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -