Changeset 447 for trunk/LocalPlayer/Select.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Select.pas
r442 r447 31 31 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 32 32 procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 33 x, y: integer);33 X, Y: Integer); 34 34 procedure FormCreate(Sender: TObject); 35 35 procedure FormDestroy(Sender: TObject); 36 36 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 37 Shift: TShiftState; x, y: integer);37 Shift: TShiftState; X, Y: Integer); 38 38 procedure FormPaint(Sender: TObject); 39 39 procedure CloseBtnClick(Sender: TObject); 40 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);40 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 41 41 procedure FormShow(Sender: TObject); 42 42 procedure ModeBtnClick(Sender: TObject); 43 43 procedure ToggleBtnClick(Sender: TObject); 44 procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);44 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 45 45 procedure PlayerClick(Sender: TObject); 46 46 private … … 59 59 Lines: array [0 .. MaxLayer - 1] of Integer; 60 60 FirstShrinkedLine: array [0 .. MaxLayer - 1] of Integer; 61 code: array [0 .. MaxLayer - 1, 0 .. 4095] of Integer;61 Code: array [0 .. MaxLayer - 1, 0 .. 4095] of Integer; 62 62 Column: array [0 .. nPl - 1] of Integer; 63 63 Closable: Boolean; … … 66 66 procedure ScrollBarUpdate(Sender: TObject); 67 67 procedure InitLines; 68 procedure line(ca: TCanvas; l: integer; NonText, lit: boolean);69 function RenameCity(cix: integer): boolean;70 function RenameModel(mix: integer): boolean;68 procedure Line(ca: TCanvas; L: Integer; NonText, lit: Boolean); 69 function RenameCity(cix: Integer): Boolean; 70 function RenameModel(mix: Integer): Boolean; 71 71 procedure OnScroll(var Msg: TMessage); message WM_VSCROLL; 72 72 procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE; 73 73 public 74 result: integer;75 function OnlyChoice(TestKind: TListKind): integer;74 Result: Integer; 75 function OnlyChoice(TestKind: TListKind): Integer; 76 76 // -2=empty, -1=ambiguous, other=only choice 77 77 procedure OffscreenPaint; override; 78 78 procedure ShowNewContent(NewMode: TWindowMode; ListKind: TListKind); 79 procedure ShowNewContent_CityProject(NewMode: TWindowMode; cix: integer);80 procedure ShowNewContent_MilReport(NewMode: TWindowMode; p: integer);79 procedure ShowNewContent_CityProject(NewMode: TWindowMode; cix: Integer); 80 procedure ShowNewContent_MilReport(NewMode: TWindowMode; P: Integer); 81 81 procedure EcoChange; 82 82 procedure TechChange; … … 135 135 procedure TListDlg.CloseBtnClick(Sender: TObject); 136 136 begin 137 Closable := true;137 Closable := True; 138 138 Close; 139 139 end; 140 140 141 procedure TListDlg.FormCloseQuery(Sender: TObject; var CanClose: boolean);141 procedure TListDlg.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 142 142 begin 143 143 CanClose := Closable or not(Kind in MustChooseKind); … … 149 149 if ScrollBar.Process(Msg) then begin 150 150 Selected := -2; 151 SmartUpdateContent( true);151 SmartUpdateContent(True); 152 152 end; 153 153 } … … 158 158 if not Closable and (Selected <> -2) then 159 159 begin 160 line(Canvas, Selected, false, false);160 Line(Canvas, Selected, False, False); 161 161 Selected := -2; 162 162 end; … … 165 165 procedure TListDlg.FormPaint(Sender: TObject); 166 166 var 167 s: string;167 S: string; 168 168 begin 169 169 inherited; 170 170 Canvas.Font.Assign(UniFont[ftNormal]); 171 171 if Selected <> -2 then 172 line(Canvas, Selected, false, true);173 s:= '';172 Line(Canvas, Selected, False, True); 173 S := ''; 174 174 if (Kind = kAdvance) and (MyData.FarTech <> adNone) then 175 s:= Format(Phrases.Lookup('TECHFOCUS'),175 S := Format(Phrases.Lookup('TECHFOCUS'), 176 176 [Phrases.Lookup('ADVANCES', MyData.FarTech)]) 177 177 else if Kind = kModels then 178 s := Tribe[me].TPhrase('SHORTNAME')178 S := Tribe[Me].TPhrase('SHORTNAME') 179 179 else if Kind = kEModels then 180 s:= Tribe[pView].TPhrase('SHORTNAME') + ' (' +180 S := Tribe[pView].TPhrase('SHORTNAME') + ' (' + 181 181 TurnToString(MyRO.EnemyReport[pView].TurnOfMilReport) + ')'; 182 if s<> '' then182 if S <> '' then 183 183 LoweredTextOut(Canvas, -1, MainTexture, 184 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, 31, s);184 (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, 31, S); 185 185 if not MultiPage and (Kind in [kProject, kAdvance, kFarAdvance]) and not Phrases2FallenBackToEnglish 186 186 then 187 187 begin 188 s:= Phrases2.Lookup('SHIFTCLICK');188 S := Phrases2.Lookup('SHIFTCLICK'); 189 189 LoweredTextOut(Canvas, -2, MainTexture, 190 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, ClientHeight - 29, s);191 end; 192 end; 193 194 procedure TListDlg. line(ca: TCanvas; l: integer; NonText, lit: boolean);190 (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, ClientHeight - 29, S); 191 end; 192 end; 193 194 procedure TListDlg.Line(ca: TCanvas; L: Integer; NonText, lit: Boolean); 195 195 // paint a line 196 196 197 procedure DisplayProject( x, y, pix: integer);197 procedure DisplayProject(X, Y, pix: Integer); 198 198 begin 199 199 if pix and (cpType or cpImp) = 0 then 200 with Tribe[ me].ModelPicture[pix and cpIndex] do201 Sprite( offscreen, HGr, x, y, 64, 48, pix mod 10 * 65 + 1,200 with Tribe[Me].ModelPicture[pix and cpIndex] do 201 Sprite(Offscreen, HGr, X, Y, 64, 48, pix mod 10 * 65 + 1, 202 202 pix div 10 * 49 + 1) 203 203 else 204 204 begin 205 Frame( offscreen.Canvas, x + (16 - 1), y + (16 - 2), x+ (16 + xSizeSmall),206 y+ (16 - 1 + ySizeSmall), MainTexture.ColorBevelLight,205 Frame(Offscreen.Canvas, X + (16 - 1), Y + (16 - 2), X + (16 + xSizeSmall), 206 Y + (16 - 1 + ySizeSmall), MainTexture.ColorBevelLight, 207 207 MainTexture.ColorBevelShade); 208 208 if pix and cpType = 0 then 209 209 if (pix and cpIndex = imPalace) and (MyRO.Government <> gAnarchy) then 210 BitBltCanvas( offscreen.Canvas, x + 16, y+ (16 - 1), xSizeSmall,210 BitBltCanvas(Offscreen.Canvas, X + 16, Y + (16 - 1), xSizeSmall, 211 211 ySizeSmall, SmallImp.Canvas, (MyRO.Government - 1) * 212 212 xSizeSmall, ySizeSmall) 213 213 else 214 BitBltCanvas( offscreen.Canvas, x + 16, y+ (16 - 1), xSizeSmall,214 BitBltCanvas(Offscreen.Canvas, X + 16, Y + (16 - 1), xSizeSmall, 215 215 ySizeSmall, SmallImp.Canvas, pix and cpIndex mod 7 * 216 216 xSizeSmall, (pix and cpIndex + SystemIconLines * 7) div 7 * 217 217 ySizeSmall) 218 218 else 219 BitBltCanvas( offscreen.Canvas, x + 16, y+ (16 - 1), xSizeSmall,219 BitBltCanvas(Offscreen.Canvas, X + 16, Y + (16 - 1), xSizeSmall, 220 220 ySizeSmall, SmallImp.Canvas, (3 + pix and cpIndex) * 221 221 xSizeSmall, 0); … … 223 223 end; 224 224 225 procedure ReplaceText( x, y, Color: integer; s: string);225 procedure ReplaceText(X, Y, Color: Integer; S: string); 226 226 var 227 227 TextSize: TSize; … … 229 229 if ca = Canvas then 230 230 begin 231 TextSize.cx := BiColorTextWidth(ca, s);232 TextSize.cy := ca.TextHeight( s);233 if y+ TextSize.cy >= TitleHeight + InnerHeight then234 TextSize.cy := TitleHeight + InnerHeight - y;235 Fill(ca, x, y, TextSize.cx, TextSize.cy, (Maintexture.Width - ClientWidth)231 TextSize.cx := BiColorTextWidth(ca, S); 232 TextSize.cy := ca.TextHeight(S); 233 if Y + TextSize.cy >= TitleHeight + InnerHeight then 234 TextSize.cy := TitleHeight + InnerHeight - Y; 235 Fill(ca, X, Y, TextSize.cx, TextSize.cy, (Maintexture.Width - ClientWidth) 236 236 div 2, (Maintexture.Height - ClientHeight) div 2); 237 237 end; 238 LoweredTextOut(ca, Color, MainTexture, x, y, s);238 LoweredTextOut(ca, Color, MainTexture, X, Y, S); 239 239 end; 240 240 241 241 var 242 icon, ofs, x, y, y0, lix, i, j, TextColor, Available, first, test,243 FutureCount, growth, TrueFood, TrueProd: integer;242 icon, ofs, X, Y, y0, lix, I, J, TextColor, Available, first, Test, 243 FutureCount, growth, TrueFood, TrueProd: Integer; 244 244 CityReport: TCityReportNew; 245 245 mox: ^TModelInfo; 246 s, number: string;247 CanGrow: boolean;248 begin 249 lix := code[Layer, ScrollBar.Position + l];250 y0 := 2 + ( l+ 1) * LineDistance;251 if ScrollBar.Position + l>= FirstShrinkedLine[Layer] then252 ofs := (ScrollBar.Position + l- FirstShrinkedLine[Layer]) and 1 * 33246 S, number: string; 247 CanGrow: Boolean; 248 begin 249 lix := Code[Layer, ScrollBar.Position + L]; 250 y0 := 2 + (L + 1) * LineDistance; 251 if ScrollBar.Position + L >= FirstShrinkedLine[Layer] then 252 ofs := (ScrollBar.Position + L - FirstShrinkedLine[Layer]) and 1 * 33 253 253 else { if FirstShrinkedLine[Layer]<Lines[Layer] then } 254 254 ofs := 33; … … 257 257 with MyCity[lix] do 258 258 begin 259 x:= 104 - 76;260 y:= y0;259 X := 104 - 76; 260 Y := y0; 261 261 if ca = Canvas then 262 262 begin 263 x := x+ SideFrame;264 y := y+ TitleHeight;263 X := X + SideFrame; 264 Y := Y + TitleHeight; 265 265 end; 266 266 if lit then … … 268 268 else 269 269 TextColor := -1; 270 s:= CityName(ID);271 while BiColorTextWidth(ca, s) > CityNameSpace do272 delete(s, length(s), 1);273 ReplaceText( x + 15, y, TextColor, s);270 S := CityName(ID); 271 while BiColorTextWidth(ca, S) > CityNameSpace do 272 Delete(S, Length(S), 1); 273 ReplaceText(X + 15, Y, TextColor, S); 274 274 275 275 if NonText then 276 with offscreen.Canvas do276 with Offscreen.Canvas do 277 277 begin // city size 278 brush.Color := $000000;279 fillrect(rect(x - 4 - 11, y + 1, x - 4 + 13, y+ 21));280 brush.Color := $FFFFFF;281 fillrect(rect(x - 4 - 12, y, x - 4 + 12, y+ 20));282 brush.style := bsClear;278 Brush.Color := $000000; 279 FillRect(rect(X - 4 - 11, Y + 1, X - 4 + 13, Y + 21)); 280 Brush.Color := $FFFFFF; 281 FillRect(rect(X - 4 - 12, Y, X - 4 + 12, Y + 20)); 282 Brush.style := bsClear; 283 283 Font.Color := $000000; 284 s := inttostr(MyCity[lix].Size);285 TextOut( x - 4 - textwidth(s) div 2, y, s);284 S := IntToStr(MyCity[lix].Size); 285 TextOut(X - 4 - textwidth(S) div 2, Y, S); 286 286 end; 287 287 … … 289 289 begin 290 290 first := -1; 291 for j:= 0 to nCityEventPriority - 1 do292 if (Flags and CityRepMask and CityEventPriority[ j] <> 0) then293 begin 294 first := j;291 for J := 0 to nCityEventPriority - 1 do 292 if (Flags and CityRepMask and CityEventPriority[J] <> 0) then 293 begin 294 first := J; 295 295 Break; 296 296 end; 297 297 if first >= 0 then 298 298 begin 299 i:= 0;300 test := 1;301 while test < CityEventPriority[first] do302 begin 303 inc(i);304 inc(test, test);305 end; 306 s := CityEventName(i);299 I := 0; 300 Test := 1; 301 while Test < CityEventPriority[first] do 302 begin 303 Inc(I); 304 Inc(Test, Test); 305 end; 306 S := CityEventName(I); 307 307 { if CityEventPriority[first]=chNoGrowthWarning then 308 308 if Built[imAqueduct]=0 then 309 s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)])310 else begin s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); i:=17 end; }311 ReplaceText( x + (CityNameSpace + 4 + 40 + 18 + 8), y, TextColor, s);309 S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)]) 310 else begin S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); I:=17 end; } 311 ReplaceText(X + (CityNameSpace + 4 + 40 + 18 + 8), Y, TextColor, S); 312 312 if NonText then 313 313 begin 314 Sprite( offscreen, HGrSystem, 105 - 76 + CityNameSpace + 4 + 40,315 y0 + 1, 18, 18, 1 + i mod 3 * 19, 1 + idiv 3 * 19);316 x:= InnerWidth - 26;317 for j:= nCityEventPriority - 1 downto first + 1 do318 if (Flags and CityRepMask and CityEventPriority[ j] <> 0) then314 Sprite(Offscreen, HGrSystem, 105 - 76 + CityNameSpace + 4 + 40, 315 y0 + 1, 18, 18, 1 + I mod 3 * 19, 1 + I div 3 * 19); 316 X := InnerWidth - 26; 317 for J := nCityEventPriority - 1 downto first + 1 do 318 if (Flags and CityRepMask and CityEventPriority[J] <> 0) then 319 319 begin 320 i:= 0;321 test := 1;322 while test < CityEventPriority[j] do320 I := 0; 321 Test := 1; 322 while Test < CityEventPriority[J] do 323 323 begin 324 inc(i);325 inc(test, test);324 Inc(I); 325 Inc(Test, Test); 326 326 end; 327 if (CityEventPriority[ j] = chNoGrowthWarning) and327 if (CityEventPriority[J] = chNoGrowthWarning) and 328 328 (Built[imAqueduct] > 0) then 329 i:= 17;330 Sprite( offscreen, HGrSystem, x, y0 + 1, 18, 18,331 1 + i mod 3 * 19, 1 + idiv 3 * 19);332 dec(x, 20);329 I := 17; 330 Sprite(Offscreen, HGrSystem, X, y0 + 1, 18, 18, 331 1 + I mod 3 * 19, 1 + I div 3 * 19); 332 Dec(X, 20); 333 333 end; 334 334 end; … … 340 340 CityReport.HypoTaxRate := -1; 341 341 CityReport.HypoLuxuryRate := -1; 342 Server(sGetCityReportNew, me, lix, CityReport);342 Server(sGetCityReportNew, Me, lix, CityReport); 343 343 TrueFood := Food; 344 344 TrueProd := Prod; 345 if supervising then345 if Supervising then 346 346 begin // normalize city from after-turn state 347 dec(TrueFood, CityReport.FoodSurplus);347 Dec(TrueFood, CityReport.FoodSurplus); 348 348 if TrueFood < 0 then 349 349 TrueFood := 0; // shouldn't happen 350 dec(TrueProd, CityReport.Production);350 Dec(TrueProd, CityReport.Production); 351 351 if TrueProd < 0 then 352 352 TrueProd := 0; // shouldn't happen 353 353 end; 354 354 355 s:= ''; // disorder info355 S := ''; // disorder info 356 356 if Flags and chCaptured <> 0 then 357 s:= Phrases.Lookup('CITYEVENTS', 14)357 S := Phrases.Lookup('CITYEVENTS', 14) 358 358 else if CityReport.HappinessBalance < 0 then 359 s:= Phrases.Lookup('CITYEVENTS', 0);360 if s<> '' then359 S := Phrases.Lookup('CITYEVENTS', 0); 360 if S <> '' then 361 361 begin { disorder } 362 362 if NonText then 363 363 begin 364 DarkGradient( offscreen.Canvas, 99 + 31 + CityNameSpace + 4,364 DarkGradient(Offscreen.Canvas, 99 + 31 + CityNameSpace + 4, 365 365 y0 + 2, 131, 3); 366 366 ca.Font.Assign(UniFont[ftSmall]); 367 RisedTextout( offscreen.Canvas, 103 + CityNameSpace + 4 + 31,368 y0 + 1, s);367 RisedTextout(Offscreen.Canvas, 103 + CityNameSpace + 4 + 31, 368 y0 + 1, S); 369 369 ca.Font.Assign(UniFont[ftNormal]); 370 370 end; … … 373 373 begin 374 374 { s:=IntToStr(CityReport.FoodSurplus); 375 ReplaceText( x+(CityNameSpace+4+48)-BiColorTextWidth(ca,s),y,TextColor,s); }376 s := inttostr(CityReport.Science);377 ReplaceText( x+ CityNameSpace + 4 + 370 + 48 - BiColorTextWidth(ca,378 s), y, TextColor, s);379 s := inttostr(CityReport.Production);380 ReplaceText( x + CityNameSpace + 4 + 132 - BiColorTextWidth(ca, s), y,381 TextColor, s);375 ReplaceText(X+(CityNameSpace+4+48)-BiColorTextWidth(ca,S),Y,TextColor,S); } 376 S := IntToStr(CityReport.Science); 377 ReplaceText(X + CityNameSpace + 4 + 370 + 48 - BiColorTextWidth(ca, 378 S), Y, TextColor, S); 379 S := IntToStr(CityReport.Production); 380 ReplaceText(X + CityNameSpace + 4 + 132 - BiColorTextWidth(ca, S), Y, 381 TextColor, S); 382 382 if NonText then 383 383 begin 384 384 // Sprite(offscreen,HGrSystem,x+CityNameSpace+4+333+1,y+6,10,10,66,115); 385 Sprite( offscreen, HGrSystem, x+ CityNameSpace + 4 + 370 + 48 + 1,386 y+ 6, 10, 10, 77, 126);387 Sprite( offscreen, HGrSystem, x + CityNameSpace + 4 + 132 + 1, y+ 6,385 Sprite(Offscreen, HGrSystem, X + CityNameSpace + 4 + 370 + 48 + 1, 386 Y + 6, 10, 10, 77, 126); 387 Sprite(Offscreen, HGrSystem, X + CityNameSpace + 4 + 132 + 1, Y + 6, 388 388 10, 10, 88, 115); 389 389 end; 390 390 end; 391 s := inttostr(CityTaxBalance(lix, CityReport));392 ReplaceText( x + CityNameSpace + 4 + 370 - BiColorTextWidth(ca, s), y,393 TextColor, s);391 S := IntToStr(CityTaxBalance(lix, CityReport)); 392 ReplaceText(X + CityNameSpace + 4 + 370 - BiColorTextWidth(ca, S), Y, 393 TextColor, S); 394 394 // if Project and (cpImp+cpIndex)<>cpImp+imTrGoods then 395 395 // ReplaceText(x+CityNameSpace+4+333+1,y,TextColor,Format('%d/%d',[TrueProd,CityReport.ProjectCost])); 396 396 if NonText then 397 397 begin 398 Sprite( offscreen, HGrSystem, x + CityNameSpace + 4 + 370 + 1, y+ 6,398 Sprite(Offscreen, HGrSystem, X + CityNameSpace + 4 + 370 + 1, Y + 6, 399 399 10, 10, 132, 115); 400 400 … … 404 404 ((Size < NeedAqueductSize) or (Built[imAqueduct] = 1) and 405 405 (Size < NeedSewerSize) or (Built[imSewer] = 1)); 406 PaintRelativeProgressBar( offscreen.Canvas, 1, x+ 15 + CityNameSpace +407 4, y+ 7, 68, TrueFood, CutCityFoodSurplus(CityReport.FoodSurplus,406 PaintRelativeProgressBar(Offscreen.Canvas, 1, X + 15 + CityNameSpace + 407 4, Y + 7, 68, TrueFood, CutCityFoodSurplus(CityReport.FoodSurplus, 408 408 (MyRO.Government <> gAnarchy) and (Flags and chCaptured = 0), 409 409 MyRO.Government, Size), CityReport.Storage, CanGrow, MainTexture); … … 411 411 if Project <> cpImp + imTrGoods then 412 412 begin 413 DisplayProject(ofs + 104 - 76 + x- 28 + CityNameSpace + 4 + 206 -413 DisplayProject(ofs + 104 - 76 + X - 28 + CityNameSpace + 4 + 206 - 414 414 60, y0 - 15, Project); 415 415 … … 419 419 (Flags and chCaptured <> 0) then 420 420 growth := 0; 421 PaintRelativeProgressBar( offscreen.Canvas, 4,422 x + CityNameSpace + 4 + 304 - 60 + 9, y+ 7, 68, TrueProd, growth,423 CityReport.ProjectCost, true, MainTexture);421 PaintRelativeProgressBar(Offscreen.Canvas, 4, 422 X + CityNameSpace + 4 + 304 - 60 + 9, Y + 7, 68, TrueProd, growth, 423 CityReport.ProjectCost, True, MainTexture); 424 424 end; 425 425 end; … … 428 428 else if Kind in [kModels, kEModels] then 429 429 begin 430 x:= 104;431 y:= y0;430 X := 104; 431 Y := y0; 432 432 if ca = Canvas then 433 433 begin 434 x := x+ SideFrame;435 y := y+ TitleHeight;434 X := X + SideFrame; 435 Y := Y + TitleHeight; 436 436 end; 437 437 if lit then … … 442 442 begin 443 443 Available := 0; 444 for j:= 0 to MyRO.nUn - 1 do445 if (MyUn[ j].Loc >= 0) and (MyUn[j].mix = lix) then446 inc(Available);444 for J := 0 to MyRO.nUn - 1 do 445 if (MyUn[J].Loc >= 0) and (MyUn[J].mix = lix) then 446 Inc(Available); 447 447 if MainScreen.mNames.Checked then 448 s := Tribe[me].ModelName[lix]448 S := Tribe[Me].ModelName[lix] 449 449 else 450 s := Format(Tribe[me].TPhrase('GENMODEL'), [lix]);450 S := Format(Tribe[Me].TPhrase('GENMODEL'), [lix]); 451 451 if NonText then 452 452 DisplayProject(8 + ofs, y0 - 15, lix); … … 456 456 Available := MyRO.EnemyReport[pView].UnCount[lix]; 457 457 if MainScreen.mNames.Checked then 458 s:= Tribe[pView].ModelName[lix]458 S := Tribe[pView].ModelName[lix] 459 459 else 460 s:= Format(Tribe[pView].TPhrase('GENMODEL'), [lix]);460 S := Format(Tribe[pView].TPhrase('GENMODEL'), [lix]); 461 461 if NonText then 462 462 with Tribe[pView].ModelPicture[lix] do 463 Sprite( offscreen, HGr, 8 + ofs, y0 - 15, 64, 48, pix mod 10 * 65 + 1,463 Sprite(Offscreen, HGr, 8 + ofs, y0 - 15, 64, 48, pix mod 10 * 65 + 1, 464 464 pix div 10 * 49 + 1); 465 465 end; 466 466 if Available > 0 then 467 ReplaceText( x + 32 - BiColorTextWidth(ca, inttostr(Available)), y,468 TextColor, inttostr(Available));469 ReplaceText( x + 40, y, TextColor, s);467 ReplaceText(X + 32 - BiColorTextWidth(ca, IntToStr(Available)), Y, 468 TextColor, IntToStr(Available)); 469 ReplaceText(X + 40, Y, TextColor, S); 470 470 end 471 471 else … … 474 474 kAllEModels, kChooseEModel: 475 475 if lix = mixAll then 476 s:= Phrases.Lookup('PRICECAT_ALLMODEL')476 S := Phrases.Lookup('PRICECAT_ALLMODEL') 477 477 else 478 478 begin … … 480 480 if MainScreen.mNames.Checked then 481 481 begin 482 s:= Tribe[mox.Owner].ModelName[mox.mix];483 if (Kind = kAllEModels) and ( code[1, ScrollBar.Position + l] = 0) then484 s := Format(Tribe[mox.Owner].TPhrase('OWNED'), [s]);482 S := Tribe[mox.Owner].ModelName[mox.mix]; 483 if (Kind = kAllEModels) and (Code[1, ScrollBar.Position + L] = 0) then 484 S := Format(Tribe[mox.Owner].TPhrase('OWNED'), [S]); 485 485 end 486 486 else 487 s:= Format(Tribe[mox.Owner].TPhrase('GENMODEL'), [mox.mix]);487 S := Format(Tribe[mox.Owner].TPhrase('GENMODEL'), [mox.mix]); 488 488 if NonText then 489 489 with Tribe[mox.Owner].ModelPicture[mox.mix] do 490 Sprite( offscreen, HGr, 8 + ofs, y0 - 15, 64, 48,490 Sprite(Offscreen, HGr, 8 + ofs, y0 - 15, 64, 48, 491 491 pix mod 10 * 65 + 1, pix div 10 * 49 + 1); 492 492 end; 493 493 kChooseModel: 494 494 if lix = mixAll then 495 s:= Phrases.Lookup('PRICECAT_ALLMODEL')495 S := Phrases.Lookup('PRICECAT_ALLMODEL') 496 496 else 497 497 begin 498 s := Tribe[me].ModelName[lix];498 S := Tribe[Me].ModelName[lix]; 499 499 if NonText then 500 500 DisplayProject(8 + ofs, y0 - 15, lix); … … 503 503 begin 504 504 if lix and cpType <> 0 then 505 s:= Phrases.Lookup('CITYTYPE', lix and cpIndex)505 S := Phrases.Lookup('CITYTYPE', lix and cpIndex) 506 506 else if lix and cpImp = 0 then 507 507 with MyModel[lix and cpIndex] do 508 508 begin 509 s := Tribe[me].ModelName[lix and cpIndex];509 S := Tribe[Me].ModelName[lix and cpIndex]; 510 510 if lix and cpConscripts <> 0 then 511 s := Format(Phrases.Lookup('CONSCRIPTS'), [s]);511 S := Format(Phrases.Lookup('CONSCRIPTS'), [S]); 512 512 end 513 513 else 514 514 begin 515 s:= Phrases.Lookup('IMPROVEMENTS', lix and cpIndex);515 S := Phrases.Lookup('IMPROVEMENTS', lix and cpIndex); 516 516 if (Imp[lix and cpIndex].Kind in [ikNatLocal, ikNatGlobal]) and 517 517 (MyRO.NatBuilt[lix and cpIndex] > 0) or … … 519 519 (MyCity[cixProject].Built[imPower] + MyCity[cixProject].Built 520 520 [imHydro] + MyCity[cixProject].Built[imNuclear] > 0) then 521 s := Format(Phrases.Lookup('NATEXISTS'), [s]);521 S := Format(Phrases.Lookup('NATEXISTS'), [S]); 522 522 end; 523 523 if NonText then … … 527 527 begin 528 528 if lix = adAll then 529 s:= Phrases.Lookup('PRICECAT_ALLTECH')529 S := Phrases.Lookup('PRICECAT_ALLTECH') 530 530 else 531 531 begin 532 532 if lix = adNexus then 533 s:= Phrases.Lookup('NEXUS')533 S := Phrases.Lookup('NEXUS') 534 534 else if lix = adNone then 535 s:= Phrases.Lookup('NOFARTECH')535 S := Phrases.Lookup('NOFARTECH') 536 536 else if lix = adMilitary then 537 s:= Phrases.Lookup('INITUNIT')537 S := Phrases.Lookup('INITUNIT') 538 538 else 539 539 begin 540 s:= Phrases.Lookup('ADVANCES', lix);540 S := Phrases.Lookup('ADVANCES', lix); 541 541 if (Kind = kAdvance) and (lix in FutureTech) then 542 542 if MyRO.Tech[lix] < tsApplicable then 543 s := s+ ' 1'543 S := S + ' 1' 544 544 else 545 s := s + ' ' + inttostr(MyRO.Tech[lix] + 1);545 S := S + ' ' + IntToStr(MyRO.Tech[lix] + 1); 546 546 end; 547 if BiColorTextWidth(ca, s) > TechNameSpace + 8 then547 if BiColorTextWidth(ca, S) > TechNameSpace + 8 then 548 548 begin 549 549 repeat 550 delete(s, length(s), 1);551 until BiColorTextWidth(ca, s) <= TechNameSpace + 5;552 s := s+ '.';550 Delete(S, Length(S), 1); 551 until BiColorTextWidth(ca, S) <= TechNameSpace + 5; 552 S := S + '.'; 553 553 end; 554 554 … … 557 557 if lix = adNexus then 558 558 begin 559 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36),559 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36), 560 560 y0 + 20, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 561 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20, 223, 295)561 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 223, 295) 562 562 end 563 563 else if lix = adNone then 564 564 begin 565 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36),565 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36), 566 566 y0 + 20, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 567 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20, 260, 295)567 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 260, 295) 568 568 end 569 569 else if lix = adMilitary then 570 570 begin 571 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36),571 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, (8 + 16 + 36), 572 572 y0 + 20, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 573 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20, 38, 295)573 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 38, 295) 574 574 end 575 575 else 576 576 begin 577 Frame( offscreen.Canvas, (8 + 16 - 1), y0 - 1,577 Frame(Offscreen.Canvas, (8 + 16 - 1), y0 - 1, 578 578 (8 + 16 + xSizeSmall), y0 + ySizeSmall, 579 579 MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 580 580 if AdvIcon[lix] < 84 then 581 BitBltCanvas( offscreen.Canvas, (8 + 16), y0, xSizeSmall,581 BitBltCanvas(Offscreen.Canvas, (8 + 16), y0, xSizeSmall, 582 582 ySizeSmall, SmallImp.Canvas, 583 583 (AdvIcon[lix] + SystemIconLines * 7) mod 7 * xSizeSmall, … … 585 585 ySizeSmall) 586 586 else 587 Dump( offscreen, HGrSystem, (8 + 16), y0, 36, 20,587 Dump(Offscreen, HGrSystem, (8 + 16), y0, 36, 20, 588 588 1 + (AdvIcon[lix] - 84) mod 8 * 37, 589 589 295 + (AdvIcon[lix] - 84) div 8 * 21); 590 j:= AdvValue[lix] div 1000;591 BitBltCanvas( offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14,592 HGrSystem.Mask.Canvas, 127 + j* 15,590 J := AdvValue[lix] div 1000; 591 BitBltCanvas(Offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14, 592 HGrSystem.Mask.Canvas, 127 + J * 15, 593 593 85, SRCAND); 594 Sprite( offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14,595 127 + j* 15, 85);594 Sprite(Offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14, 595 127 + J * 15, 85); 596 596 end; 597 597 end; … … 600 600 if NonText and (Kind in [kAdvance, kScience]) then 601 601 begin // show research state 602 for j:= 0 to nColumn - 1 do602 for J := 0 to nColumn - 1 do 603 603 begin 604 604 FutureCount := 0; 605 if j= 0 then // own science605 if J = 0 then // own science 606 606 if lix = MyRO.ResearchTech then 607 607 begin 608 Server(sGetTechCost, me, 0, icon);608 Server(sGetTechCost, Me, 0, icon); 609 609 icon := 4 + MyRO.Research * 4 div icon; 610 610 if icon > 4 + 3 then … … 625 625 icon := -1 626 626 else 627 with MyRO.EnemyReport[Column[ j]]^ do // enemy science628 if (MyRO.Alive and (1 shl Column[ j]) <> 0) and627 with MyRO.EnemyReport[Column[J]]^ do // enemy science 628 if (MyRO.Alive and (1 shl Column[J]) <> 0) and 629 629 (TurnOfCivilReport >= 0) and (lix = ResearchTech) and 630 630 ((lix = adMilitary) or (lix in FutureTech) or … … 649 649 icon := -1; 650 650 if icon >= 0 then 651 Sprite( offscreen, HGrSystem, 104 - 33 + 15 + 3 + TechNameSpace +652 24 * j, y0 + 3, 14, 14, 67 + icon * 15, 85)651 Sprite(Offscreen, HGrSystem, 104 - 33 + 15 + 3 + TechNameSpace + 652 24 * J, y0 + 3, 14, 14, 67 + icon * 15, 85) 653 653 else if (Kind = kScience) and (FutureCount > 0) then 654 654 begin 655 number := inttostr(FutureCount);656 RisedTextout(ca, 104 - 33 + 15 + 10 + TechNameSpace + 24 * j-655 number := IntToStr(FutureCount); 656 RisedTextout(ca, 104 - 33 + 15 + 10 + TechNameSpace + 24 * J - 657 657 BiColorTextWidth(ca, number) div 2, y0, number); 658 658 end; … … 661 661 end; // kAdvance, kScience 662 662 kTribe: 663 s:= TribeNames[lix];663 S := TribeNames[lix]; 664 664 kShipPart: 665 665 begin 666 s:= Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' +667 inttostr(MyRO.Ship[me].Parts[lix]) + ')';666 S := Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' + 667 IntToStr(MyRO.Ship[Me].Parts[lix]) + ')'; 668 668 if NonText then 669 669 DisplayProject(8 + ofs, y0 - 15, cpImp + imShipComp + lix); … … 671 671 kEShipPart: 672 672 begin 673 s:= Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' +674 inttostr(MyRO.Ship[DipMem[me].pContact].Parts[lix]) + ')';673 S := Phrases.Lookup('IMPROVEMENTS', imShipComp + lix) + ' (' + 674 IntToStr(MyRO.Ship[DipMem[Me].pContact].Parts[lix]) + ')'; 675 675 if NonText then 676 676 DisplayProject(8 + ofs, y0 - 15, cpImp + imShipComp + lix); … … 678 678 kGov: 679 679 begin 680 s:= Phrases.Lookup('GOVERNMENT', lix);680 S := Phrases.Lookup('GOVERNMENT', lix); 681 681 if NonText then 682 682 begin 683 Frame( offscreen.Canvas, 8 + 16 - 1, y0 - 15 + (16 - 2),683 Frame(Offscreen.Canvas, 8 + 16 - 1, y0 - 15 + (16 - 2), 684 684 8 + 16 + xSizeSmall, y0 - 15 + (16 - 1 + ySizeSmall), 685 685 MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 686 BitBltCanvas( offscreen.Canvas, 8 + 16, y0 - 15 + (16 - 1),686 BitBltCanvas(Offscreen.Canvas, 8 + 16, y0 - 15 + (16 - 1), 687 687 xSizeSmall, ySizeSmall, SmallImp.Canvas, 688 688 (lix - 1) * xSizeSmall, ySizeSmall); … … 690 690 end; 691 691 kMission: 692 s:= Phrases.Lookup('SPYMISSION', lix);692 S := Phrases.Lookup('SPYMISSION', lix); 693 693 end; 694 694 case Kind of 695 695 kTribe, kMission: // center text 696 696 if Lines[0] > MaxLines then 697 x:= (InnerWidth - GetSystemMetrics(SM_CXVSCROLL)) div 2 -698 BiColorTextWidth(ca, s) div 2697 X := (InnerWidth - GetSystemMetrics(SM_CXVSCROLL)) div 2 - 698 BiColorTextWidth(ca, S) div 2 699 699 else 700 x := InnerWidth div 2 - BiColorTextWidth(ca, s) div 2;700 X := InnerWidth div 2 - BiColorTextWidth(ca, S) div 2; 701 701 kAdvance, kFarAdvance, kScience, kChooseTech, kChooseETech, 702 702 kStealTech, kGov: 703 x:= 104 - 33;703 X := 104 - 33; 704 704 kAllEModels: 705 x:= 104;705 X := 104; 706 706 else 707 x:= 104 + 15;707 X := 104 + 15; 708 708 end; 709 y:= y0;709 Y := y0; 710 710 if ca = Canvas then 711 711 begin 712 x := x+ SideFrame;713 y := y+ TitleHeight;712 X := X + SideFrame; 713 Y := Y + TitleHeight; 714 714 end; 715 715 if lit then … … 718 718 TextColor := -1; 719 719 { if Kind=kTribe then ReplaceText_Tribe(x,y,TextColor, 720 integer(TribeNames.Objects[lix]),s)721 else } ReplaceText( x, y, TextColor, s);720 Integer(TribeNames.Objects[lix]),S) 721 else } ReplaceText(X, Y, TextColor, S); 722 722 end; 723 723 end; … … 725 725 procedure TListDlg.OffscreenPaint; 726 726 var 727 i, j: integer;727 I, J: Integer; 728 728 begin 729 729 case Kind of 730 730 kCities: 731 Caption := Tribe[ me].TPhrase('TITLE_CITIES');731 Caption := Tribe[Me].TPhrase('TITLE_CITIES'); 732 732 kCityEvents: 733 733 Caption := Format(Phrases.Lookup('TITLE_EVENTS'), … … 736 736 737 737 inherited; 738 offscreen.Canvas.Font.Assign(UniFont[ftNormal]);738 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 739 739 FillOffscreen(0, 0, InnerWidth, InnerHeight); 740 with offscreen.Canvas do740 with Offscreen.Canvas do 741 741 begin 742 742 if Kind = kScience then 743 for i:= 1 to nColumn - 1 do743 for I := 1 to nColumn - 1 do 744 744 begin 745 745 Pen.Color := $000000; 746 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * i, 0);747 LineTo(104 - 33 + 15 + TechNameSpace + 24 * i, InnerHeight);748 MoveTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * i, 0);749 LineTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * i, InnerHeight);750 if MyRO.EnemyReport[Column[ i]].TurnOfCivilReport >= MyRO.Turn - 1 then751 begin 752 brush.Color := Tribe[Column[i]].Color;753 fillrect(rect(104 - 33 + 14 + TechNameSpace + 24 * i+ 1 * 2, 0,754 104 - 33 + 17 + TechNameSpace + 24 * i+ 8 * 2, InnerHeight));755 brush.style := bsClear;746 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * I, 0); 747 LineTo(104 - 33 + 15 + TechNameSpace + 24 * I, InnerHeight); 748 MoveTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * I, 0); 749 LineTo(104 - 33 + 15 + TechNameSpace + 9 * 2 + 24 * I, InnerHeight); 750 if MyRO.EnemyReport[Column[I]].TurnOfCivilReport >= MyRO.Turn - 1 then 751 begin 752 Brush.Color := Tribe[Column[I]].Color; 753 FillRect(rect(104 - 33 + 14 + TechNameSpace + 24 * I + 1 * 2, 0, 754 104 - 33 + 17 + TechNameSpace + 24 * I + 8 * 2, InnerHeight)); 755 Brush.style := bsClear; 756 756 end 757 757 else 758 758 begin // colored player columns 759 Pen.Color := Tribe[Column[ i]].Color;760 for j:= 1 to 8 do761 begin 762 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * i + j* 2, 0);763 LineTo(104 - 33 + 15 + TechNameSpace + 24 * i + j* 2, InnerHeight);764 end; 765 end; 766 end; 767 768 for i:= -1 to DispLines do769 if ( i + ScrollBar.Position >= 0) and (i+ ScrollBar.Position < Lines[Layer]) then770 Self. line(offscreen.Canvas, i, true, false);759 Pen.Color := Tribe[Column[I]].Color; 760 for J := 1 to 8 do 761 begin 762 MoveTo(104 - 33 + 15 + TechNameSpace + 24 * I + J * 2, 0); 763 LineTo(104 - 33 + 15 + TechNameSpace + 24 * I + J * 2, InnerHeight); 764 end; 765 end; 766 end; 767 768 for I := -1 to DispLines do 769 if (I + ScrollBar.Position >= 0) and (I + ScrollBar.Position < Lines[Layer]) then 770 Self.Line(Offscreen.Canvas, I, True, False); 771 771 end; 772 772 MarkUsedOffscreen(InnerWidth, 8 + 48 + DispLines * LineDistance); … … 774 774 775 775 procedure TListDlg.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 776 x, y: integer);776 X, Y: Integer); 777 777 var 778 i0, Sel0, iColumn, OldScienceNation, xScreen: integer;779 s: string;780 begin 781 y := y- TitleHeight;778 i0, Sel0, iColumn, OldScienceNation, xScreen: Integer; 779 S: string; 780 begin 781 Y := Y - TitleHeight; 782 782 i0 := ScrollBar.Position; 783 783 Sel0 := Selected; 784 if ( x >= SideFrame) and (x < SideFrame + InnerWidth) and (y>= 0) and785 ( y < InnerHeight) and (y mod LineDistance >= 4) and (ymod LineDistance < 20)784 if (X >= SideFrame) and (X < SideFrame + InnerWidth) and (Y >= 0) and 785 (Y < InnerHeight) and (Y mod LineDistance >= 4) and (Y mod LineDistance < 20) 786 786 then 787 Selected := ydiv LineDistance - 1787 Selected := Y div LineDistance - 1 788 788 else 789 789 Selected := -2; … … 794 794 begin 795 795 if Sel0 <> -2 then 796 line(Canvas, Sel0, false, false);796 Line(Canvas, Sel0, False, False); 797 797 if Selected <> -2 then 798 line(Canvas, Selected, false, true);798 Line(Canvas, Selected, False, True); 799 799 end; 800 800 … … 803 803 OldScienceNation := ScienceNation; 804 804 ScienceNation := -1; 805 if ( x>= SideFrame + (104 - 33 + 15 + TechNameSpace)) and806 (( x- SideFrame - (104 - 33 + 15 + TechNameSpace)) mod 24 <= 18) and807 ( y >= 0) and (y< InnerHeight) then805 if (X >= SideFrame + (104 - 33 + 15 + TechNameSpace)) and 806 ((X - SideFrame - (104 - 33 + 15 + TechNameSpace)) mod 24 <= 18) and 807 (Y >= 0) and (Y < InnerHeight) then 808 808 begin 809 iColumn := ( x- SideFrame - (104 - 33 + 15 + TechNameSpace)) div 24;809 iColumn := (X - SideFrame - (104 - 33 + 15 + TechNameSpace)) div 24; 810 810 if (iColumn >= 1) and (iColumn < nColumn) then 811 811 ScienceNation := Column[iColumn]; … … 818 818 if ScienceNation >= 0 then 819 819 begin 820 s:= Tribe[ScienceNation].TPhrase('SHORTNAME');820 S := Tribe[ScienceNation].TPhrase('SHORTNAME'); 821 821 if MyRO.Alive and (1 shl ScienceNation) = 0 then 822 s := Format(Phrases.Lookup('SCIENCEREPORT_EXTINCT'), [s]) // extinct822 S := Format(Phrases.Lookup('SCIENCEREPORT_EXTINCT'), [S]) // extinct 823 823 else if MyRO.EnemyReport[ScienceNation].TurnOfCivilReport < MyRO.Turn - 1 824 824 then 825 s := s+ ' (' + TurnToString(MyRO.EnemyReport[ScienceNation]825 S := S + ' (' + TurnToString(MyRO.EnemyReport[ScienceNation] 826 826 .TurnOfCivilReport) + ')'; // old report 827 xScreen := (ClientWidth - BiColorTextWidth(Canvas, s)) div 2;827 xScreen := (ClientWidth - BiColorTextWidth(Canvas, S)) div 2; 828 828 LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10, 829 ClientHeight - 29, s);829 ClientHeight - 29, S); 830 830 BitBltCanvas(ScienceNationDotBuffer.Canvas, 0, 0, ScienceNationDot.Width, 831 831 ScienceNationDot.Height, Canvas, xScreen - 10, ClientHeight - 27); … … 853 853 end; 854 854 855 function TListDlg.RenameCity(cix: integer): boolean;855 function TListDlg.RenameCity(cix: Integer): Boolean; 856 856 var 857 857 CityNameInfo: TCityNameInfo; … … 870 870 (CityNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt); 871 871 Server(CommandWithData(cSetCityName, CityNameInfo.GetCommandDataSize), 872 me, 0, CityNameInfo);872 Me, 0, CityNameInfo); 873 873 if CityDlg.Visible then 874 874 begin … … 882 882 end; 883 883 884 function TListDlg.RenameModel(mix: integer): boolean;884 function TListDlg.RenameModel(mix: Integer): Boolean; 885 885 var 886 886 ModelNameInfo: TModelNameInfo; 887 887 begin 888 888 InputDlg.Caption := Phrases.Lookup('TITLE_MODELNAME'); 889 InputDlg.EInput.Text := Tribe[ me].ModelName[mix];889 InputDlg.EInput.Text := Tribe[Me].ModelName[mix]; 890 890 InputDlg.CenterToRect(BoundsRect); 891 891 InputDlg.ShowModal; 892 892 if (InputDlg.ModalResult = mrOK) and (InputDlg.EInput.Text <> '') and 893 (InputDlg.EInput.Text <> Tribe[ me].ModelName[mix]) then893 (InputDlg.EInput.Text <> Tribe[Me].ModelName[mix]) then 894 894 begin 895 895 ModelNameInfo.mix := mix; … … 899 899 (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt); 900 900 Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize), 901 me, 0, ModelNameInfo);901 Me, 0, ModelNameInfo); 902 902 if UnitStatDlg.Visible then 903 903 begin … … 905 905 UnitStatDlg.Invalidate; 906 906 end; 907 result := true;907 Result := True; 908 908 end 909 909 else 910 result := false;910 Result := False; 911 911 end; 912 912 913 913 procedure TListDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 914 Shift: TShiftState; x, y: integer);914 Shift: TShiftState; X, Y: Integer); 915 915 var 916 lix: integer;916 lix: Integer; 917 917 begin 918 918 if ScrollBar.Position + Selected >= 0 then 919 lix := code[Layer, ScrollBar.Position + Selected];919 lix := Code[Layer, ScrollBar.Position + Selected]; 920 920 if Kind in [kScience, kCities, kCityEvents, kModels, kEModels, kAllEModels] 921 921 then 922 include(Shift, ssShift); // don't close list window922 Include(Shift, ssShift); // don't close list window 923 923 if (ssLeft in Shift) and not(ssShift in Shift) then 924 924 begin 925 925 if Selected <> -2 then 926 926 begin 927 result := lix;928 Closable := true;927 Result := lix; 928 Closable := True; 929 929 Close; 930 930 end; … … 937 937 MainScreen.ZoomToCity(MyCity[lix].Loc); 938 938 kCityEvents: 939 MainScreen.ZoomToCity(MyCity[lix].Loc, false, MyCity[lix].Flags and939 MainScreen.ZoomToCity(MyCity[lix].Loc, False, MyCity[lix].Flags and 940 940 CityRepMask); 941 941 kModels, kChooseModel: … … 944 944 kEModels: 945 945 UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, 946 code[1, ScrollBar.Position + Selected]);946 Code[1, ScrollBar.Position + Selected]); 947 947 kAllEModels, kChooseEModel: 948 948 if lix <> mixAll then … … 987 987 procedure TListDlg.InitLines; 988 988 var 989 required: array [0 .. nAdv - 1] of integer;990 991 procedure TryAddImpLine(Layer, Project: integer);992 begin 993 if Server(sSetCityProject - sExecute, me, cixProject, Project) >= rExecuted989 required: array [0 .. nAdv - 1] of Integer; 990 991 procedure TryAddImpLine(Layer, Project: Integer); 992 begin 993 if Server(sSetCityProject - sExecute, Me, cixProject, Project) >= rExecuted 994 994 then 995 995 begin 996 code[Layer, Lines[Layer]] := Project;997 inc(Lines[Layer]);996 Code[Layer, Lines[Layer]] := Project; 997 Inc(Lines[Layer]); 998 998 end; 999 999 end; … … 1001 1001 procedure SortTechs; 1002 1002 var 1003 i, j, swap: integer;1003 I, J, swap: Integer; 1004 1004 begin // sort by advancedness 1005 for i:= 0 to Lines[0] - 2 do1006 if code[0, i] < adMilitary then1007 for j := i+ 1 to Lines[0] - 1 do1008 if AdvValue[ code[0, i]] * nAdv + code[0, i] < AdvValue[code[0, j]] *1009 nAdv + code[0, j] then1010 begin 1011 swap := code[0, i];1012 code[0, i] := code[0, j];1013 code[0, j] := swap;1005 for I := 0 to Lines[0] - 2 do 1006 if Code[0, I] < adMilitary then 1007 for J := I + 1 to Lines[0] - 1 do 1008 if AdvValue[Code[0, I]] * nAdv + Code[0, I] < AdvValue[Code[0, J]] * 1009 nAdv + Code[0, J] then 1010 begin 1011 swap := Code[0, I]; 1012 Code[0, I] := Code[0, J]; 1013 Code[0, J] := swap; 1014 1014 end; 1015 1015 end; … … 1017 1017 procedure SortCities; 1018 1018 var 1019 i, j, swap: integer;1020 begin 1021 for i:= 0 to Lines[0] - 2 do1022 for j := i+ 1 to Lines[0] - 1 do1023 if CityName(MyCity[ code[0, i]].ID) > CityName(MyCity[code[0, j]].ID)1019 I, J, swap: Integer; 1020 begin 1021 for I := 0 to Lines[0] - 2 do 1022 for J := I + 1 to Lines[0] - 1 do 1023 if CityName(MyCity[Code[0, I]].ID) > CityName(MyCity[Code[0, J]].ID) 1024 1024 then 1025 1025 begin 1026 swap := code[0, i];1027 code[0, i] := code[0, j];1028 code[0, j] := swap;1026 swap := Code[0, I]; 1027 Code[0, I] := Code[0, J]; 1028 Code[0, J] := swap; 1029 1029 end; 1030 1030 end; 1031 1031 1032 1032 function ModelSortValue(const mi: TModelInfo; 1033 MixPlayers: boolean = false): integer;1034 begin 1035 result := (mi.Domain + 1) shl 28 - mi.mix;1033 MixPlayers: Boolean = False): Integer; 1034 begin 1035 Result := (mi.Domain + 1) shl 28 - mi.mix; 1036 1036 if MixPlayers then 1037 dec(result, ModelCode(mi) shl 16);1037 Dec(Result, ModelCode(mi) shl 16); 1038 1038 end; 1039 1039 1040 1040 procedure SortModels; 1041 1041 var 1042 i, j, swap: integer;1042 I, J, swap: Integer; 1043 1043 begin // sort by code[2] 1044 for i:= 0 to Lines[0] - 2 do1045 for j := i+ 1 to Lines[0] - 1 do1046 if code[2, i] > code[2, j] then1047 begin 1048 swap := code[0, i];1049 code[0, i] := code[0, j];1050 code[0, j] := swap;1051 swap := code[1, i];1052 code[1, i] := code[1, j];1053 code[1, j] := swap;1054 swap := code[2, i];1055 code[2, i] := code[2, j];1056 code[2, j] := swap;1057 end; 1058 end; 1059 1060 procedure MarkPreqs( i: integer);1061 begin 1062 required[ i] := 1;1063 if MyRO.Tech[ i] < tsSeen then1044 for I := 0 to Lines[0] - 2 do 1045 for J := I + 1 to Lines[0] - 1 do 1046 if Code[2, I] > Code[2, J] then 1047 begin 1048 swap := Code[0, I]; 1049 Code[0, I] := Code[0, J]; 1050 Code[0, J] := swap; 1051 swap := Code[1, I]; 1052 Code[1, I] := Code[1, J]; 1053 Code[1, J] := swap; 1054 swap := Code[2, I]; 1055 Code[2, I] := Code[2, J]; 1056 Code[2, J] := swap; 1057 end; 1058 end; 1059 1060 procedure MarkPreqs(I: Integer); 1061 begin 1062 required[I] := 1; 1063 if MyRO.Tech[I] < tsSeen then 1064 1064 begin 1065 if (AdvPreq[ i, 0] >= 0) then1066 MarkPreqs(AdvPreq[ i, 0]);1067 if (AdvPreq[ i, 1] >= 0) then1068 MarkPreqs(AdvPreq[ i, 1]);1065 if (AdvPreq[I, 0] >= 0) then 1066 MarkPreqs(AdvPreq[I, 0]); 1067 if (AdvPreq[I, 1] >= 0) then 1068 MarkPreqs(AdvPreq[I, 1]); 1069 1069 end; 1070 1070 end; 1071 1071 1072 1072 var 1073 Loc1, i, j, p1, dx, dy, mix, emix, EnemyType, TestEnemyType: integer;1073 Loc1, I, J, p1, dx, dy, mix, emix, EnemyType, TestEnemyType: Integer; 1074 1074 mi: TModelInfo; 1075 1075 PPicture, PTestPicture: ^TModelPicture; 1076 ModelOk: array [0 .. 4095] of boolean;1077 ok: boolean;1078 begin 1079 for i:= 0 to MaxLayer - 1 do1080 begin 1081 Lines[ i] := 0;1082 FirstShrinkedLine[ i] := MaxInt;1076 ModelOk: array [0 .. 4095] of Boolean; 1077 ok: Boolean; 1078 begin 1079 for I := 0 to MaxLayer - 1 do 1080 begin 1081 Lines[I] := 0; 1082 FirstShrinkedLine[I] := MaxInt; 1083 1083 end; 1084 1084 case Kind of … … 1086 1086 begin 1087 1087 // improvements 1088 code[0, 0] := cpImp + imTrGoods;1088 Code[0, 0] := cpImp + imTrGoods; 1089 1089 Lines[0] := 1; 1090 for i:= nWonder to nImp - 1 do1091 if Imp[ i].Kind = ikCommon then1092 TryAddImpLine(0, i+ cpImp);1093 for i:= nWonder to nImp - 1 do1094 if not(Imp[ i].Kind in [ikCommon, ikTrGoods]) and1095 ((MyRO.NatBuilt[ i] = 0) or (Imp[i].Kind = ikNatLocal)) then1096 TryAddImpLine(0, i+ cpImp);1097 for i:= 0 to nCityType - 1 do1098 if MyData.ImpOrder[ i, 0] >= 0 then1099 begin 1100 code[0, Lines[0]] := cpType + i;1101 inc(Lines[0]);1090 for I := nWonder to nImp - 1 do 1091 if Imp[I].Kind = ikCommon then 1092 TryAddImpLine(0, I + cpImp); 1093 for I := nWonder to nImp - 1 do 1094 if not(Imp[I].Kind in [ikCommon, ikTrGoods]) and 1095 ((MyRO.NatBuilt[I] = 0) or (Imp[I].Kind = ikNatLocal)) then 1096 TryAddImpLine(0, I + cpImp); 1097 for I := 0 to nCityType - 1 do 1098 if MyData.ImpOrder[I, 0] >= 0 then 1099 begin 1100 Code[0, Lines[0]] := cpType + I; 1101 Inc(Lines[0]); 1102 1102 end; 1103 1103 1104 1104 // wonders 1105 for i:= 0 to nWonder - 1 do1106 TryAddImpLine(1, i+ cpImp);1105 for I := 0 to nWonder - 1 do 1106 TryAddImpLine(1, I + cpImp); 1107 1107 1108 1108 // units 1109 for i:= 0 to MyRO.nModel - 1 do1109 for I := 0 to MyRO.nModel - 1 do 1110 1110 begin 1111 1111 { if MyModel[i].Kind=mkSlaves then 1112 ok:= MyRO.Wonder[woPyramids].EffectiveOwner= me1113 else } if MyModel[ i].Domain = dSea then1114 begin 1115 ok := false;1112 ok:= MyRO.Wonder[woPyramids].EffectiveOwner=Me 1113 else } if MyModel[I].Domain = dSea then 1114 begin 1115 ok := False; 1116 1116 for dx := -2 to 2 do 1117 1117 for dy := -2 to 2 do … … 1122 1122 ((MyMap[Loc1] and fTerrain = fShore) or 1123 1123 (MyMap[Loc1] and fCanal > 0)) then 1124 ok := true;1124 ok := True; 1125 1125 end; 1126 1126 end 1127 1127 else 1128 ok := true;1128 ok := True; 1129 1129 if ok then 1130 1130 begin 1131 if MyModel[ i].Status and msObsolete = 0 then1131 if MyModel[I].Status and msObsolete = 0 then 1132 1132 begin 1133 code[2, Lines[2]] := i;1134 inc(Lines[2]);1133 Code[2, Lines[2]] := I; 1134 Inc(Lines[2]); 1135 1135 end; 1136 if MyModel[ i].Status and msAllowConscripts <> 0 then1136 if MyModel[I].Status and msAllowConscripts <> 0 then 1137 1137 begin 1138 code[2, Lines[2]] := i+ cpConscripts;1139 inc(Lines[2]);1138 Code[2, Lines[2]] := I + cpConscripts; 1139 Inc(Lines[2]); 1140 1140 end; 1141 1141 end; … … 1151 1151 MarkPreqs(MyData.FarTech); 1152 1152 end; 1153 for i:= 0 to nAdv - 1 do1154 if (( i in FutureTech) or (MyRO.Tech[i] < tsApplicable)) and1155 (Server(sSetResearch - sExecute, me, i, nil^) >= rExecuted) and1156 ((MyData.FarTech = adNone) or (required[ i] > 0)) then1157 begin 1158 code[0, Lines[0]] := i;1159 inc(Lines[0]);1153 for I := 0 to nAdv - 1 do 1154 if ((I in FutureTech) or (MyRO.Tech[I] < tsApplicable)) and 1155 (Server(sSetResearch - sExecute, Me, I, nil^) >= rExecuted) and 1156 ((MyData.FarTech = adNone) or (required[I] > 0)) then 1157 begin 1158 Code[0, Lines[0]] := I; 1159 Inc(Lines[0]); 1160 1160 end; 1161 1161 SortTechs; 1162 1162 if Lines[0] = 0 then // no more techs -- offer nexus 1163 1163 begin 1164 code[0, Lines[0]] := adNexus;1165 inc(Lines[0]);1166 end; 1167 ok := false;1168 for i:= 0 to nDomains - 1 do1169 if (upgrade[ i, 0].Preq = preNone) or1170 (MyRO.Tech[upgrade[ i, 0].Preq] >= tsApplicable) then1171 ok := true;1164 Code[0, Lines[0]] := adNexus; 1165 Inc(Lines[0]); 1166 end; 1167 ok := False; 1168 for I := 0 to nDomains - 1 do 1169 if (upgrade[I, 0].Preq = preNone) or 1170 (MyRO.Tech[upgrade[I, 0].Preq] >= tsApplicable) then 1171 ok := True; 1172 1172 if ok then { new unit class } 1173 1173 begin 1174 code[0, Lines[0]] := adMilitary;1175 inc(Lines[0]);1174 Code[0, Lines[0]] := adMilitary; 1175 Inc(Lines[0]); 1176 1176 end; 1177 1177 end; 1178 1178 kFarAdvance: 1179 1179 begin 1180 code[0, Lines[0]] := adNone;1181 inc(Lines[0]);1182 for i:= 0 to nAdv - 1 do1183 if not( i in FutureTech) and (MyRO.Tech[i] < tsApplicable) and1184 ((AdvValue[ i] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and1185 ((AdvValue[ i] < 1000) or (MyRO.Tech[adScience] > tsNA)) then1186 begin 1187 code[0, Lines[0]] := i;1188 inc(Lines[0]);1180 Code[0, Lines[0]] := adNone; 1181 Inc(Lines[0]); 1182 for I := 0 to nAdv - 1 do 1183 if not(I in FutureTech) and (MyRO.Tech[I] < tsApplicable) and 1184 ((AdvValue[I] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and 1185 ((AdvValue[I] < 1000) or (MyRO.Tech[adScience] > tsNA)) then 1186 begin 1187 Code[0, Lines[0]] := I; 1188 Inc(Lines[0]); 1189 1189 end; 1190 1190 SortTechs; … … 1192 1192 kChooseTech: 1193 1193 begin 1194 for i:= 0 to nAdv - 1 do1195 if not( i in FutureTech) and (MyRO.Tech[i] >= tsApplicable) and1196 (MyRO.EnemyReport[DipMem[ me].pContact].Tech[i] < tsSeen) then1197 begin 1198 code[0, Lines[0]] := i;1199 inc(Lines[0]);1194 for I := 0 to nAdv - 1 do 1195 if not(I in FutureTech) and (MyRO.Tech[I] >= tsApplicable) and 1196 (MyRO.EnemyReport[DipMem[Me].pContact].Tech[I] < tsSeen) then 1197 begin 1198 Code[0, Lines[0]] := I; 1199 Inc(Lines[0]); 1200 1200 end; 1201 1201 SortTechs; 1202 1202 // if Lines[0]>1 then 1203 1203 begin 1204 code[0, Lines[0]] := adAll;1205 inc(Lines[0]);1204 Code[0, Lines[0]] := adAll; 1205 Inc(Lines[0]); 1206 1206 end; 1207 1207 end; 1208 1208 kChooseETech: 1209 1209 begin 1210 for i:= 0 to nAdv - 1 do1211 if not( i in FutureTech) and (MyRO.Tech[i] < tsSeen) and1212 (MyRO.EnemyReport[DipMem[ me].pContact].Tech[i] >= tsApplicable) then1213 begin 1214 code[0, Lines[0]] := i;1215 inc(Lines[0]);1210 for I := 0 to nAdv - 1 do 1211 if not(I in FutureTech) and (MyRO.Tech[I] < tsSeen) and 1212 (MyRO.EnemyReport[DipMem[Me].pContact].Tech[I] >= tsApplicable) then 1213 begin 1214 Code[0, Lines[0]] := I; 1215 Inc(Lines[0]); 1216 1216 end; 1217 1217 SortTechs; 1218 1218 // if Lines[0]>1 then 1219 1219 begin 1220 code[0, Lines[0]] := adAll;1221 inc(Lines[0]);1220 Code[0, Lines[0]] := adAll; 1221 Inc(Lines[0]); 1222 1222 end; 1223 1223 end; 1224 1224 kStealTech: 1225 1225 begin 1226 for i:= 0 to nAdv - 1 do1227 if Server(sStealTech - sExecute, me, i, nil^) >= rExecuted then1228 begin 1229 code[0, Lines[0]] := i;1230 inc(Lines[0]);1226 for I := 0 to nAdv - 1 do 1227 if Server(sStealTech - sExecute, Me, I, nil^) >= rExecuted then 1228 begin 1229 Code[0, Lines[0]] := I; 1230 Inc(Lines[0]); 1231 1231 end; 1232 1232 SortTechs; … … 1234 1234 kScience: 1235 1235 begin 1236 Column[0] := me;1236 Column[0] := Me; 1237 1237 nColumn := 1; 1238 1238 for EnemyType := 0 to 2 do … … 1252 1252 begin 1253 1253 Column[nColumn] := p1; 1254 inc(nColumn);1254 Inc(nColumn); 1255 1255 end; 1256 1256 end; 1257 for i:= 0 to nAdv - 1 do1258 begin 1259 ok := (MyRO.Tech[ i] <> tsNA) or (MyRO.ResearchTech = i);1260 for j:= 1 to nColumn - 1 do1261 with MyRO.EnemyReport[Column[ j]]^ do1262 if (Tech[ i] <> tsNA) or (TurnOfCivilReport >= 0) and1263 (ResearchTech = i) then1264 ok := true;1257 for I := 0 to nAdv - 1 do 1258 begin 1259 ok := (MyRO.Tech[I] <> tsNA) or (MyRO.ResearchTech = I); 1260 for J := 1 to nColumn - 1 do 1261 with MyRO.EnemyReport[Column[J]]^ do 1262 if (Tech[I] <> tsNA) or (TurnOfCivilReport >= 0) and 1263 (ResearchTech = I) then 1264 ok := True; 1265 1265 if ok then 1266 1266 begin 1267 code[0, Lines[0]] := i;1268 inc(Lines[0]);1267 Code[0, Lines[0]] := I; 1268 Inc(Lines[0]); 1269 1269 end; 1270 1270 end; … … 1272 1272 1273 1273 ok := MyRO.ResearchTech = adMilitary; 1274 for j:= 1 to nColumn - 1 do1275 with MyRO.EnemyReport[Column[ j]]^ do1276 if (MyRO.Alive and (1 shl Column[ j]) <> 0) and1274 for J := 1 to nColumn - 1 do 1275 with MyRO.EnemyReport[Column[J]]^ do 1276 if (MyRO.Alive and (1 shl Column[J]) <> 0) and 1277 1277 (TurnOfCivilReport >= 0) and (ResearchTech = adMilitary) then 1278 ok := true;1278 ok := True; 1279 1279 if ok then 1280 1280 begin 1281 code[0, Lines[0]] := adMilitary;1282 inc(Lines[0]);1281 Code[0, Lines[0]] := adMilitary; 1282 Inc(Lines[0]); 1283 1283 end 1284 1284 end; … … 1286 1286 begin 1287 1287 if ClientMode < scContact then 1288 for i:= 0 to MyRO.nCity - 1 do1289 if MyCity[ i].Loc >= 0 then1288 for I := 0 to MyRO.nCity - 1 do 1289 if MyCity[I].Loc >= 0 then 1290 1290 begin 1291 code[0, Lines[0]] := i;1292 inc(Lines[0]);1291 Code[0, Lines[0]] := I; 1292 Inc(Lines[0]); 1293 1293 end; 1294 1294 SortCities; … … 1297 1297 kCityEvents: 1298 1298 begin 1299 for i:= 0 to MyRO.nCity - 1 do1300 if (MyCity[ i].Loc >= 0) and (MyCity[i].Flags and CityRepMask <> 0)1299 for I := 0 to MyRO.nCity - 1 do 1300 if (MyCity[I].Loc >= 0) and (MyCity[I].Flags and CityRepMask <> 0) 1301 1301 then 1302 1302 begin 1303 code[0, Lines[0]] := i;1304 inc(Lines[0]);1303 Code[0, Lines[0]] := I; 1304 Inc(Lines[0]); 1305 1305 end; 1306 1306 SortCities; … … 1309 1309 { kChooseECity: 1310 1310 begin 1311 for i:=0 to MyRO.nEnemyCity-1 do1312 if (MyRO.EnemyCity[ i].Loc>=0)1313 and (MyRO.EnemyCity[ i].owner=DipMem[me].pContact) then1314 begin code[0,Lines[0]]:=i; inc(Lines[0]); end;1311 for I:=0 to MyRO.nEnemyCity-1 do 1312 if (MyRO.EnemyCity[I].Loc>=0) 1313 and (MyRO.EnemyCity[I].owner=DipMem[Me].pContact) then 1314 begin Code[0,Lines[0]]:=I; Inc(Lines[0]); end; 1315 1315 FirstShrinkedLine:=0 1316 1316 end; } … … 1319 1319 for mix := 0 to MyRO.nModel - 1 do 1320 1320 begin 1321 code[0, mix] := mix;1322 MakeModelInfo( me, mix, MyModel[mix], mi);1323 code[2, mix] := ModelSortValue(mi);1321 Code[0, mix] := mix; 1322 MakeModelInfo(Me, mix, MyModel[mix], mi); 1323 Code[2, mix] := ModelSortValue(mi); 1324 1324 end; 1325 1325 Lines[0] := MyRO.nModel; … … 1331 1331 for mix := 3 to MyRO.nModel - 1 do 1332 1332 begin // check if opponent already has this model 1333 MakeModelInfo( me, mix, MyModel[mix], mi);1334 ok := true;1333 MakeModelInfo(Me, mix, MyModel[mix], mi); 1334 ok := True; 1335 1335 for emix := 0 to MyRO.nEnemyModel - 1 do 1336 if (MyRO.EnemyModel[emix].Owner = DipMem[ me].pContact) and1336 if (MyRO.EnemyModel[emix].Owner = DipMem[Me].pContact) and 1337 1337 IsSameModel(MyRO.EnemyModel[emix], mi) then 1338 ok := false;1338 ok := False; 1339 1339 if ok then 1340 1340 begin 1341 code[0, Lines[0]] := mix;1342 MakeModelInfo( me, mix, MyModel[mix], mi);1343 code[2, Lines[0]] := ModelSortValue(mi);1344 inc(Lines[0]);1341 Code[0, Lines[0]] := mix; 1342 MakeModelInfo(Me, mix, MyModel[mix], mi); 1343 Code[2, Lines[0]] := ModelSortValue(mi); 1344 Inc(Lines[0]); 1345 1345 end; 1346 1346 end; … … 1348 1348 // if Lines[0]>1 then 1349 1349 begin 1350 code[0, Lines[0]] := mixAll;1351 inc(Lines[0]);;1350 Code[0, Lines[0]] := mixAll; 1351 Inc(Lines[0]);; 1352 1352 end; 1353 1353 FirstShrinkedLine[0] := 0; … … 1356 1356 begin 1357 1357 if MyRO.TestFlags and tfUncover <> 0 then 1358 Server(sGetModels, me, 0, nil^);1358 Server(sGetModels, Me, 0, nil^); 1359 1359 for emix := 0 to MyRO.nEnemyModel - 1 do 1360 ModelOk[emix] := MyRO.EnemyModel[emix].Owner = DipMem[ me].pContact;1360 ModelOk[emix] := MyRO.EnemyModel[emix].Owner = DipMem[Me].pContact; 1361 1361 for mix := 0 to MyRO.nModel - 1 do 1362 1362 begin // don't list models I already have 1363 MakeModelInfo( me, mix, MyModel[mix], mi);1363 MakeModelInfo(Me, mix, MyModel[mix], mi); 1364 1364 for emix := 0 to MyRO.nEnemyModel - 1 do 1365 1365 ModelOk[emix] := ModelOk[emix] and … … 1369 1369 if ModelOk[emix] then 1370 1370 begin 1371 if not Assigned(Tribe[DipMem[ me].pContact].ModelPicture1371 if not Assigned(Tribe[DipMem[Me].pContact].ModelPicture 1372 1372 [MyRO.EnemyModel[emix].mix].HGr) then 1373 1373 InitEnemyModel(emix); 1374 code[0, Lines[0]] := emix;1375 code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix]);1376 inc(Lines[0]);1374 Code[0, Lines[0]] := emix; 1375 Code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix]); 1376 Inc(Lines[0]); 1377 1377 end; 1378 1378 SortModels; 1379 1379 // if not IsMilReportNew(DipMem[me].pContact) or (Lines[0]>1) then 1380 1380 begin 1381 code[0, Lines[0]] := mixAll;1382 inc(Lines[0]);1381 Code[0, Lines[0]] := mixAll; 1382 Inc(Lines[0]); 1383 1383 end; 1384 1384 FirstShrinkedLine[0] := 0; … … 1386 1386 kEModels: 1387 1387 begin 1388 for i:= 0 to MyRO.EnemyReport[pView].nModelCounted - 1 do1389 begin 1390 code[1, Lines[0]] := MyRO.nEnemyModel - 1;1391 while ( code[1, Lines[0]] >= 0) and1392 not((MyRO.EnemyModel[ code[1, Lines[0]]].Owner = pView) and1393 (MyRO.EnemyModel[ code[1, Lines[0]]].mix = i)) do1394 dec(code[1, Lines[0]]);1395 if not Assigned(Tribe[pView].ModelPicture[ i].HGr) then1396 InitEnemyModel( code[1, Lines[0]]);1397 code[0, Lines[0]] := i;1398 code[2, Lines[0]] :=1399 ModelSortValue(MyRO.EnemyModel[ code[1, Lines[0]]]);1400 inc(Lines[0]);1388 for I := 0 to MyRO.EnemyReport[pView].nModelCounted - 1 do 1389 begin 1390 Code[1, Lines[0]] := MyRO.nEnemyModel - 1; 1391 while (Code[1, Lines[0]] >= 0) and 1392 not((MyRO.EnemyModel[Code[1, Lines[0]]].Owner = pView) and 1393 (MyRO.EnemyModel[Code[1, Lines[0]]].mix = I)) do 1394 Dec(Code[1, Lines[0]]); 1395 if not Assigned(Tribe[pView].ModelPicture[I].HGr) then 1396 InitEnemyModel(Code[1, Lines[0]]); 1397 Code[0, Lines[0]] := I; 1398 Code[2, Lines[0]] := 1399 ModelSortValue(MyRO.EnemyModel[Code[1, Lines[0]]]); 1400 Inc(Lines[0]); 1401 1401 end; 1402 1402 SortModels; … … 1405 1405 kAllEModels: 1406 1406 begin 1407 if (MyRO.TestFlags and tfUncover <> 0) or (G.Difficulty[ me] = 0) then1408 Server(sGetModels, me, 0, nil^);1407 if (MyRO.TestFlags and tfUncover <> 0) or (G.Difficulty[Me] = 0) then 1408 Server(sGetModels, Me, 0, nil^); 1409 1409 for emix := 0 to MyRO.nEnemyModel - 1 do 1410 1410 if (MyRO.EnemyModel[emix].mix >= 3) and … … 1416 1416 if not Assigned(PPicture.HGr) then 1417 1417 InitEnemyModel(emix); 1418 ok := true;1418 ok := True; 1419 1419 if MainScreen.mNames.Checked then 1420 for j:= 0 to Lines[0] - 1 do1420 for J := 0 to Lines[0] - 1 do 1421 1421 begin 1422 PTestPicture := @Tribe[MyRO.EnemyModel[ code[0, j]].Owner]1423 .ModelPicture[MyRO.EnemyModel[ code[0, j]].mix];1422 PTestPicture := @Tribe[MyRO.EnemyModel[Code[0, J]].Owner] 1423 .ModelPicture[MyRO.EnemyModel[Code[0, J]].mix]; 1424 1424 if (PPicture.HGr = PTestPicture.HGr) and 1425 1425 (PPicture.pix = PTestPicture.pix) and 1426 1426 (ModelHash(MyRO.EnemyModel[emix]) 1427 = ModelHash(MyRO.EnemyModel[ code[0, j]])) then1427 = ModelHash(MyRO.EnemyModel[Code[0, J]])) then 1428 1428 begin 1429 code[1, j] := 1;1430 ok := false;1429 Code[1, J] := 1; 1430 ok := False; 1431 1431 Break; 1432 1432 end; … … 1434 1434 if ok then 1435 1435 begin 1436 code[0, Lines[0]] := emix;1437 code[1, Lines[0]] := 0;1438 code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], true);1439 inc(Lines[0]);1436 Code[0, Lines[0]] := emix; 1437 Code[1, Lines[0]] := 0; 1438 Code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], True); 1439 Inc(Lines[0]); 1440 1440 end; 1441 1441 end; … … 1444 1444 end; 1445 1445 kTribe: 1446 for i:= 0 to TribeNames.Count - 1 do1447 begin 1448 code[0, Lines[0]] := i;1449 inc(Lines[0]);1446 for I := 0 to TribeNames.Count - 1 do 1447 begin 1448 Code[0, Lines[0]] := I; 1449 Inc(Lines[0]); 1450 1450 end; 1451 1451 (* kDeliver: 1452 if MyRO.Treaty[DipMem[ me].pContact]<trAlliance then1452 if MyRO.Treaty[DipMem[Me].pContact]<trAlliance then 1453 1453 begin // suggest next treaty level 1454 code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[me].pContact]+1;1455 inc(Lines[0]);1456 end; 1457 if MyRO.Treaty[DipMem[ me].pContact]=trNone then1454 Code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]+1; 1455 Inc(Lines[0]); 1456 end; 1457 if MyRO.Treaty[DipMem[Me].pContact]=trNone then 1458 1458 begin // suggest peace 1459 code[0,Lines[0]]:=opTreaty+trPeace;1460 inc(Lines[0]);1461 end; 1462 if MyRO.Treaty[DipMem[ me].pContact]>trNone then1459 Code[0,Lines[0]]:=opTreaty+trPeace; 1460 Inc(Lines[0]); 1461 end; 1462 if MyRO.Treaty[DipMem[Me].pContact]>trNone then 1463 1463 begin // suggest next treaty level 1464 code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[me].pContact]-1;1465 inc(Lines[0]);1464 Code[0,Lines[0]]:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]-1; 1465 Inc(Lines[0]); 1466 1466 end; *) 1467 1467 kShipPart: 1468 1468 begin 1469 1469 Lines[0] := 0; 1470 for i:= 0 to nShipPart - 1 do1471 if MyRO.Ship[ me].Parts[i] > 0 then1472 begin 1473 code[0, Lines[0]] := i;1474 inc(Lines[0]);1470 for I := 0 to nShipPart - 1 do 1471 if MyRO.Ship[Me].Parts[I] > 0 then 1472 begin 1473 Code[0, Lines[0]] := I; 1474 Inc(Lines[0]); 1475 1475 end; 1476 1476 end; … … 1478 1478 begin 1479 1479 Lines[0] := 0; 1480 for i:= 0 to nShipPart - 1 do1481 if MyRO.Ship[DipMem[ me].pContact].Parts[i] > 0 then1482 begin 1483 code[0, Lines[0]] := i;1484 inc(Lines[0]);1480 for I := 0 to nShipPart - 1 do 1481 if MyRO.Ship[DipMem[Me].pContact].Parts[I] > 0 then 1482 begin 1483 Code[0, Lines[0]] := I; 1484 Inc(Lines[0]); 1485 1485 end; 1486 1486 end; 1487 1487 kGov: 1488 for i:= 1 to nGov - 1 do1489 if (GovPreq[ i] <> preNA) and1490 ((GovPreq[ i] = preNone) or (MyRO.Tech[GovPreq[i]] >= tsApplicable))1488 for I := 1 to nGov - 1 do 1489 if (GovPreq[I] <> preNA) and 1490 ((GovPreq[I] = preNone) or (MyRO.Tech[GovPreq[I]] >= tsApplicable)) 1491 1491 then 1492 1492 begin 1493 code[0, Lines[0]] := i;1494 inc(Lines[0]);1493 Code[0, Lines[0]] := I; 1494 Inc(Lines[0]); 1495 1495 end; 1496 1496 kMission: 1497 for i:= 0 to nSpyMission - 1 do1498 begin 1499 code[0, Lines[0]] := i;1500 inc(Lines[0]);1497 for I := 0 to nSpyMission - 1 do 1498 begin 1499 Code[0, Lines[0]] := I; 1500 Inc(Lines[0]); 1501 1501 end; 1502 1502 end; … … 1505 1505 if Lines[0] + Lines[1] + Lines[2] <= MaxLines then 1506 1506 begin 1507 for i:= 0 to Lines[1] - 1 do // add wonders to first page1508 begin 1509 code[0, Lines[0]] := code[1, i];1510 inc(Lines[0]);1507 for I := 0 to Lines[1] - 1 do // add wonders to first page 1508 begin 1509 Code[0, Lines[0]] := Code[1, I]; 1510 Inc(Lines[0]); 1511 1511 end; 1512 1512 Lines[1] := 0; 1513 1513 FirstShrinkedLine[0] := Lines[0]; 1514 for i:= 0 to Lines[2] - 1 do // add models to first page1515 begin 1516 code[0, Lines[0]] := code[2, i];1517 inc(Lines[0]);1514 for I := 0 to Lines[2] - 1 do // add models to first page 1515 begin 1516 Code[0, Lines[0]] := Code[2, I]; 1517 Inc(Lines[0]); 1518 1518 end; 1519 1519 Lines[2] := 0; … … 1521 1521 end; 1522 1522 1523 function TListDlg.OnlyChoice(TestKind: TListKind): integer;1523 function TListDlg.OnlyChoice(TestKind: TListKind): Integer; 1524 1524 begin 1525 1525 Kind := TestKind; 1526 1526 InitLines; 1527 1527 if Lines[0] = 0 then 1528 result := -21528 Result := -2 1529 1529 else if Lines[0] > 1 then 1530 result := -11530 Result := -1 1531 1531 else 1532 result := code[0, 0];1532 Result := Code[0, 0]; 1533 1533 end; 1534 1534 1535 1535 procedure TListDlg.FormShow(Sender: TObject); 1536 1536 var 1537 i: integer;1538 begin 1539 result := -1;1540 Closable := false;1537 I: Integer; 1538 begin 1539 Result := -1; 1540 Closable := False; 1541 1541 1542 1542 if Kind = kTribe then … … 1554 1554 InitLines; 1555 1555 1556 MultiPage := false;1557 for i:= 1 to MaxLayer - 1 do1558 if Lines[ i] > 0 then1559 MultiPage := true;1556 MultiPage := False; 1557 for I := 1 to MaxLayer - 1 do 1558 if Lines[I] > 0 then 1559 MultiPage := True; 1560 1560 WideBottom := MultiPage or (Kind = kScience) or 1561 1561 not Phrases2FallenBackToEnglish and … … 1571 1571 1572 1572 DispLines := Lines[0]; 1573 for i:= 0 to MaxLayer - 1 do1574 if Lines[ i] > DispLines then1575 DispLines := Lines[ i];1573 for I := 0 to MaxLayer - 1 do 1574 if Lines[I] > DispLines then 1575 DispLines := Lines[I]; 1576 1576 if WideBottom then 1577 1577 begin … … 1588 1588 ClientHeight := InnerHeight + TitleHeight + NarrowFrame; 1589 1589 end; 1590 assert(ClientHeight <= Maintexture.Height);1590 Assert(ClientHeight <= Maintexture.Height); 1591 1591 1592 1592 TechNameSpace := 224; … … 1649 1649 Layer0Btn.Top := ClientHeight - 31; 1650 1650 Layer0Btn.Left := ClientWidth div 2 - (12 + 29); 1651 Layer0Btn.Down := true;1651 Layer0Btn.Down := True; 1652 1652 Layer1Btn.Top := ClientHeight - 31; 1653 1653 Layer1Btn.Left := ClientWidth div 2 - (12 - 29); 1654 Layer1Btn.Down := false;1654 Layer1Btn.Down := False; 1655 1655 Layer2Btn.Top := ClientHeight - 31; 1656 1656 Layer2Btn.Left := ClientWidth div 2 - 12; 1657 Layer2Btn.Down := false;1657 Layer2Btn.Down := False; 1658 1658 end; 1659 1659 … … 1668 1668 procedure TListDlg.ShowNewContent(NewMode: TWindowMode; ListKind: TListKind); 1669 1669 var 1670 i: integer;1671 ShowFocus, forceclose: boolean;1670 I: Integer; 1671 ShowFocus, forceclose: Boolean; 1672 1672 begin 1673 1673 forceclose := (ListKind <> Kind) and … … 1733 1733 if Kind = kAdvance then // show focus button? 1734 1734 if MyData.FarTech <> adNone then 1735 ShowFocus := true1735 ShowFocus := True 1736 1736 else 1737 1737 begin 1738 ShowFocus := false;1739 for i:= 0 to nAdv - 1 do1740 if not( i in FutureTech) and (MyRO.Tech[i] < tsApplicable) and1741 ((AdvValue[ i] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and1742 ((AdvValue[ i] < 1000) or (MyRO.Tech[adScience] > tsNA)) and1743 (Server(sSetResearch - sExecute, me, i, nil^) < rExecuted) then1744 ShowFocus := true;1738 ShowFocus := False; 1739 for I := 0 to nAdv - 1 do 1740 if not(I in FutureTech) and (MyRO.Tech[I] < tsApplicable) and 1741 ((AdvValue[I] < 2000) or (MyRO.Tech[adMassProduction] > tsNA)) and 1742 ((AdvValue[I] < 1000) or (MyRO.Tech[adScience] > tsNA)) and 1743 (Server(sSetResearch - sExecute, Me, I, nil^) < rExecuted) then 1744 ShowFocus := True; 1745 1745 end; 1746 ToggleBtn.Visible := (Kind = kCities) and not supervising or (Kind = kAdvance)1746 ToggleBtn.Visible := (Kind = kCities) and not Supervising or (Kind = kAdvance) 1747 1747 and ShowFocus or (Kind = kModels) or (Kind = kEModels); 1748 1748 CloseBtn.Visible := not(Kind in MustChooseKind); … … 1751 1751 end; 1752 1752 1753 procedure TListDlg.ShowNewContent_CityProject(NewMode: TWindowMode; cix: integer);1753 procedure TListDlg.ShowNewContent_CityProject(NewMode: TWindowMode; cix: Integer); 1754 1754 begin 1755 1755 cixProject := cix; … … 1757 1757 end; 1758 1758 1759 procedure TListDlg.ShowNewContent_MilReport(NewMode: TWindowMode; p: integer);1760 begin 1761 pView := p;1762 if p = me then1759 procedure TListDlg.ShowNewContent_MilReport(NewMode: TWindowMode; P: Integer); 1760 begin 1761 pView := P; 1762 if P = Me then 1763 1763 ShowNewContent(NewMode, kModels) 1764 1764 else … … 1768 1768 procedure TListDlg.PlayerClick(Sender: TObject); 1769 1769 begin 1770 if TComponent(Sender).Tag = me then1770 if TComponent(Sender).Tag = Me then 1771 1771 Kind := kModels 1772 1772 else … … 1796 1796 procedure TListDlg.ToggleBtnClick(Sender: TObject); 1797 1797 var 1798 p1: integer;1799 m: TMenuItem;1798 p1: Integer; 1799 M: TMenuItem; 1800 1800 begin 1801 1801 case Kind of 1802 1802 kAdvance: 1803 1803 begin 1804 result := adFar;1805 Closable := true;1804 Result := adFar; 1805 Closable := True; 1806 1806 Close; 1807 1807 end; … … 1818 1818 begin 1819 1819 EmptyMenu(Popup.Items); 1820 if G.Difficulty[ me] > 0 then1821 begin 1822 m:= TMenuItem.Create(Popup);1823 m.RadioItem := true;1824 m.Caption := Tribe[me].TPhrase('SHORTNAME');1825 m.Tag := me;1826 m.OnClick := PlayerClick;1820 if G.Difficulty[Me] > 0 then 1821 begin 1822 M := TMenuItem.Create(Popup); 1823 M.RadioItem := True; 1824 M.Caption := Tribe[Me].TPhrase('SHORTNAME'); 1825 M.Tag := Me; 1826 M.OnClick := PlayerClick; 1827 1827 if Kind = kModels then 1828 m.Checked := true;1829 Popup.Items.Add( m);1828 M.Checked := True; 1829 Popup.Items.Add(M); 1830 1830 end; 1831 1831 for p1 := 0 to nPl - 1 do 1832 if (p1 <> me) and (MyRO.EnemyReport[p1] <> nil) and1832 if (p1 <> Me) and (MyRO.EnemyReport[p1] <> nil) and 1833 1833 (MyRO.EnemyReport[p1].TurnOfMilReport >= 0) then 1834 1834 begin 1835 m:= TMenuItem.Create(Popup);1836 m.RadioItem := true;1837 m.Caption := Tribe[p1].TPhrase('SHORTNAME');1838 m.Tag := p1;1839 m.OnClick := PlayerClick;1835 M := TMenuItem.Create(Popup); 1836 M.RadioItem := True; 1837 M.Caption := Tribe[p1].TPhrase('SHORTNAME'); 1838 M.Tag := p1; 1839 M.OnClick := PlayerClick; 1840 1840 if (Kind = kEModels) and (p1 = pView) then 1841 m.Checked := true;1842 Popup.Items.Add( m);1841 M.Checked := True; 1842 Popup.Items.Add(M); 1843 1843 end; 1844 1844 Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top + … … 1848 1848 end; 1849 1849 1850 procedure TListDlg.FormKeyDown(Sender: TObject; var Key: word;1850 procedure TListDlg.FormKeyDown(Sender: TObject; var Key: Word; 1851 1851 Shift: TShiftState); 1852 1852 begin … … 1894 1894 begin 1895 1895 Selected := -2; 1896 SmartUpdateContent( true);1896 SmartUpdateContent(True); 1897 1897 end; 1898 1898
Note:
See TracChangeset
for help on using the changeset viewer.