Changeset 447 for trunk/LocalPlayer/Diplomacy.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Diplomacy.pas
r38 r447 7 7 8 8 function DipCommandToString(pSender, pTarget, Treaty, OppCommand, 9 Command: integer; const OppOffer, Offer: TOffer): string;9 Command: Integer; const OppOffer, Offer: TOffer): string; 10 10 11 11 implementation … … 16 16 function DipCommandToString; 17 17 18 function PriceToString( p, Price: integer): string;18 function PriceToString(P, Price: Integer): string; 19 19 begin 20 20 case Price and opMask of 21 21 opChoose: 22 result := Phrases.Lookup('PRICE_CHOOSE');22 Result := Phrases.Lookup('PRICE_CHOOSE'); 23 23 opCivilReport: 24 result := Tribe[p].TPhrase('PRICE_CIVIL');24 Result := Tribe[P].TPhrase('PRICE_CIVIL'); 25 25 opMilReport: 26 result := Tribe[p].TPhrase('PRICE_MIL');26 Result := Tribe[P].TPhrase('PRICE_MIL'); 27 27 opMap: 28 result := Tribe[p].TPhrase('PRICE_MAP');28 Result := Tribe[P].TPhrase('PRICE_MAP'); 29 29 opTreaty: 30 30 { if Price-opTreaty<Treaty then 31 31 case Treaty of 32 trPeace: result:=Phrases.Lookup('FRENDTREATY_PEACE');33 trFriendlyContact: result:=Phrases.Lookup('FRENDTREATY_FRIENDLY');34 trAlliance: result:=Phrases.Lookup('FRENDTREATY_ALLIANCE');35 end 36 else } result := Phrases.Lookup('TREATY', Price - opTreaty);32 trPeace: Result:=Phrases.Lookup('FRENDTREATY_PEACE'); 33 trFriendlyContact: Result:=Phrases.Lookup('FRENDTREATY_FRIENDLY'); 34 trAlliance: Result:=Phrases.Lookup('FRENDTREATY_ALLIANCE'); 35 end 36 else } Result := Phrases.Lookup('TREATY', Price - opTreaty); 37 37 opShipParts: 38 38 case Price shr 16 and $F of 39 39 0: 40 result := Format(Phrases.Lookup('PRICE_SHIPCOMP'),40 Result := Format(Phrases.Lookup('PRICE_SHIPCOMP'), 41 41 [Price and $FFFF]); 42 42 1: 43 result := Format(Phrases.Lookup('PRICE_SHIPPOW'),43 Result := Format(Phrases.Lookup('PRICE_SHIPPOW'), 44 44 [Price and $FFFF]); 45 45 2: 46 result := Format(Phrases.Lookup('PRICE_SHIPHAB'),46 Result := Format(Phrases.Lookup('PRICE_SHIPHAB'), 47 47 [Price and $FFFF]); 48 48 end; 49 49 opMoney: 50 result := Format('%d%%c', [Price - opMoney]);50 Result := Format('%d%%c', [Price - opMoney]); 51 51 opTribute: 52 result := Format(Phrases.Lookup('PRICE_TRIBUTE'), [Price - opTribute]);52 Result := Format(Phrases.Lookup('PRICE_TRIBUTE'), [Price - opTribute]); 53 53 opTech: 54 result := Phrases.Lookup('ADVANCES', Price - opTech);54 Result := Phrases.Lookup('ADVANCES', Price - opTech); 55 55 opAllTech: 56 result := Tribe[p].TPhrase('PRICE_ALLTECH');56 Result := Tribe[P].TPhrase('PRICE_ALLTECH'); 57 57 opModel: 58 result := Tribe[p].ModelName[Price - opModel];58 Result := Tribe[P].ModelName[Price - opModel]; 59 59 opAllModel: 60 result := Tribe[p].TPhrase('PRICE_ALLMODEL');60 Result := Tribe[P].TPhrase('PRICE_ALLMODEL'); 61 61 { opCity: 62 result:=Format(TPhrase('PRICE_CITY',p),[CityName(Price-opCity)]); }62 Result:=Format(TPhrase('PRICE_CITY',P),[CityName(Price-opCity)]); } 63 63 end 64 64 end; 65 65 66 66 var 67 i: integer;67 I: Integer; 68 68 sAdd, sDeliver, sCost: string; 69 DoIntro: boolean;69 DoIntro: Boolean; 70 70 begin 71 71 DoIntro := OppCommand = scDipStart; … … 75 75 case Treaty of 76 76 trPeace: 77 result := Phrases.Lookup('FRCANCELTREATY_PEACE');77 Result := Phrases.Lookup('FRCANCELTREATY_PEACE'); 78 78 trFriendlyContact: 79 result := Phrases.Lookup('FRCANCELTREATY_FRIENDLY');79 Result := Phrases.Lookup('FRCANCELTREATY_FRIENDLY'); 80 80 trAlliance: 81 result := Phrases.Lookup('FRCANCELTREATY_ALLIANCE');82 end; 83 DoIntro := false;81 Result := Phrases.Lookup('FRCANCELTREATY_ALLIANCE'); 82 end; 83 DoIntro := False; 84 84 end; 85 85 scDipNotice: 86 result := Phrases.Lookup('FRNOTICE');86 Result := Phrases.Lookup('FRNOTICE'); 87 87 scDipAccept: 88 88 begin 89 89 if (OppOffer.nDeliver + OppOffer.nCost = 1) and 90 90 (OppOffer.Price[0] and opMask = opTreaty) and 91 ( integer(OppOffer.Price[0] - opTreaty) > Treaty) then91 (Integer(OppOffer.Price[0] - opTreaty) > Treaty) then 92 92 // simple treaty offer 93 93 { if OppOffer.Price[0]-opTreaty=trCeaseFire then 94 result:=Tribe[pTarget].TPhrase('FRACCEPTCEASEFIRE')95 else } result := Tribe[pTarget].TPhrase('FRACCEPTTREATY')94 Result:=Tribe[pTarget].TPhrase('FRACCEPTCEASEFIRE') 95 else } Result := Tribe[pTarget].TPhrase('FRACCEPTTREATY') 96 96 else if OppOffer.nDeliver = 0 then 97 result := Tribe[pSender].TPhrase('FRACCEPTDEMAND_STRONG')97 Result := Tribe[pSender].TPhrase('FRACCEPTDEMAND_STRONG') 98 98 else if OppOffer.nCost = 0 then 99 result := Tribe[pSender].TPhrase('FRACCEPTPRESENT')99 Result := Tribe[pSender].TPhrase('FRACCEPTPRESENT') 100 100 else 101 result := Tribe[pSender].TPhrase('FRACCEPTOFFER');101 Result := Tribe[pSender].TPhrase('FRACCEPTOFFER'); 102 102 end; 103 103 scDipBreak: 104 104 begin 105 result := Tribe[pTarget].TPhrase('FRBREAK');106 DoIntro := false;105 Result := Tribe[pTarget].TPhrase('FRBREAK'); 106 DoIntro := False; 107 107 end; 108 108 scDipOffer: 109 109 begin 110 result := '';110 Result := ''; 111 111 if (OppCommand = scDipOffer) and 112 112 ((OppOffer.nDeliver > 0) or (OppOffer.nCost > 0)) and … … 115 115 if (OppOffer.nDeliver + OppOffer.nCost = 1) and 116 116 (OppOffer.Price[0] and opMask = opTreaty) and 117 ( integer(OppOffer.Price[0] - opTreaty) > Treaty) then117 (Integer(OppOffer.Price[0] - opTreaty) > Treaty) then 118 118 // simple treaty offer 119 result := Tribe[pSender].TPhrase('FRNOTACCEPTTREATY') + '\'119 Result := Tribe[pSender].TPhrase('FRNOTACCEPTTREATY') + '\' 120 120 else if OppOffer.nDeliver = 0 then 121 result := Tribe[pSender].TPhrase('FRNOTACCEPTDEMAND_STRONG') + '\'121 Result := Tribe[pSender].TPhrase('FRNOTACCEPTDEMAND_STRONG') + '\' 122 122 else if OppOffer.nCost = 0 then 123 result := Tribe[pSender].TPhrase('FRNOTACCEPTPRESENT') + '\';123 Result := Tribe[pSender].TPhrase('FRNOTACCEPTPRESENT') + '\'; 124 124 end; 125 125 126 126 sDeliver := ''; 127 for i:= 0 to Offer.nDeliver - 1 do128 begin 129 sAdd := PriceToString(pSender, Offer.Price[ i]);130 if i= 0 then127 for I := 0 to Offer.nDeliver - 1 do 128 begin 129 sAdd := PriceToString(pSender, Offer.Price[I]); 130 if I = 0 then 131 131 sDeliver := sAdd 132 132 else … … 134 134 end; 135 135 sCost := ''; 136 for i:= 0 to Offer.nCost - 1 do137 begin 138 sAdd := PriceToString(pTarget, Offer.Price[Offer.nDeliver + i]);139 if i= 0 then136 for I := 0 to Offer.nCost - 1 do 137 begin 138 sAdd := PriceToString(pTarget, Offer.Price[Offer.nDeliver + I]); 139 if I = 0 then 140 140 sCost := sAdd 141 141 else … … 147 147 if (OppCommand = scDipOffer) and 148 148 ((OppOffer.nDeliver = 0) and (OppOffer.nCost = 0)) then 149 result := Tribe[pTarget].TPhrase('FRBYE')149 Result := Tribe[pTarget].TPhrase('FRBYE') 150 150 else 151 151 begin 152 if ( result = '') and (OppCommand = scDipOffer) and152 if (Result = '') and (OppCommand = scDipOffer) and 153 153 ((OppOffer.nDeliver > 0) or (OppOffer.nCost > 0)) then 154 154 begin 155 155 if (OppOffer.nDeliver = 1) and (OppOffer.Price[0] = opChoose) and 156 156 not Phrases2FallenBackToEnglish then 157 result := Tribe[pSender].TString157 Result := Tribe[pSender].TString 158 158 (Phrases2.Lookup('FRNOTACCEPTANYOFFER')) + ' ' 159 159 else if (OppOffer.nCost = 1) and 160 160 (OppOffer.Price[OppOffer.nDeliver] = opChoose) and not Phrases2FallenBackToEnglish 161 161 then 162 result := Tribe[pSender].TString162 Result := Tribe[pSender].TString 163 163 (Phrases2.Lookup('FRNOTACCEPTANYWANT')) + ' ' 164 164 else 165 result := Tribe[pSender].TPhrase('FRNOTACCEPTOFFER') + ' ';165 Result := Tribe[pSender].TPhrase('FRNOTACCEPTOFFER') + ' '; 166 166 end; 167 result := result + Phrases.Lookup('FRDONE');168 DoIntro := false167 Result := Result + Phrases.Lookup('FRDONE'); 168 DoIntro := False 169 169 end 170 170 end 171 171 else if (Offer.nDeliver + Offer.nCost = 1) and 172 172 (Offer.Price[0] and opMask = opTreaty) and 173 ( integer(Offer.Price[0] - opTreaty) > Treaty) then173 (Integer(Offer.Price[0] - opTreaty) > Treaty) then 174 174 // simple treaty offer 175 175 begin … … 177 177 // trCeaseFire: result:=result+Tribe[pTarget].TPhrase('FRCEASEFIRE'); 178 178 trPeace: 179 result := result + Tribe[pTarget].TPhrase('FRPEACE');179 Result := Result + Tribe[pTarget].TPhrase('FRPEACE'); 180 180 trFriendlyContact: 181 result := result + Tribe[pTarget].TPhrase('FRFRIENDLY');181 Result := Result + Tribe[pTarget].TPhrase('FRFRIENDLY'); 182 182 trAlliance: 183 result := result + Tribe[pTarget].TPhrase('FRALLIANCE');183 Result := Result + Tribe[pTarget].TPhrase('FRALLIANCE'); 184 184 end 185 185 end … … 188 188 if (Treaty >= trFriendlyContact) and not Phrases2FallenBackToEnglish 189 189 then 190 result := result +190 Result := Result + 191 191 Format(Tribe[pTarget].TString(Phrases2.Lookup('FRDEMAND_SOFT') 192 192 ), [sCost]) 193 193 else 194 194 begin 195 result := result +195 Result := Result + 196 196 Format(Tribe[pTarget].TPhrase('FRDEMAND_STRONG'), [sCost]); 197 DoIntro := false197 DoIntro := False 198 198 end 199 199 end 200 200 else if Offer.nCost = 0 then // present 201 result := result + Format(Tribe[pTarget].TPhrase('FRPRESENT'),201 Result := Result + Format(Tribe[pTarget].TPhrase('FRPRESENT'), 202 202 [sDeliver]) 203 203 else if (Offer.nDeliver = 1) and (Offer.Price[0] = opChoose) then 204 result := result + Format(Phrases.Lookup('FRDELCHOICE'), [sCost])204 Result := Result + Format(Phrases.Lookup('FRDELCHOICE'), [sCost]) 205 205 else if (Offer.nCost = 1) and (Offer.Price[Offer.nDeliver] = opChoose) 206 206 then 207 result := result + Format(Phrases.Lookup('FRCOSTCHOICE'), [sDeliver])207 Result := Result + Format(Phrases.Lookup('FRCOSTCHOICE'), [sDeliver]) 208 208 else 209 result := result + Format(Phrases.Lookup('FROFFER'),209 Result := Result + Format(Phrases.Lookup('FROFFER'), 210 210 [sDeliver, sCost]); 211 211 end; … … 213 213 if DoIntro then 214 214 if Treaty < trPeace then 215 result := Tribe[pSender].TPhrase('FRSTART_NOTREATY') + ' ' + result215 Result := Tribe[pSender].TPhrase('FRSTART_NOTREATY') + ' ' + Result 216 216 else 217 result := Tribe[pSender].TPhrase('FRSTART_PEACE') + ' ' + result217 Result := Tribe[pSender].TPhrase('FRSTART_PEACE') + ' ' + Result 218 218 end; 219 219
Note:
See TracChangeset
for help on using the changeset viewer.