📄 term.pas
字号:
Bankrupt, ShipMore:integer;
MoveAdviceData: TMoveAdviceData;
Picture: TModelPictureInfo;
s, Item, Item2: string;
UpdatePanel, OwnWonder, ok, Stop, Multi, ShowCityList: boolean;
begin
Multi:=false;
for p1:=1 to nPl-1 do
if G.RO[p1]<>nil then Multi:=true;
if (ClientMode>=scContact) or Multi and (p<>me) then
begin
UnitBtn.Visible:=false;
EOT.Visible:=false;
end;
if Multi and (p<>me) then
begin //inter player screen
GameBtn.Visible:=false;
StatBtn.Visible:=false;
for i:=0 to ControlCount-1 do if Controls[i] is TButtonC then
Controls[i].visible:=false;
me:=-1;
with Panel.Canvas do
begin
Brush.Color:=$000000;
FillRect(Rect(0,0,Panel.Width,Panel.Height));
Brush.Style:=bsClear;
end;
Invalidate;
s:=TurnToString(G.RO[0].Turn);
MessgDlg.Tex.Height:=0;
MessgDlg.Tex.clBevelLight:=$A0A0A0;
MessgDlg.Tex.clBevelShade:=$202020;
if G.Difficulty[NewPlayer]=0 then
SimpleMessage(Format(Phrases.Lookup('SUPERTURN'),[s]), 'TURNSTART')
else SimpleMessage(Format(Tribe[NewPlayer].TPhrase('TURN'),[s]),
'TURNSTART');
for i:=0 to ControlCount-1 do if Controls[i] is TButtonC then
Controls[i].visible:=true;
end;
ItsMeAgain(p);
MyData:=MyRO.Data;
if G.Difficulty[me]>0 then
begin
Age:=GetAge(me);
// age:=MyRO.Turn mod 4; //!!!
Tribe[me].InitAgeTextures(OuterTex,InnerTex,Age);
if ClientMode<scContact then EOT.ButtonIndex:=4;
end
else
begin
Age:=0;
InitTexture(OuterTex,'StdTextures',0);
InitTexture(InnerTex,'StdTextures',1);
InitCityMark(OuterTex);
EOT.ButtonIndex:=5;
end;
BaseWin.DlgTex:=OuterTex;
InputDlg.Tex:=InnerTex;
MessgDlg.Tex:=InnerTex;
MessgExDlg.Tex:=InnerTex;
HelpDlg.Difficulty:=G.Difficulty[me];
UnFocus:=-1;
BlinkON:=false;
BlinkTime:=-1;
Tracking:=false;
TurnComplete:=false;
if ClientMode<scContact then SumCities(TaxSum,ScienceSum);
GameBtn.Visible:=true;
StatBtn.Visible:=true;
if ClientMode<scContact then
begin
UnitBtn.Visible:= UnFocus>=0;
TurnComplete:= G.Difficulty[me]=0; {supervisor}
EOT.Hint:=Phrases.Lookup('BTN_ENDTURN');
EOT.Visible:= Server(sTurn-sExecute,me,0,nil^)>=rExecuted;
end;
SetTroopLoc(-1);
MapValid:=false;
if (MyRO.Turn=0) and (G.Difficulty[me]>0) or Multi or (ClientMode=cResume) then
begin
if MyRO.nCity>0 then Centre(MyCity[0].Loc)
else if MyRO.nUn>0 then Centre(MyUn[0].Loc)
else if ClientMode<>cResume then MainPaint;
end
else if ClientMode<>cResume then MainPaint;
if (ToldSlavery<0)
or ((ToldSlavery=1)<>(MyRO.Wonder[woPyramids].EffectiveOwner>=0)) then
begin
if MyRO.Wonder[woPyramids].EffectiveOwner>=0 then ToldSlavery:=1
else ToldSlavery:=0;
for p1:=0 to nPl-1 do
if (Tribe[p1]<>nil) and (Tribe[p1].mixSlaves>=0) then
with Picture do
begin // replace unit picture
mix:=Tribe[p1].mixSlaves;
if ToldSlavery=1 then pix:=pixSlaves else pix:=pixNoSlaves;
Hash:=1;
GrName:='StdUnits';
Tribe[p1].SetModelPicture(Picture, false);
end
end;
if ClientMode<>cResume then
begin
if MyRO.Happened and phGameEnd<>0 then
with MessgExDlg do
begin // game ended
if MyRO.Happened and phExtinct<>0 then
begin
Play('GAMEOVER');
MessgText:=Tribe[me].TPhrase('GAMEOVER');
BigIcon:=21;
end
else if MyRO.Happened and phShipComplete<>0 then
begin
Play('SPACESHIP');
p1:=MyRO.Happened shr 16 and $f; // winner
if p1=me then
begin MessgText:=Tribe[me].TPhrase('MYSPACESHIP'); BigIcon:=27; end
else begin MessgText:=Tribe[p1].TPhrase('SPACESHIP'); BigIcon:=23; end
end
else {if MyRO.Happened and fTimeUp<>0 then}
begin
Play('GAMEOVER');
if G.Difficulty[me]>0 then MessgText:=Tribe[me].TPhrase('TIMEUP')
else MessgText:=Phrases.Lookup('TIMEUPSUPER');
BigIcon:=22;
end;
Kind:=mkOK;
ShowModal;
if MyRO.Happened and phShipComplete<>0 then
begin DiaDlg.Kind:=dkShip; DiaDlg.Player:=p1; DiaDlg.ShowModal; end;
if MyRO.Turn>=2 then
begin DiaDlg.Kind:=dkChart; DiaDlg.ShowModal; end;
TurnComplete:=true;
exit;
end;
if (G.Difficulty[me]>0) and (1 shl me and MyRO.Alive=0) then
begin TurnComplete:=true; exit; end;
if (ClientMode=cContinue) and (DipMem[me].SentCommand and $FF0F=scContact) then
// contact was refused
if MyRO.Treaty[DipMem[me].pContact]>=trPeace then
begin
if SimpleQuery(mkYesNo,Tribe[DipMem[me].pContact].TPhrase('FRREJECTED')
+' '+Format(Phrases.Lookup('FRCANCELQUERY'),
[Phrases.Lookup('TREATY',MyRO.Treaty[DipMem[me].pContact])]),'')
=mrOK then
begin
Server(sCancelTreaty,me,0,nil^);
MapValid:=false;
MainPaint;
end
end
else SimpleMessage(Tribe[DipMem[me].pContact].TPhrase('FRREJECTED'),'');
if MyData.ToldAlive<>MyRO.Alive then
begin
for p1:=0 to nPl-1 do
if (MyData.ToldAlive-MyRO.Alive) and (1 shl p1)<>0 then
with MessgExDlg do
begin
Play('EXTINCT');
MessgText:=Tribe[p1].TPhrase('EXTINCT');
if MyRO.Alive=1 shl me then
MessgText:=MessgText+Phrases.Lookup('EXTINCTALL');
Kind:=mkOK;
BigIcon:=21;
ShowModal;
end;
if (G.Difficulty[me]>0) and (MyRO.Turn>=2) then
begin DiaDlg.Kind:=dkChart; DiaDlg.ShowModal; end;
MyData.ToldAlive:=MyRO.Alive;
end;
if (G.Difficulty[me]>0) and (Age>MyData.ToldAge) then with MessgExDlg do
begin
case Age of
0: s:=Tribe[me].TPhrase('AGE0');
1: s:=Tribe[me].TPhrase('AGE1');
2: s:=Tribe[me].TPhrase('AGE2');
3: s:=Tribe[me].TPhrase('AGE3');
end;
if Age=0 then
MessgText:=Format(s,[TurnToString(MyRO.Turn),CityName(MyCity[0].ID)])
else MessgText:=Format(s,[TurnToString(MyRO.Turn)]);
BigIcon:=24+Age;
{if age=0 then} Kind:=mkOK
{else begin Kind:=mkOkHelp; HelpKind:=hkAdv; HelpNo:=AgePreq[age]; end};
ShowModal;
MyData.ToldAge:=Age;
if Age>0 then
MyData.ToldTech[AgePreq[Age]]:=MyRO.Tech[AgePreq[Age]];
end;
if ClientMode=cTurn then
begin
Bankrupt:=0;
for p1:=0 to nPl-1 do
if (p1<>me) and (1 shl p1 and MyRO.Alive<>0)
and (MyRO.TributePaid[p1]<MyRO.Tribute[p1]) then
inc(Bankrupt,1 shl p1);
if MyRO.Happened and phBankrupt<>0 then inc(Bankrupt,1 shl me);
for p1:=0 to nPl-1 do
if 1 shl p1 and MyData.ToldBankrupt < 1 shl p1 and Bankrupt then
if p1=me then SimpleMessage(Tribe[p1].TPhrase('WEBANKRUPT'),'')
else SimpleMessage(Tribe[p1].TPhrase('BANKRUPT'),'');
MyData.ToldBankrupt:=Bankrupt;
end;
for i:=0 to 27 do
begin
OwnWonder:=false;
for cix:=0 to MyRO.nCity-1 do
if (MyCity[cix].Loc>=0) and (MyCity[cix].ID=MyRO.Wonder[i].CityID) then
OwnWonder:=true;
if MyRO.Wonder[i].CityID<>MyData.ToldWonders[i].CityID then
begin
if MyRO.Wonder[i].CityID=-2 then with MessgExDlg do
begin {tell about destroyed wonders}
MessgText:=Format(Phrases.Lookup('WONDERDEST'),
[Phrases.Lookup('IMPROVEMENTS',i)]);
Kind:=mkOkHelp;
HelpKind:=hkImp;
HelpNo:=i;
BigIcon:=i;
ShowModal;
end
else with MessgExDlg do
begin {tell about newly built wonders}
Play('IMP_SPECIAL',i);
if i=woManhattan then
begin
if MyRO.Wonder[i].EffectiveOwner>me then
MyData.ColdWarStart:=MyRO.Turn-1
else MyData.ColdWarStart:=MyRO.Turn;
s:=Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('COLDWAR')
end
else if OwnWonder then s:=Tribe[me].TPhrase('WONDERBUILTOWN')
else if MyRO.Wonder[i].EffectiveOwner>=0 then
s:=Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('WONDERBUILT')
else s:=Phrases.Lookup('WONDERBUILTEXP'); // already expired when built
MessgText:=Format(s, [Phrases.Lookup('IMPROVEMENTS',i),
CityName(MyRO.Wonder[i].CityID)]);
Kind:=mkOkHelp;
HelpKind:=hkImp;
HelpNo:=i;
BigIcon:=i;
ShowModal;
end
end
else if (MyRO.Wonder[i].EffectiveOwner<>MyData.ToldWonders[i].EffectiveOwner)
and (MyRO.Wonder[i].CityID>-2) then
if MyRO.Wonder[i].EffectiveOwner<0 then
begin
if i<>woMir then with MessgExDlg do
begin {tell about expired wonders}
MessgText:=Format(Phrases.Lookup('WONDEREXP'),
[Phrases.Lookup('IMPROVEMENTS',i),
CityName(MyRO.Wonder[i].CityID)]);
Kind:=mkOkHelp;
HelpKind:=hkImp;
HelpNo:=i;
BigIcon:=i;
ShowModal;
end
end
else if (MyData.ToldWonders[i].EffectiveOwner>=0) and not OwnWonder then
with MessgExDlg do
begin {tell about capture of wonders}
s:=Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('WONDERCAPT');
MessgText:=Format(s, [Phrases.Lookup('IMPROVEMENTS',i),
CityName(MyRO.Wonder[i].CityID)]);
Kind:=mkOkHelp;
HelpKind:=hkImp;
HelpNo:=i;
BigIcon:=i;
ShowModal;
end;
end;
move(MyRO.Wonder,MyData.ToldWonders,SizeOf(MyData.ToldWonders));
// AnyShipChanged:=false;
for p1:=0 to nPl-1 do
if (p1<>me) and (1 shl p1 and MyRO.Alive<>0) then
begin // check whether enemy ship changed
ShipMore:=-1;
for i:=0 to nShipPart-1 do
if (MyRO.Ship[p1].Parts[i]>MyData.ToldShip[p1].Parts[i])
and (MyData.ToldShip[p1].Parts[i]<ShipNeed[i]) then
ShipMore:=i;
if ShipMore>=0 then with MessgExDlg do
begin
MessgText:=Tribe[p1].TPhrase('SHIPBUILT');
Kind:=mkOK;
BigIcon:=imShipComp+ShipMore;
ShowModal;
// AnyShipChanged:=true;
end
end;
move(MyRO.Ship,MyData.ToldShip,SizeOf(MyData.ToldShip));
if MyRO.Turn=MyData.ColdWarStart+ColdWarTurns then
begin
SimpleMessage(Phrases.Lookup('COLDWAREND'),''{!!!Sound});
MyData.ColdWarStart:=-ColdWarTurns-1
end;
TellNewModels;
end; // ClientMode<>cResume
if ClientMode=cTurn then
begin
NewResearch:=-1;
if MyRO.Happened and phTech<>0 then
if (MyData.FarTech<>adNone) and (MyRO.Tech[MyData.FarTech]>=tsApplicable) then
MyData.FarTech:=adNone
else if MyData.FarTech<>adNone then
NewResearch:=AutoResearch(MyData.FarTech);
// tell about new techs
if MyRO.TestFlags and tfAllTechs=0 then for ad:=0 to nAdv-1 do
if ((MyRO.Tech[ad]>=tsApplicable)<>(MyData.ToldTech[ad]>=tsApplicable))
or (ad in FutureTech ) and (MyRO.Tech[ad]<>MyData.ToldTech[ad]) then
with MessgExDlg do
begin
if not (ad in FutureTech ) and (MyRO.Tech[ad]=tsGrLibrary) then
Play('GRLIB')
else Play('RESEARCH');
if not (ad in FutureTech ) and (MyRO.Tech[ad]=tsGrLibrary) then
Item:='GRLIB_GENERAL'
else Item:='RESEARCH_GENERAL';
Item2:=Phrases.Lookup('ADVANCES',ad);
if ad in FutureTech then Item2:=Item2+' '+IntToStr(MyRO.Tech[ad]);
MessgText:=Format(Phrases.Lookup(Item),[Item2]);
if (MyRO.Tech[ad]=tsResearched) and (NewResearch>=0) then
MessgText:=MessgText+'\\'+Format(Phrases.Lookup('RESEARCH_START'),
[Phrases.Lookup('ADVANCES',NewResearch)]);
Kind:=mkOkHelp;
HelpKind:=hkAdv;
HelpNo:=ad;
for i:=0 to nImp-1 do if Imp[i].Preq=ad then
include(Icons,i);
for Domain:=0 to nDomains-1 do
for i:=0 to nUpgrade-1 do if upgrade[Domain,i].Preq=ad then
begin include(Icons,86+Domain); Break end;
for i:=0 to nFeature-1 do if Feature[i].Preq=ad then
for Domain:=0 to nDomains-1 do
if 1 shl Domain and Feature[i].Domains<>0 then
include(Icons,86+Domain);
for i:=2 to nGov-1 do if GovPreq[i]=ad then
include(Icons,imPalace);
if Icons=[] then Icons:=[24+Age];
ShowModal;
MyData.ToldTech[ad]:=MyRO.Tech[ad];
end;
if MyRO.Happened and phTech<>0 then
begin
if NewResearch<0 then
begin {research complete -- select new}
repeat
SelectDlg.Caption:=Phrases.Lookup('TITLE_TECHSELECT');
SelectDlg.Kind:=kAdvance;
SelectDlg.ShowModal;
NewResearch:=SelectDlg.result;
if NewResearch=adMilitary then
begin
DraftDlg.ShowModal;
if DraftDlg.ModalResult<>mrOK then
Tribe[me].ModelPicture[MyRO.nModel].HGr:=0
end
until(NewResearch<>adMilitary) or (DraftDlg.ModalResult=mrOK);
if NewResearch=adMilitary then InitMyModel(MyRO.nModel,true)
else if not (NewResearch in FutureTech) then
MyData.FarTech:=NewResearch;
if MyData.FarTech<>adNone then
begin
NewResearch:=AutoResearch(MyData.FarTech);
if NewResearch<>MyData.FarTech then
SimpleMessage(Format(Phrases.Lookup('RESEARCH_START'),
[Phrases.Lookup('ADVANCES',NewResearch)]),'')
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -