Changeset 447 for trunk/LocalPlayer
- Timestamp:
- May 19, 2022, 10:39:34 PM (3 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Battle.pas
r442 r447 32 32 uix, ToLoc: Integer; 33 33 Forecast: TBattleForecastEx; 34 IsSuicideQuery: boolean;34 IsSuicideQuery: Boolean; 35 35 end; 36 36 … … 63 63 TextSize: TSize; 64 64 LabelText: string; 65 FirstStrike: boolean;65 FirstStrike: Boolean; 66 66 begin 67 67 MaxBar := 65; … … 196 196 BitBltCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm - 8 - 4 - 66, 197 197 ym + 8 + 12); 198 MakeUnitInfo( me, MyUn[uix], UnitInfo);198 MakeUnitInfo(Me, MyUn[uix], UnitInfo); 199 199 UnitInfo.Flags := UnitInfo.Flags and not unFortified; 200 200 IsoMap.PaintUnit(1, 0, UnitInfo, 0); … … 216 216 ClientWidth := 300; 217 217 ClientHeight := 288; 218 OKBtn.Visible := true;219 CancelBtn.Visible := true;218 OKBtn.Visible := True; 219 CancelBtn.Visible := True; 220 220 Left := (Screen.Width - ClientWidth) div 2; // center on screen 221 221 Top := (Screen.Height - ClientHeight) div 2; … … 225 225 ClientWidth := 178; 226 226 ClientHeight := 178; 227 OKBtn.Visible := false;228 CancelBtn.Visible := false;227 OKBtn.Visible := False; 228 CancelBtn.Visible := False; 229 229 end; 230 230 end; … … 232 232 procedure TBattleDlg.FormPaint(Sender: TObject); 233 233 var 234 ym, cix, p: Integer;235 s, s1: string;234 ym, cix, P: Integer; 235 S, s1: string; 236 236 begin 237 237 with Canvas do … … 253 253 begin 254 254 Canvas.Font.Assign(UniFont[ftCaption]); 255 s:= Phrases.Lookup('TITLE_SUICIDE');256 RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s)) div 2,257 7 + Border, s);255 S := Phrases.Lookup('TITLE_SUICIDE'); 256 RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, 257 7 + Border, S); 258 258 Canvas.Font.Assign(UniFont[ftNormal]); 259 s:= Phrases.Lookup('SUICIDE');260 p := pos('\', s);261 if p= 0 then262 RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))263 div 2, 205, s)259 S := Phrases.Lookup('SUICIDE'); 260 P := Pos('\', S); 261 if P = 0 then 262 RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) 263 div 2, 205, S) 264 264 else 265 265 begin 266 s1 := copy(s, 1, p- 1);266 s1 := Copy(S, 1, P - 1); 267 267 RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2, 268 268 205 - MessageLineSpacing div 2, s1); 269 s1 := copy(s, p+ 1, 255);269 s1 := Copy(S, P + 1, 255); 270 270 RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2, 271 271 205 + (MessageLineSpacing - MessageLineSpacing div 2), s1); -
trunk/LocalPlayer/CityScreen.pas
r442 r447 39 39 procedure FormDestroy(Sender: TObject); 40 40 procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 41 Shift: TShiftState; x, y: integer);41 Shift: TShiftState; X, Y: Integer); 42 42 procedure BuyClick(Sender: TObject); 43 43 procedure CloseBtnClick(Sender: TObject); … … 53 53 procedure PageDownBtnClick(Sender: TObject); 54 54 private 55 c: TCity;55 C: TCity; 56 56 Report: TCityReportNew; 57 57 cOwner: Integer; … … 70 70 Optimize_cixTileChange: Integer; 71 71 Optimize_TilesBeforeChange: Integer; 72 Happened: cardinal;73 imix: array [0 .. 15] of integer;72 Happened: Cardinal; 73 imix: array [0 .. 15] of Integer; 74 74 CityAreaInfo: TCityAreaInfo; 75 75 AreaMap: TIsoMap; … … 89 89 procedure InitZoomCityMap; 90 90 procedure ChooseProject; 91 procedure ChangeCity( d: integer);92 procedure ChangeResourceWeights(iResourceWeights: integer);91 procedure ChangeCity(D: Integer); 92 procedure ChangeResourceWeights(iResourceWeights: Integer); 93 93 procedure OnPlaySound(var Msg: TMessage); message WM_PLAYSOUND; 94 94 public … … 96 96 CloseAction: TCityCloseAction; 97 97 procedure OffscreenPaint; override; 98 procedure ShowNewContent(NewMode: TWindowMode; Loc: integer; ShowEvent: cardinal);98 procedure ShowNewContent(NewMode: TWindowMode; Loc: Integer; ShowEvent: Cardinal); 99 99 procedure Reset; 100 100 procedure CheckAge; … … 202 202 NoMap := TIsoMap.Create; 203 203 AreaMap := TIsoMap.Create; 204 AreaMap.SetOutput( offscreen);204 AreaMap.SetOutput(Offscreen); 205 205 AreaMap.SetPaintBounds(xmArea - 192, ymArea - 96 - 32, xmArea + 192, 206 206 ymArea + 96); … … 293 293 procedure TCityDlg.InitSmallCityMap; 294 294 var 295 i, iix, cli1, Color0, Color1, Color2: integer;295 I, iix, cli1, Color0, Color1, Color2: Integer; 296 296 begin 297 297 if cix >= 0 then 298 c:= MyCity[cix];298 C := MyCity[cix]; 299 299 case MyMap[cLoc] and fTerrain of 300 300 fPrairie: cli1 := cliPrairie; … … 329 329 begin 330 330 Brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImp]; 331 for i:= 0 to 29 do331 for I := 0 to 29 do 332 332 begin 333 333 for iix := nWonder to nImp - 1 do 334 if (ImpPosition[iix] = i) and (c.Built[iix] > 0) then334 if (ImpPosition[iix] = I) and (C.Built[iix] > 0) then 335 335 begin 336 FillRect(Rect(5 + 16 * ( i mod 3) + 48 * (idiv 18),337 3 + 12 * ( i mod 18 div 3), 13 + 16 * (i mod 3) + 48 * (idiv 18),338 11 + 12 * ( imod 18 div 3)));339 break;336 FillRect(Rect(5 + 16 * (I mod 3) + 48 * (I div 18), 337 3 + 12 * (I mod 18 div 3), 13 + 16 * (I mod 3) + 48 * (I div 18), 338 11 + 12 * (I mod 18 div 3))); 339 Break; 340 340 end; 341 341 end; 342 i:= 30;342 I := 30; 343 343 for iix := 0 to nImp do 344 if ( c.Built[iix] > 0) and ((iix < nWonder) or (ImpPosition[iix] < 0)) then344 if (C.Built[iix] > 0) and ((iix < nWonder) or (ImpPosition[iix] < 0)) then 345 345 begin 346 FillRect(Rect(5 + 16 * ( i mod 3) + 48 * (idiv 18),347 3 + 12 * ( i mod 18 div 3), 13 + 16 * (i mod 3) + 48 * (idiv 18),348 11 + 12 * ( imod 18 div 3)));349 inc(i);350 if i= 36 then351 break; // area is full346 FillRect(Rect(5 + 16 * (I mod 3) + 48 * (I div 18), 347 3 + 12 * (I mod 18 div 3), 13 + 16 * (I mod 3) + 48 * (I div 18), 348 11 + 12 * (I mod 18 div 3))); 349 Inc(I); 350 if I = 36 then 351 Break; // area is full 352 352 end; 353 if c.Project and cpImp <> 0 then354 begin 355 iix := c.Project and cpIndex;353 if C.Project and cpImp <> 0 then 354 begin 355 iix := C.Project and cpIndex; 356 356 if iix <> imTrGoods then 357 357 begin 358 358 if (iix >= nWonder) and (ImpPosition[iix] >= 0) then 359 i:= ImpPosition[iix];360 if i< 36 then359 I := ImpPosition[iix]; 360 if I < 36 then 361 361 begin 362 brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImpProject];363 FillRect(Rect(5 + 16 * ( i mod 3) + 48 * (idiv 18),364 3 + 12 * ( i mod 18 div 3), 13 + 16 * (i mod 3) + 48 * (idiv 18),365 11 + 12 * ( imod 18 div 3)));362 Brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImpProject]; 363 FillRect(Rect(5 + 16 * (I mod 3) + 48 * (I div 18), 364 3 + 12 * (I mod 18 div 3), 13 + 16 * (I mod 3) + 48 * (I div 18), 365 11 + 12 * (I mod 18 div 3))); 366 366 end; 367 367 end; 368 368 end; 369 brush.style := bsClear;369 Brush.style := bsClear; 370 370 end; 371 371 end; … … 384 384 112 * (ZoomArea - 3), wZoomMap - wZoomEnvironment, hZoomMap); 385 385 ImageOp_B(ZoomCityMap, CityMapTemplate, wZoomMap - wZoomEnvironment, 0, 386 1504 + wZoomEnvironment * byte(IsPort), 112 * (ZoomArea - 3),386 1504 + wZoomEnvironment * Byte(IsPort), 112 * (ZoomArea - 3), 387 387 wZoomEnvironment, hZoomMap); 388 388 end; … … 392 392 procedure TCityDlg.OffscreenPaint; 393 393 394 procedure FillBar( x, y, pos, Growth, max, Kind: integer;395 IndicateComplete: boolean);394 procedure FillBar(X, Y, Pos, Growth, Max, Kind: Integer; 395 IndicateComplete: Boolean); 396 396 begin 397 397 BarTex.Assign(MainTexture); … … 400 400 BarTex.ColorBevelShade := BarTex.ColorBevelLight; 401 401 end; 402 PaintRelativeProgressBar( offscreen.Canvas, Kind, x - 3, y, wBar - 4, pos,403 Growth, max, IndicateComplete, BarTex);404 end; 405 406 procedure PaintResources( x, y, Loc: integer; Add4Happy: boolean);402 PaintRelativeProgressBar(Offscreen.Canvas, Kind, X - 3, Y, wBar - 4, Pos, 403 Growth, Max, IndicateComplete, BarTex); 404 end; 405 406 procedure PaintResources(X, Y, Loc: Integer; Add4Happy: Boolean); 407 407 var 408 d, i, Total, xGr, yGr: integer;408 D, I, Total, xGr, yGr: Integer; 409 409 TileInfo: TTileInfo; 410 rare: boolean;410 rare: Boolean; 411 411 begin 412 412 with AreaMap do begin 413 if Server(sGetCityTileInfo, me, Loc, TileInfo) <> eOk then414 begin 415 assert(cix < 0);416 exit413 if Server(sGetCityTileInfo, Me, Loc, TileInfo) <> eOk then 414 begin 415 Assert(cix < 0); 416 Exit 417 417 end; 418 418 Total := TileInfo.Food + TileInfo.Prod + TileInfo.Trade; 419 419 rare := MyMap[Loc] and $06000000 > 0; 420 420 if rare then 421 inc(Total);421 Inc(Total); 422 422 if Add4Happy then 423 inc(Total, 4);423 Inc(Total, 4); 424 424 if Total > 1 then 425 d:= (xxt - 11) div (Total - 1);426 if d< 1 then427 d:= 1;428 if d> 4 then429 d:= 4;430 for i:= 0 to Total - 1 do425 D := (xxt - 11) div (Total - 1); 426 if D < 1 then 427 D := 1; 428 if D > 4 then 429 D := 4; 430 for I := 0 to Total - 1 do 431 431 begin 432 432 yGr := 115; 433 if Add4Happy and ( i>= Total - 4) then433 if Add4Happy and (I >= Total - 4) then 434 434 begin 435 435 xGr := 132; 436 436 yGr := 126 437 437 end 438 else if rare and ( i= Total - 1) then438 else if rare and (I = Total - 1) then 439 439 xGr := 66 + 110 440 else if i>= TileInfo.Food + TileInfo.Prod then440 else if I >= TileInfo.Food + TileInfo.Prod then 441 441 xGr := 66 + 44 442 else if i>= TileInfo.Prod then442 else if I >= TileInfo.Prod then 443 443 xGr := 66 444 444 else 445 445 xGr := 66 + 22; 446 Sprite( offscreen, HGrSystem, x + xxt - 5 + d * (2 * i+ 1 - Total),447 y+ yyt - 5, 10, 10, xGr, yGr);446 Sprite(Offscreen, HGrSystem, X + xxt - 5 + D * (2 * I + 1 - Total), 447 Y + yyt - 5, 10, 10, xGr, yGr); 448 448 end; 449 449 end; 450 450 end; 451 451 var 452 line, MessageCount: integer;453 454 procedure CheckMessage(Flag: integer);452 Line, MessageCount: Integer; 453 454 procedure CheckMessage(Flag: Integer); 455 455 var 456 i, test: integer;457 s: string;456 I, Test: Integer; 457 S: string; 458 458 begin 459 459 if Happened and Flag <> 0 then 460 460 begin 461 i:= 0;462 test := 1;463 while test < Flag do461 I := 0; 462 Test := 1; 463 while Test < Flag do 464 464 begin 465 inc(i);466 inc(test, test)465 Inc(I); 466 Inc(Test, Test); 467 467 end; 468 468 469 469 if AllowChange and (Sounds <> nil) and (OpenSoundEvent = -1) then 470 470 begin 471 s := CityEventSoundItem[i];472 if s<> '' then473 s := Sounds.Lookup(s);474 if (Flag = chProduction) or ( s <> '') and (s[1] <> '*') and (s[1] <> '[')471 S := CityEventSoundItem[I]; 472 if S <> '' then 473 S := Sounds.Lookup(S); 474 if (Flag = chProduction) or (S <> '') and (S[1] <> '*') and (S[1] <> '[') 475 475 then 476 OpenSoundEvent := i476 OpenSoundEvent := I; 477 477 end; 478 478 479 s := CityEventName(i);479 S := CityEventName(I); 480 480 { if Flag=chNoGrowthWarning then 481 if c.Built[imAqueduct]=0 then482 s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)])483 else s:=Format(s,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); }484 RisedTextOut( offscreen.Canvas, xmOpt + 40, ymOpt - 1 - 8 * MessageCount +485 16 * line, s);486 inc(line)481 if C.Built[imAqueduct]=0 then 482 S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imAqueduct)]) 483 else S:=Format(S,[Phrases.Lookup('IMPROVEMENTS',imSewer)]); } 484 RisedTextOut(Offscreen.Canvas, xmOpt + 40, ymOpt - 1 - 8 * MessageCount + 485 16 * Line, S); 486 Inc(Line); 487 487 end; 488 488 end; 489 489 490 490 var 491 x, y, xGr, i, j, iix, d, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix,491 X, Y, xGr, I, J, iix, D, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix, 492 492 HappyGain, OptiType, rx, ry, TrueFood, TrueProd, TruePoll: Integer; 493 493 av: Integer; 494 PrName, s: string;494 PrName, S: string; 495 495 UnitInfo: TUnitInfo; 496 496 UnitReport: TUnitReport; … … 499 499 inherited; 500 500 if cix >= 0 then 501 c:= MyCity[cix];501 C := MyCity[cix]; 502 502 Report.HypoTiles := -1; 503 503 Report.HypoTaxRate := -1; 504 504 Report.HypoLuxuryRate := -1; 505 505 if cix >= 0 then 506 Server(sGetCityReportNew, me, cix, Report) // own city506 Server(sGetCityReportNew, Me, cix, Report) // own city 507 507 else 508 Server(sGetEnemyCityReportNew, me, cLoc, Report); // enemy city509 TrueFood := c.Food;510 TrueProd := c.Prod;511 TruePoll := c.Pollution;508 Server(sGetEnemyCityReportNew, Me, cLoc, Report); // enemy city 509 TrueFood := C.Food; 510 TrueProd := C.Prod; 511 TruePoll := C.Pollution; 512 512 if Supervising or (cix < 0) then 513 513 begin // normalize city from after-turn state … … 522 522 TruePoll := 0; // shouldn't happen 523 523 end; 524 IsCityAlive := (cGov <> gAnarchy) and ( c.Flags and chCaptured = 0);524 IsCityAlive := (cGov <> gAnarchy) and (C.Flags and chCaptured = 0); 525 525 if not IsCityAlive then 526 Report.Working := c.Size;526 Report.Working := C.Size; 527 527 528 528 RedTex.Assign(MainTexture); … … 532 532 RedTex.ColorTextShade := $0000FF; 533 533 534 BitBltCanvas( offscreen.Canvas, 0, 0, 640, 480, Back.Canvas, 0, 0);534 BitBltCanvas(Offscreen.Canvas, 0, 0, 640, 480, Back.Canvas, 0, 0); 535 535 536 536 Offscreen.Canvas.Font.Assign(UniFont[ftCaption]); … … 544 544 Brush.style := bsClear; 545 545 Font.Color := $000000; 546 s := IntToStr(c.Size);547 TextOut(8 + 14 - TextWidth( s) div 2, 7, s);546 S := IntToStr(C.Size); 547 TextOut(8 + 14 - TextWidth(S) div 2, 7, S); 548 548 end; 549 549 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); … … 553 553 MakeRed(Offscreen, 18, 280, 298, 40); 554 554 if cGov = gAnarchy then 555 s:= Phrases.Lookup('GOVERNMENT', gAnarchy)555 S := Phrases.Lookup('GOVERNMENT', gAnarchy) 556 556 else { if c.Flags and chCaptured<>0 then } 557 s:= Phrases.Lookup('CITYEVENTS', 14);558 RisedTextOut( offscreen.Canvas, 167 - BiColorTextWidth(offscreen.Canvas, s)559 div 2, ymOpt - 9, s);557 S := Phrases.Lookup('CITYEVENTS', 14); 558 RisedTextOut(Offscreen.Canvas, 167 - BiColorTextWidth(Offscreen.Canvas, S) 559 div 2, ymOpt - 9, S); 560 560 end 561 561 else if AllowChange then 562 562 begin 563 OptiType := c.Status shr 4 and $0F;564 Sprite( offscreen, HGrSystem2, xmOpt - 32, ymOpt - 32, 64, 64,563 OptiType := C.Status shr 4 and $0F; 564 Sprite(Offscreen, HGrSystem2, xmOpt - 32, ymOpt - 32, 64, 64, 565 565 1 + OptiType mod 3 * 64, 217 + OptiType div 3 * 64); 566 566 567 567 { display messages now } 568 568 MessageCount := 0; 569 for i:= 0 to 31 do570 if Happened and ($FFFFFFFF - chCaptured) and (1 shl i) <> 0 then571 inc(MessageCount);569 for I := 0 to 31 do 570 if Happened and ($FFFFFFFF - chCaptured) and (1 shl I) <> 0 then 571 Inc(MessageCount); 572 572 if MessageCount > 3 then 573 573 MessageCount := 3; 574 574 if MessageCount > 0 then 575 575 begin 576 MakeBlue( offscreen, 74, 280, 242, 40);577 line := 0;578 for i:= 0 to nCityEventPriority - 1 do579 if line < MessageCount then580 CheckMessage(CityEventPriority[ i]);576 MakeBlue(Offscreen, 74, 280, 242, 40); 577 Line := 0; 578 for I := 0 to nCityEventPriority - 1 do 579 if Line < MessageCount then 580 CheckMessage(CityEventPriority[I]); 581 581 end 582 582 else 583 583 begin 584 s:= Phrases.Lookup('CITYMANAGETYPE', OptiType);585 j := pos('\', s);586 if j= 0 then587 LoweredTextout( offscreen.Canvas, -1, MainTexture, xmOpt + 40,588 ymOpt - 9, s)584 S := Phrases.Lookup('CITYMANAGETYPE', OptiType); 585 J := Pos('\', S); 586 if J = 0 then 587 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xmOpt + 40, 588 ymOpt - 9, S) 589 589 else 590 590 begin 591 LoweredTextout( offscreen.Canvas, -1, MainTexture, xmOpt + 40,592 ymOpt - 17, copy(s, 1, j- 1));593 LoweredTextout( offscreen.Canvas, -1, MainTexture, xmOpt + 40, ymOpt - 1,594 copy(s, j+ 1, 255));591 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xmOpt + 40, 592 ymOpt - 17, Copy(S, 1, J - 1)); 593 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xmOpt + 40, ymOpt - 1, 594 Copy(S, J + 1, 255)); 595 595 end; 596 596 end; … … 602 602 AreaMap.Paint(xmArea - xxt * 2 * rx, ymArea - yyt * 2 * ry - 3 * yyt, 603 603 dLoc(cLoc, -2 * rx + 1, -2 * ry - 1), 4 * rx - 1, 4 * ry + 1, cLoc, cOwner, 604 false, AllowChange and IsCityAlive and605 ( c.Status and csResourceWeightsMask = 0));606 BitBltCanvas( offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas,604 False, AllowChange and IsCityAlive and 605 (C.Status and csResourceWeightsMask = 0)); 606 BitBltCanvas(Offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas, 607 607 xmArea + 102, 42); 608 608 … … 616 616 ((Loc1 < 0) or (Loc1 >= G.lx * G.ly) or (MyMap[Loc1] and fCity = 0)) 617 617 then 618 Sprite( offscreen, HGrTerrain, xmArea - xxt + xxt * dx,618 Sprite(Offscreen, HGrTerrain, xmArea - xxt + xxt * dx, 619 619 ymArea - yyt + yyt * dy, xxt * 2, yyt * 2, 1 + 5 * (xxt * 2 + 1), 620 620 1 + yyt + 15 * (yyt * 3 + 1)); 621 if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and c.Tiles <> 0) then621 if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and C.Tiles <> 0) then 622 622 PaintResources(xmArea - xxt + xxt * dx, ymArea - yyt + yyt * dy, 623 623 Loc1, (dx = 0) and (dy = 0)); … … 626 626 627 627 if Report.Working > 1 then 628 d:= (xService - (xmArea - 192) - 8 - 32) div (Report.Working - 1);629 if d> 28 then630 d:= 28;631 for i:= Report.Working - 1 downto 0 do628 D := (xService - (xmArea - 192) - 8 - 32) div (Report.Working - 1); 629 if D > 28 then 630 D := 28; 631 for I := Report.Working - 1 downto 0 do 632 632 begin 633 633 if IsCityAlive then … … 635 635 else 636 636 xGr := 141; 637 BitBltCanvas( offscreen.Canvas, xmArea - 192 + 5 + i * d, ymArea - 96 - 29,637 BitBltCanvas(Offscreen.Canvas, xmArea - 192 + 5 + I * D, ymArea - 96 - 29, 638 638 27, 30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow } 639 Sprite( offscreen, HGrSystem, xmArea - 192 + 4 + i * d, ymArea - 96 - 30, 27,639 Sprite(Offscreen, HGrSystem, xmArea - 192 + 4 + I * D, ymArea - 96 - 30, 27, 640 640 30, xGr, 171); 641 641 end; 642 if c.Size - Report.Working > 1 then643 d := (xmArea + 192 - xService - 32) div (c.Size - Report.Working - 1);644 if d> 28 then645 d:= 28;646 for i := 0 to c.Size - Report.Working - 1 do642 if C.Size - Report.Working > 1 then 643 D := (xmArea + 192 - xService - 32) div (C.Size - Report.Working - 1); 644 if D > 28 then 645 D := 28; 646 for I := 0 to C.Size - Report.Working - 1 do 647 647 begin 648 648 xGr := 1 + 112; 649 BitBltCanvas( offscreen.Canvas, xmArea + 192 - 27 + 1 - i * d, 29 + 1, 27,649 BitBltCanvas(Offscreen.Canvas, xmArea + 192 - 27 + 1 - I * D, 29 + 1, 27, 650 650 30, HGrSystem.Mask.Canvas, xGr, 171, SRCAND); { shadow } 651 Sprite( offscreen, HGrSystem, xmArea + 192 - 27 - i * d, 29, 27, 30,651 Sprite(Offscreen, HGrSystem, xmArea + 192 - 27 - I * D, 29, 27, 30, 652 652 xGr, 171); 653 Sprite( offscreen, HGrSystem, xmArea + 192 - 27 + 4 - i * d, 29 + 32, 10,653 Sprite(Offscreen, HGrSystem, xmArea + 192 - 27 + 4 - I * D, 29 + 32, 10, 654 654 10, 121, 126); 655 Sprite( offscreen, HGrSystem, xmArea + 192 - 27 + 13 - i * d, 29 + 32, 10,655 Sprite(Offscreen, HGrSystem, xmArea + 192 - 27 + 13 - I * D, 29 + 32, 10, 656 656 10, 121, 126); 657 657 // Sprite(offscreen,HGrSystem,xmArea+192-31+18-i*d,ymArea-96-80+32,10,10,88,115); 658 658 end; 659 659 660 if c.Project and cpImp = 0 then661 PrName := Tribe[cOwner].ModelName[ c.Project and cpIndex]660 if C.Project and cpImp = 0 then 661 PrName := Tribe[cOwner].ModelName[C.Project and cpIndex] 662 662 else 663 PrName := Phrases.Lookup('IMPROVEMENTS', c.Project and cpIndex);663 PrName := Phrases.Lookup('IMPROVEMENTS', C.Project and cpIndex); 664 664 PrCost := Report.ProjectCost; 665 665 … … 668 668 begin 669 669 if cGov = gFundamentalism then 670 CountBar( offscreen, xHapp, yHapp + dyBar, wBar, 17,670 CountBar(Offscreen, xHapp, yHapp + dyBar, wBar, 17, 671 671 Phrases.Lookup('FAITH'), Report.CollectedControl, MainTexture) 672 672 else 673 673 begin 674 CountBar( offscreen, xHapp, yHapp + dyBar, wBar, 17,674 CountBar(Offscreen, xHapp, yHapp + dyBar, wBar, 17, 675 675 Phrases.Lookup('HAPPINESS'), Report.Morale, MainTexture); 676 CountBar( offscreen, xHapp, yHapp + 2 * dyBar, wBar, 16,676 CountBar(Offscreen, xHapp, yHapp + 2 * dyBar, wBar, 16, 677 677 Phrases.Lookup('CONTROL'), Report.CollectedControl, MainTexture); 678 678 end; 679 CountBar( offscreen, xHapp, yHapp, wBar, 8, Phrases.Lookup('LUX'),679 CountBar(Offscreen, xHapp, yHapp, wBar, 8, Phrases.Lookup('LUX'), 680 680 Report.Luxury, MainTexture); 681 CountBar( offscreen, xHapp + dxBar, yHapp, wBar, 19,681 CountBar(Offscreen, xHapp + dxBar, yHapp, wBar, 19, 682 682 Phrases.Lookup('UNREST'), 2 * Report.Deployed, MainTexture); 683 CountBar( offscreen, xHapp + dxBar, yHapp + dyBar, wBar, 17,684 Phrases.Lookup('HAPPINESSDEMAND'), c.Size, MainTexture);683 CountBar(Offscreen, xHapp + dxBar, yHapp + dyBar, wBar, 17, 684 Phrases.Lookup('HAPPINESSDEMAND'), C.Size, MainTexture); 685 685 if Report.HappinessBalance >= 0 then 686 CountBar( offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 17,686 CountBar(Offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 17, 687 687 Phrases.Lookup('HAPPINESSPLUS'), Report.HappinessBalance, MainTexture) 688 688 else 689 689 begin 690 690 MakeRed(Offscreen, xHapp + dxBar - 6, yHapp + 2 * dyBar, wBar + 10, 38); 691 CountBar( offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 18,691 CountBar(Offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 18, 692 692 Phrases.Lookup('LACK'), -Report.HappinessBalance, RedTex); 693 693 end; … … 697 697 if IsCityAlive then 698 698 begin 699 CountBar( offscreen, xFood, yFood + dyBar div 2, wBar, 0,699 CountBar(Offscreen, xFood, yFood + dyBar div 2, wBar, 0, 700 700 Phrases.Lookup('FOOD'), Report.CollectedFood, MainTexture); 701 CountBar( offscreen, xFood + dxBar, yFood + dyBar, wBar, 0,702 Phrases.Lookup('DEMAND'), 2 * c.Size, MainTexture);703 CountBar( offscreen, xFood + dxBar, yFood, wBar, 0,701 CountBar(Offscreen, xFood + dxBar, yFood + dyBar, wBar, 0, 702 Phrases.Lookup('DEMAND'), 2 * C.Size, MainTexture); 703 CountBar(Offscreen, xFood + dxBar, yFood, wBar, 0, 704 704 Phrases.Lookup('SUPPORT'), Report.FoodSupport, MainTexture); 705 705 if Report.FoodSurplus >= 0 then 706 if (cGov = gFuture) or ( c.Size >= NeedAqueductSize) and706 if (cGov = gFuture) or (C.Size >= NeedAqueductSize) and 707 707 (Report.FoodSurplus < 2) then 708 CountBar( offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 6,708 CountBar(Offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 6, 709 709 Phrases.Lookup('PROFIT'), Report.FoodSurplus, MainTexture) 710 710 else 711 CountBar( offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 0,711 CountBar(Offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 0, 712 712 Phrases.Lookup('SURPLUS'), Report.FoodSurplus, MainTexture) 713 713 else 714 714 begin 715 715 MakeRed(Offscreen, xFood + dxBar - 6, yFood + 2 * dyBar, wBar + 10, 38); 716 CountBar( offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 1,716 CountBar(Offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 1, 717 717 Phrases.Lookup('LACK'), -Report.FoodSurplus, RedTex); 718 718 end; 719 719 end; 720 CanGrow := ( c.Size < MaxCitySize) and (cGov <> gFuture) and721 (Report.FoodSurplus > 0) and (( c.Size < NeedAqueductSize) or722 ( c.Built[imAqueduct] = 1) and (c.Size < NeedSewerSize) or723 ( c.Built[imSewer] = 1));720 CanGrow := (C.Size < MaxCitySize) and (cGov <> gFuture) and 721 (Report.FoodSurplus > 0) and ((C.Size < NeedAqueductSize) or 722 (C.Built[imAqueduct] = 1) and (C.Size < NeedSewerSize) or 723 (C.Built[imSewer] = 1)); 724 724 FillBar(xFood + 3, yFood + 102, TrueFood, 725 CutCityFoodSurplus(Report.FoodSurplus, IsCityAlive, cGov, c.Size),725 CutCityFoodSurplus(Report.FoodSurplus, IsCityAlive, cGov, C.Size), 726 726 Report.Storage, 1, CanGrow); 727 LoweredTextout( offscreen.Canvas, -1, MainTexture, xFood + 3 - 5,727 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xFood + 3 - 5, 728 728 yFood + 102 - 20, Format('%d/%d', [TrueFood, Report.Storage])); 729 LoweredTextout( offscreen.Canvas, -1, MainTexture, xFood - 2, yFood + 66,729 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xFood - 2, yFood + 66, 730 730 Phrases.Lookup('STORAGE')); 731 731 … … 733 733 if IsCityAlive then 734 734 begin 735 CountBar( offscreen, xProd, yProd, wBar, 2, Phrases.Lookup('MATERIAL'),735 CountBar(Offscreen, xProd, yProd, wBar, 2, Phrases.Lookup('MATERIAL'), 736 736 Report.CollectedMaterial, MainTexture); 737 CountBar( offscreen, xProd + dxBar, yProd, wBar, 2,737 CountBar(Offscreen, xProd + dxBar, yProd, wBar, 2, 738 738 Phrases.Lookup('SUPPORT'), Report.MaterialSupport, MainTexture); 739 739 if Report.Production >= 0 then 740 if c.Project and (cpImp + cpIndex) = cpImp + imTrGoods then741 CountBar( offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 6,740 if C.Project and (cpImp + cpIndex) = cpImp + imTrGoods then 741 CountBar(Offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 6, 742 742 Phrases.Lookup('PROFIT'), Report.Production, MainTexture) 743 743 else 744 CountBar( offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 2,744 CountBar(Offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 2, 745 745 Phrases.Lookup('PROD'), Report.Production, MainTexture) 746 746 else 747 747 begin 748 748 MakeRed(Offscreen, xProd + dxBar - 6, yProd + dyBar + 17, wBar + 10, 38); 749 CountBar( offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 3,749 CountBar(Offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 3, 750 750 Phrases.Lookup('LACK'), -Report.Production, RedTex); 751 751 end; 752 752 end; 753 if c.Project and (cpImp + cpIndex) <> cpImp + imTrGoods then754 with offscreen.Canvas do755 begin 756 i:= Report.Production;757 if ( i< 0) or not IsCityAlive then758 i:= 0;759 FillBar(xProd + 3, yProd + 16 + 63, TrueProd, i, PrCost, 4, true);760 LoweredTextout( offscreen.Canvas, -1, MainTexture, xProd + 3 - 5,753 if C.Project and (cpImp + cpIndex) <> cpImp + imTrGoods then 754 with Offscreen.Canvas do 755 begin 756 I := Report.Production; 757 if (I < 0) or not IsCityAlive then 758 I := 0; 759 FillBar(xProd + 3, yProd + 16 + 63, TrueProd, I, PrCost, 4, True); 760 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xProd + 3 - 5, 761 761 yProd + 16 + 43, Format('%d/%d', [TrueProd, PrCost])); 762 if BiColorTextWidth( offscreen.Canvas, PrName) > wBar + dxBar then762 if BiColorTextWidth(Offscreen.Canvas, PrName) > wBar + dxBar then 763 763 begin 764 764 repeat 765 Delete(PrName, length(PrName), 1)766 until BiColorTextWidth( offscreen.Canvas, PrName) <= wBar + dxBar;765 Delete(PrName, Length(PrName), 1) 766 until BiColorTextWidth(Offscreen.Canvas, PrName) <= wBar + dxBar; 767 767 PrName := PrName + '.' 768 768 end; 769 769 end; 770 RisedTextOut( offscreen.Canvas, xProd - 2, yProd + 36, PrName);770 RisedTextOut(Offscreen.Canvas, xProd - 2, yProd + 36, PrName); 771 771 772 772 // pollution section … … 774 774 begin 775 775 FillBar(xPoll + 3, yPoll + 20, TruePoll, Report.AddPollution, 776 MaxPollution, 3, true);777 RisedTextOut( offscreen.Canvas, xPoll + 3 - 5, yPoll + 20 - 20,776 MaxPollution, 3, True); 777 RisedTextOut(Offscreen.Canvas, xPoll + 3 - 5, yPoll + 20 - 20, 778 778 Phrases.Lookup('POLL')); 779 779 end; … … 782 782 if IsCityAlive and (Report.CollectedTrade > 0) then 783 783 begin 784 CountBar( offscreen, xTrade, yTrade + dyBar div 2, wBar, 4,784 CountBar(Offscreen, xTrade, yTrade + dyBar div 2, wBar, 4, 785 785 Phrases.Lookup('TRADE'), Report.CollectedTrade, MainTexture); 786 CountBar( offscreen, xTrade + dxBar, yTrade + 2 * dyBar, wBar, 5,786 CountBar(Offscreen, xTrade + dxBar, yTrade + 2 * dyBar, wBar, 5, 787 787 Phrases.Lookup('CORR'), Report.Corruption, MainTexture); 788 CountBar( offscreen, xTrade + dxBar, yTrade, wBar, 6, Phrases.Lookup('TAX'),788 CountBar(Offscreen, xTrade + dxBar, yTrade, wBar, 6, Phrases.Lookup('TAX'), 789 789 Report.Tax, MainTexture); 790 CountBar( offscreen, xTrade + dxBar, yTrade + dyBar, wBar, 12,790 CountBar(Offscreen, xTrade + dxBar, yTrade + dyBar, wBar, 12, 791 791 Phrases.Lookup('SCIENCE'), Report.Science, MainTexture); 792 792 end; 793 793 794 794 // small map 795 BitBltCanvas( offscreen.Canvas, xSmallMap, ySmallMap, wSmallMap, hSmallMap,795 BitBltCanvas(Offscreen.Canvas, xSmallMap, ySmallMap, wSmallMap, hSmallMap, 796 796 SmallCityMap.Canvas, 0, 0); 797 797 if SmallMapMode = smImprovements then 798 Frame( offscreen.Canvas, xSmallMap + 48 * (ZoomArea div 3),798 Frame(Offscreen.Canvas, xSmallMap + 48 * (ZoomArea div 3), 799 799 ySmallMap + 24 * (ZoomArea mod 3), xSmallMap + 48 * (ZoomArea div 3) + 49, 800 800 ySmallMap + 24 * (ZoomArea mod 3) + 25, MainTexture.ColorMark, 801 801 MainTexture.ColorMark); 802 Frame( offscreen.Canvas, xSmallMap - 1, ySmallMap - 1, xSmallMap + wSmallMap,802 Frame(Offscreen.Canvas, xSmallMap - 1, ySmallMap - 1, xSmallMap + wSmallMap, 803 803 ySmallMap + hSmallMap, $B0B0B0, $FFFFFF); 804 RFrame( offscreen.Canvas, xSmallMap - 2, ySmallMap - 2, xSmallMap + wSmallMap +804 RFrame(Offscreen.Canvas, xSmallMap - 2, ySmallMap - 2, xSmallMap + wSmallMap + 805 805 1, ySmallMap + hSmallMap + 1, $FFFFFF, $B0B0B0); 806 806 807 Frame( offscreen.Canvas, xSupport - 1, ySupport - 1, xSupport + wSupport,807 Frame(Offscreen.Canvas, xSupport - 1, ySupport - 1, xSupport + wSupport, 808 808 ySupport + hSupport, $B0B0B0, $FFFFFF); 809 RFrame( offscreen.Canvas, xSupport - 2, ySupport - 2, xSupport + wSupport + 1,809 RFrame(Offscreen.Canvas, xSupport - 2, ySupport - 2, xSupport + wSupport + 1, 810 810 ySupport + hSupport + 1, $FFFFFF, $B0B0B0); 811 x:= xSupport + wSupport div 2;812 y:= ySupport + hSupport div 2;811 X := xSupport + wSupport div 2; 812 Y := ySupport + hSupport div 2; 813 813 if SmallMapMode = smSupportedUnits then 814 814 begin 815 offscreen.Canvas.brush.Color := MainTexture.ColorMark;816 offscreen.Canvas.FillRect(Rect(x - 27, y - 6, x + 27, y+ 6));817 offscreen.Canvas.brush.style := bsClear;818 end; 819 Sprite( offscreen, HGrSystem, x - 16, y- 5, 10, 10, 88, 115);820 Sprite( offscreen, HGrSystem, x - 5, y- 5, 10, 10, 66, 115);821 Sprite( offscreen, HGrSystem, x + 6, y- 5, 10, 10, 154, 126);822 823 BitBltCanvas( offscreen.Canvas, xZoomMap, yZoomMap, wZoomMap, hZoomMap,815 Offscreen.Canvas.Brush.Color := MainTexture.ColorMark; 816 Offscreen.Canvas.FillRect(Rect(X - 27, Y - 6, X + 27, Y + 6)); 817 Offscreen.Canvas.Brush.style := bsClear; 818 end; 819 Sprite(Offscreen, HGrSystem, X - 16, Y - 5, 10, 10, 88, 115); 820 Sprite(Offscreen, HGrSystem, X - 5, Y - 5, 10, 10, 66, 115); 821 Sprite(Offscreen, HGrSystem, X + 6, Y - 5, 10, 10, 154, 126); 822 823 BitBltCanvas(Offscreen.Canvas, xZoomMap, yZoomMap, wZoomMap, hZoomMap, 824 824 ZoomCityMap.Canvas, 0, 0); 825 825 826 for i:= 0 to 5 do827 imix[ i] := -1;826 for I := 0 to 5 do 827 imix[I] := -1; 828 828 if SmallMapMode = smImprovements then 829 829 begin … … 832 832 Cnt := 0; 833 833 for iix := 0 to nImp - 1 do 834 if ((iix < nWonder) or (ImpPosition[iix] < 0)) and ( c.Built[iix] > 0) then834 if ((iix < nWonder) or (ImpPosition[iix] < 0)) and (C.Built[iix] > 0) then 835 835 begin 836 i:= Cnt - Page * 6;837 if ( i >= 0) and (i< 6) then838 imix[ i] := iix;839 inc(Cnt);836 I := Cnt - Page * 6; 837 if (I >= 0) and (I < 6) then 838 imix[I] := iix; 839 Inc(Cnt); 840 840 end; 841 841 PageCount := (Cnt + 5) div 6; … … 845 845 for iix := nWonder to nImp - 1 do 846 846 begin 847 i:= ImpPosition[iix] - 6 * ZoomArea;848 if ( i >= 0) and (i < 6) and (c.Built[iix] > 0) then849 imix[ i] := iix;847 I := ImpPosition[iix] - 6 * ZoomArea; 848 if (I >= 0) and (I < 6) and (C.Built[iix] > 0) then 849 imix[I] := iix; 850 850 end; 851 851 PageCount := 0; 852 852 end; 853 for i:= 0 to 5 do854 if imix[ i] >= 0 then853 for I := 0 to 5 do 854 if imix[I] >= 0 then 855 855 begin 856 iix := imix[ i];857 x := xZoomMap + 14 + 72 * (imod 3);858 y := yZoomMap + 14 + 56 * (idiv 3);859 ImpImage( offscreen.Canvas, x, y, iix, cGov, AllowChange and856 iix := imix[I]; 857 X := xZoomMap + 14 + 72 * (I mod 3); 858 Y := yZoomMap + 14 + 56 * (I div 3); 859 ImpImage(Offscreen.Canvas, X, Y, iix, cGov, AllowChange and 860 860 (ClientMode < scContact)); 861 861 if IsCityAlive then … … 863 863 if iix = imColosseum then 864 864 begin 865 Sprite( offscreen, HGrSystem, x + 46, y, 14, 14, 82, 100);865 Sprite(Offscreen, HGrSystem, X + 46, Y, 14, 14, 82, 100); 866 866 end 867 867 else … … 881 881 if HappyGain > 1 then 882 882 begin 883 d:= 30 div (HappyGain - 1);884 if d> 10 then885 d:= 10883 D := 30 div (HappyGain - 1); 884 if D > 10 then 885 D := 10 886 886 end; 887 for j:= 0 to HappyGain - 1 do888 Sprite( offscreen, HGrSystem, x + 50, y + d * j, 10, 10, 132, 126);887 for J := 0 to HappyGain - 1 do 888 Sprite(Offscreen, HGrSystem, X + 50, Y + D * J, 10, 10, 132, 126); 889 889 end; 890 for j:= 0 to Imp[iix].Maint - 1 do891 Sprite( offscreen, HGrSystem, x - 4, y + 29 - 3 * j, 10, 10,890 for J := 0 to Imp[iix].Maint - 1 do 891 Sprite(Offscreen, HGrSystem, X - 4, Y + 29 - 3 * J, 10, 10, 892 892 132, 115); 893 893 end … … 920 920 else { if SmallMapMode = smSupportedUnits then } 921 921 begin 922 LoweredTextout( offscreen.Canvas, -1, MainTexture, xZoomMap + 6,922 LoweredTextout(Offscreen.Canvas, -1, MainTexture, xZoomMap + 6, 923 923 yZoomMap + 2, Phrases.Lookup('SUPUNITS')); 924 FreeSupp := c.Size * SupportFree[cGov] shr 1;924 FreeSupp := C.Size * SupportFree[cGov] shr 1; 925 925 Cnt := 0; 926 for i:= 0 to MyRO.nUn - 1 do927 if (MyUn[ i].Loc >= 0) and (MyUn[i].Home = cix) then928 with MyModel[MyUn[ i].mix] do926 for I := 0 to MyRO.nUn - 1 do 927 if (MyUn[I].Loc >= 0) and (MyUn[I].Home = cix) then 928 with MyModel[MyUn[I].mix] do 929 929 begin 930 Server(sGetUnitReport, me, i, UnitReport);930 Server(sGetUnitReport, Me, I, UnitReport); 931 931 if (Cnt >= 6 * Page) and (Cnt < 6 * (Page + 1)) then 932 932 begin // unit visible in display 933 imix[Cnt - 6 * Page] := i;934 x:= ((Cnt - 6 * Page) mod 3) * 64 + xZoomMap;935 y:= ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20;936 MakeUnitInfo( me, MyUn[i], UnitInfo);937 NoMap.SetOutput( offscreen);938 NoMap.PaintUnit( x, y, UnitInfo, MyUn[i].Status);939 940 for j:= 0 to UnitReport.FoodSupport - 1 do941 Sprite( offscreen, HGrSystem, x + 38 + 11 * j, y+ 40, 10,933 imix[Cnt - 6 * Page] := I; 934 X := ((Cnt - 6 * Page) mod 3) * 64 + xZoomMap; 935 Y := ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20; 936 MakeUnitInfo(Me, MyUn[I], UnitInfo); 937 NoMap.SetOutput(Offscreen); 938 NoMap.PaintUnit(X, Y, UnitInfo, MyUn[I].Status); 939 940 for J := 0 to UnitReport.FoodSupport - 1 do 941 Sprite(Offscreen, HGrSystem, X + 38 + 11 * J, Y + 40, 10, 942 942 10, 66, 115); 943 for j:= 0 to UnitReport.ProdSupport - 1 do943 for J := 0 to UnitReport.ProdSupport - 1 do 944 944 begin 945 945 if (FreeSupp > 0) and 946 946 (UnitReport.ReportFlags and urfAlwaysSupport = 0) then 947 947 begin 948 Sprite( offscreen, HGrSystem, x + 16 - 11 * j, y+ 40, 10,948 Sprite(Offscreen, HGrSystem, X + 16 - 11 * J, Y + 40, 10, 949 949 10, 143, 115); 950 dec(FreeSupp);950 Dec(FreeSupp); 951 951 end 952 952 else 953 Sprite( offscreen, HGrSystem, x + 16 - 11 * j, y+ 40, 10,953 Sprite(Offscreen, HGrSystem, X + 16 - 11 * J, Y + 40, 10, 954 954 10, 88, 115); 955 955 end; 956 956 if UnitReport.ReportFlags and urfDeployed <> 0 then 957 for j:= 0 to 1 do958 Sprite( offscreen, HGrSystem, x + 27 + 11 * j, y+ 40, 10,957 for J := 0 to 1 do 958 Sprite(Offscreen, HGrSystem, X + 27 + 11 * J, Y + 40, 10, 959 959 10, 154, 126) 960 960 end // unit visible in display … … 977 977 begin 978 978 { display project now } 979 DLine( offscreen.Canvas, xView + 9 + xSizeBig, xProd + 2 * wBar + 10,979 DLine(Offscreen.Canvas, xView + 9 + xSizeBig, xProd + 2 * wBar + 10, 980 980 yProd + dyBar + 16, $FFFFFF, $B0B0B0); 981 981 if ProdHint then 982 982 begin 983 ScreenTools.Frame( offscreen.Canvas, xView + 9 - 1, yView + 5 - 1,983 ScreenTools.Frame(Offscreen.Canvas, xView + 9 - 1, yView + 5 - 1, 984 984 xView + 9 + xSizeBig, yView + 5 + ySizeBig, $B0B0B0, $FFFFFF); 985 RFrame( offscreen.Canvas, xView + 9 - 2, yView + 5 - 2,985 RFrame(Offscreen.Canvas, xView + 9 - 2, yView + 5 - 2, 986 986 xView + 9 + xSizeBig + 1, yView + 5 + ySizeBig + 1, $FFFFFF, $B0B0B0); 987 with offscreen.Canvas do987 with Offscreen.Canvas do 988 988 begin 989 brush.Color := $000000;989 Brush.Color := $000000; 990 990 FillRect(Rect(xView + 9, yView + 5, xView + 1 + 72 - 8, 991 991 yView + 5 + 40)); 992 brush.style := bsClear;992 Brush.style := bsClear; 993 993 end; 994 994 end 995 else if AllowChange and ( c.Status and 7 <> 0) then995 else if AllowChange and (C.Status and 7 <> 0) then 996 996 begin // city type autobuild 997 FrameImage( offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig,998 ySizeBig, ( c.Status and 7 - 1 + 3) * xSizeBig, 0, (cix >= 0) and997 FrameImage(Offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig, 998 ySizeBig, (C.Status and 7 - 1 + 3) * xSizeBig, 0, (cix >= 0) and 999 999 (ClientMode < scContact)); 1000 1000 end 1001 else if c.Project and cpImp = 0 then1001 else if C.Project and cpImp = 0 then 1002 1002 begin // project is unit 1003 FrameImage( offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig,1003 FrameImage(Offscreen.Canvas, bigimp, xView + 9, yView + 5, xSizeBig, 1004 1004 ySizeBig, 0, 0, AllowChange and (ClientMode < scContact)); 1005 with Tribe[cOwner].ModelPicture[ c.Project and cpIndex] do1006 Sprite( offscreen, HGr, xView + 5, yView + 1, 64, 44,1005 with Tribe[cOwner].ModelPicture[C.Project and cpIndex] do 1006 Sprite(Offscreen, HGr, xView + 5, yView + 1, 64, 44, 1007 1007 pix mod 10 * 65 + 1, pix div 10 * 49 + 1); 1008 1008 end … … 1010 1010 begin // project is building 1011 1011 if ProdHint then 1012 Paintiix := c.Project0 and cpIndex1012 Paintiix := C.Project0 and cpIndex 1013 1013 else 1014 Paintiix := c.Project and cpIndex;1015 ImpImage( offscreen.Canvas, xView + 9, yView + 5, Paintiix, cGov,1014 Paintiix := C.Project and cpIndex; 1015 ImpImage(Offscreen.Canvas, xView + 9, yView + 5, Paintiix, cGov, 1016 1016 AllowChange and (ClientMode < scContact)); 1017 1017 end; … … 1020 1020 if AllowChange and (ClientMode < scContact) then 1021 1021 begin 1022 i := Server(sBuyCityProject - sExecute, me, cix, nil^);1023 BuyBtn.Visible := ( i = eOk) or (i= eViolation);1022 I := Server(sBuyCityProject - sExecute, Me, cix, nil^); 1023 BuyBtn.Visible := (I = eOk) or (I = eViolation); 1024 1024 end 1025 1025 else 1026 BuyBtn.Visible := false;1026 BuyBtn.Visible := False; 1027 1027 1028 1028 MarkUsedOffscreen(ClientWidth, ClientHeight); … … 1031 1031 procedure TCityDlg.FormShow(Sender: TObject); 1032 1032 var 1033 dx, dy, Loc1: integer;1033 dx, dy, Loc1: Integer; 1034 1034 GetCityData: TGetCityData; 1035 1035 begin … … 1037 1037 if cix >= 0 then 1038 1038 begin { own city } 1039 c:= MyCity[cix];1040 cOwner := me;1039 C := MyCity[cix]; 1040 cOwner := Me; 1041 1041 cGov := MyRO.Government; 1042 1042 ProdHint := (cGov <> gAnarchy) and 1043 1043 (Happened and (chProduction or chFounded or chCaptured or 1044 1044 chAllImpsMade) <> 0); 1045 Server(sGetCityAreaInfo, me, cix, CityAreaInfo);1045 Server(sGetCityAreaInfo, Me, cix, CityAreaInfo); 1046 1046 NextCityBtn.Visible := WindowMode = wmPersistent; 1047 1047 PrevCityBtn.Visible := WindowMode = wmPersistent; … … 1050 1050 begin 1051 1051 SmallMapMode := smImprovements; 1052 Server(sGetCity, me, cLoc, GetCityData);1053 c := GetCityData.c;1052 Server(sGetCity, Me, cLoc, GetCityData); 1053 C := GetCityData.C; 1054 1054 cOwner := GetCityData.Owner; 1055 1055 cGov := MyRO.EnemyReport[cOwner].Government; 1056 Happened := c.Flags and $7FFFFFFF;1057 ProdHint := false;1058 Server(sGetEnemyCityAreaInfo, me, cLoc, CityAreaInfo);1059 1060 if c.Project and cpImp = 0 then1056 Happened := C.Flags and $7FFFFFFF; 1057 ProdHint := False; 1058 Server(sGetEnemyCityAreaInfo, Me, cLoc, CityAreaInfo); 1059 1060 if C.Project and cpImp = 0 then 1061 1061 begin 1062 1062 emix := MyRO.nEnemyModel - 1; 1063 1063 while (emix > 0) and ((MyRO.EnemyModel[emix].Owner <> cOwner) or 1064 ( integer(MyRO.EnemyModel[emix].mix) <> c.Project and cpIndex)) do1065 dec(emix);1066 if not Assigned(Tribe[cOwner].ModelPicture[ c.Project and cpIndex].HGr) then1064 (Integer(MyRO.EnemyModel[emix].mix) <> C.Project and cpIndex)) do 1065 Dec(emix); 1066 if not Assigned(Tribe[cOwner].ModelPicture[C.Project and cpIndex].HGr) then 1067 1067 InitEnemyModel(emix); 1068 1068 end; … … 1073 1073 Page := 0; 1074 1074 1075 if c.Size < 5 then1075 if C.Size < 5 then 1076 1076 SizeClass := 0 1077 else if c.Size < 9 then1077 else if C.Size < 9 then 1078 1078 SizeClass := 1 1079 else if c.Size < 13 then1079 else if C.Size < 13 then 1080 1080 SizeClass := 2 1081 1081 else … … 1100 1100 end; 1101 1101 1102 Caption := CityName( c.ID);1102 Caption := CityName(C.ID); 1103 1103 1104 1104 InitSmallCityMap; … … 1109 1109 end; 1110 1110 1111 procedure TCityDlg.ShowNewContent(NewMode: TWindowMode; Loc: integer; ShowEvent: cardinal);1111 procedure TCityDlg.ShowNewContent(NewMode: TWindowMode; Loc: Integer; ShowEvent: Cardinal); 1112 1112 begin 1113 1113 if MyMap[Loc] and fOwned <> 0 then … … 1115 1115 cix := MyRO.nCity - 1; 1116 1116 while (cix >= 0) and (MyCity[cix].Loc <> Loc) do 1117 dec(cix);1118 assert(cix >= 0);1117 Dec(cix); 1118 Assert(cix >= 0); 1119 1119 if (Optimize_cixTileChange >= 0) and 1120 1120 (Optimize_TilesBeforeChange and not MyCity[Optimize_cixTileChange].Tiles … … 1132 1132 else 1133 1133 cix := -1; 1134 AllowChange := not supervising and (cix >= 0);1134 AllowChange := not Supervising and (cix >= 0); 1135 1135 cLoc := Loc; 1136 1136 Happened := ShowEvent; … … 1139 1139 1140 1140 procedure TCityDlg.FormMouseDown(Sender: TObject; Button: TMouseButton; 1141 Shift: TShiftState; x, y: integer);1141 Shift: TShiftState; X, Y: Integer); 1142 1142 var 1143 i, qx, qy, dx, dy, fix, NewTiles, Loc1, iix, SellResult: integer;1144 Rebuild: boolean;1145 begin 1146 if (ssLeft in Shift) and ( x >= xSmallMap) and (x< xSmallMap + wSmallMap) and1147 ( y >= ySmallMap) and (y< ySmallMap + hSmallMap) then1143 I, qx, qy, dx, dy, fix, NewTiles, Loc1, iix, SellResult: Integer; 1144 Rebuild: Boolean; 1145 begin 1146 if (ssLeft in Shift) and (X >= xSmallMap) and (X < xSmallMap + wSmallMap) and 1147 (Y >= ySmallMap) and (Y < ySmallMap + hSmallMap) then 1148 1148 begin 1149 1149 SmallMapMode := smImprovements; 1150 ZoomArea := ( y- ySmallMap) * 3 div hSmallMap + 3 *1151 (( x- xSmallMap) * 2 div wSmallMap);1150 ZoomArea := (Y - ySmallMap) * 3 div hSmallMap + 3 * 1151 ((X - xSmallMap) * 2 div wSmallMap); 1152 1152 Page := 0; 1153 1153 InitZoomCityMap; … … 1155 1155 Exit; 1156 1156 end; 1157 if (ssLeft in Shift) and ( x >= xSupport) and (x< xSupport + wSupport) and1158 ( y >= ySupport) and (y< ySupport + hSupport) then1157 if (ssLeft in Shift) and (X >= xSupport) and (X < xSupport + wSupport) and 1158 (Y >= ySupport) and (Y < ySupport + hSupport) then 1159 1159 begin 1160 1160 SmallMapMode := smSupportedUnits; … … 1168 1168 1169 1169 if (ssLeft in Shift) then 1170 if (ClientMode < scContact) and ( x >= xView) and (y>= yView) and1171 ( x < xView + 73) and (y< yView + 50) then1170 if (ClientMode < scContact) and (X >= xView) and (Y >= yView) and 1171 (X < xView + 73) and (Y < yView + 50) then 1172 1172 if cGov = gAnarchy then 1173 1173 with MessgExDlg do 1174 1174 begin 1175 1175 { MessgText:=Phrases.Lookup('OUTOFCONTROL'); 1176 if c.Project and cpImp=0 then1177 MessgText:=Format(MessgText,[Tribe[cOwner].ModelName[ c.Project and cpIndex]])1178 else MessgText:=Format(MessgText,[Phrases.Lookup('IMPROVEMENTS', c.Project and cpIndex)]); }1176 if C.Project and cpImp=0 then 1177 MessgText:=Format(MessgText,[Tribe[cOwner].ModelName[C.Project and cpIndex]]) 1178 else MessgText:=Format(MessgText,[Phrases.Lookup('IMPROVEMENTS',C.Project and cpIndex)]); } 1179 1179 MessgText := Phrases.Lookup('NOCHANGEINANARCHY'); 1180 1180 Kind := mkOk; … … 1185 1185 if ProdHint then 1186 1186 begin 1187 ProdHint := false;1187 ProdHint := False; 1188 1188 SmartUpdateContent 1189 1189 end; 1190 1190 ChooseProject; 1191 1191 end 1192 else if (SmallMapMode = smImprovements) and ( x >= xZoomMap) and (x< xZoomMap + wZoomMap) and1193 ( y >= yZoomMap) and (y< yZoomMap + hZoomMap) then1194 begin 1195 i:= 5;1196 while ( i >= 0) and not((x >= xZoomMap + 14 + 72 * (imod 3)) and1197 ( x < xZoomMap + 14 + 56 + 72 * (imod 3)) and1198 ( y >= yZoomMap + 14 + 56 * (idiv 3)) and1199 ( y < yZoomMap + 14 + 40 + 56 * (idiv 3))) do1200 dec(i);1201 if i>= 0 then1192 else if (SmallMapMode = smImprovements) and (X >= xZoomMap) and (X < xZoomMap + wZoomMap) and 1193 (Y >= yZoomMap) and (Y < yZoomMap + hZoomMap) then 1194 begin 1195 I := 5; 1196 while (I >= 0) and not((X >= xZoomMap + 14 + 72 * (I mod 3)) and 1197 (X < xZoomMap + 14 + 56 + 72 * (I mod 3)) and 1198 (Y >= yZoomMap + 14 + 56 * (I div 3)) and 1199 (Y < yZoomMap + 14 + 40 + 56 * (I div 3))) do 1200 Dec(I); 1201 if I >= 0 then 1202 1202 begin 1203 iix := imix[ i];1203 iix := imix[I]; 1204 1204 if iix >= 0 then 1205 1205 if ssShift in Shift then … … 1221 1221 else 1222 1222 begin 1223 SellResult := Server(sSellCityImprovement - sExecute, me,1223 SellResult := Server(sSellCityImprovement - sExecute, Me, 1224 1224 cix, iix); 1225 1225 if SellResult < rExecuted then … … 1236 1236 else 1237 1237 begin 1238 if Server(sRebuildCityImprovement - sExecute, me, cix, iix) < rExecuted1238 if Server(sRebuildCityImprovement - sExecute, Me, cix, iix) < rExecuted 1239 1239 then 1240 1240 begin // no rebuild possible, ask for sell only 1241 Rebuild := false;1241 Rebuild := False; 1242 1242 MessgText := Phrases.Lookup('IMPROVEMENTS', iix); 1243 1243 if not Phrases2FallenBackToEnglish then 1244 1244 MessgText := Format(Phrases2.Lookup('SELL2'), 1245 1245 [MessgText, Imp[iix].Cost * BuildCostMod 1246 [G.Difficulty[ me]] div 12])1246 [G.Difficulty[Me]] div 12]) 1247 1247 else 1248 1248 MessgText := Format(Phrases.Lookup('SELL'), [MessgText]); 1249 1249 if iix = imSpacePort then 1250 with MyRO.Ship[ me] do1250 with MyRO.Ship[Me] do 1251 1251 if Parts[0] + Parts[1] + Parts[2] > 0 then 1252 1252 MessgText := MessgText + ' ' + … … 1259 1259 else 1260 1260 begin 1261 Rebuild := true;1261 Rebuild := True; 1262 1262 MessgText := Phrases.Lookup('IMPROVEMENTS', iix); 1263 1263 if not Phrases2FallenBackToEnglish then 1264 1264 MessgText := Format(Phrases2.Lookup('DISPOSE2'), 1265 1265 [MessgText, Imp[iix].Cost * BuildCostMod 1266 [G.Difficulty[ me]] div 12 * 2 div 3])1266 [G.Difficulty[Me]] div 12 * 2 div 3]) 1267 1267 else 1268 1268 MessgText := Format(Phrases.Lookup('DISPOSE'), 1269 1269 [MessgText]); 1270 1270 if iix = imSpacePort then 1271 with MyRO.Ship[ me] do1271 with MyRO.Ship[Me] do 1272 1272 if Parts[0] + Parts[1] + Parts[2] > 0 then 1273 1273 MessgText := MessgText + ' ' + … … 1283 1283 begin 1284 1284 Play('CITY_REBUILDIMP'); 1285 Server(sRebuildCityImprovement, me, cix, iix);1285 Server(sRebuildCityImprovement, Me, cix, iix); 1286 1286 end 1287 1287 else 1288 1288 begin 1289 1289 Play('CITY_SELLIMP'); 1290 Server(sSellCityImprovement, me, cix, iix);1290 Server(sSellCityImprovement, Me, cix, iix); 1291 1291 end; 1292 1292 CityOptimizer_CityChange(cix); … … 1301 1301 end; 1302 1302 end 1303 else if (SmallMapMode = smSupportedUnits) and ( x >= xZoomMap) and (x< xZoomMap + wZoomMap) and1304 ( y >= yZoomMap) and (y< yZoomMap + hZoomMap) then1305 begin 1306 i:= 5;1307 while ( i >= 0) and not((x >= xZoomMap + 64 * (imod 3)) and1308 ( x < xZoomMap + 64 + 64 * (imod 3)) and1309 ( y >= yZoomMap + 20 + 48 * (idiv 3)) and1310 ( y < yZoomMap + 20 + 52 + 48 * (idiv 3))) do1311 dec(i);1312 if ( i >= 0) and (imix[i] >= 0) then1303 else if (SmallMapMode = smSupportedUnits) and (X >= xZoomMap) and (X < xZoomMap + wZoomMap) and 1304 (Y >= yZoomMap) and (Y < yZoomMap + hZoomMap) then 1305 begin 1306 I := 5; 1307 while (I >= 0) and not((X >= xZoomMap + 64 * (I mod 3)) and 1308 (X < xZoomMap + 64 + 64 * (I mod 3)) and 1309 (Y >= yZoomMap + 20 + 48 * (I div 3)) and 1310 (Y < yZoomMap + 20 + 52 + 48 * (I div 3))) do 1311 Dec(I); 1312 if (I >= 0) and (imix[I] >= 0) then 1313 1313 if ssShift in Shift then 1314 1314 else if (cix >= 0) and (ClientMode < scContact) and … … 1317 1317 CloseAction := None; 1318 1318 Close; 1319 MainScreen.CityClosed(imix[ i], false, true);1319 MainScreen.CityClosed(imix[I], False, True); 1320 1320 end; 1321 1321 end 1322 else if ( x >= xmArea - 192) and (x < xmArea + 192) and (y>= ymArea - 96)1323 and ( y< ymArea + 96) then1322 else if (X >= xmArea - 192) and (X < xmArea + 192) and (Y >= ymArea - 96) 1323 and (Y < ymArea + 96) then 1324 1324 with AreaMap do begin 1325 qx := ((4000 * xxt * yyt) + ( x - xmArea) * (yyt * 2) + (y- ymArea + yyt)1325 qx := ((4000 * xxt * yyt) + (X - xmArea) * (yyt * 2) + (Y - ymArea + yyt) 1326 1326 * (xxt * 2)) div (xxt * yyt * 4) - 1000; 1327 qy := ((4000 * xxt * yyt) + ( y - ymArea + yyt) * (xxt * 2) - (x- xmArea)1327 qy := ((4000 * xxt * yyt) + (Y - ymArea + yyt) * (xxt * 2) - (X - xmArea) 1328 1328 * (yyt * 2)) div (xxt * yyt * 4) - 1000; 1329 1329 dx := qx - qy; … … 1338 1338 end 1339 1339 else if (ClientMode < scContact) and (cGov <> gAnarchy) and 1340 ( c.Flags and chCaptured = 0) then1340 (C.Flags and chCaptured = 0) then 1341 1341 begin // toggle exploitation 1342 assert(not supervising);1343 if c.Status and csResourceWeightsMask <> 0 then1342 Assert(not Supervising); 1343 if C.Status and csResourceWeightsMask <> 0 then 1344 1344 begin 1345 1345 with MessgExDlg do … … 1355 1355 MyCity[cix].Status := MyCity[cix].Status and 1356 1356 not csResourceWeightsMask; // off 1357 c.Status := MyCity[cix].Status;1357 C.Status := MyCity[cix].Status; 1358 1358 SmartUpdateContent; 1359 1359 end; 1360 exit;1360 Exit; 1361 1361 end; 1362 1362 fix := (dy + 3) shl 2 + (dx + 3) shr 1; 1363 1363 NewTiles := MyCity[cix].Tiles xor (1 shl fix); 1364 if Server(sSetCityTiles, me, cix, NewTiles) >= rExecuted then1364 if Server(sSetCityTiles, Me, cix, NewTiles) >= rExecuted then 1365 1365 begin 1366 1366 SmartUpdateContent; … … 1371 1371 end 1372 1372 else if (ClientMode < scContact) and (cGov <> gAnarchy) and 1373 ( c.Flags and chCaptured = 0) and (x >= xmOpt - 32) and (x< xmOpt + 32)1374 and ( y >= ymOpt - 32) and (y< ymOpt + 32) then1375 begin 1376 i := sqr(x - xmOpt) + sqr(y- ymOpt); // click radius1377 if i<= 32 * 32 then1373 (C.Flags and chCaptured = 0) and (X >= xmOpt - 32) and (X < xmOpt + 32) 1374 and (Y >= ymOpt - 32) and (Y < ymOpt + 32) then 1375 begin 1376 I := sqr(X - xmOpt) + sqr(Y - ymOpt); // click radius 1377 if I <= 32 * 32 then 1378 1378 begin 1379 if i< 16 * 16 then // inner area clicked1380 if c.Status and csResourceWeightsMask <> 0 then1381 i := (c.Status shr 4 and $0F) mod 5 + 1 // rotate except off1379 if I < 16 * 16 then // inner area clicked 1380 if C.Status and csResourceWeightsMask <> 0 then 1381 I := (C.Status shr 4 and $0F) mod 5 + 1 // rotate except off 1382 1382 else 1383 i:= 3 // rwGrowth1383 I := 3 // rwGrowth 1384 1384 else 1385 case trunc(arctan2( x - xmOpt, ymOpt - y) * 180 / pi) of1385 case trunc(arctan2(X - xmOpt, ymOpt - Y) * 180 / pi) of 1386 1386 - 25 - 52 * 2 .. -26 - 52: 1387 i:= 1;1387 I := 1; 1388 1388 -25 - 52 .. -26: 1389 i:= 2;1389 I := 2; 1390 1390 -25 .. 25: 1391 i:= 3;1391 I := 3; 1392 1392 26 .. 25 + 52: 1393 i:= 4;1393 I := 4; 1394 1394 26 + 52 .. 25 + 52 * 2: 1395 i:= 5;1395 I := 5; 1396 1396 180 - 26 .. 180, -180 .. -180 + 26: 1397 i:= 0;1397 I := 0; 1398 1398 else 1399 i:= -1;1399 I := -1; 1400 1400 end; 1401 if i>= 0 then1401 if I >= 0 then 1402 1402 begin 1403 ChangeResourceWeights( i);1403 ChangeResourceWeights(I); 1404 1404 SmartUpdateContent; 1405 1405 if WindowMode <> wmModal then … … 1423 1423 ); 1424 1424 1425 function ProjectType(Project: integer): TProjectType;1425 function ProjectType(Project: Integer): TProjectType; 1426 1426 begin 1427 1427 if Project and cpCompleted <> 0 then … … 1445 1445 1446 1446 var 1447 NewProject, OldMoney, cix1: integer;1447 NewProject, OldMoney, cix1: Integer; 1448 1448 pt0, pt1: TProjectType; 1449 QueryOk: boolean;1450 begin 1451 Assert(not supervising);1449 QueryOk: Boolean; 1450 begin 1451 Assert(not Supervising); 1452 1452 ModalSelectDlg.ShowNewContent_CityProject(wmModal, cix); 1453 if ModalSelectDlg. result <> -1 then1454 begin 1455 if ModalSelectDlg. result and cpType <> 0 then1453 if ModalSelectDlg.Result <> -1 then 1454 begin 1455 if ModalSelectDlg.Result and cpType <> 0 then 1456 1456 begin 1457 1457 MyCity[cix].Status := MyCity[cix].Status and not 7 or 1458 (1 + ModalSelectDlg. result and cpIndex);1459 AutoBuild(cix, MyData.ImpOrder[ModalSelectDlg. result and cpIndex]);1458 (1 + ModalSelectDlg.Result and cpIndex); 1459 AutoBuild(cix, MyData.ImpOrder[ModalSelectDlg.Result and cpIndex]); 1460 1460 end 1461 1461 else … … 1522 1522 then 1523 1523 NewProject := NewProject or cpDisbandCity; 1524 Server(sSetCityProject, me, cix, NewProject);1525 c.Project := MyCity[cix].Project;1524 Server(sSetCityProject, Me, cix, NewProject); 1525 C.Project := MyCity[cix].Project; 1526 1526 if MyRO.Money > OldMoney then 1527 1527 Play('CITY_SELLIMP'); … … 1538 1538 procedure TCityDlg.BuyClick(Sender: TObject); 1539 1539 var 1540 NextProd, Cost: integer;1540 NextProd, Cost: Integer; 1541 1541 begin 1542 1542 if (cix < 0) or (ClientMode >= scContact) then 1543 exit;1543 Exit; 1544 1544 with MyCity[cix], MessgExDlg do 1545 1545 begin … … 1549 1549 NextProd := 0; 1550 1550 Cost := Cost - Prod - NextProd; 1551 if (MyRO.Wonder[woMich].EffectiveOwner = me) and (Project and cpImp <> 0)1551 if (MyRO.Wonder[woMich].EffectiveOwner = Me) and (Project and cpImp <> 0) 1552 1552 then 1553 1553 Cost := Cost * 2 … … 1573 1573 if (Kind = mkYesNo) and (ModalResult = mrOK) then 1574 1574 begin 1575 if Server(sBuyCityProject, me, cix, nil^) >= rExecuted then1575 if Server(sBuyCityProject, Me, cix, nil^) >= rExecuted then 1576 1576 begin 1577 1577 Play('CITY_BUYPROJECT'); … … 1633 1633 else if BlinkTime = 6 then 1634 1634 begin 1635 if AllowChange and ( c.Status and 7 <> 0) then1635 if AllowChange and (C.Status and 7 <> 0) then 1636 1636 begin // city type autobuild 1637 1637 FrameImage(Canvas, bigimp, xView + 9, yView + 5, xSizeBig, ySizeBig, 1638 ( c.Status and 7 - 1 + 3) * xSizeBig, 0, true);1638 (C.Status and 7 - 1 + 3) * xSizeBig, 0, True); 1639 1639 end 1640 else if c.Project and cpImp = 0 then1640 else if C.Project and cpImp = 0 then 1641 1641 begin // project is unit 1642 1642 BitBltCanvas(Canvas, xView + 9, yView + 5, xSizeBig, ySizeBig, 1643 1643 Bigimp.Canvas, 0, 0); 1644 with Tribe[cOwner].ModelPicture[ c.Project and cpIndex] do1644 with Tribe[cOwner].ModelPicture[C.Project and cpIndex] do 1645 1645 Sprite(Canvas, HGr, xView + 5, yView + 1, 64, 44, pix mod 10 * 65 + 1, 1646 1646 pix div 10 * 49 + 1); 1647 1647 end 1648 1648 else 1649 ImpImage(Canvas, xView + 9, yView + 5, c.Project0 and cpIndex,1650 cGov, true);1649 ImpImage(Canvas, xView + 9, yView + 5, C.Project0 and cpIndex, 1650 cGov, True); 1651 1651 end; 1652 1652 end; … … 1664 1664 if 1 shl OpenSoundEvent = chProduction then 1665 1665 begin 1666 if c.Project0 and cpImp <> 0 then1667 begin 1668 if c.Project0 and cpIndex >= 28 then1666 if C.Project0 and cpImp <> 0 then 1667 begin 1668 if C.Project0 and cpIndex >= 28 then 1669 1669 // wonders have already extra message with sound 1670 if Imp[ c.Project0 and cpIndex].Kind = ikShipPart then1670 if Imp[C.Project0 and cpIndex].Kind = ikShipPart then 1671 1671 Play('SHIP_BUILT') 1672 1672 else … … 1682 1682 end; 1683 1683 1684 function Prio(iix: integer): integer;1684 function Prio(iix: Integer): Integer; 1685 1685 begin 1686 1686 case Imp[iix].Kind of 1687 1687 ikWonder: 1688 result := iix + 10000;1688 Result := iix + 10000; 1689 1689 ikNatLocal, ikNatGlobal: 1690 1690 case iix of 1691 1691 imPalace: 1692 result := 0;1692 Result := 0; 1693 1693 else 1694 result := iix + 20000;1694 Result := iix + 20000; 1695 1695 end; 1696 1696 else 1697 1697 case iix of 1698 1698 imTownHall, imCourt: 1699 result := iix + 30000;1699 Result := iix + 30000; 1700 1700 imAqueduct, imSewer: 1701 result := iix + 40000;1701 Result := iix + 40000; 1702 1702 imTemple, imTheater, imCathedral: 1703 result := iix + 50000;1704 else 1705 result := iix + 90000;1703 Result := iix + 50000; 1704 else 1705 Result := iix + 90000; 1706 1706 end; 1707 1707 end; … … 1718 1718 end; 1719 1719 1720 procedure TCityDlg.ChangeCity( d: integer);1720 procedure TCityDlg.ChangeCity(D: Integer); 1721 1721 var 1722 cixNew: integer;1722 cixNew: Integer; 1723 1723 begin 1724 1724 cixNew := cix; 1725 1725 repeat 1726 cixNew := (cixNew + MyRO.nCity + d) mod MyRO.nCity;1726 cixNew := (cixNew + MyRO.nCity + D) mod MyRO.nCity; 1727 1727 until (MyCity[cixNew].Loc >= 0) or (cixNew = cix); 1728 1728 if cixNew <> cix then … … 1766 1766 end; 1767 1767 1768 procedure TCityDlg.ChangeResourceWeights(iResourceWeights: integer);1768 procedure TCityDlg.ChangeResourceWeights(iResourceWeights: Integer); 1769 1769 var 1770 1770 Advice: TCityTileAdviceData; 1771 1771 begin 1772 assert(not supervising);1773 assert(cix >= 0);1772 Assert(not Supervising); 1773 Assert(cix >= 0); 1774 1774 MyCity[cix].Status := MyCity[cix].Status and not csResourceWeightsMask or 1775 1775 (iResourceWeights shl 4); 1776 c.Status := MyCity[cix].Status;1776 C.Status := MyCity[cix].Status; 1777 1777 if iResourceWeights > 0 then 1778 1778 begin 1779 1779 Advice.ResourceWeights := OfferedResourceWeights[iResourceWeights]; 1780 Server(sGetCityTileAdvice, me, cix, Advice);1780 Server(sGetCityTileAdvice, Me, cix, Advice); 1781 1781 if Advice.Tiles <> MyCity[cix].Tiles then 1782 Server(sSetCityTiles, me, cix, Advice.Tiles);1782 Server(sSetCityTiles, Me, cix, Advice.Tiles); 1783 1783 end; 1784 1784 end; … … 1786 1786 procedure SortImprovements; 1787 1787 var 1788 i, j, k: integer;1789 begin 1790 for i:= 0 to nImp - 1 do1791 ImpSorted[ i] := i;1792 for i:= 0 to nImp - 2 do1793 for j := i+ 1 to nImp - 1 do1794 if Prio(ImpSorted[ i]) > Prio(ImpSorted[j]) then begin1795 k := ImpSorted[i];1796 ImpSorted[ i] := ImpSorted[j];1797 ImpSorted[ j] := k;1788 I, J, K: Integer; 1789 begin 1790 for I := 0 to nImp - 1 do 1791 ImpSorted[I] := I; 1792 for I := 0 to nImp - 2 do 1793 for J := I + 1 to nImp - 1 do 1794 if Prio(ImpSorted[I]) > Prio(ImpSorted[J]) then begin 1795 K := ImpSorted[I]; 1796 ImpSorted[I] := ImpSorted[J]; 1797 ImpSorted[J] := K; 1798 1798 end; 1799 1799 end; -
trunk/LocalPlayer/CityType.pas
r442 r447 18 18 procedure FormShow(Sender: TObject); 19 19 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 20 Shift: TShiftState; x, y: integer);20 Shift: TShiftState; X, Y: Integer); 21 21 procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; 22 Shift: TShiftState; x, y: integer);22 Shift: TShiftState; X, Y: Integer); 23 23 procedure FormClose(Sender: TObject; var Action: TCloseAction); 24 24 procedure DeleteBtnClick(Sender: TObject); … … 28 28 procedure OffscreenPaint; override; 29 29 private 30 nPool, dragiix, ctype: integer;31 Pooliix: array [0 .. nImp - 1] of integer;30 nPool, dragiix, ctype: Integer; 31 Pooliix: array [0 .. nImp - 1] of Integer; 32 32 listed: Set of 0 .. nImp; 33 Changed: boolean;34 procedure LoadType(NewType: integer);33 Changed: Boolean; 34 procedure LoadType(NewType: Integer); 35 35 procedure SaveType; 36 36 end; … … 82 82 procedure TCityTypeDlg.OffscreenPaint; 83 83 var 84 i, iix: integer;85 s: string;84 I, iix: Integer; 85 S: string; 86 86 begin 87 87 inherited; 88 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);88 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 89 89 FillOffscreen(xList - 7, yList, 42 * nListCol + 14, 32 * nListRow); 90 90 FillOffscreen(xPool - 7, yPool, 42 * nPoolCol + 14, 32 * nPoolRow); … … 92 92 yPool - yList - 32 * nListRow); 93 93 94 Frame( offscreen.Canvas, 0, yList + 32 * nListRow, InnerWidth - 255,94 Frame(Offscreen.Canvas, 0, yList + 32 * nListRow, InnerWidth - 255, 95 95 yPool - 23, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 96 Frame( offscreen.Canvas, InnerWidth - 254, yList + 32 * nListRow,96 Frame(Offscreen.Canvas, InnerWidth - 254, yList + 32 * nListRow, 97 97 InnerWidth - 89, yPool - 23, MainTexture.ColorBevelLight, 98 98 MainTexture.ColorBevelShade); 99 Frame( offscreen.Canvas, InnerWidth - 88, yList + 32 * nListRow,99 Frame(Offscreen.Canvas, InnerWidth - 88, yList + 32 * nListRow, 100 100 InnerWidth - 1, yPool - 23, MainTexture.ColorBevelLight, 101 101 MainTexture.ColorBevelShade); 102 Frame( offscreen.Canvas, 0, yPool - 22, InnerWidth - 1, yPool - 1,102 Frame(Offscreen.Canvas, 0, yPool - 22, InnerWidth - 1, yPool - 1, 103 103 MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 104 for i:= 0 to nCityType - 1 do105 begin 106 RFrame( offscreen.Canvas, xSwitch + i * 42, ySwitch, xSwitch + 39 + i* 42,104 for I := 0 to nCityType - 1 do 105 begin 106 RFrame(Offscreen.Canvas, xSwitch + I * 42, ySwitch, xSwitch + 39 + I * 42, 107 107 ySwitch + 23, MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 108 if i= ctype then109 Frame( offscreen.Canvas, xSwitch + 1 + i* 42, ySwitch + 1,110 xSwitch + 38 + i* 42, ySwitch + 22, MainTexture.ColorBevelShade,108 if I = ctype then 109 Frame(Offscreen.Canvas, xSwitch + 1 + I * 42, ySwitch + 1, 110 xSwitch + 38 + I * 42, ySwitch + 22, MainTexture.ColorBevelShade, 111 111 MainTexture.ColorBevelLight) 112 112 else 113 Frame( offscreen.Canvas, xSwitch + 1 + i* 42, ySwitch + 1,114 xSwitch + 38 + i* 42, ySwitch + 22, MainTexture.ColorBevelLight,113 Frame(Offscreen.Canvas, xSwitch + 1 + I * 42, ySwitch + 1, 114 xSwitch + 38 + I * 42, ySwitch + 22, MainTexture.ColorBevelLight, 115 115 MainTexture.ColorBevelShade); 116 BitBltCanvas( offscreen.Canvas, xSwitch + 2 + i* 42, ySwitch + 2,117 xSizeSmall, ySizeSmall, SmallImp.Canvas, ( i+ 3) * xSizeSmall, 0);118 end; 119 RisedTextOut( offscreen.Canvas, 8, yList + 32 * nListRow + 2,116 BitBltCanvas(Offscreen.Canvas, xSwitch + 2 + I * 42, ySwitch + 2, 117 xSizeSmall, ySizeSmall, SmallImp.Canvas, (I + 3) * xSizeSmall, 0); 118 end; 119 RisedTextOut(Offscreen.Canvas, 8, yList + 32 * nListRow + 2, 120 120 Phrases.Lookup('BUILDORDER')); 121 RisedTextOut( offscreen.Canvas, 8, ySwitch + 26,121 RisedTextOut(Offscreen.Canvas, 8, ySwitch + 26, 122 122 Phrases.Lookup('CITYTYPE', ctype)); 123 s:= Phrases.Lookup('BUILDREST');124 RisedTextOut( offscreen.Canvas,125 (InnerWidth - BiColorTextWidth( offscreen.Canvas, s)) div 2,126 yList + 72 + 32 * nListRow, s);127 128 with offscreen.Canvas do129 begin 130 for i:= 1 to nListRow - 1 do131 DLine( offscreen.Canvas, xList - 5, xList + 4 + 42 * nListCol,132 yList - 1 + 32 * i, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade);133 for i:= 0 to nListCol * nListRow - 1 do134 begin 135 s := IntToStr(i+ 1);123 S := Phrases.Lookup('BUILDREST'); 124 RisedTextOut(Offscreen.Canvas, 125 (InnerWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 126 yList + 72 + 32 * nListRow, S); 127 128 with Offscreen.Canvas do 129 begin 130 for I := 1 to nListRow - 1 do 131 DLine(Offscreen.Canvas, xList - 5, xList + 4 + 42 * nListCol, 132 yList - 1 + 32 * I, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 133 for I := 0 to nListCol * nListRow - 1 do 134 begin 135 S := IntToStr(I + 1); 136 136 Font.Color := MainTexture.ColorTextLight; 137 Textout(xList + 20 + i mod nListCol * 42 - TextWidth(s) div 2,138 yList + 15 + i div nListCol * 32 - TextHeight(s) div 2, s);139 end; 140 end; 141 142 i:= 0;143 while MyData.ImpOrder[ctype, i] >= 0 do144 begin 145 RFrame( offscreen.Canvas, xList + 20 - xSizeSmall div 2 + imod nListCol *146 42, yList + 15 - ySizeSmall div 2 + idiv nListCol * 32,147 xList + 21 + xSizeSmall div 2 + imod nListCol * 42,148 yList + 16 + ySizeSmall div 2 + idiv nListCol * 32,137 Textout(xList + 20 + I mod nListCol * 42 - TextWidth(S) div 2, 138 yList + 15 + I div nListCol * 32 - TextHeight(S) div 2, S); 139 end; 140 end; 141 142 I := 0; 143 while MyData.ImpOrder[ctype, I] >= 0 do 144 begin 145 RFrame(Offscreen.Canvas, xList + 20 - xSizeSmall div 2 + I mod nListCol * 146 42, yList + 15 - ySizeSmall div 2 + I div nListCol * 32, 147 xList + 21 + xSizeSmall div 2 + I mod nListCol * 42, 148 yList + 16 + ySizeSmall div 2 + I div nListCol * 32, 149 149 MainTexture.ColorBevelLight, MainTexture.ColorBevelShade); 150 BitBltCanvas( offscreen.Canvas, xList + 21 - xSizeSmall div 2 +151 i mod nListCol * 42, yList + 16 - ySizeSmall div 2 + idiv nListCol * 32,150 BitBltCanvas(Offscreen.Canvas, xList + 21 - xSizeSmall div 2 + 151 I mod nListCol * 42, yList + 16 - ySizeSmall div 2 + I div nListCol * 32, 152 152 xSizeSmall, ySizeSmall, SmallImp.Canvas, 153 MyData.ImpOrder[ctype, i] mod 7 * xSizeSmall,154 (MyData.ImpOrder[ctype, i] + SystemIconLines * 7) div 7 *153 MyData.ImpOrder[ctype, I] mod 7 * xSizeSmall, 154 (MyData.ImpOrder[ctype, I] + SystemIconLines * 7) div 7 * 155 155 ySizeSmall); 156 inc(i);156 Inc(I); 157 157 end; 158 158 … … 165 165 begin 166 166 Pooliix[nPool] := iix; 167 RFrame( offscreen.Canvas, xPool + 20 - xSizeSmall div 2 +167 RFrame(Offscreen.Canvas, xPool + 20 - xSizeSmall div 2 + 168 168 nPool mod nPoolCol * 42, yPool + 15 - ySizeSmall div 2 + 169 169 nPool div nPoolCol * 32, xPool + 21 + xSizeSmall div 2 + … … 171 171 nPool div nPoolCol * 32, MainTexture.ColorBevelLight, 172 172 MainTexture.ColorBevelShade); 173 BitBltCanvas( offscreen.Canvas, xPool + 21 - xSizeSmall div 2 +173 BitBltCanvas(Offscreen.Canvas, xPool + 21 - xSizeSmall div 2 + 174 174 nPool mod nPoolCol * 42, yPool + 16 - ySizeSmall div 2 + 175 175 nPool div nPoolCol * 32, xSizeSmall, ySizeSmall, SmallImp.Canvas, 176 176 iix mod 7 * xSizeSmall, (iix + SystemIconLines * 7) div 7 * 177 177 ySizeSmall); 178 inc(nPool);178 Inc(nPool); 179 179 end; 180 180 DeleteBtn.Visible := MyData.ImpOrder[ctype, 0] >= 0; … … 182 182 if dragiix >= 0 then 183 183 begin 184 ImpImage( offscreen.Canvas, xView + 9, yView + 5, dragiix);185 s:= Phrases.Lookup('IMPROVEMENTS', dragiix);186 RisedTextOut( offscreen.Canvas,187 xView + 36 - BiColorTextWidth( offscreen.Canvas, s) div 2,188 ySwitch + 26, s);184 ImpImage(Offscreen.Canvas, xView + 9, yView + 5, dragiix); 185 S := Phrases.Lookup('IMPROVEMENTS', dragiix); 186 RisedTextOut(Offscreen.Canvas, 187 xView + 36 - BiColorTextWidth(Offscreen.Canvas, S) div 2, 188 ySwitch + 26, S); 189 189 end; 190 190 MarkUsedOffscreen(InnerWidth, InnerHeight); 191 191 end; 192 192 193 procedure TCityTypeDlg.LoadType(NewType: integer);194 var 195 i: integer;193 procedure TCityTypeDlg.LoadType(NewType: Integer); 194 var 195 I: Integer; 196 196 begin 197 197 ctype := NewType; 198 198 listed := []; 199 i:= 0;200 while MyData.ImpOrder[ctype, i] >= 0 do201 begin 202 include(listed, MyData.ImpOrder[ctype, i]);203 inc(i);204 end; 205 Changed := false;199 I := 0; 200 while MyData.ImpOrder[ctype, I] >= 0 do 201 begin 202 Include(listed, MyData.ImpOrder[ctype, I]); 203 Inc(I); 204 end; 205 Changed := False; 206 206 end; 207 207 208 208 procedure TCityTypeDlg.SaveType; 209 209 var 210 cix: integer;210 cix: Integer; 211 211 begin 212 212 if Changed then … … 215 215 if (MyCity[cix].Loc >= 0) and (MyCity[cix].Status and 7 = ctype + 1) then 216 216 AutoBuild(cix, MyData.ImpOrder[ctype]); 217 Changed := false;217 Changed := False; 218 218 end; 219 219 end; … … 232 232 233 233 procedure TCityTypeDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 234 Shift: TShiftState; x, y: integer);235 var 236 i: integer;237 begin 238 x := x- SideFrame;239 y := y- WideFrame;240 i := (x - xList) div 42 + (y- yList) div 32 * nListCol;241 if ( i < nImp) and (MyData.ImpOrder[ctype, i] >= 0) and242 ( x > xList + 2 + imod nListCol * 42) and243 ( y > yList + 5 + idiv nListCol * 32) and244 ( x < xList + 3 + 36 + imod nListCol * 42) and245 ( y < yList + 6 + 20 + idiv nListCol * 32) then234 Shift: TShiftState; X, Y: Integer); 235 var 236 I: Integer; 237 begin 238 X := X - SideFrame; 239 Y := Y - WideFrame; 240 I := (X - xList) div 42 + (Y - yList) div 32 * nListCol; 241 if (I < nImp) and (MyData.ImpOrder[ctype, I] >= 0) and 242 (X > xList + 2 + I mod nListCol * 42) and 243 (Y > yList + 5 + I div nListCol * 32) and 244 (X < xList + 3 + 36 + I mod nListCol * 42) and 245 (Y < yList + 6 + 20 + I div nListCol * 32) then 246 246 begin 247 247 if ssShift in Shift then 248 248 HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, 249 MyData.ImpOrder[ctype, i])249 MyData.ImpOrder[ctype, I]) 250 250 else 251 251 begin 252 dragiix := MyData.ImpOrder[ctype, i];252 dragiix := MyData.ImpOrder[ctype, I]; 253 253 Screen.Cursor := crImpDrag; 254 254 SmartUpdateContent; 255 255 end; 256 exit;257 end; 258 i := (x - xPool) div 42 + (y- yPool) div 32 * nPoolCol;259 if ( i < nPool) and (x > xPool + 2 + imod nPoolCol * 42) and260 ( y > yPool + 5 + idiv nPoolCol * 32) and261 ( x < xPool + 3 + 36 + imod nPoolCol * 42) and262 ( y < yPool + 6 + 20 + idiv nPoolCol * 32) then256 Exit; 257 end; 258 I := (X - xPool) div 42 + (Y - yPool) div 32 * nPoolCol; 259 if (I < nPool) and (X > xPool + 2 + I mod nPoolCol * 42) and 260 (Y > yPool + 5 + I div nPoolCol * 32) and 261 (X < xPool + 3 + 36 + I mod nPoolCol * 42) and 262 (Y < yPool + 6 + 20 + I div nPoolCol * 32) then 263 263 begin 264 264 if ssShift in Shift then 265 HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Pooliix[ i])265 HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkImp, Pooliix[I]) 266 266 else 267 267 begin 268 dragiix := Pooliix[ i];268 dragiix := Pooliix[I]; 269 269 Screen.Cursor := crImpDrag; 270 270 SmartUpdateContent; 271 271 end; 272 exit;273 end; 274 i := (x- xSwitch) div 42;275 if ( i < nCityType) and (x > xSwitch + 2 + i* 42) and276 ( x < xSwitch + 3 + 36 + i * 42) and (y >= ySwitch + 2) and (y< ySwitch + 22)272 Exit; 273 end; 274 I := (X - xSwitch) div 42; 275 if (I < nCityType) and (X > xSwitch + 2 + I * 42) and 276 (X < xSwitch + 3 + 36 + I * 42) and (Y >= ySwitch + 2) and (Y < ySwitch + 22) 277 277 then 278 278 begin 279 279 SaveType; 280 LoadType( i);280 LoadType(I); 281 281 SmartUpdateContent; 282 282 end; … … 284 284 285 285 procedure TCityTypeDlg.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; 286 Shift: TShiftState; x, y: integer);287 288 procedure UnList(iix: integer);286 Shift: TShiftState; X, Y: Integer); 287 288 procedure UnList(iix: Integer); 289 289 var 290 i: integer;291 begin 292 i:= 0;293 while (MyData.ImpOrder[ctype, i] >= 0) and294 (MyData.ImpOrder[ctype, i] <> iix) do295 inc(i);296 assert(MyData.ImpOrder[ctype, i] = iix);297 move(MyData.ImpOrder[ctype, i + 1], MyData.ImpOrder[ctype, i], nImp - i);290 I: Integer; 291 begin 292 I := 0; 293 while (MyData.ImpOrder[ctype, I] >= 0) and 294 (MyData.ImpOrder[ctype, I] <> iix) do 295 Inc(I); 296 Assert(MyData.ImpOrder[ctype, I] = iix); 297 Move(MyData.ImpOrder[ctype, I + 1], MyData.ImpOrder[ctype, I], nImp - I); 298 298 Exclude(listed, iix); 299 299 end; 300 300 301 301 var 302 i: integer;303 begin 304 x := x- SideFrame;305 y := y- WideFrame;302 I: Integer; 303 begin 304 X := X - SideFrame; 305 Y := Y - WideFrame; 306 306 if dragiix >= 0 then 307 307 begin 308 if ( x >= xList) and (x < xList + nListCol * 42) and (y>= yList) and309 ( y< yList + nListRow * 32) then308 if (X >= xList) and (X < xList + nListCol * 42) and (Y >= yList) and 309 (Y < yList + nListRow * 32) then 310 310 begin 311 311 if dragiix in listed then 312 312 UnList(dragiix); 313 i := (x - xList) div 42 + (y- yList) div 32 * nListCol;314 while ( i > 0) and (MyData.ImpOrder[ctype, i- 1] < 0) do315 dec(i);316 move(MyData.ImpOrder[ctype, i], MyData.ImpOrder[ctype, i+ 1],317 nImp - i- 1);318 MyData.ImpOrder[ctype, i] := dragiix;319 include(listed, dragiix);320 Changed := true;313 I := (X - xList) div 42 + (Y - yList) div 32 * nListCol; 314 while (I > 0) and (MyData.ImpOrder[ctype, I - 1] < 0) do 315 Dec(I); 316 Move(MyData.ImpOrder[ctype, I], MyData.ImpOrder[ctype, I + 1], 317 nImp - I - 1); 318 MyData.ImpOrder[ctype, I] := dragiix; 319 Include(listed, dragiix); 320 Changed := True; 321 321 end 322 else if (dragiix in listed) and ( x >= xPool) and (x< xPool + nPoolCol * 42)323 and ( y >= yPool) and (y< yPool + nPoolRow * 32) then322 else if (dragiix in listed) and (X >= xPool) and (X < xPool + nPoolCol * 42) 323 and (Y >= yPool) and (Y < yPool + nPoolRow * 32) then 324 324 begin 325 325 UnList(dragiix); 326 Changed := true;326 Changed := True; 327 327 end; 328 328 dragiix := -1; … … 340 340 procedure TCityTypeDlg.DeleteBtnClick(Sender: TObject); 341 341 begin 342 fillchar(MyData.ImpOrder[ctype], sizeof(MyData.ImpOrder[ctype]), Byte(-1));342 FillChar(MyData.ImpOrder[ctype], SizeOf(MyData.ImpOrder[ctype]), Byte(-1)); 343 343 listed := []; 344 Changed := true;344 Changed := True; 345 345 SmartUpdateContent; 346 346 end; -
trunk/LocalPlayer/ClientTools.pas
r442 r447 9 9 const 10 10 nOfferedResourceWeights = 6; 11 OfferedResourceWeights: array [0 .. nOfferedResourceWeights - 1] of cardinal =11 OfferedResourceWeights: array [0 .. nOfferedResourceWeights - 1] of Cardinal = 12 12 (rwOff, rwMaxScience, rwForceScience, rwMaxGrowth, rwForceProd, rwMaxProd); 13 13 14 14 type 15 TImpOrder = array [0 .. (nImp + 4) div 4 * 4 - 1] of shortint;16 TEnhancementJobs = array [0 .. 11, 0 .. 7] of byte;15 TImpOrder = array [0 .. (nImp + 4) div 4 * 4 - 1] of ShortInt; 16 TEnhancementJobs = array [0 .. 11, 0 .. 7] of Byte; 17 17 JobResultSet = set of 0 .. 39; 18 18 … … 36 36 Server: TServerCall; 37 37 G: TNewGameData; 38 me: integer;38 Me: Integer; 39 39 MyRO: ^TPlayerContext; 40 40 MyMap: ^TTileList; … … 43 43 MyModel: ^TModelList; 44 44 45 AdvValue: array [0 .. nAdv - 1] of integer;46 47 function dLoc(Loc, dx, dy: integer): integer;48 function Distance(Loc0, Loc1: integer): integer;49 function UnrestAtLoc(uix, Loc: integer): boolean;50 function GetMoveAdvice(uix, ToLoc: integer;51 var MoveAdviceData: TMoveAdviceData): integer;52 function ColorOfHealth(Health: integer): integer;53 function IsMultiPlayerGame: boolean;54 procedure ItsMeAgain( p: integer);55 function GetAge( p: integer): integer;56 function IsCivilReportNew(Enemy: integer): boolean;57 function IsMilReportNew(Enemy: integer): boolean;58 function CutCityFoodSurplus(FoodSurplus: integer; IsCityAlive: boolean;59 gov, size: integer): integer;60 function CityTaxBalance(cix: integer; const CityReport: TCityReportNew): integer;61 procedure SumCities(var TaxSum, ScienceSum: integer);62 function JobTest(uix, Job: integer; IgnoreResults: JobResultSet = []): boolean;63 procedure GetUnitInfo(Loc: integer; var uix: integer; var UnitInfo: TUnitInfo);64 procedure GetCityInfo(Loc: integer; var cix: integer; var CityInfo: TCityInfo);65 function UnitExhausted(uix: integer): boolean;66 function ModelHash(const ModelInfo: TModelInfo): integer;67 function ProcessEnhancement(uix: integer; const Jobs: TEnhancementJobs): integer;68 function AutoBuild(cix: integer; const ImpOrder: TImpOrder): boolean;69 procedure DebugMessage(Level: integer; Text: string);45 AdvValue: array [0 .. nAdv - 1] of Integer; 46 47 function dLoc(Loc, dx, dy: Integer): Integer; 48 function Distance(Loc0, Loc1: Integer): Integer; 49 function UnrestAtLoc(uix, Loc: Integer): Boolean; 50 function GetMoveAdvice(uix, ToLoc: Integer; 51 var MoveAdviceData: TMoveAdviceData): Integer; 52 function ColorOfHealth(Health: Integer): Integer; 53 function IsMultiPlayerGame: Boolean; 54 procedure ItsMeAgain(P: Integer); 55 function GetAge(P: Integer): Integer; 56 function IsCivilReportNew(Enemy: Integer): Boolean; 57 function IsMilReportNew(Enemy: Integer): Boolean; 58 function CutCityFoodSurplus(FoodSurplus: Integer; IsCityAlive: Boolean; 59 gov, size: Integer): Integer; 60 function CityTaxBalance(cix: Integer; const CityReport: TCityReportNew): Integer; 61 procedure SumCities(var TaxSum, ScienceSum: Integer); 62 function JobTest(uix, Job: Integer; IgnoreResults: JobResultSet = []): Boolean; 63 procedure GetUnitInfo(Loc: Integer; var uix: Integer; var UnitInfo: TUnitInfo); 64 procedure GetCityInfo(Loc: Integer; var cix: Integer; var CityInfo: TCityInfo); 65 function UnitExhausted(uix: Integer): Boolean; 66 function ModelHash(const ModelInfo: TModelInfo): Integer; 67 function ProcessEnhancement(uix: Integer; const Jobs: TEnhancementJobs): Integer; 68 function AutoBuild(cix: Integer; const ImpOrder: TImpOrder): Boolean; 69 procedure DebugMessage(Level: Integer; Text: string); 70 70 procedure CityOptimizer_BeginOfTurn; 71 procedure CityOptimizer_CityChange(cix: integer);72 procedure CityOptimizer_TileBecomesAvailable(Loc: integer);73 procedure CityOptimizer_ReleaseCityTiles(cix, ReleasedTiles: integer);74 procedure CityOptimizer_BeforeRemoveUnit(uix: integer);71 procedure CityOptimizer_CityChange(cix: Integer); 72 procedure CityOptimizer_TileBecomesAvailable(Loc: Integer); 73 procedure CityOptimizer_ReleaseCityTiles(cix, ReleasedTiles: Integer); 74 procedure CityOptimizer_BeforeRemoveUnit(uix: Integer); 75 75 procedure CityOptimizer_AfterRemoveUnit; 76 76 procedure CityOptimizer_EndOfTurn; … … 84 84 85 85 var 86 CityNeedsOptimize: array [0 .. ncmax - 1] of boolean;87 88 function dLoc(Loc, dx, dy: integer): integer;89 var 90 y0: integer;86 CityNeedsOptimize: array [0 .. ncmax - 1] of Boolean; 87 88 function dLoc(Loc, dx, dy: Integer): Integer; 89 var 90 y0: Integer; 91 91 begin 92 92 y0 := (Loc + G.lx * 1024) div G.lx - 1024; … … 94 94 end; 95 95 96 function Distance(Loc0, Loc1: integer): integer;97 var 98 dx, dy: integer;96 function Distance(Loc0, Loc1: Integer): Integer; 97 var 98 dx, dy: Integer; 99 99 begin 100 100 Inc(Loc0, G.lx * 1024); … … 106 106 end; 107 107 108 function UnrestAtLoc(uix, Loc: integer): boolean;109 var 110 uix1: integer;108 function UnrestAtLoc(uix, Loc: Integer): Boolean; 109 var 110 uix1: Integer; 111 111 begin 112 112 Result := False; … … 114 114 case MyRO.Government of 115 115 gRepublic, gFuture: 116 Result := (MyRO.Territory[Loc] >= 0) and (MyRO.Territory[Loc] <> me) and116 Result := (MyRO.Territory[Loc] >= 0) and (MyRO.Territory[Loc] <> Me) and 117 117 (MyRO.Treaty[MyRO.Territory[Loc]] < trAlliance); 118 118 gDemocracy: 119 Result := (MyRO.Territory[Loc] < 0) or (MyRO.Territory[Loc] <> me) and119 Result := (MyRO.Territory[Loc] < 0) or (MyRO.Territory[Loc] <> Me) and 120 120 (MyRO.Treaty[MyRO.Territory[Loc]] < trAlliance); 121 121 end; … … 127 127 end; 128 128 129 function GetMoveAdvice(uix, ToLoc: integer;130 var MoveAdviceData: TMoveAdviceData): integer;131 var 132 MinEndHealth: integer;129 function GetMoveAdvice(uix, ToLoc: Integer; 130 var MoveAdviceData: TMoveAdviceData): Integer; 131 var 132 MinEndHealth: Integer; 133 133 begin 134 134 if MyModel[MyUn[uix].mix].Domain = dGround then … … 142 142 MoveAdviceData.MoreTurns := 999; 143 143 MoveAdviceData.MaxHostile_MovementLeft := MyUn[uix].Health - MinEndHealth; 144 Result := Server(sGetMoveAdvice, me, uix, MoveAdviceData);144 Result := Server(sGetMoveAdvice, Me, uix, MoveAdviceData); 145 145 if (MinEndHealth <= 1) or (Result <> eNoWay) then 146 exit;146 Exit; 147 147 end; 148 148 case MinEndHealth of … … 159 159 end; 160 160 161 function ColorOfHealth(Health: integer): integer;162 var 163 red, green: integer;164 begin 165 green := 400 * Health div 100;166 if green > 200 then167 green := 200;168 red := 510 * (100 - Health) div 100;169 if red > 255 then170 red := 255;171 Result := green shl 8 + red;172 end; 173 174 function IsMultiPlayerGame: boolean;175 var 176 p1: integer;161 function ColorOfHealth(Health: Integer): Integer; 162 var 163 Red, Green: Integer; 164 begin 165 Green := 400 * Health div 100; 166 if Green > 200 then 167 Green := 200; 168 Red := 510 * (100 - Health) div 100; 169 if Red > 255 then 170 Red := 255; 171 Result := Green shl 8 + Red; 172 end; 173 174 function IsMultiPlayerGame: Boolean; 175 var 176 p1: Integer; 177 177 begin 178 178 Result := False; … … 182 182 end; 183 183 184 procedure ItsMeAgain( p: integer);185 begin 186 if G.RO[ p] <> nil then187 MyRO := pointer(G.RO[p])188 else if G.SuperVisorRO[ p] <> nil then189 MyRO := pointer(G.SuperVisorRO[p])184 procedure ItsMeAgain(P: Integer); 185 begin 186 if G.RO[P] <> nil then 187 MyRO := Pointer(G.RO[P]) 188 else if G.SuperVisorRO[P] <> nil then 189 MyRO := Pointer(G.SuperVisorRO[P]) 190 190 else 191 exit;192 me := p;193 MyMap := pointer(MyRO.Map);194 MyUn := pointer(MyRO.Un);195 MyCity := pointer(MyRO.City);196 MyModel := pointer(MyRO.Model);197 end; 198 199 function GetAge( p: integer): integer;200 var 201 i: integer;202 begin 203 if p = me then begin191 Exit; 192 Me := P; 193 MyMap := Pointer(MyRO.Map); 194 MyUn := Pointer(MyRO.Un); 195 MyCity := Pointer(MyRO.City); 196 MyModel := Pointer(MyRO.Model); 197 end; 198 199 function GetAge(P: Integer): Integer; 200 var 201 I: Integer; 202 begin 203 if P = Me then begin 204 204 Result := 0; 205 for i:= 1 to 3 do206 if MyRO.Tech[AgePreq[ i]] >= tsApplicable then207 Result := i;205 for I := 1 to 3 do 206 if MyRO.Tech[AgePreq[I]] >= tsApplicable then 207 Result := I; 208 208 end else begin 209 209 Result := 0; 210 for i:= 1 to 3 do211 if MyRO.EnemyReport[ p].Tech[AgePreq[i]] >= tsApplicable then212 Result := i;213 end; 214 end; 215 216 function IsCivilReportNew(Enemy: integer): boolean;217 var 218 i: integer;219 begin 220 assert(Enemy <> me);221 i:= MyRO.EnemyReport[Enemy].TurnOfCivilReport;222 Result := ( i = MyRO.Turn) or (i = MyRO.Turn - 1) and (Enemy > me);223 end; 224 225 function IsMilReportNew(Enemy: integer): boolean;226 var 227 i: integer;228 begin 229 assert(Enemy <> me);230 i:= MyRO.EnemyReport[Enemy].TurnOfMilReport;231 Result := ( i = MyRO.Turn) or (i = MyRO.Turn - 1) and (Enemy > me);232 end; 233 234 function CutCityFoodSurplus(FoodSurplus: integer; IsCityAlive: boolean;235 gov, size: integer): integer;210 for I := 1 to 3 do 211 if MyRO.EnemyReport[P].Tech[AgePreq[I]] >= tsApplicable then 212 Result := I; 213 end; 214 end; 215 216 function IsCivilReportNew(Enemy: Integer): Boolean; 217 var 218 I: Integer; 219 begin 220 Assert(Enemy <> Me); 221 I := MyRO.EnemyReport[Enemy].TurnOfCivilReport; 222 Result := (I = MyRO.Turn) or (I = MyRO.Turn - 1) and (Enemy > Me); 223 end; 224 225 function IsMilReportNew(Enemy: Integer): Boolean; 226 var 227 I: Integer; 228 begin 229 Assert(Enemy <> Me); 230 I := MyRO.EnemyReport[Enemy].TurnOfMilReport; 231 Result := (I = MyRO.Turn) or (I = MyRO.Turn - 1) and (Enemy > Me); 232 end; 233 234 function CutCityFoodSurplus(FoodSurplus: Integer; IsCityAlive: Boolean; 235 gov, size: Integer): Integer; 236 236 begin 237 237 Result := FoodSurplus; … … 241 241 end; 242 242 243 function CityTaxBalance(cix: integer; const CityReport: TCityReportNew): integer;244 var 245 i: integer;243 function CityTaxBalance(cix: Integer; const CityReport: TCityReportNew): Integer; 244 var 245 I: Integer; 246 246 begin 247 247 Result := 0; … … 258 258 Inc(Result, CityReport.FoodSurplus); 259 259 end; 260 for i:= nWonder to nImp - 1 do261 if MyCity[cix].Built[ i] > 0 then262 Dec(Result, Imp[ i].Maint);263 end; 264 265 procedure SumCities(var TaxSum, ScienceSum: integer);266 var 267 cix: integer;260 for I := nWonder to nImp - 1 do 261 if MyCity[cix].Built[I] > 0 then 262 Dec(Result, Imp[I].Maint); 263 end; 264 265 procedure SumCities(var TaxSum, ScienceSum: Integer); 266 var 267 cix: Integer; 268 268 CityReport: TCityReportNew; 269 269 begin … … 271 271 ScienceSum := 0; 272 272 if MyRO.Government = gAnarchy then 273 exit;273 Exit; 274 274 for cix := 0 to MyRO.nCity - 1 do 275 275 if MyCity[cix].Loc >= 0 then … … 278 278 CityReport.HypoTaxRate := -1; 279 279 CityReport.HypoLuxuryRate := -1; 280 Server(sGetCityReportNew, me, cix, CityReport);280 Server(sGetCityReportNew, Me, cix, CityReport); 281 281 if (CityReport.HappinessBalance >= 0) { no disorder } and 282 282 (MyCity[cix].Flags and chCaptured = 0) then // not captured … … 286 286 end; 287 287 288 function JobTest(uix, Job: integer; IgnoreResults: JobResultSet): boolean;289 var 290 Test: integer;291 begin 292 Test := Server(sStartJob + Job shl 4 - sExecute, me, uix, nil^);288 function JobTest(uix, Job: Integer; IgnoreResults: JobResultSet): Boolean; 289 var 290 Test: Integer; 291 begin 292 Test := Server(sStartJob + Job shl 4 - sExecute, Me, uix, nil^); 293 293 Result := (Test >= rExecuted) or (Test in IgnoreResults); 294 294 end; 295 295 296 procedure GetUnitInfo(Loc: integer; var uix: integer; var UnitInfo: TUnitInfo);297 var 298 i, Cnt: integer;296 procedure GetUnitInfo(Loc: Integer; var uix: Integer; var UnitInfo: TUnitInfo); 297 var 298 I, Cnt: Integer; 299 299 begin 300 300 if MyMap[Loc] and fOwned <> 0 then 301 301 begin 302 Server(sGetDefender, me, Loc, uix);302 Server(sGetDefender, Me, Loc, uix); 303 303 Cnt := 0; 304 for i:= 0 to MyRO.nUn - 1 do305 if MyUn[ i].Loc = Loc then304 for I := 0 to MyRO.nUn - 1 do 305 if MyUn[I].Loc = Loc then 306 306 Inc(Cnt); 307 MakeUnitInfo( me, MyUn[uix], UnitInfo);307 MakeUnitInfo(Me, MyUn[uix], UnitInfo); 308 308 if Cnt > 1 then 309 309 UnitInfo.Flags := UnitInfo.Flags or unMulti; … … 318 318 end; 319 319 320 procedure GetCityInfo(Loc: integer; var cix: integer; var CityInfo: TCityInfo);320 procedure GetCityInfo(Loc: Integer; var cix: Integer; var CityInfo: TCityInfo); 321 321 begin 322 322 if MyMap[Loc] and fOwned <> 0 then … … 328 328 with CityInfo do 329 329 begin 330 Owner := me;330 Owner := Me; 331 331 ID := MyCity[cix].ID; 332 332 size := MyCity[cix].size; … … 356 356 end; 357 357 358 function UnitExhausted(uix: integer): boolean;358 function UnitExhausted(uix: Integer): Boolean; 359 359 // check if another move of this unit is still possible 360 360 var 361 dx, dy: integer;361 dx, dy: Integer; 362 362 begin 363 363 Result := True; 364 364 if (MyUn[uix].Movement > 0) or 365 (MyRO.Wonder[woShinkansen].EffectiveOwner = me) then365 (MyRO.Wonder[woShinkansen].EffectiveOwner = Me) then 366 366 if (MyUn[uix].Movement >= 100) or 367 367 ((MyModel[MyUn[uix].mix].Kind = mkCaravan) and … … 373 373 if abs(dx) + abs(dy) = 2 then 374 374 if Server(sMoveUnit - sExecute + dx and 7 shl 4 + dy and 375 7 shl 7, me, uix, nil^) >= rExecuted then375 7 shl 7, Me, uix, nil^) >= rExecuted then 376 376 Result := False; 377 377 end; 378 378 379 function ModelHash(const ModelInfo: TModelInfo): integer;380 var 381 i, FeatureCode, Hash1, Hash2, Hash2r, d: cardinal;379 function ModelHash(const ModelInfo: TModelInfo): Integer; 380 var 381 I, FeatureCode, Hash1, Hash2, Hash2r, D: Cardinal; 382 382 begin 383 383 with ModelInfo do 384 384 if Kind > mkEnemyDeveloped then 385 Result := integer($C0000000 + Speed div 50 + Kind shl 8)385 Result := Integer($C0000000 + Speed div 50 + Kind shl 8) 386 386 else 387 387 begin 388 388 FeatureCode := 0; 389 for i:= mcFirstNonCap to nFeature - 1 do390 if 1 shl Domain and Feature[ i].Domains <> 0 then389 for I := mcFirstNonCap to nFeature - 1 do 390 if 1 shl Domain and Feature[I].Domains <> 0 then 391 391 begin 392 392 FeatureCode := FeatureCode * 2; 393 if 1 shl ( i- mcFirstNonCap) <> 0 then393 if 1 shl (I - mcFirstNonCap) <> 0 then 394 394 Inc(FeatureCode); 395 395 end; … … 397 397 dGround: 398 398 begin 399 assert(FeatureCode < 1 shl 8);400 assert(Attack < 5113);401 assert(Defense < 2273);402 assert(Cost < 1611);399 Assert(FeatureCode < 1 shl 8); 400 Assert(Attack < 5113); 401 Assert(Defense < 2273); 402 Assert(Cost < 1611); 403 403 Hash1 := (Attack * 2273 + Defense) * 9 + (Speed - 150) div 50; 404 404 Hash2 := FeatureCode * 1611 + Cost; … … 406 406 dSea: 407 407 begin 408 assert(FeatureCode < 1 shl 9);409 assert(Attack < 12193);410 assert(Defense < 6097);411 assert(Cost < 4381);408 Assert(FeatureCode < 1 shl 9); 409 Assert(Attack < 12193); 410 Assert(Defense < 6097); 411 Assert(Cost < 4381); 412 412 Hash1 := ((Attack * 6097 + Defense) * 5 + 413 413 (Speed - 350) div 100) * 2; … … 419 419 dAir: 420 420 begin 421 assert(FeatureCode < 1 shl 5);422 assert(Attack < 2407);423 assert(Defense < 1605);424 assert(Bombs < 4813);425 assert(Cost < 2089);421 Assert(FeatureCode < 1 shl 5); 422 Assert(Attack < 2407); 423 Assert(Defense < 1605); 424 Assert(Bombs < 4813); 425 Assert(Cost < 2089); 426 426 Hash1 := (Attack * 1605 + Defense) shl 5 + FeatureCode; 427 427 Hash2 := ((Bombs * 7 + ATrans_Fuel) * 4 + TTrans) * 2089 + Cost; … … 429 429 end; 430 430 Hash2r := 0; 431 for i:= 0 to 7 do431 for I := 0 to 7 do 432 432 begin 433 433 Hash2r := Hash2r * 13; 434 d:= Hash2 div 13;435 Inc(Hash2r, Hash2 - d* 13);436 Hash2 := d;434 D := Hash2 div 13; 435 Inc(Hash2r, Hash2 - D * 13); 436 Hash2 := D; 437 437 end; 438 Result := integer(Domain shl 30 + Hash1 xor Hash2r);438 Result := Integer(Domain shl 30 + Hash1 xor Hash2r); 439 439 end; 440 440 end; 441 441 442 function ProcessEnhancement(uix: integer; const Jobs: TEnhancementJobs): integer;442 function ProcessEnhancement(uix: Integer; const Jobs: TEnhancementJobs): Integer; 443 443 { return values: 444 444 eJobDone - all applicable jobs done … … 446 446 eDied - job done and died (thurst) } 447 447 var 448 stage, NextJob, Tile: integer;448 stage, NextJob, Tile: Integer; 449 449 Done: set of jNone .. jPoll; 450 450 begin … … 452 452 Tile := MyMap[MyUn[uix].Loc]; 453 453 if Tile and fRoad <> 0 then 454 include(Done, jRoad);454 Include(Done, jRoad); 455 455 if Tile and fRR <> 0 then 456 include(Done, jRR);456 Include(Done, jRR); 457 457 if (Tile and fTerImp = tiIrrigation) or (Tile and fTerImp = tiFarm) then 458 include(Done, jIrr);458 Include(Done, jIrr); 459 459 if Tile and fTerImp = tiFarm then 460 include(Done, jFarm);460 Include(Done, jFarm); 461 461 if Tile and fTerImp = tiMine then 462 include(Done, jMine);462 Include(Done, jMine); 463 463 if Tile and fPoll = 0 then 464 include(Done, jPoll);464 Include(Done, jPoll); 465 465 466 466 if MyUn[uix].Job = jNone then … … 485 485 Break; 486 486 end; // tile enhancement complete 487 Result := Server(sStartJob + NextJob shl 4, me, uix, nil^);488 include(Done, NextJob);489 end; 490 end; 491 492 function AutoBuild(cix: integer; const ImpOrder: TImpOrder): boolean;493 var 494 i, NewProject: integer;487 Result := Server(sStartJob + NextJob shl 4, Me, uix, nil^); 488 Include(Done, NextJob); 489 end; 490 end; 491 492 function AutoBuild(cix: Integer; const ImpOrder: TImpOrder): Boolean; 493 var 494 I, NewProject: Integer; 495 495 begin 496 496 Result := False; … … 498 498 (MyCity[cix].Flags and chProduction <> 0) then 499 499 begin 500 i:= 0;500 I := 0; 501 501 repeat 502 while (ImpOrder[ i] >= 0) and (MyCity[cix].Built[ImpOrder[i]] > 0) do503 Inc( i);504 if ImpOrder[ i] < 0 then502 while (ImpOrder[I] >= 0) and (MyCity[cix].Built[ImpOrder[I]] > 0) do 503 Inc(I); 504 if ImpOrder[I] < 0 then 505 505 Break; 506 assert(i< nImp);507 NewProject := cpImp + ImpOrder[ i];508 if Server(sSetCityProject, me, cix, NewProject) >= rExecuted then506 Assert(I < nImp); 507 NewProject := cpImp + ImpOrder[I]; 508 if Server(sSetCityProject, Me, cix, NewProject) >= rExecuted then 509 509 begin 510 510 Result := True; … … 512 512 Break; 513 513 end; 514 Inc( i);514 Inc(I); 515 515 until False; 516 516 end; … … 519 519 procedure CalculateAdvValues; 520 520 var 521 i, j: integer;522 known: array [0 .. nAdv - 1] of integer;523 524 procedure MarkPreqs( i: integer);525 begin 526 if known[ i] = 0 then521 I, J: Integer; 522 known: array [0 .. nAdv - 1] of Integer; 523 524 procedure MarkPreqs(I: Integer); 525 begin 526 if known[I] = 0 then 527 527 begin 528 known[ i] := 1;529 if ( i <> adScience) and (i<> adMassProduction) then528 known[I] := 1; 529 if (I <> adScience) and (I <> adMassProduction) then 530 530 begin 531 if (AdvPreq[ i, 0] >= 0) then532 MarkPreqs(AdvPreq[ i, 0]);533 if (AdvPreq[ i, 1] >= 0) then534 MarkPreqs(AdvPreq[ i, 1]);531 if (AdvPreq[I, 0] >= 0) then 532 MarkPreqs(AdvPreq[I, 0]); 533 if (AdvPreq[I, 1] >= 0) then 534 MarkPreqs(AdvPreq[I, 1]); 535 535 end; 536 536 end; … … 539 539 begin 540 540 FillChar(AdvValue, SizeOf(AdvValue), 0); 541 for i:= 0 to nAdv - 1 do541 for I := 0 to nAdv - 1 do 542 542 begin 543 543 FillChar(known, SizeOf(known), 0); 544 MarkPreqs( i);545 for j:= 0 to nAdv - 1 do546 if known[ j] > 0 then547 Inc(AdvValue[ i]);548 if iin FutureTech then549 Inc(AdvValue[ i], 3000)544 MarkPreqs(I); 545 for J := 0 to nAdv - 1 do 546 if known[J] > 0 then 547 Inc(AdvValue[I]); 548 if I in FutureTech then 549 Inc(AdvValue[I], 3000) 550 550 else if known[adMassProduction] > 0 then 551 Inc(AdvValue[ i], 2000)551 Inc(AdvValue[I], 2000) 552 552 else if known[adScience] > 0 then 553 Inc(AdvValue[ i], 1000);554 end; 555 end; 556 557 procedure DebugMessage(Level: integer; Text: string);558 begin 559 Server(sMessage, me, Level, PChar(Text)^);560 end; 561 562 function MarkCitiesAround(Loc, cixExcept: integer): boolean;553 Inc(AdvValue[I], 1000); 554 end; 555 end; 556 557 procedure DebugMessage(Level: Integer; Text: string); 558 begin 559 Server(sMessage, Me, Level, PChar(Text)^); 560 end; 561 562 function MarkCitiesAround(Loc, cixExcept: Integer): Boolean; 563 563 // return whether a city was marked 564 564 var 565 cix: integer;565 cix: Integer; 566 566 begin 567 567 Result := False; … … 576 576 end; 577 577 578 procedure OptimizeCities(CheckOnly: boolean);579 var 580 cix, fix, dx, dy, Loc1, OptiType: integer;581 Done: boolean;578 procedure OptimizeCities(CheckOnly: Boolean); 579 var 580 cix, fix, dx, dy, Loc1, OptiType: Integer; 581 Done: Boolean; 582 582 Advice: TCityTileAdviceData; 583 583 begin … … 591 591 begin 592 592 Advice.ResourceWeights := OfferedResourceWeights[OptiType]; 593 Server(sGetCityTileAdvice, me, cix, Advice);593 Server(sGetCityTileAdvice, Me, cix, Advice); 594 594 if Advice.Tiles <> MyCity[cix].Tiles then 595 595 if CheckOnly then … … 611 611 Done := False; 612 612 end; 613 Server(sSetCityTiles, me, cix, Advice.Tiles);613 Server(sSetCityTiles, Me, cix, Advice.Tiles); 614 614 end; 615 615 end; … … 621 621 procedure CityOptimizer_BeginOfTurn; 622 622 var 623 cix: integer;623 cix: Integer; 624 624 begin 625 625 FillChar(CityNeedsOptimize, MyRO.nCity - 1, 0); // false … … 634 634 end; 635 635 636 procedure CityOptimizer_CityChange(cix: integer);636 procedure CityOptimizer_CityChange(cix: Integer); 637 637 begin 638 638 if (MyRO.Government <> gAnarchy) and (cix <> -1) and (MyCity[cix].Flags and … … 644 644 end; 645 645 646 procedure CityOptimizer_TileBecomesAvailable(Loc: integer);646 procedure CityOptimizer_TileBecomesAvailable(Loc: Integer); 647 647 begin 648 648 if (MyRO.Government <> gAnarchy) and MarkCitiesAround(Loc, -1) then … … 650 650 end; 651 651 652 procedure CityOptimizer_ReleaseCityTiles(cix, ReleasedTiles: integer);653 var 654 fix, dx, dy, Loc1: integer;655 Done: boolean;652 procedure CityOptimizer_ReleaseCityTiles(cix, ReleasedTiles: Integer); 653 var 654 fix, dx, dy, Loc1: Integer; 655 Done: Boolean; 656 656 begin 657 657 if (MyRO.Government <> gAnarchy) and (ReleasedTiles <> 0) then … … 672 672 end; 673 673 674 procedure CityOptimizer_BeforeRemoveUnit(uix: integer);675 var 676 uix1: integer;674 procedure CityOptimizer_BeforeRemoveUnit(uix: Integer); 675 var 676 uix1: Integer; 677 677 begin 678 678 if MyRO.Government <> gAnarchy then … … 698 698 // all cities should already be optimized here -- only check this 699 699 var 700 cix: integer;700 cix: Integer; 701 701 begin 702 702 {$IFOPT O-} -
trunk/LocalPlayer/Diagram.pas
r442 r447 19 19 procedure ToggleBtnClick(Sender: TObject); 20 20 procedure PlayerClick(Sender: TObject); 21 procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);21 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 22 22 23 23 public 24 24 procedure OffscreenPaint; override; 25 25 procedure ShowNewContent_Charts(NewMode: TWindowMode); 26 procedure ShowNewContent_Ship(NewMode: TWindowMode; p: integer = -1);26 procedure ShowNewContent_Ship(NewMode: TWindowMode; P: Integer = -1); 27 27 28 28 private 29 29 Kind: (dkChart, dkShip); 30 Player, Mode: integer;30 Player, Mode: Integer; 31 31 end; 32 32 … … 34 34 DiaDlg: TDiaDlg; 35 35 36 procedure PaintColonyShip( canvas: TCanvas; Player, Left, Width, Top: integer);36 procedure PaintColonyShip(Canvas: TCanvas; Player, Left, Width, Top: Integer); 37 37 38 38 implementation … … 45 45 const 46 46 Border = 24; 47 RoundPixels: array [0 .. nStat - 1] of integer = (0, 0, 0, 5, 5, 5);47 RoundPixels: array [0 .. nStat - 1] of Integer = (0, 0, 0, 5, 5, 5); 48 48 49 49 yArea = 48; 50 xComp: array [0 .. 5] of integer = (-60, -28, 4, 4, 36, 68);51 yComp: array [0 .. 5] of integer = (-40, -40, -79, -1, -40, -40);52 xPow: array [0 .. 3] of integer = (-116, -116, -116, -116);53 yPow: array [0 .. 3] of integer = (-28, 0, -44, 16);54 xHab: array [0 .. 1] of integer = (23, 23);55 yHab: array [0 .. 1] of integer = (-81, 1);56 57 procedure PaintColonyShip( canvas: TCanvas; Player, Left, Width, Top: integer);58 var 59 i, x, r, nComp, nPow, nHab: integer;50 xComp: array [0 .. 5] of Integer = (-60, -28, 4, 4, 36, 68); 51 yComp: array [0 .. 5] of Integer = (-40, -40, -79, -1, -40, -40); 52 xPow: array [0 .. 3] of Integer = (-116, -116, -116, -116); 53 yPow: array [0 .. 3] of Integer = (-28, 0, -44, 16); 54 xHab: array [0 .. 1] of Integer = (23, 23); 55 yHab: array [0 .. 1] of Integer = (-81, 1); 56 57 procedure PaintColonyShip(Canvas: TCanvas; Player, Left, Width, Top: Integer); 58 var 59 I, X, R, nComp, nPow, nHab: Integer; 60 60 begin 61 61 Canvas.Brush.Color := $000000; 62 62 Canvas.FillRect(Rect(Left, Top, Left + Width, Top + 200)); 63 63 Canvas.Brush.Style := bsClear; 64 ScreenTools.Frame( canvas, Left - 1, Top - 1, Left + Width, Top + 200,64 ScreenTools.Frame(Canvas, Left - 1, Top - 1, Left + Width, Top + 200, 65 65 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 66 RFrame( canvas, Left - 2, Top - 2, Left + Width + 1, Top + 200 + 1,66 RFrame(Canvas, Left - 2, Top - 2, Left + Width + 1, Top + 200 + 1, 67 67 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 68 68 69 69 // stars 70 70 DelphiRandSeed := Player * 11111; 71 for i:= 1 to Width - 16 do71 for I := 1 to Width - 16 do 72 72 begin 73 x:= DelphiRandom((Width - 16) * 200);74 r:= DelphiRandom(13) + 28;75 Canvas.Pixels[ x div 200 + 8, xmod 200 + Top] :=76 ( r * r * r * rdiv 10001) * $10101;73 X := DelphiRandom((Width - 16) * 200); 74 R := DelphiRandom(13) + 28; 75 Canvas.Pixels[X div 200 + 8, X mod 200 + Top] := 76 (R * R * R * R div 10001) * $10101; 77 77 end; 78 78 … … 86 86 if nHab > 2 then 87 87 nHab := 2; 88 for i:= 0 to nHab - 1 do89 Sprite( canvas, HGrSystem2, Left + Width div 2 + xHab[i],90 Top + 100 + yHab[ i], 80, 80, 34, 1);91 for i:= 0 to nComp - 1 do92 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[i],93 Top + 100 + yComp[ i], 32, 80, 1, 1);88 for I := 0 to nHab - 1 do 89 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xHab[I], 90 Top + 100 + yHab[I], 80, 80, 34, 1); 91 for I := 0 to nComp - 1 do 92 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[I], 93 Top + 100 + yComp[I], 32, 80, 1, 1); 94 94 if nComp > 0 then 95 for i:= 3 downto nPow do96 Sprite( canvas, HGrSystem2, Left + Width div 2 + xPow[i] + 40,97 Top + 100 + yPow[ i], 16, 27, 1, 82);98 for i:= nPow - 1 downto 0 do99 Sprite( canvas, HGrSystem2, Left + Width div 2 + xPow[i],100 Top + 100 + yPow[ i], 56, 28, 58, 82);95 for I := 3 downto nPow do 96 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xPow[I] + 40, 97 Top + 100 + yPow[I], 16, 27, 1, 82); 98 for I := nPow - 1 downto 0 do 99 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xPow[I], 100 Top + 100 + yPow[I], 56, 28, 58, 82); 101 101 if (nComp < 3) and (nHab >= 1) then 102 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[2] + 32 - 16,102 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[2] + 32 - 16, 103 103 Top + 100 + 7 + yComp[2], 16, 27, 1, 82); 104 104 if (nComp >= 3) and (nHab < 1) then 105 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[2] + 32,105 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[2] + 32, 106 106 Top + 100 + 7 + yComp[2], 16, 27, 18, 82); 107 107 if (nComp < 4) and (nHab >= 2) then 108 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[3] + 32 - 16,108 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[3] + 32 - 16, 109 109 Top + 100 + 46 + yComp[3], 16, 27, 1, 82); 110 110 if (nComp >= 4) and (nHab < 2) then 111 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[3] + 32,111 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[3] + 32, 112 112 Top + 100 + 46 + yComp[3], 16, 27, 18, 82); 113 113 if (nComp <> 6) and (nComp <> 2) and not((nComp = 0) and (nPow < 1)) then 114 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[nComp],114 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[nComp], 115 115 Top + 100 + 7 + yComp[nComp], 16, 27, 18, 82); 116 116 if (nComp <> 6) and (nComp <> 3) and not((nComp = 0) and (nPow < 2)) then 117 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[nComp],117 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[nComp], 118 118 Top + 100 + 46 + yComp[nComp], 16, 27, 18, 82); 119 119 if nComp = 2 then 120 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[3],120 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[3], 121 121 Top + 100 + 7 + yComp[3], 16, 27, 18, 82); 122 122 if nComp = 3 then 123 Sprite( canvas, HGrSystem2, Left + Width div 2 + xComp[4],123 Sprite(Canvas, HGrSystem2, Left + Width div 2 + xComp[4], 124 124 Top + 100 + 7 + yComp[4], 16, 27, 18, 82); 125 125 end; … … 142 142 procedure TDiaDlg.OffscreenPaint; 143 143 var 144 p, T, max, x, y, y0, Stop, r, RoundRange, LineStep: integer;145 s: string;144 P, T, Max, X, Y, y0, Stop, R, RoundRange, LineStep: Integer; 145 S: string; 146 146 List: ^TChart; 147 147 148 function Round(T: integer): integer;148 function Round(T: Integer): Integer; 149 149 var 150 n, i: integer;150 N, I: Integer; 151 151 begin 152 152 if T < RoundRange then 153 n:= T153 N := T 154 154 else 155 n:= RoundRange;156 result := 0;157 for i := T - nto T do158 inc(result, List[i]);159 result := result div (n+ 1);160 end; 161 162 procedure ShareBar( x, y: integer; Cap: string; val0, val1: integer);163 begin 164 LoweredTextOut( offscreen.canvas, -1, MainTexture, x - 2, y, Cap);165 DLine( offscreen.canvas, x - 2, x + 169, y+ 16, MainTexture.ColorTextShade,155 N := RoundRange; 156 Result := 0; 157 for I := T - N to T do 158 Inc(Result, List[I]); 159 Result := Result div (N + 1); 160 end; 161 162 procedure ShareBar(X, Y: Integer; Cap: string; val0, val1: Integer); 163 begin 164 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, X - 2, Y, Cap); 165 DLine(Offscreen.Canvas, X - 2, X + 169, Y + 16, MainTexture.ColorTextShade, 166 166 MainTexture.ColorTextLight); 167 167 if val0 > 0 then 168 s:= Format(Phrases.Lookup('SHARE'), [val0, val1])168 S := Format(Phrases.Lookup('SHARE'), [val0, val1]) 169 169 else 170 s:= '0';171 RisedTextOut( offscreen.canvas,172 x + 170 - BiColorTextWidth(offscreen.canvas, s), y, s);170 S := '0'; 171 RisedTextOut(Offscreen.Canvas, 172 X + 170 - BiColorTextWidth(Offscreen.Canvas, S), Y, S); 173 173 end; 174 174 … … 176 176 inherited; 177 177 if Kind = dkChart then 178 with offscreen.canvas do178 with Offscreen.Canvas do 179 179 begin 180 180 Font.Assign(UniFont[ftTiny]); … … 186 186 GetMem(List, 4 * (MyRO.Turn + 2)); 187 187 if Mode = stExplore then 188 max := G.lx * G.ly188 Max := G.lx * G.ly 189 189 else 190 190 begin 191 max := -1;192 for p:= 0 to nPl - 1 do193 if (G.Difficulty[ p] > 0) and194 (Server(sGetChart + Mode shl 4, me, p, List^) >= rExecuted) then191 Max := -1; 192 for P := 0 to nPl - 1 do 193 if (G.Difficulty[P] > 0) and 194 (Server(sGetChart + Mode shl 4, Me, P, List^) >= rExecuted) then 195 195 for T := 0 to MyRO.Turn - 1 do 196 196 begin 197 r:= Round(T);198 if r > max then199 max := r;197 R := Round(T); 198 if R > Max then 199 Max := R; 200 200 end; 201 201 end; … … 215 215 for T := 0 to (MyRO.Turn - 1) div LineStep do 216 216 begin 217 x:= Border + (InnerWidth - 2 * Border) * T *217 X := Border + (InnerWidth - 2 * Border) * T * 218 218 LineStep div (MyRO.Turn - 1); 219 MoveTo( x, Border);220 LineTo( x, InnerHeight - Border);221 s:= IntToStr(abs(TurnToYear(T * LineStep)));222 Textout( x - TextWidth(s) div 2, Border - 16, s);219 MoveTo(X, Border); 220 LineTo(X, InnerHeight - Border); 221 S := IntToStr(abs(TurnToYear(T * LineStep))); 222 Textout(X - TextWidth(S) div 2, Border - 16, S); 223 223 end; 224 224 225 225 y0 := 0; 226 if max > 0 then226 if Max > 0 then 227 227 begin 228 for p:= 0 to nPl - 1 do229 if (G.Difficulty[ p] > 0) and230 (Server(sGetChart + Mode shl 4, me, p, List^) >= rExecuted) then228 for P := 0 to nPl - 1 do 229 if (G.Difficulty[P] > 0) and 230 (Server(sGetChart + Mode shl 4, Me, P, List^) >= rExecuted) then 231 231 begin 232 Pen.Color := Tribe[ p].Color;232 Pen.Color := Tribe[P].Color; 233 233 Stop := MyRO.Turn - 1; 234 234 while (Stop > 0) and (List[Stop] = 0) do 235 dec(Stop);235 Dec(Stop); 236 236 for T := 0 to Stop do 237 237 begin 238 r:= Round(T);239 x:= Border + (InnerWidth - 2 * Border) * T div (MyRO.Turn - 1);240 y:= InnerHeight - Border - (InnerHeight - 2 * Border) *241 r div max;238 R := Round(T); 239 X := Border + (InnerWidth - 2 * Border) * T div (MyRO.Turn - 1); 240 Y := InnerHeight - Border - (InnerHeight - 2 * Border) * 241 R div Max; 242 242 if T = 0 then 243 MoveTo( x, y)243 MoveTo(X, Y) 244 244 // else if Mode=stTerritory then 245 245 // begin LineTo(x,y0); LineTo(x,y) end 246 246 else if RoundPixels[Mode] = 0 then 247 247 begin 248 if ( y<> y0) or (T = Stop) then249 LineTo( x, y)248 if (Y <> y0) or (T = Stop) then 249 LineTo(X, Y) 250 250 end 251 251 else 252 LineTo( x, y);253 y0 := y;252 LineTo(X, Y); 253 y0 := Y; 254 254 end; 255 255 end; … … 258 258 end 259 259 else 260 with offscreen.canvas do260 with Offscreen.Canvas do 261 261 begin 262 262 Font.Assign(UniFont[ftSmall]); 263 263 FillOffscreen(0, 0, InnerWidth, InnerHeight); 264 264 265 PaintColonyShip( offscreen.canvas, Player, 8, InnerWidth - 16, yArea);265 PaintColonyShip(Offscreen.Canvas, Player, 8, InnerWidth - 16, yArea); 266 266 267 267 ShareBar(InnerWidth div 2 - 85, InnerHeight - 62, … … 277 277 procedure TDiaDlg.FormPaint(Sender: TObject); 278 278 var 279 s: string;279 S: string; 280 280 begin 281 281 inherited; 282 canvas.Font.Assign(UniFont[ftNormal]);282 Canvas.Font.Assign(UniFont[ftNormal]); 283 283 if Kind = dkChart then 284 s:= Phrases.Lookup('DIAGRAM', Mode)285 else 286 s:= Tribe[Player].TPhrase('SHORTNAME');287 LoweredTextOut( canvas, -1, MainTexture,288 (ClientWidth - BiColorTextWidth( canvas, s)) div 2, 31, s);284 S := Phrases.Lookup('DIAGRAM', Mode) 285 else 286 S := Tribe[Player].TPhrase('SHORTNAME'); 287 LoweredTextOut(Canvas, -1, MainTexture, 288 (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, 31, S); 289 289 end; 290 290 … … 309 309 end; 310 310 311 procedure TDiaDlg.ShowNewContent_Ship(NewMode: TWindowMode; p: integer);311 procedure TDiaDlg.ShowNewContent_Ship(NewMode: TWindowMode; P: Integer); 312 312 begin 313 313 Kind := dkShip; 314 if p< 0 then315 begin 316 Player := me;314 if P < 0 then 315 begin 316 Player := Me; 317 317 while MyRO.Ship[Player].Parts[spComp] + MyRO.Ship[Player].Parts[spPow] + 318 318 MyRO.Ship[Player].Parts[spHab] = 0 do … … 320 320 end 321 321 else 322 Player := p;322 Player := P; 323 323 ToggleBtn.ButtonIndex := 28; 324 324 ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT'); … … 329 329 procedure TDiaDlg.ToggleBtnClick(Sender: TObject); 330 330 var 331 p1: integer;332 m: TMenuItem;331 p1: Integer; 332 M: TMenuItem; 333 333 begin 334 334 if Kind = dkChart then … … 345 345 MyRO.Ship[p1].Parts[spHab] > 0 then 346 346 begin 347 m:= TMenuItem.Create(Popup);348 m.RadioItem := true;349 m.Caption := Tribe[p1].TPhrase('SHORTNAME');350 m.Tag := p1;351 m.OnClick := PlayerClick;347 M := TMenuItem.Create(Popup); 348 M.RadioItem := True; 349 M.Caption := Tribe[p1].TPhrase('SHORTNAME'); 350 M.Tag := p1; 351 M.OnClick := PlayerClick; 352 352 if p1 = Player then 353 m.Checked := true;354 Popup.Items.Add( m);353 M.Checked := True; 354 Popup.Items.Add(M); 355 355 end; 356 356 Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top + ToggleBtn.Height); … … 363 363 end; 364 364 365 procedure TDiaDlg.FormKeyDown(Sender: TObject; var Key: word;365 procedure TDiaDlg.FormKeyDown(Sender: TObject; var Key: Word; 366 366 Shift: TShiftState); 367 367 begin -
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 -
trunk/LocalPlayer/Draft.pas
r442 r447 20 20 procedure CloseBtnClick(Sender: TObject); 21 21 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 22 Shift: TShiftState; x, y: integer);22 Shift: TShiftState; X, Y: Integer); 23 23 procedure OKBtnClick(Sender: TObject); 24 24 procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; 25 Shift: TShiftState; x, y: integer);25 Shift: TShiftState; X, Y: Integer); 26 26 public 27 27 procedure ShowNewContent(NewMode: TWindowMode); … … 30 30 private 31 31 Domain, MaxLines, Lines, Cut, yDomain, yFeature, yWeight, yTotal, yView, 32 IncCap, DecCap: integer;33 code: array [0 .. nFeature - 1] of integer;32 IncCap, DecCap: Integer; 33 Code: array [0 .. nFeature - 1] of Integer; 34 34 Template, Back: TBitmap; 35 function IsFeatureInList( d, i: integer): boolean;36 procedure SetDomain( d: integer);35 function IsFeatureInList(D, I: Integer): Boolean; 36 procedure SetDomain(D: Integer); 37 37 end; 38 38 … … 108 108 procedure TDraftDlg.OffscreenPaint; 109 109 110 function DomainAvailable( d: integer): boolean;111 begin 112 result := (upgrade[d, 0].Preq = preNone) or113 (MyRO.Tech[upgrade[ d, 0].Preq] >= tsApplicable);110 function DomainAvailable(D: Integer): Boolean; 111 begin 112 Result := (upgrade[D, 0].Preq = preNone) or 113 (MyRO.Tech[upgrade[D, 0].Preq] >= tsApplicable); 114 114 end; 115 115 116 116 procedure PaintTotalBars; 117 117 var 118 i, y, dx, num, w: integer;119 s: string;120 begin 121 with offscreen.Canvas do118 I, Y, dx, num, W: Integer; 119 S: string; 120 begin 121 with Offscreen.Canvas do 122 122 begin 123 123 // strength bar 124 y:= yTotal;125 DarkGradient( offscreen.Canvas, xTotal - 6, y+ 1, 184, 2);126 DarkGradient( offscreen.Canvas, xTotal2 + 172, y+ 1, 95, 2);127 RisedTextOut( offscreen.Canvas, xTotal - 2, y,124 Y := yTotal; 125 DarkGradient(Offscreen.Canvas, xTotal - 6, Y + 1, 184, 2); 126 DarkGradient(Offscreen.Canvas, xTotal2 + 172, Y + 1, 95, 2); 127 RisedTextOut(Offscreen.Canvas, xTotal - 2, Y, 128 128 Phrases.Lookup('UNITSTRENGTH')); 129 RisedTextOut( offscreen.Canvas, xTotal + 112 + 30, y,129 RisedTextOut(Offscreen.Canvas, xTotal + 112 + 30, Y, 130 130 'x' + IntToStr(MyRO.DevModel.MStrength)); 131 RisedTextOut( offscreen.Canvas, xTotal2 + 148 + 30, y, '=');132 s:= IntToStr(MyRO.DevModel.Attack) + '/' +131 RisedTextOut(Offscreen.Canvas, xTotal2 + 148 + 30, Y, '='); 132 S := IntToStr(MyRO.DevModel.Attack) + '/' + 133 133 IntToStr(MyRO.DevModel.Defense); 134 RisedTextOut( offscreen.Canvas, xTotal2 + 170 + 64 + 30 -135 BiColorTextWidth( offscreen.Canvas, s), y, s);134 RisedTextOut(Offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 135 BiColorTextWidth(Offscreen.Canvas, S), Y, S); 136 136 137 137 // transport bar 138 138 if MyRO.DevModel.MTrans > 0 then 139 139 begin 140 y:= yTotal + 19;141 DarkGradient( offscreen.Canvas, xTotal - 6, y+ 1, 184, 1);142 DarkGradient( offscreen.Canvas, xTotal2 + 172, y+ 1, 95, 1);143 RisedTextOut( offscreen.Canvas, xTotal - 2, y,140 Y := yTotal + 19; 141 DarkGradient(Offscreen.Canvas, xTotal - 6, Y + 1, 184, 1); 142 DarkGradient(Offscreen.Canvas, xTotal2 + 172, Y + 1, 95, 1); 143 RisedTextOut(Offscreen.Canvas, xTotal - 2, Y, 144 144 Phrases.Lookup('UNITTRANSPORT')); 145 RisedTextOut( offscreen.Canvas, xTotal + 112 + 30, y,145 RisedTextOut(Offscreen.Canvas, xTotal + 112 + 30, Y, 146 146 'x' + IntToStr(MyRO.DevModel.MTrans)); 147 RisedTextOut( offscreen.Canvas, xTotal2 + 148 + 30, y, '=');147 RisedTextOut(Offscreen.Canvas, xTotal2 + 148 + 30, Y, '='); 148 148 149 149 Font.Color := $000000; 150 150 dx := -237 - 30; 151 for i:= mcFirstNonCap - 1 downto 3 do152 if iin [mcSeaTrans, mcCarrier, mcAirTrans] then151 for I := mcFirstNonCap - 1 downto 3 do 152 if I in [mcSeaTrans, mcCarrier, mcAirTrans] then 153 153 begin 154 num := MyRO.DevModel.Cap[ i] * MyRO.DevModel.MTrans;154 num := MyRO.DevModel.Cap[I] * MyRO.DevModel.MTrans; 155 155 if num > 0 then 156 156 begin 157 inc(dx, 15);157 Inc(dx, 15); 158 158 Brush.Color := $C0C0C0; 159 FrameRect(Rect(xTotal2 - 3 - dx, y+ 2,160 xTotal2 + 11 - dx, y+ 16));159 FrameRect(Rect(xTotal2 - 3 - dx, Y + 2, 160 xTotal2 + 11 - dx, Y + 16)); 161 161 Brush.Style := bsClear; 162 Sprite( offscreen, HGrSystem, xTotal2 - 1 - dx, y+ 4, 10, 10,163 66 + i mod 11 * 11, 137 + idiv 11 * 11);162 Sprite(Offscreen, HGrSystem, xTotal2 - 1 - dx, Y + 4, 10, 10, 163 66 + I mod 11 * 11, 137 + I div 11 * 11); 164 164 if num > 1 then 165 165 begin 166 s:= IntToStr(num);167 w := TextWidth(s);168 inc(dx, w+ 1);166 S := IntToStr(num); 167 W := TextWidth(S); 168 Inc(dx, W + 1); 169 169 Brush.Color := $FFFFFF; 170 FillRect(Rect(xTotal2 - 3 - dx, y+ 2,171 xTotal2 + w - 1 - dx, y+ 16));170 FillRect(Rect(xTotal2 - 3 - dx, Y + 2, 171 xTotal2 + W - 1 - dx, Y + 16)); 172 172 Brush.Style := bsClear; 173 Textout(xTotal2 - 3 - dx + 1, y, s);173 Textout(xTotal2 - 3 - dx + 1, Y, S); 174 174 end; 175 175 end; … … 178 178 179 179 // speed bar 180 y:= yTotal + 38;181 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2, y,180 Y := yTotal + 38; 181 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, Y, 182 182 Phrases.Lookup('UNITSPEED')); 183 DLine( offscreen.Canvas, xTotal - 2, xTotal + 174, y+ 16,183 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 174, Y + 16, 184 184 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 185 DLine( offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, y+ 16,185 DLine(Offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, Y + 16, 186 186 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 187 s:= MovementToString(MyRO.DevModel.Speed);188 RisedTextOut( offscreen.Canvas, xTotal2 + 170 + 64 + 30 -189 TextWidth( s), y, s);187 S := MovementToString(MyRO.DevModel.Speed); 188 RisedTextOut(Offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 189 TextWidth(S), Y, S); 190 190 191 191 // cost bar 192 y:= yTotal + 57;193 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2, y,192 Y := yTotal + 57; 193 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, Y, 194 194 Phrases.Lookup('UNITCOST')); 195 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal + 112 + 30, y,195 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal + 112 + 30, Y, 196 196 'x' + IntToStr(MyRO.DevModel.MCost)); 197 LoweredTextOut( offscreen.Canvas, -1, MainTexture,198 xTotal2 + 148 + 30, y, '=');199 DLine( offscreen.Canvas, xTotal - 2, xTotal + 174, y+ 16,197 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 198 xTotal2 + 148 + 30, Y, '='); 199 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 174, Y + 16, 200 200 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 201 DLine( offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, y+ 16,201 DLine(Offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, Y + 16, 202 202 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 203 s:= IntToStr(MyRO.DevModel.Cost);204 RisedTextOut( offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 12 -205 TextWidth( s), y, s);206 Sprite( offscreen, HGrSystem, xTotal2 + 170 + 54 + 30, y+ 4, 10,203 S := IntToStr(MyRO.DevModel.Cost); 204 RisedTextOut(Offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 12 - 205 TextWidth(S), Y, S); 206 Sprite(Offscreen, HGrSystem, xTotal2 + 170 + 54 + 30, Y + 4, 10, 207 207 10, 88, 115); 208 208 209 if G.Difficulty[ me] <> 2 then209 if G.Difficulty[Me] <> 2 then 210 210 begin // corrected cost bar 211 y:= yTotal + 76;212 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2, y,213 Phrases.Lookup('COSTDIFF' + char(48 + G.Difficulty[ me])));214 LoweredTextOut( offscreen.Canvas, -1, MainTexture,215 xTotal2 + 148 + 30, y, '=');216 DLine( offscreen.Canvas, xTotal - 2, xTotal + 174, y+ 16,211 Y := yTotal + 76; 212 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, Y, 213 Phrases.Lookup('COSTDIFF' + char(48 + G.Difficulty[Me]))); 214 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 215 xTotal2 + 148 + 30, Y, '='); 216 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 174, Y + 16, 217 217 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 218 DLine( offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, y+ 16,218 DLine(Offscreen.Canvas, xTotal2 + 176, xTotal2 + 263, Y + 16, 219 219 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 220 s:= IntToStr(MyRO.DevModel.Cost * BuildCostMod221 [G.Difficulty[ me]] div 12);222 RisedTextOut( offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 12 -223 TextWidth( s), y, s);224 Sprite( offscreen, HGrSystem, xTotal2 + 170 + 54 + 30, y+ 4, 10,220 S := IntToStr(MyRO.DevModel.Cost * BuildCostMod 221 [G.Difficulty[Me]] div 12); 222 RisedTextOut(Offscreen.Canvas, xTotal2 + 170 + 64 + 30 - 12 - 223 TextWidth(S), Y, S); 224 Sprite(Offscreen, HGrSystem, xTotal2 + 170 + 54 + 30, Y + 4, 10, 225 225 10, 88, 115); 226 226 end; … … 229 229 230 230 var 231 i, j, x, d, n, TextColor, CapWeight, DomainCount: integer;231 I, J, X, D, N, TextColor, CapWeight, DomainCount: Integer; 232 232 begin 233 233 inherited; … … 253 253 Template.Height - 64 - Cut); 254 254 255 BitBltCanvas( offscreen.Canvas, 0, 0, ClientWidth, ClientHeight,255 BitBltCanvas(Offscreen.Canvas, 0, 0, ClientWidth, ClientHeight, 256 256 Back.Canvas, 0, 0); 257 257 258 offscreen.Canvas.Font.Assign(UniFont[ftCaption]);259 RisedTextOut( offscreen.Canvas, 10, 7, Caption);260 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);258 Offscreen.Canvas.Font.Assign(UniFont[ftCaption]); 259 RisedTextOut(Offscreen.Canvas, 10, 7, Caption); 260 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 261 261 262 262 with MyRO.DevModel do 263 263 begin 264 264 DomainCount := 0; 265 for d:= 0 to nDomains - 1 do266 if DomainAvailable( d) then267 inc(DomainCount);265 for D := 0 to nDomains - 1 do 266 if DomainAvailable(D) then 267 Inc(DomainCount); 268 268 if DomainCount > 1 then 269 269 begin 270 for d:= 0 to nDomains - 1 do271 if DomainAvailable( d) then270 for D := 0 to nDomains - 1 do 271 if DomainAvailable(D) then 272 272 begin 273 x := xDomain + d* DomainPitch;274 if d= Domain then275 ImageOp_BCC( offscreen, Templates.Data, x, yDomain, 142, 246 + 37 * d, 36,273 X := xDomain + D * DomainPitch; 274 if D = Domain then 275 ImageOp_BCC(Offscreen, Templates.Data, X, yDomain, 142, 246 + 37 * D, 36, 276 276 36, 0, $00C0FF) 277 277 else 278 ImageOp_BCC( offscreen, Templates.Data, x, yDomain, 142, 246 + 37 * d, 36,278 ImageOp_BCC(Offscreen, Templates.Data, X, yDomain, 142, 246 + 37 * D, 36, 279 279 36, 0, $606060); 280 280 end; 281 Frame( offscreen.Canvas, xDomain - 11, yDomain - 3,281 Frame(Offscreen.Canvas, xDomain - 11, yDomain - 3, 282 282 xDomain + 2 * DomainPitch + 46, yDomain + 38, $B0B0B0, $FFFFFF); 283 RFrame( offscreen.Canvas, xDomain - 12, yDomain - 4,283 RFrame(Offscreen.Canvas, xDomain - 12, yDomain - 4, 284 284 xDomain + 2 * DomainPitch + 47, yDomain + 39, $FFFFFF, $B0B0B0); 285 285 end; … … 294 294 295 295 // display weight 296 with offscreen.Canvas do297 begin 298 for i:= 0 to MaxWeight - 1 do299 if i< Weight then300 ImageOp_BCC( offscreen, Templates.Data, Point(xWeight + 20 * i, yWeight),296 with Offscreen.Canvas do 297 begin 298 for I := 0 to MaxWeight - 1 do 299 if I < Weight then 300 ImageOp_BCC(Offscreen, Templates.Data, Point(xWeight + 20 * I, yWeight), 301 301 WeightOn.BoundsRect, 0, $949494) 302 302 else 303 ImageOp_BCC( offscreen, Templates.Data, Point(xWeight + 20 * i, yWeight),303 ImageOp_BCC(Offscreen, Templates.Data, Point(xWeight + 20 * I, yWeight), 304 304 WeightOff.BoundsRect, 0, $949494); 305 305 end; 306 306 307 with offscreen.Canvas do308 for i:= 0 to Lines - 1 do307 with Offscreen.Canvas do 308 for I := 0 to Lines - 1 do 309 309 begin 310 if not( code[i] in AutoFeature) then310 if not(Code[I] in AutoFeature) then 311 311 begin 312 312 // paint +/- butttons 313 if code[i] < mcFirstNonCap then313 if Code[I] < mcFirstNonCap then 314 314 begin 315 Dump( offscreen, HGrSystem, xFeature - 21, yFeature + 2 + LinePitch *316 i, 12, 12, 169, 172);317 Dump( offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *318 i, 12, 12, 169, 159);319 RFrame( offscreen.Canvas, xFeature - (21 + 1),320 yFeature + 2 + LinePitch * i- 1, xFeature - (21 - 24),321 yFeature + 2 + LinePitch * i+ 12, MainTexture.ColorBevelShade,315 Dump(Offscreen, HGrSystem, xFeature - 21, yFeature + 2 + LinePitch * 316 I, 12, 12, 169, 172); 317 Dump(Offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch * 318 I, 12, 12, 169, 159); 319 RFrame(Offscreen.Canvas, xFeature - (21 + 1), 320 yFeature + 2 + LinePitch * I - 1, xFeature - (21 - 24), 321 yFeature + 2 + LinePitch * I + 12, MainTexture.ColorBevelShade, 322 322 MainTexture.ColorBevelLight); 323 323 end 324 324 else 325 325 begin 326 Dump( offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *327 i, 12, 12, 169, 185 + 13 * MyRO.DevModel.Cap[code[i]]);328 RFrame( offscreen.Canvas, xFeature - (9 + 1),329 yFeature + 2 + LinePitch * i- 1, xFeature - (21 - 24),330 yFeature + 2 + LinePitch * i+ 12, MainTexture.ColorBevelShade,326 Dump(Offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch * 327 I, 12, 12, 169, 185 + 13 * MyRO.DevModel.Cap[Code[I]]); 328 RFrame(Offscreen.Canvas, xFeature - (9 + 1), 329 yFeature + 2 + LinePitch * I - 1, xFeature - (21 - 24), 330 yFeature + 2 + LinePitch * I + 12, MainTexture.ColorBevelShade, 331 331 MainTexture.ColorBevelLight); 332 332 end; 333 333 334 334 // paint cost 335 LightGradient( offscreen.Canvas, xFeature + 34,336 yFeature + LinePitch * i, 50, HGrSystem.Data.Canvas.Pixels335 LightGradient(Offscreen.Canvas, xFeature + 34, 336 yFeature + LinePitch * I, 50, HGrSystem.Data.Canvas.Pixels 337 337 [187, 137]); 338 if (Domain = dGround) and ( code[i] = mcDefense) then338 if (Domain = dGround) and (Code[I] = mcDefense) then 339 339 CapWeight := 2 340 340 else 341 CapWeight := Feature[ code[i]].Weight;342 n := CapWeight + Feature[code[i]].Cost;343 d:= 6;344 while ( n - 1) * d* 2 > 48 - 10 do345 dec(d);346 for j := 0 to n- 1 do347 if j< CapWeight then348 Sprite( offscreen, HGrSystem, xFeature + 54 + (j * 2 + 1 - n) * d,349 yFeature + 2 + LinePitch * i+ 1, 10, 10, 88, 126)341 CapWeight := Feature[Code[I]].Weight; 342 N := CapWeight + Feature[Code[I]].Cost; 343 D := 6; 344 while (N - 1) * D * 2 > 48 - 10 do 345 Dec(D); 346 for J := 0 to N - 1 do 347 if J < CapWeight then 348 Sprite(Offscreen, HGrSystem, xFeature + 54 + (J * 2 + 1 - N) * D, 349 yFeature + 2 + LinePitch * I + 1, 10, 10, 88, 126) 350 350 else 351 Sprite( offscreen, HGrSystem, xFeature + 54 + (j * 2 + 1 - n) * d,352 yFeature + 2 + LinePitch * i+ 1, 10, 10, 88, 115);351 Sprite(Offscreen, HGrSystem, xFeature + 54 + (J * 2 + 1 - N) * D, 352 yFeature + 2 + LinePitch * I + 1, 10, 10, 88, 115); 353 353 end; // if not (code[i] in AutoFeature) 354 DarkGradient( offscreen.Canvas, xFeature + 17,355 yFeature + LinePitch * i, 16, 1);356 ScreenTools.Frame( offscreen.Canvas, xFeature + 18, yFeature + 1 + LinePitch * i,357 xFeature + 20 - 2 + 13, yFeature + 2 + 1 - 2 + 13 + LinePitch * i,354 DarkGradient(Offscreen.Canvas, xFeature + 17, 355 yFeature + LinePitch * I, 16, 1); 356 ScreenTools.Frame(Offscreen.Canvas, xFeature + 18, yFeature + 1 + LinePitch * I, 357 xFeature + 20 - 2 + 13, yFeature + 2 + 1 - 2 + 13 + LinePitch * I, 358 358 $C0C0C0, $C0C0C0); 359 Sprite( offscreen, HGrSystem, xFeature + 20, yFeature + 2 + 1 + LinePitch360 * i, 10, 10, 66 + code[i] mod 11 * 11, 137 + code[i] div 11 * 11);361 362 if MyRO.DevModel.Cap[ code[i]] > 0 then359 Sprite(Offscreen, HGrSystem, xFeature + 20, yFeature + 2 + 1 + LinePitch 360 * I, 10, 10, 66 + Code[I] mod 11 * 11, 137 + Code[I] div 11 * 11); 361 362 if MyRO.DevModel.Cap[Code[I]] > 0 then 363 363 TextColor := MainTexture.ColorLitText 364 364 else 365 365 TextColor := -1; 366 366 367 if code[i] < mcFirstNonCap then368 LoweredTextOut( offscreen.Canvas, TextColor, MainTexture, xFeature + 7,369 yFeature + LinePitch * i - 1, IntToStr(MyRO.DevModel.Cap[code[i]]));370 LoweredTextOut( offscreen.Canvas, TextColor, MainTexture, xFeature + 88,371 yFeature + LinePitch * i - 1, Phrases.Lookup('FEATURES', code[i]));367 if Code[I] < mcFirstNonCap then 368 LoweredTextOut(Offscreen.Canvas, TextColor, MainTexture, xFeature + 7, 369 yFeature + LinePitch * I - 1, IntToStr(MyRO.DevModel.Cap[Code[I]])); 370 LoweredTextOut(Offscreen.Canvas, TextColor, MainTexture, xFeature + 88, 371 yFeature + LinePitch * I - 1, Phrases.Lookup('FEATURES', Code[I])); 372 372 end; 373 373 end; 374 374 375 375 // free features 376 j:= 0;377 for i:= 0 to nFeature - 1 do378 if ( i in AutoFeature) and (1 shl Domain and Feature[i].Domains <> 0) and379 (Feature[ i].Preq <> preNA) and380 ((Feature[ i].Preq = preSun) and (MyRO.Wonder[woSun].EffectiveOwner = me)381 or (Feature[ i].Preq >= 0) and (MyRO.Tech[Feature[i].Preq] >= tsApplicable)382 ) and not((Feature[ i].Preq = adSteamEngine) and376 J := 0; 377 for I := 0 to nFeature - 1 do 378 if (I in AutoFeature) and (1 shl Domain and Feature[I].Domains <> 0) and 379 (Feature[I].Preq <> preNA) and 380 ((Feature[I].Preq = preSun) and (MyRO.Wonder[woSun].EffectiveOwner = Me) 381 or (Feature[I].Preq >= 0) and (MyRO.Tech[Feature[I].Preq] >= tsApplicable) 382 ) and not((Feature[I].Preq = adSteamEngine) and 383 383 (MyRO.Tech[adNuclearPower] >= tsApplicable)) then 384 384 begin 385 DarkGradient( offscreen.Canvas, xWeight + 4, yWeight + 32 + LinePitch386 * j, 16, 1);387 Frame( offscreen.Canvas, xWeight + 5, yWeight + 33 + LinePitch * j,388 xWeight + 18, yWeight + 47 + LinePitch * j, $C0C0C0, $C0C0C0);389 Sprite( offscreen, HGrSystem, xWeight + 7, yWeight + 36 + LinePitch * j,390 10, 10, 66 + i mod 11 * 11, 137 + idiv 11 * 11);391 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xWeight + 26,392 yWeight + 31 + LinePitch * j, Phrases.Lookup('FEATURES', i));393 inc(j);394 end; 395 396 with Tribe[ me].ModelPicture[MyRO.nModel] do397 begin 398 FrameImage( offscreen.Canvas, BigImp, xView + 4, yView + 4, xSizeBig,385 DarkGradient(Offscreen.Canvas, xWeight + 4, yWeight + 32 + LinePitch 386 * J, 16, 1); 387 Frame(Offscreen.Canvas, xWeight + 5, yWeight + 33 + LinePitch * J, 388 xWeight + 18, yWeight + 47 + LinePitch * J, $C0C0C0, $C0C0C0); 389 Sprite(Offscreen, HGrSystem, xWeight + 7, yWeight + 36 + LinePitch * J, 390 10, 10, 66 + I mod 11 * 11, 137 + I div 11 * 11); 391 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xWeight + 26, 392 yWeight + 31 + LinePitch * J, Phrases.Lookup('FEATURES', I)); 393 Inc(J); 394 end; 395 396 with Tribe[Me].ModelPicture[MyRO.nModel] do 397 begin 398 FrameImage(Offscreen.Canvas, BigImp, xView + 4, yView + 4, xSizeBig, 399 399 ySizeBig, 0, 0); 400 Sprite( offscreen, HGr, xView, yView, 64, 44, pix mod 10 * 65 + 1,400 Sprite(Offscreen, HGr, xView, yView, 64, 44, pix mod 10 * 65 + 1, 401 401 pix div 10 * 49 + 1); 402 402 end; … … 404 404 end; 405 405 406 procedure TDraftDlg.SetDomain( d: integer);407 408 function Prio(fix: integer): integer;406 procedure TDraftDlg.SetDomain(D: Integer); 407 408 function Prio(fix: Integer): Integer; 409 409 var 410 FeaturePreq: integer;410 FeaturePreq: Integer; 411 411 begin 412 412 FeaturePreq := Feature[fix].Preq; 413 assert(FeaturePreq <> preNA);413 Assert(FeaturePreq <> preNA); 414 414 if fix < mcFirstNonCap then 415 result := 10000 + fix415 Result := 10000 + fix 416 416 else if FeaturePreq = preNone then 417 result := 20000417 Result := 20000 418 418 else if FeaturePreq < 0 then 419 result := 40000419 Result := 40000 420 420 else 421 result := 30000 + AdvValue[FeaturePreq];421 Result := 30000 + AdvValue[FeaturePreq]; 422 422 if not(fix in AutoFeature) then 423 inc(result, 90000);423 Inc(Result, 90000); 424 424 end; 425 425 426 426 var 427 i, j, x: integer;428 begin 429 Domain := d;427 I, J, X: Integer; 428 begin 429 Domain := D; 430 430 Lines := 0; 431 for i:= 0 to nFeature - 1 do432 if IsFeatureInList(Domain, i) then433 begin 434 code[Lines] := i;435 inc(Lines);431 for I := 0 to nFeature - 1 do 432 if IsFeatureInList(Domain, I) then 433 begin 434 Code[Lines] := I; 435 Inc(Lines); 436 436 end; 437 437 yFeature := yFeature0 + (MaxLines - Lines) * LinePitch div 2; 438 438 439 439 // sort features 440 for i:= 0 to Lines - 2 do441 for j := i+ 1 to Lines - 1 do442 if Prio( code[i]) > Prio(code[j]) then440 for I := 0 to Lines - 2 do 441 for J := I + 1 to Lines - 1 do 442 if Prio(Code[I]) > Prio(Code[J]) then 443 443 begin // exchange 444 x := code[i];445 code[i] := code[j];446 code[j] := x;444 X := Code[I]; 445 Code[I] := Code[J]; 446 Code[J] := X; 447 447 end; 448 448 end; 449 449 450 function TDraftDlg.IsFeatureInList( d, i: integer): boolean;451 begin 452 result := not(i in AutoFeature) and (1 shl d and Feature[i].Domains <> 0) and453 (Feature[ i].Preq <> preNA) and454 ((Feature[ i].Preq = preNone) or (Feature[i].Preq = preSun) and455 (MyRO.Wonder[woSun].EffectiveOwner = me) or (Feature[i].Preq >= 0) and456 (MyRO.Tech[Feature[ i].Preq] >= tsApplicable));450 function TDraftDlg.IsFeatureInList(D, I: Integer): Boolean; 451 begin 452 Result := not(I in AutoFeature) and (1 shl D and Feature[I].Domains <> 0) and 453 (Feature[I].Preq <> preNA) and 454 ((Feature[I].Preq = preNone) or (Feature[I].Preq = preSun) and 455 (MyRO.Wonder[woSun].EffectiveOwner = Me) or (Feature[I].Preq >= 0) and 456 (MyRO.Tech[Feature[I].Preq] >= tsApplicable)); 457 457 end; 458 458 459 459 procedure TDraftDlg.FormShow(Sender: TObject); 460 460 var 461 count, d, i: integer;461 count, D, I: Integer; 462 462 begin 463 463 Domain := dGround; 464 464 while (Domain < dAir) and (upgrade[Domain, 0].Preq <> preNone) and 465 465 (MyRO.Tech[upgrade[Domain, 0].Preq] < tsApplicable) do 466 inc(Domain);466 Inc(Domain); 467 467 468 468 // count max number of features in any domain 469 469 MaxLines := 0; 470 for d:= 0 to nDomains - 1 do471 if (upgrade[ d, 0].Preq = preNone) or472 (MyRO.Tech[upgrade[ d, 0].Preq] >= tsApplicable) then470 for D := 0 to nDomains - 1 do 471 if (upgrade[D, 0].Preq = preNone) or 472 (MyRO.Tech[upgrade[D, 0].Preq] >= tsApplicable) then 473 473 begin 474 474 count := 0; 475 for i:= 0 to nFeature - 1 do476 if IsFeatureInList( d, i) then477 inc(count);475 for I := 0 to nFeature - 1 do 476 if IsFeatureInList(D, I) then 477 Inc(count); 478 478 if count > MaxLines then 479 479 MaxLines := count; … … 493 493 494 494 SetDomain(Domain); 495 Server(sCreateDevModel, me, Domain, nil^);495 Server(sCreateDevModel, Me, Domain, nil^); 496 496 MyModel[MyRO.nModel] := MyRO.DevModel; 497 InitMyModel(MyRO.nModel, false);497 InitMyModel(MyRO.nModel, False); 498 498 OffscreenPaint; 499 499 IncCap := -1; … … 507 507 508 508 procedure TDraftDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 509 Shift: TShiftState; x, y: integer);509 Shift: TShiftState; X, Y: Integer); 510 510 var 511 i, d: integer;511 I, D: Integer; 512 512 begin 513 513 if Button = mbLeft then 514 514 begin 515 for d:= 0 to nDomains - 1 do516 if ( d <> Domain) and ((upgrade[d, 0].Preq = preNone) or517 (MyRO.Tech[upgrade[ d, 0].Preq] >= tsApplicable)) and518 ( x >= xDomain + d* DomainPitch) and519 ( x < xDomain + d * DomainPitch + 36) and (y>= yDomain) and520 ( y< yDomain + 36) then515 for D := 0 to nDomains - 1 do 516 if (D <> Domain) and ((upgrade[D, 0].Preq = preNone) or 517 (MyRO.Tech[upgrade[D, 0].Preq] >= tsApplicable)) and 518 (X >= xDomain + D * DomainPitch) and 519 (X < xDomain + D * DomainPitch + 36) and (Y >= yDomain) and 520 (Y < yDomain + 36) then 521 521 begin 522 SetDomain( d);523 Server(sCreateDevModel, me, Domain, nil^);522 SetDomain(D); 523 Server(sCreateDevModel, Me, Domain, nil^); 524 524 MyModel[MyRO.nModel] := MyRO.DevModel; 525 InitMyModel(MyRO.nModel, false);525 InitMyModel(MyRO.nModel, False); 526 526 SmartUpdateContent; 527 527 end; 528 528 529 if ( y >= yFeature) and (y< yFeature + LinePitch * Lines) then530 begin 531 i := (y- yFeature) div LinePitch;532 if ( x >= xFeature - 21) and (x< ClientWidth) and (ssShift in Shift) then533 HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkFeature, code[i])534 else if not( code[i] in AutoFeature) then529 if (Y >= yFeature) and (Y < yFeature + LinePitch * Lines) then 530 begin 531 I := (Y - yFeature) div LinePitch; 532 if (X >= xFeature - 21) and (X < ClientWidth) and (ssShift in Shift) then 533 HelpDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), hkFeature, Code[I]) 534 else if not(Code[I] in AutoFeature) then 535 535 begin 536 if ( code[i] < mcFirstNonCap) and (x>= xFeature - 21) and537 ( x< xFeature - 21 + 12) then536 if (Code[I] < mcFirstNonCap) and (X >= xFeature - 21) and 537 (X < xFeature - 21 + 12) then 538 538 begin 539 IncCap := code[i];540 Dump( offscreen, HGrSystem, xFeature - 21, yFeature + 2 + LinePitch *541 i, 12, 12, 182, 172);539 IncCap := Code[I]; 540 Dump(Offscreen, HGrSystem, xFeature - 21, yFeature + 2 + LinePitch * 541 I, 12, 12, 182, 172); 542 542 SmartInvalidate; 543 543 end 544 else if ( x >= xFeature - 9) and (x< xFeature - 9 + 12) then544 else if (X >= xFeature - 9) and (X < xFeature - 9 + 12) then 545 545 begin 546 DecCap := code[i];547 if code[i] < mcFirstNonCap then548 Dump( offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *549 i, 12, 12, 182, 159)546 DecCap := Code[I]; 547 if Code[I] < mcFirstNonCap then 548 Dump(Offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch * 549 I, 12, 12, 182, 159) 550 550 else 551 Dump( offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch *552 i, 12, 12, 182, 185 + 13 * MyRO.DevModel.Cap[code[i]]);551 Dump(Offscreen, HGrSystem, xFeature - 9, yFeature + 2 + LinePitch * 552 I, 12, 12, 182, 185 + 13 * MyRO.DevModel.Cap[Code[I]]); 553 553 SmartInvalidate; 554 554 end; … … 559 559 560 560 procedure TDraftDlg.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; 561 Shift: TShiftState; x, y: integer);561 Shift: TShiftState; X, Y: Integer); 562 562 var 563 NewValue: integer;563 NewValue: Integer; 564 564 begin 565 565 if IncCap >= 0 then 566 566 begin 567 567 NewValue := MyRO.DevModel.Cap[IncCap] + 1; 568 Server(sSetDevModelCap + NewValue shl 4, me, IncCap, nil^);568 Server(sSetDevModelCap + NewValue shl 4, Me, IncCap, nil^); 569 569 MyModel[MyRO.nModel] := MyRO.DevModel; 570 InitMyModel(MyRO.nModel, false);570 InitMyModel(MyRO.nModel, False); 571 571 SmartUpdateContent; 572 572 IncCap := -1; … … 579 579 if DecCap >= mcFirstNonCap then 580 580 NewValue := -NewValue; 581 Server(sSetDevModelCap + NewValue shl 4, me, DecCap, nil^);581 Server(sSetDevModelCap + NewValue shl 4, Me, DecCap, nil^); 582 582 MyModel[MyRO.nModel] := MyRO.DevModel; 583 InitMyModel(MyRO.nModel, false);583 InitMyModel(MyRO.nModel, False); 584 584 end; 585 585 SmartUpdateContent; -
trunk/LocalPlayer/Enhance.pas
r442 r447 37 37 NoMap: TIsoMap; 38 38 public 39 procedure ShowNewContent(NewMode: TWindowMode; TerrType: integer = -1);39 procedure ShowNewContent(NewMode: TWindowMode; TerrType: Integer = -1); 40 40 protected 41 Page: integer;41 Page: Integer; 42 42 procedure OffscreenPaint; override; 43 43 end; … … 56 56 procedure TEnhanceDlg.FormCreate(Sender: TObject); 57 57 var 58 TerrType: integer;59 m: TMenuItem;58 TerrType: Integer; 59 M: TMenuItem; 60 60 begin 61 61 inherited; … … 71 71 if TerrType <> fJungle then 72 72 begin 73 m:= TMenuItem.Create(Popup);74 m.RadioItem := true;73 M := TMenuItem.Create(Popup); 74 M.RadioItem := True; 75 75 if TerrType = fGrass then 76 m.Caption := Format(Phrases.Lookup('TWOTERRAINS'),76 M.Caption := Format(Phrases.Lookup('TWOTERRAINS'), 77 77 [Phrases.Lookup('TERRAIN', fGrass), Phrases.Lookup('TERRAIN', 78 78 fGrass + 12)]) 79 79 else if TerrType = fForest then 80 m.Caption := Format(Phrases.Lookup('TWOTERRAINS'),80 M.Caption := Format(Phrases.Lookup('TWOTERRAINS'), 81 81 [Phrases.Lookup('TERRAIN', fForest), Phrases.Lookup('TERRAIN', 82 82 fJungle)]) 83 83 else 84 m.Caption := Phrases.Lookup('TERRAIN', TerrType);85 m.Tag := TerrType;86 m.OnClick := TerrClick;87 Popup.Items.Add( m);84 M.Caption := Phrases.Lookup('TERRAIN', TerrType); 85 M.Tag := TerrType; 86 M.OnClick := TerrClick; 87 Popup.Items.Add(M); 88 88 end; 89 89 end; … … 96 96 procedure TEnhanceDlg.FormPaint(Sender: TObject); 97 97 var 98 i: integer;98 I: Integer; 99 99 begin 100 100 inherited; … … 103 103 BtnFrame(Canvas, Rect(job3.Left, job3.Top, job9.Left + job9.Width, 104 104 job3.Top + job3.Height), MainTexture); 105 for i:= 0 to ControlCount - 1 do106 if Controls[ i] is TButtonC then107 BitBltCanvas(Canvas, Controls[ i].Left + 2, Controls[i].Top - 11, 8, 8,108 HGrSystem.Data.Canvas, 121 + Controls[ i].Tag mod 7 * 9,109 1 + Controls[ i].Tag div 7 * 9);105 for I := 0 to ControlCount - 1 do 106 if Controls[I] is TButtonC then 107 BitBltCanvas(Canvas, Controls[I].Left + 2, Controls[I].Top - 11, 8, 8, 108 HGrSystem.Data.Canvas, 121 + Controls[I].Tag mod 7 * 9, 109 1 + Controls[I].Tag div 7 * 9); 110 110 end; 111 111 … … 115 115 end; 116 116 117 procedure TEnhanceDlg.ShowNewContent(NewMode: TWindowMode; TerrType: integer);117 procedure TEnhanceDlg.ShowNewContent(NewMode: TWindowMode; TerrType: Integer); 118 118 begin 119 119 if (TerrType < fGrass) or (TerrType > fMountains) then … … 126 126 procedure TEnhanceDlg.OffscreenPaint; 127 127 var 128 i, stage, TerrType, TileImp, x, EndStage, Cost, LastJob: integer;129 s: string;128 I, stage, TerrType, TileImp, X, EndStage, Cost, LastJob: Integer; 129 S: string; 130 130 Done: Set of jNone .. jTrans; 131 TypeChanged: boolean;131 TypeChanged: Boolean; 132 132 begin 133 133 OffscreenUser := self; 134 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);134 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 135 135 FillOffscreen(0, 0, InnerWidth, InnerHeight); 136 136 137 137 EndStage := 0; 138 138 while (EndStage < 5) and (MyData.EnhancementJobs[Page, EndStage] <> jNone) do 139 inc(EndStage);139 Inc(EndStage); 140 140 with NoMap do 141 x:= InnerWidth div 2 - xxt - (xxt + 3) * EndStage;141 X := InnerWidth div 2 - xxt - (xxt + 3) * EndStage; 142 142 143 143 TerrType := Page; … … 149 149 if stage > 0 then 150 150 begin 151 Sprite( offscreen, HGrSystem, x- 10, 66, 14, 14, 80, 1);151 Sprite(Offscreen, HGrSystem, X - 10, 66, 14, 14, 80, 1); 152 152 case MyData.EnhancementJobs[Page, stage - 1] of 153 153 jRoad: 154 154 begin 155 inc(Cost, Terrain[TerrType].MoveCost * RoadWork);155 Inc(Cost, Terrain[TerrType].MoveCost * RoadWork); 156 156 TileImp := TileImp or fRoad; 157 157 end; 158 158 jRR: 159 159 begin 160 inc(Cost, Terrain[TerrType].MoveCost * RRWork);160 Inc(Cost, Terrain[TerrType].MoveCost * RRWork); 161 161 TileImp := TileImp or fRR; 162 162 end; 163 163 jIrr: 164 164 begin 165 inc(Cost, Terrain[TerrType].IrrClearWork);165 Inc(Cost, Terrain[TerrType].IrrClearWork); 166 166 TileImp := TileImp and not fTerImp or tiIrrigation; 167 167 end; 168 168 jFarm: 169 169 begin 170 inc(Cost, Terrain[TerrType].IrrClearWork * FarmWork);170 Inc(Cost, Terrain[TerrType].IrrClearWork * FarmWork); 171 171 TileImp := TileImp and not fTerImp or tiFarm; 172 172 end; 173 173 jMine: 174 174 begin 175 inc(Cost, Terrain[TerrType].MineAfforestWork);175 Inc(Cost, Terrain[TerrType].MineAfforestWork); 176 176 TileImp := TileImp and not fTerImp or tiMine; 177 177 end; 178 178 jClear: 179 179 begin 180 inc(Cost, Terrain[TerrType].IrrClearWork);180 Inc(Cost, Terrain[TerrType].IrrClearWork); 181 181 TerrType := Terrain[TerrType].ClearTerrain; 182 182 end; 183 183 jAfforest: 184 184 begin 185 inc(Cost, Terrain[TerrType].MineAfforestWork);185 Inc(Cost, Terrain[TerrType].MineAfforestWork); 186 186 TerrType := Terrain[TerrType].AfforestTerrain; 187 187 end; 188 188 jTrans: 189 189 begin 190 inc(Cost, Terrain[TerrType].TransWork);190 Inc(Cost, Terrain[TerrType].TransWork); 191 191 TerrType := Terrain[TerrType].TransTerrain; 192 192 end; 193 193 end; 194 include(Done, MyData.EnhancementJobs[Page, stage - 1]);194 Include(Done, MyData.EnhancementJobs[Page, stage - 1]); 195 195 end; 196 196 197 197 with NoMap do begin 198 198 if TerrType < fForest then 199 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,199 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 200 200 1 + TerrType * (xxt * 2 + 1), 1 + yyt) 201 201 else 202 202 begin 203 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,203 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 204 204 1 + 2 * (xxt * 2 + 1), 1 + yyt + 2 * (yyt * 3 + 1)); 205 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,205 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 206 206 1 + 7 * (xxt * 2 + 1), 1 + yyt + 2 * (2 + TerrType - fForest) * 207 207 (yyt * 3 + 1)); 208 208 end; 209 209 if TileImp and fTerImp = tiFarm then 210 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,210 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 211 211 1 + (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1)) 212 212 else if TileImp and fTerImp = tiIrrigation then 213 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1,213 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 1, 214 214 1 + yyt + 12 * (yyt * 3 + 1)); 215 215 if TileImp and fRR <> 0 then 216 216 begin 217 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,217 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 218 218 1 + 6 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1)); 219 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,219 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 220 220 1 + 2 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1)); 221 221 end 222 222 else if TileImp and fRoad <> 0 then 223 223 begin 224 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,224 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 225 225 1 + 6 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1)); 226 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,226 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 227 227 1 + 2 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1)); 228 228 end; 229 229 if TileImp and fTerImp = tiMine then 230 Sprite( offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2,230 Sprite(Offscreen, HGrTerrain, X, 64 - yyt, xxt * 2, yyt * 2, 231 231 1 + 2 * (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1)); 232 inc(x, xxt * 2 + 6);233 end; 234 end; 235 236 for i:= 0 to Popup.Items.Count - 1 do237 if Popup.Items[ i].Tag = Page then238 s := Popup.Items[i].Caption;232 Inc(X, xxt * 2 + 6); 233 end; 234 end; 235 236 for I := 0 to Popup.Items.Count - 1 do 237 if Popup.Items[I].Tag = Page then 238 S := Popup.Items[I].Caption; 239 239 if Cost > 0 then 240 s := Format(Phrases.Lookup('ENHANCE'), [s, MovementToString(Cost)]);241 LoweredTextOut( offscreen.Canvas, -1, MainTexture,242 (InnerWidth - BiColorTextWidth( offscreen.Canvas, s)) div 2, 12, s);240 S := Format(Phrases.Lookup('ENHANCE'), [S, MovementToString(Cost)]); 241 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 242 (InnerWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 12, S); 243 243 244 244 if EndStage > 0 then … … 289 289 (Terrain[TerrType].MineEff > 0); 290 290 job3.Visible := not TypeChanged and (Terrain[TerrType].ClearTerrain >= 0) and 291 ((TerrType <> fDesert) or (MyRO.Wonder[woGardens].EffectiveOwner = me)) or291 ((TerrType <> fDesert) or (MyRO.Wonder[woGardens].EffectiveOwner = Me)) or 292 292 (LastJob = jClear); 293 293 job6.Visible := not TypeChanged and (Terrain[TerrType].AfforestTerrain >= 0) … … 306 306 procedure TEnhanceDlg.ToggleBtnClick(Sender: TObject); 307 307 var 308 i: integer;309 begin 310 for i:= 0 to Popup.Items.Count - 1 do311 Popup.Items[ i].Checked := Popup.Items[i].Tag = Page;308 I: Integer; 309 begin 310 for I := 0 to Popup.Items.Count - 1 do 311 Popup.Items[I].Checked := Popup.Items[I].Tag = Page; 312 312 Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top + ToggleBtn.Height); 313 313 end; … … 321 321 procedure TEnhanceDlg.JobClick(Sender: TObject); 322 322 var 323 stage, NewJob: integer;323 stage, NewJob: Integer; 324 324 Done: Set of jNone .. jTrans; 325 325 326 procedure RemoveJob( j: integer);326 procedure RemoveJob(J: Integer); 327 327 begin // remove job 328 328 stage := 0; 329 329 while (stage < 5) and (MyData.EnhancementJobs[Page, stage] <> jNone) do 330 330 begin 331 if (MyData.EnhancementJobs[Page, stage] = j) or (j= jRoad) and332 (MyData.EnhancementJobs[Page, stage] = jRR) or ( j= jIrr) and331 if (MyData.EnhancementJobs[Page, stage] = J) or (J = jRoad) and 332 (MyData.EnhancementJobs[Page, stage] = jRR) or (J = jIrr) and 333 333 (MyData.EnhancementJobs[Page, stage] = jFarm) then 334 334 begin 335 335 if stage < 4 then 336 move(MyData.EnhancementJobs[Page, stage + 1],336 Move(MyData.EnhancementJobs[Page, stage + 1], 337 337 MyData.EnhancementJobs[Page, stage], 4 - stage); 338 338 MyData.EnhancementJobs[Page, 4] := jNone; 339 339 end 340 340 else 341 inc(stage);341 Inc(stage); 342 342 end; 343 343 end; … … 349 349 while (stage < 5) and (MyData.EnhancementJobs[Page, stage] <> jNone) do 350 350 begin 351 include(Done, MyData.EnhancementJobs[Page, stage]);352 inc(stage);351 Include(Done, MyData.EnhancementJobs[Page, stage]); 352 Inc(stage); 353 353 end; 354 354 if NewJob in Done then … … 363 363 begin 364 364 MyData.EnhancementJobs[Page, stage] := jRoad; 365 inc(stage);365 Inc(stage); 366 366 end; 367 367 if (NewJob = jFarm) and not(jIrr in Done) then 368 368 begin 369 369 MyData.EnhancementJobs[Page, stage] := jIrr; 370 inc(stage);370 Inc(stage); 371 371 end; 372 372 MyData.EnhancementJobs[Page, stage] := NewJob; -
trunk/LocalPlayer/Help.pas
r431 r447 41 41 THyperText = class(TStringList) 42 42 public 43 procedure AddLine( s: String = ''; Format: integer = 0; Picpix: Integer = 0;44 LinkCategory: integer = 0; LinkIndex: integer = 0);43 procedure AddLine(S: String = ''; Format: Integer = 0; Picpix: Integer = 0; 44 LinkCategory: Integer = 0; LinkIndex: Integer = 0); 45 45 procedure LineFeed; 46 46 procedure AppendList(Source: THyperText); … … 78 78 procedure CloseBtnClick(Sender: TObject); 79 79 procedure PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 80 x, y: integer);80 X, Y: Integer); 81 81 procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 82 Shift: TShiftState; x, y: integer);82 Shift: TShiftState; X, Y: Integer); 83 83 procedure BackBtnClick(Sender: TObject); 84 84 procedure TopBtnClick(Sender: TObject); … … 104 104 NoMap: TIsoMap; 105 105 x0: array [-2..180] of Integer; 106 procedure PaintTerrIcon( x, y, xSrc, ySrc: Integer);106 procedure PaintTerrIcon(X, Y, xSrc, ySrc: Integer); 107 107 procedure ScrollBarUpdate(Sender: TObject); 108 procedure Line(ca: TCanvas; i: Integer; lit: Boolean);108 procedure Line(ca: TCanvas; I: Integer; lit: Boolean); 109 109 procedure Prepare(sbPos: Integer = 0); 110 110 procedure ShowNewContentProcExecute(NewMode: TWindowMode; HelpContext: string); … … 176 176 end; 177 177 178 procedure THyperText.AddLine( s: String; Format: integer; Picpix: integer;179 LinkCategory: integer; LinkIndex: integer);178 procedure THyperText.AddLine(S: String; Format: Integer; Picpix: Integer; 179 LinkCategory: Integer; LinkIndex: Integer); 180 180 var 181 181 HelpLineInfo: THelpLineInfo; … … 187 187 HelpLineInfo.Picpix := Picpix; 188 188 HelpLineInfo.Link := LinkCategory shl 8 + LinkIndex; 189 AddObject( s, TObject(HelpLineInfo));189 AddObject(S, TObject(HelpLineInfo)); 190 190 end; 191 191 … … 263 263 264 264 nTerrainHelp = 14; 265 TerrainHelp: array [0 .. nTerrainHelp - 1] of integer = (fGrass, fGrass + 12,265 TerrainHelp: array [0 .. nTerrainHelp - 1] of Integer = (fGrass, fGrass + 12, 266 266 fPrairie, fForest, fJungle, fHills, fMountains, fSwamp, fTundra, fArctic, 267 267 fDesert, 3 * 12 { DeadLands } , fShore, fOcean); 268 268 269 269 nJobHelp = 8; 270 JobHelp: array [0 .. nJobHelp - 1] of integer = (jRoad, jRR, jCanal, jIrr,270 JobHelp: array [0 .. nJobHelp - 1] of Integer = (jRoad, jRR, jCanal, jIrr, 271 271 jFarm, jMine, jFort, jBase); 272 272 … … 280 280 CaptionLeft := BackBtn.Left + BackBtn.Width; 281 281 CaptionRight := SearchBtn.Left; 282 inc(ModalFrameIndent, 29);282 Inc(ModalFrameIndent, 29); 283 283 MainText := THyperText.Create; 284 284 MainText.OwnsObjects := True; … … 356 356 if ScrollBar.Process(Msg) then begin 357 357 Sel := -1; 358 SmartUpdateContent( true)358 SmartUpdateContent(True) 359 359 end; 360 360 } … … 364 364 begin 365 365 if Sel <> -1 then begin 366 Line(Canvas, Sel, false);366 Line(Canvas, Sel, False); 367 367 Sel := -1 368 368 end; … … 380 380 end; 381 381 382 procedure THelpDlg.Line(ca: TCanvas; i: Integer; lit: Boolean);382 procedure THelpDlg.Line(ca: TCanvas; I: Integer; lit: Boolean); 383 383 var 384 TextColor, x, y: Integer;384 TextColor, X, Y: Integer; 385 385 TextSize: TSize; 386 s: string;387 begin 388 s := MainText[ScrollBar.Position + i];389 if s= '' then386 S: string; 387 begin 388 S := MainText[ScrollBar.Position + I]; 389 if S = '' then 390 390 Exit; 391 x := x0[i];392 y := 2 + i* 24;391 X := x0[I]; 392 Y := 2 + I * 24; 393 393 if ca = Canvas then 394 394 begin 395 x := x+ SideFrame;396 y := y+ WideFrame397 end; 398 if THelpLineInfo(MainText.Objects[ScrollBar.Position + i]).Format395 X := X + SideFrame; 396 Y := Y + WideFrame 397 end; 398 if THelpLineInfo(MainText.Objects[ScrollBar.Position + I]).Format 399 399 in [pkCaption, pkBigTer, pkRightIcon, pkBigFeature] then 400 400 begin 401 401 ca.Font.Assign(CaptionFont); 402 402 { ca.brush.color:=CaptionColor; 403 ca.FillRect(rect( x,i*24,x+24,i*24+24));404 ca. brush.color:=$FFFFFF;405 ca.FrameRect(rect( x+1,i*24+1,x+24-1,i*24+24-1));403 ca.FillRect(rect(X,I*24,X+24,I*24+24)); 404 ca.Brush.Color:=$FFFFFF; 405 ca.FrameRect(rect(X+1,I*24+1,X+24-1,I*24+24-1)); 406 406 ca.Brush.Style:=bsClear; } 407 BitBltCanvas(ca, x, y- 4, 24, 24, HGrSystem.Data.Canvas, 1,407 BitBltCanvas(ca, X, Y - 4, 24, 24, HGrSystem.Data.Canvas, 1, 408 408 146); 409 BiColorTextOut(ca, $FFFFFF, $7F007F, x + 10 - ca.Textwidth(s[1]) div 2,410 y - 3, s[1]);411 BiColorTextOut(ca, CaptionColor, $7F007F, x + 24, y - 3, copy(s, 2, 255));409 BiColorTextOut(ca, $FFFFFF, $7F007F, X + 10 - ca.Textwidth(S[1]) div 2, 410 Y - 3, S[1]); 411 BiColorTextOut(ca, CaptionColor, $7F007F, X + 24, Y - 3, Copy(S, 2, 255)); 412 412 ca.Font.Assign(UniFont[ftNormal]); 413 413 end 414 else if THelpLineInfo(MainText.Objects[ScrollBar.Position + i]).Format = pkSection414 else if THelpLineInfo(MainText.Objects[ScrollBar.Position + I]).Format = pkSection 415 415 then 416 416 begin 417 417 ca.Font.Assign(CaptionFont); 418 BiColorTextOut(ca, CaptionColor, $7F007F, x, y - 3, s);418 BiColorTextOut(ca, CaptionColor, $7F007F, X, Y - 3, S); 419 419 ca.Font.Assign(UniFont[ftNormal]); 420 420 end … … 426 426 if ca = Canvas then 427 427 begin 428 TextSize.cx := BiColorTextWidth(ca, s);429 TextSize.cy := ca.TextHeight( s);430 if y+ TextSize.cy >= WideFrame + InnerHeight then431 TextSize.cy := WideFrame + InnerHeight - y;432 FillSeamless(ca, x, y, TextSize.cx, TextSize.cy, -SideFrame,428 TextSize.cx := BiColorTextWidth(ca, S); 429 TextSize.cy := ca.TextHeight(S); 430 if Y + TextSize.cy >= WideFrame + InnerHeight then 431 TextSize.cy := WideFrame + InnerHeight - Y; 432 FillSeamless(ca, X, Y, TextSize.cx, TextSize.cy, -SideFrame, 433 433 ScrollBar.Position * 24 - WideFrame, Paper); 434 434 end; 435 BiColorTextOut(ca, TextColor, $7F007F, x, y, s);435 BiColorTextOut(ca, TextColor, $7F007F, X, Y, S); 436 436 if lit then 437 437 with ca do … … 439 439 Assert(ca = Canvas); 440 440 Pen.Color := TextColor; 441 MoveTo( x + 1, y+ TextSize.cy - 2);442 LineTo( x + TextSize.cx, y+ TextSize.cy - 2);441 MoveTo(X + 1, Y + TextSize.cy - 2); 442 LineTo(X + TextSize.cx, Y + TextSize.cy - 2); 443 443 end; 444 444 if (Kind = hkMisc) and (no = miscMain) then … … 447 447 end; 448 448 449 procedure THelpDlg.WaterSign(x0, y0, iix: integer);449 procedure THelpDlg.WaterSign(x0, y0, iix: Integer); 450 450 const 451 451 nHeaven = 28; 452 452 MaxSum = 9 * 9 * 255 * 75 div 100; 453 453 var 454 x, y, dx, dy, xSrc, ySrc, Sum, xx: integer;455 Heaven: array [0..nHeaven] of integer;454 X, Y, dx, dy, xSrc, ySrc, Sum, xx: Integer; 455 Heaven: array [0..nHeaven] of Integer; 456 456 PaintPtr: TPixelPointer; 457 457 CoalPtr: TPixelPointer; … … 471 471 for dy := -1 to 1 do 472 472 ImpPtr[dy] := PixelPointer(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc)); 473 for y:= 0 to ScaleToNative(ySizeBig) * 2 - 1 do begin474 if ((ScaleToNative(y0) + y) >= 0) and ((ScaleToNative(y0) + y) < ScaleToNative(InnerHeight)) then begin473 for Y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do begin 474 if ((ScaleToNative(y0) + Y) >= 0) and ((ScaleToNative(y0) + Y) < ScaleToNative(InnerHeight)) then begin 475 475 for dy := -1 to 1 do 476 if ((Max( y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(y+ ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then477 ImpPtr[dy].SetXY(0, Max( y+ ScaleToNative(dy), 0) shr 1);478 for x:= 0 to ScaleToNative(xSizeBig * 2) - 1 do begin476 if ((Max(Y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(Y + ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then 477 ImpPtr[dy].SetXY(0, Max(Y + ScaleToNative(dy), 0) shr 1); 478 for X := 0 to ScaleToNative(xSizeBig * 2) - 1 do begin 479 479 Sum := 0; 480 480 for dx := -1 to 1 do begin 481 xx := Max(( x+ ScaleToNative(dx)), 0) shr 1;481 xx := Max((X + ScaleToNative(dx)), 0) shr 1; 482 482 for dy := -1 to 1 do begin 483 483 ImpPtr[dy].SetX(xx); 484 if (( y + ScaleToNative(dy)) shr 1 < 0) or ((y+ ScaleToNative(dy)) shr 1 >= ScaleToNative(ySizeBig)) or485 (( x + ScaleToNative(dx)) shr 1 < 0) or ((x+ ScaleToNative(dx)) shr 1 >= ScaleToNative(xSizeBig)) or486 (( y+ ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and484 if ((Y + ScaleToNative(dy)) shr 1 < 0) or ((Y + ScaleToNative(dy)) shr 1 >= ScaleToNative(ySizeBig)) or 485 ((X + ScaleToNative(dx)) shr 1 < 0) or ((X + ScaleToNative(dx)) shr 1 >= ScaleToNative(xSizeBig)) or 486 ((Y + ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and 487 487 (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 + 488 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative( y+ ScaleToNative(dy))) shr 1]) then488 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(Y + ScaleToNative(dy))) shr 1]) then 489 489 Sum := Sum + 9 * 255 490 490 else … … 510 510 end; 511 511 512 procedure THelpDlg.PaintTerrIcon( x, y, xSrc, ySrc: integer);512 procedure THelpDlg.PaintTerrIcon(X, Y, xSrc, ySrc: Integer); 513 513 begin 514 514 with NoMap do begin 515 Frame(OffScreen.Canvas, x - 1, y - 1, x + xSizeBig, y+ ySizeBig,515 Frame(OffScreen.Canvas, X - 1, Y - 1, X + xSizeBig, Y + ySizeBig, 516 516 $000000, $000000); 517 517 if 2 * yyt < 40 then begin 518 Sprite(OffScreen, HGrTerrain, x, y, 56, 2 * yyt, xSrc, ySrc);519 Sprite(OffScreen, HGrTerrain, x, y+ 2 * yyt, 56, 40 - 2 * yyt,518 Sprite(OffScreen, HGrTerrain, X, Y, 56, 2 * yyt, xSrc, ySrc); 519 Sprite(OffScreen, HGrTerrain, X, Y + 2 * yyt, 56, 40 - 2 * yyt, 520 520 xSrc, ySrc); 521 521 end else 522 Sprite(OffScreen, HGrTerrain, x, y, 56, 40, xSrc, ySrc);523 Sprite(OffScreen, HGrTerrain, x, y, xxt, yyt, xSrc + xxt, ySrc + yyt);524 Sprite(OffScreen, HGrTerrain, x, y+ yyt, xxt, 40 - yyt, xSrc + xxt, ySrc);525 Sprite(OffScreen, HGrTerrain, x + xxt, y, 56 - xxt, yyt, xSrc, ySrc + yyt);526 Sprite(OffScreen, HGrTerrain, x + xxt, y+ yyt, 56 - xxt, 40 - yyt,522 Sprite(OffScreen, HGrTerrain, X, Y, 56, 40, xSrc, ySrc); 523 Sprite(OffScreen, HGrTerrain, X, Y, xxt, yyt, xSrc + xxt, ySrc + yyt); 524 Sprite(OffScreen, HGrTerrain, X, Y + yyt, xxt, 40 - yyt, xSrc + xxt, ySrc); 525 Sprite(OffScreen, HGrTerrain, X + xxt, Y, 56 - xxt, yyt, xSrc, ySrc + yyt); 526 Sprite(OffScreen, HGrTerrain, X + xxt, Y + yyt, 56 - xxt, 40 - yyt, 527 527 xSrc, ySrc); 528 528 end; … … 531 531 procedure THelpDlg.OffscreenPaint; 532 532 var 533 i, j, yl, srcno, ofs, cnt, y: Integer;534 s: string;533 I, J, yl, srcno, ofs, cnt, Y: Integer; 534 S: string; 535 535 HelpLineInfo: THelpLineInfo; 536 536 begin … … 542 542 begin 543 543 Font.Assign(UniFont[ftNormal]); 544 for i:= -ScrollBar.Position to InnerHeight div 24 do545 if ScrollBar.Position + i< MainText.Count then544 for I := -ScrollBar.Position to InnerHeight div 24 do 545 if ScrollBar.Position + I < MainText.Count then 546 546 begin 547 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + i]);547 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + I]); 548 548 if HelpLineInfo.Format = pkExternal then 549 549 begin 550 550 yl := ExtPic.Height; 551 if 4 + i* 24 + yl > InnerHeight then552 yl := InnerHeight - (4 + i* 24);553 BitBltCanvas(OffScreen.Canvas, 8, 4 + i* 24, ExtPic.Width, yl, ExtPic.Canvas,551 if 4 + I * 24 + yl > InnerHeight then 552 yl := InnerHeight - (4 + I * 24); 553 BitBltCanvas(OffScreen.Canvas, 8, 4 + I * 24, ExtPic.Width, yl, ExtPic.Canvas, 554 554 0, 0); 555 555 end; 556 556 end; 557 for i:= -2 to InnerHeight div 24 do558 if (ScrollBar.Position + i >= 0) and (ScrollBar.Position + i< MainText.Count) then557 for I := -2 to InnerHeight div 24 do 558 if (ScrollBar.Position + I >= 0) and (ScrollBar.Position + I < MainText.Count) then 559 559 begin 560 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + i]);560 HelpLineInfo := THelpLineInfo(MainText.Objects[ScrollBar.Position + I]); 561 561 if HelpLineInfo.Link <> 0 then 562 562 begin 563 563 if (Kind = hkMisc) and (no = miscSearchResult) then 564 Sprite(OffScreen, HGrSystem, 18, 9 + i* 24, 8, 8, 90, 16)564 Sprite(OffScreen, HGrSystem, 18, 9 + I * 24, 8, 8, 90, 16) 565 565 else if HelpLineInfo.Format in [pkSmallIcon_AsPreq, pkAdvIcon_AsPreq] 566 566 then 567 Sprite(OffScreen, HGrSystem, 12, i* 24 + 5, 14, 14, 65, 20)567 Sprite(OffScreen, HGrSystem, 12, I * 24 + 5, 14, 14, 65, 20) 568 568 else if HelpLineInfo.Link and (hkCrossLink shl 8) <> 0 then 569 Sprite(OffScreen, HGrSystem, 12, i* 24 + 5, 14, 14, 80, 1)569 Sprite(OffScreen, HGrSystem, 12, I * 24 + 5, 14, 14, 80, 1) 570 570 else if not((Kind = hkMisc) and (no = miscMain)) then 571 Sprite(OffScreen, HGrSystem, 10, i* 24 + 6, 14, 14, 65, 1);572 x0[ i] := 24;571 Sprite(OffScreen, HGrSystem, 10, I * 24 + 6, 14, 14, 65, 1); 572 x0[I] := 24; 573 573 end 574 574 else 575 x0[ i] := 0;575 x0[I] := 0; 576 576 case HelpLineInfo.Format of 577 577 pkLogo: 578 578 begin 579 Server(sGetVersion, 0, 0, j);580 s := Format('%d.%d.%d', [j shr 16 and $FF, jshr 8 and $FF,581 jand $FF]);582 PaintLogo(OffScreen.Canvas, (InnerWidth - 122) div 2, i* 24 + 1,579 Server(sGetVersion, 0, 0, J); 580 S := Format('%d.%d.%d', [J shr 16 and $FF, J shr 8 and $FF, 581 J and $FF]); 582 PaintLogo(OffScreen.Canvas, (InnerWidth - 122) div 2, I * 24 + 1, 583 583 HGrSystem.Data.Canvas.Pixels[95, 1], $000000); 584 584 Font.Assign(UniFont[ftSmall]); 585 585 BiColorTextOut(OffScreen.Canvas, $000000, $7F007F, 586 (InnerWidth - Textwidth( s)) div 2, i * 24 + 26, s);586 (InnerWidth - Textwidth(S)) div 2, I * 24 + 26, S); 587 587 Font.Assign(UniFont[ftNormal]); 588 588 end; 589 589 pkSmallIcon, pkSmallIcon_AsPreq: 590 590 begin 591 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,592 8 + xSizeSmall + x0[ i], 2 + 20 + i* 24, $000000, $000000);591 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 592 8 + xSizeSmall + x0[I], 2 + 20 + I * 24, $000000, $000000); 593 593 if HelpLineInfo.Picpix = imPalace then 594 BitBltCanvas(OffScreen.Canvas, 8 + x0[ i], 2 + i* 24,594 BitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, 595 595 xSizeSmall, ySizeSmall, SmallImp.Canvas, 596 596 0 * xSizeSmall, 1 * ySizeSmall) 597 597 else 598 BitBltCanvas(OffScreen.Canvas, 8 + x0[ i], 2 + i* 24,598 BitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, 599 599 xSizeSmall, ySizeSmall, SmallImp.Canvas, 600 600 HelpLineInfo.Picpix mod 7 * xSizeSmall, 601 601 (HelpLineInfo.Picpix + SystemIconLines * 7) div 7 * 602 602 ySizeSmall); 603 x0[ i] := x0[i] + (8 + 8 + 36);603 x0[I] := x0[I] + (8 + 8 + 36); 604 604 end; 605 605 pkBigIcon: 606 606 begin 607 FrameImage(OffScreen.Canvas, BigImp, x0[ i] + 12, i* 24 - 7, 56,607 FrameImage(OffScreen.Canvas, BigImp, x0[I] + 12, I * 24 - 7, 56, 608 608 40, HelpLineInfo.Picpix mod 7 * xSizeBig, 609 609 HelpLineInfo.Picpix div 7 * ySizeBig); 610 x0[ i] := 64 + 8 + 8 + x0[i];610 x0[I] := 64 + 8 + 8 + x0[I]; 611 611 end; 612 612 pkSpecialIcon: … … 615 615 0: 616 616 FrameImage(OffScreen.Canvas, HGrSystem2.Data, 617 12 + x0[ i], -7 + i* 24, 56, 40, 137, 127);617 12 + x0[I], -7 + I * 24, 56, 40, 137, 127); 618 618 1: 619 619 with NoMap do begin 620 PaintTerrIcon(12 + x0[ i], -7 + i* 24,620 PaintTerrIcon(12 + x0[I], -7 + I * 24, 621 621 1 + 3 * (xxt * 2 + 1), 1 + yyt); 622 622 if 2 * yyt < 40 then 623 Sprite(OffScreen, HGrTerrain, 12 + x0[ i], -7 + 4 + i* 24,623 Sprite(OffScreen, HGrTerrain, 12 + x0[I], -7 + 4 + I * 24, 624 624 56, 2 * yyt, 1 + 3 * (xxt * 2 + 1) + xxt - 28, 625 625 1 + yyt + 1 * (yyt * 3 + 1)) 626 626 else 627 Sprite(OffScreen, HGrTerrain, 12 + x0[ i],628 -7 + 4 + i* 24 - 4, 56, 40, 1 + 3 * (xxt * 2 + 1) + xxt627 Sprite(OffScreen, HGrTerrain, 12 + x0[I], 628 -7 + 4 + I * 24 - 4, 56, 40, 1 + 3 * (xxt * 2 + 1) + xxt 629 629 - 28, 1 + yyt + 1 * (yyt * 3 + 1) + yyt - 20); 630 630 end; 631 631 2: 632 632 with NoMap do begin 633 PaintTerrIcon(12 + x0[ i], -7 + i* 24,633 PaintTerrIcon(12 + x0[I], -7 + I * 24, 634 634 1 + 7 * (xxt * 2 + 1), 1 + yyt + 4 * (yyt * 3 + 1)); 635 635 if 2 * yyt < 40 then 636 Sprite(OffScreen, HGrTerrain, 12 + x0[ i], -7 + 4 + i* 24,636 Sprite(OffScreen, HGrTerrain, 12 + x0[I], -7 + 4 + I * 24, 637 637 56, 32, 1 + 4 * (xxt * 2 + 1) + xxt - 28, 638 638 1 + yyt + 12 * (yyt * 3 + 1) + yyt - 16) 639 639 else 640 Sprite(OffScreen, HGrTerrain, 12 + x0[ i], -7 + 4 + i* 24,640 Sprite(OffScreen, HGrTerrain, 12 + x0[I], -7 + 4 + I * 24, 641 641 56, 32, 1 + 4 * (xxt * 2 + 1) + xxt - 28, 642 642 1 + yyt + 12 * (yyt * 3 + 1) + yyt - 16) 643 643 end; 644 644 end; 645 x0[ i] := 64 + 8 + 8 + x0[i];645 x0[I] := 64 + 8 + 8 + x0[I]; 646 646 end; 647 647 pkDomain: 648 648 begin 649 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,650 8 + 36 + x0[ i], 2 + 20 + i* 24, $000000, $000000);651 Dump(OffScreen, HGrSystem, 8 + x0[ i], 2 + i* 24, 36, 20,649 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 650 8 + 36 + x0[I], 2 + 20 + I * 24, $000000, $000000); 651 Dump(OffScreen, HGrSystem, 8 + x0[I], 2 + I * 24, 36, 20, 652 652 75 + HelpLineInfo.Picpix * 37, 295); 653 x0[ i] := x0[i] + (8 + 8 + 36);653 x0[I] := x0[I] + (8 + 8 + 36); 654 654 end; 655 655 pkAdvIcon, pkAdvIcon_AsPreq: 656 656 begin 657 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,658 8 + xSizeSmall + x0[ i], 2 + ySizeSmall + i* 24,657 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 658 8 + xSizeSmall + x0[I], 2 + ySizeSmall + I * 24, 659 659 $000000, $000000); 660 660 if AdvIcon[HelpLineInfo.Picpix] < 84 then 661 BitBltCanvas(OffScreen.Canvas, 8 + x0[ i], 2 + i* 24,661 BitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, 662 662 xSizeSmall, ySizeSmall, SmallImp.Canvas, 663 663 (AdvIcon[HelpLineInfo.Picpix] + SystemIconLines * 7) mod 7 * … … 665 665 7) div 7 * ySizeSmall) 666 666 else 667 Dump(OffScreen, HGrSystem, 8 + x0[ i], 2 + i* 24, 36, 20,667 Dump(OffScreen, HGrSystem, 8 + x0[I], 2 + I * 24, 36, 20, 668 668 1 + (AdvIcon[HelpLineInfo.Picpix] - 84) mod 8 * 37, 669 669 295 + (AdvIcon[HelpLineInfo.Picpix] - 84) div 8 * 21); 670 j:= AdvValue[HelpLineInfo.Picpix] div 1000;671 BitBltCanvas(OffScreen.Canvas, x0[ i] + 4, 4 + i* 24, 14, 14,672 HGrSystem.Mask.Canvas, 127 + j* 15, 85, SRCAND);673 Sprite(OffScreen, HGrSystem, x0[ i] + 3, 3 + i* 24, 14, 14,674 127 + j* 15, 85);675 x0[ i] := x0[i] + (8 + 8 + 36);670 J := AdvValue[HelpLineInfo.Picpix] div 1000; 671 BitBltCanvas(OffScreen.Canvas, x0[I] + 4, 4 + I * 24, 14, 14, 672 HGrSystem.Mask.Canvas, 127 + J * 15, 85, SRCAND); 673 Sprite(OffScreen, HGrSystem, x0[I] + 3, 3 + I * 24, 14, 14, 674 127 + J * 15, 85); 675 x0[I] := x0[I] + (8 + 8 + 36); 676 676 end; 677 677 pkRightIcon: 678 678 begin 679 679 if Imp[HelpLineInfo.Picpix].Kind <> ikWonder then 680 ImpImage(OffScreen.Canvas, InnerWidth - (40 + xSizeBig), i* 24,680 ImpImage(OffScreen.Canvas, InnerWidth - (40 + xSizeBig), I * 24, 681 681 HelpLineInfo.Picpix, gDespotism) 682 682 else 683 WaterSign(InnerWidth - (40 + 2 * xSizeBig), i* 24 - 8,683 WaterSign(InnerWidth - (40 + 2 * xSizeBig), I * 24 - 8, 684 684 HelpLineInfo.Picpix + 7); 685 x0[ i] := x0[i] + 8;685 x0[I] := x0[I] + 8; 686 686 end; 687 687 pkIllu: 688 WaterSign(8, i* 24 - 8, HelpLineInfo.Picpix);688 WaterSign(8, I * 24 - 8, HelpLineInfo.Picpix); 689 689 pkBigFeature: 690 690 begin 691 691 cnt := 0; 692 for j:= nDomains - 1 downto 0 do693 if 1 shl jand Feature[HelpLineInfo.Picpix].Domains <> 0 then692 for J := nDomains - 1 downto 0 do 693 if 1 shl J and Feature[HelpLineInfo.Picpix].Domains <> 0 then 694 694 begin 695 inc(cnt);695 Inc(cnt); 696 696 Dump(OffScreen, HGrSystem, InnerWidth - 38 - 38 * cnt, 697 i * 24 + 1, 36, 20, 75 + j* 37, 295);698 ScreenTools.Frame(OffScreen.Canvas, InnerWidth - 39 - 38 * cnt, i* 24,699 InnerWidth - 2 - 38 * cnt, i* 24 + 21, $000000, $000000);697 I * 24 + 1, 36, 20, 75 + J * 37, 295); 698 ScreenTools.Frame(OffScreen.Canvas, InnerWidth - 39 - 38 * cnt, I * 24, 699 InnerWidth - 2 - 38 * cnt, I * 24 + 21, $000000, $000000); 700 700 end; 701 701 DarkGradient(OffScreen.Canvas, InnerWidth - 38 - 38 * cnt, 702 i* 24 + 23, cnt * 38 - 2, 1);702 I * 24 + 23, cnt * 38 - 2, 1); 703 703 ofs := InnerWidth - (39 + 7) - 19 * cnt; 704 704 with OffScreen.Canvas do 705 705 begin 706 Brush. color := $C0C0C0;707 FrameRect(Rect(ofs, 1 + 23 + i* 24, ofs + 14,708 15 + 23 + i* 24));706 Brush.Color := $C0C0C0; 707 FrameRect(Rect(ofs, 1 + 23 + I * 24, ofs + 14, 708 15 + 23 + I * 24)); 709 709 Brush.Style := bsClear; 710 Sprite(OffScreen, HGrSystem, ofs + 2, 3 + 23 + i* 24, 10, 10,710 Sprite(OffScreen, HGrSystem, ofs + 2, 3 + 23 + I * 24, 10, 10, 711 711 66 + HelpLineInfo.Picpix mod 11 * 11, 712 712 137 + HelpLineInfo.Picpix div 11 * 11); 713 713 end; 714 x0[ i] := x0[i] + 8;714 x0[I] := x0[I] + 8; 715 715 end; 716 716 pkTer, pkBigTer: 717 717 with NoMap do begin 718 718 if HelpLineInfo.Format = pkBigTer then 719 y := i* 24 - 3 + yyt719 Y := I * 24 - 3 + yyt 720 720 else 721 y := i* 24 + 13;721 Y := I * 24 + 13; 722 722 if HelpLineInfo.Picpix >= 3 * 12 then 723 723 srcno := 2 * 9 + 6 … … 730 730 if HelpLineInfo.Format = pkTer then 731 731 begin 732 ofs := x0[ i] + 8;733 x0[ i] := 2 * xxt + 8 + ofs;732 ofs := x0[I] + 8; 733 x0[I] := 2 * xxt + 8 + ofs; 734 734 end 735 735 else 736 736 begin 737 737 ofs := InnerWidth - (2 * xxt + 38); 738 x0[ i] := x0[i] + 8;738 x0[I] := x0[I] + 8; 739 739 end; 740 740 if srcno >= fJungle then 741 741 begin 742 Sprite(OffScreen, HGrTerrain, ofs + 4, y- yyt + 2, xxt * 2 - 8,742 Sprite(OffScreen, HGrTerrain, ofs + 4, Y - yyt + 2, xxt * 2 - 8, 743 743 yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1), 744 744 3 + yyt + 2 * (yyt * 3 + 1)); 745 Sprite(OffScreen, HGrTerrain, ofs, y- 2 * yyt, xxt * 2,745 Sprite(OffScreen, HGrTerrain, ofs, Y - 2 * yyt, xxt * 2, 746 746 yyt * 3 - 2, 1 + srcno mod 9 * (xxt * 2 + 1), 747 747 1 + srcno div 9 * (yyt * 3 + 1)); 748 748 end 749 749 else 750 Sprite(OffScreen, HGrTerrain, ofs + 4, y- yyt + 2, xxt * 2 - 8,750 Sprite(OffScreen, HGrTerrain, ofs + 4, Y - yyt + 2, xxt * 2 - 8, 751 751 yyt * 2 - 4, 5 + srcno mod 9 * (xxt * 2 + 1), 752 752 3 + yyt + srcno div 9 * (yyt * 3 + 1)); 753 753 if HelpLineInfo.Picpix >= 3 * 12 then { rare resource } 754 Sprite(OffScreen, HGrTerrain, ofs, y- 2 * yyt, xxt * 2,754 Sprite(OffScreen, HGrTerrain, ofs, Y - 2 * yyt, xxt * 2, 755 755 yyt * 3, 1 + 8 * (xxt * 2 + 1), 756 756 1 + (HelpLineInfo.Picpix - 2 * 12) * (yyt * 3 + 1)) … … 764 764 srcno := 18 + 8 + (HelpLineInfo.Picpix mod 12 - 9) * 18; 765 765 srcno := srcno + HelpLineInfo.Picpix div 12 * 9; 766 Sprite(OffScreen, HGrTerrain, ofs, y- 2 * yyt, xxt * 2,766 Sprite(OffScreen, HGrTerrain, ofs, Y - 2 * yyt, xxt * 2, 767 767 yyt * 3, 1 + srcno mod 9 * (xxt * 2 + 1), 768 768 1 + srcno div 9 * (yyt * 3 + 1)); … … 774 774 if HelpLineInfo.Picpix = 5 then 775 775 begin // display mine on hills 776 Sprite(OffScreen, HGrTerrain, ofs + 4, i* 24 + 13 - yyt,776 Sprite(OffScreen, HGrTerrain, ofs + 4, I * 24 + 13 - yyt, 777 777 xxt * 2 - 8, yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1), 778 778 3 + yyt + 2 * (yyt * 3 + 1)); … … 781 781 else 782 782 srcno := fPrairie; // display on prairie 783 Sprite(OffScreen, HGrTerrain, ofs + 4, i* 24 + 13 - yyt,783 Sprite(OffScreen, HGrTerrain, ofs + 4, I * 24 + 13 - yyt, 784 784 xxt * 2 - 8, yyt * 2 - 4, 5 + srcno mod 9 * (xxt * 2 + 1), 785 785 3 + yyt + srcno div 9 * (yyt * 3 + 1)); 786 786 if HelpLineInfo.Picpix = 12 then { river } 787 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - yyt, xxt * 2,787 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - yyt, xxt * 2, 788 788 yyt * 2, 1 + 5 * (xxt * 2 + 1), 1 + yyt + 13 * (yyt * 3 + 1)) 789 789 else if HelpLineInfo.Picpix >= 3 then { improvement 2 } 790 790 begin 791 791 if HelpLineInfo.Picpix = 6 then 792 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,792 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 793 793 xxt * 2, yyt * 3, 1 + 7 * (xxt * 2 + 1), 794 794 1 + 12 * (yyt * 3 + 1)); 795 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,795 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 796 796 xxt * 2, yyt * 3, 1 + (HelpLineInfo.Picpix - 3) * 797 797 (xxt * 2 + 1), 1 + 12 * (yyt * 3 + 1)) … … 799 799 else { improvement 1 } 800 800 begin 801 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,801 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 802 802 xxt * 2, yyt * 3, 1 + 2 * (xxt * 2 + 1), 803 803 1 + (9 + HelpLineInfo.Picpix) * (yyt * 3 + 1)); 804 Sprite(OffScreen, HGrTerrain, ofs, i* 24 + 11 - 2 * yyt,804 Sprite(OffScreen, HGrTerrain, ofs, I * 24 + 11 - 2 * yyt, 805 805 xxt * 2, yyt * 3, 1 + 5 * (xxt * 2 + 1), 806 806 1 + (9 + HelpLineInfo.Picpix) * (yyt * 3 + 1)) 807 807 end; 808 x0[ i] := x0[i] + 8;808 x0[I] := x0[I] + 8; 809 809 end; 810 810 pkModel: 811 811 begin 812 FrameImage(OffScreen.Canvas, BigImp, x0[ i] + 12, i* 24 - 7,812 FrameImage(OffScreen.Canvas, BigImp, x0[I] + 12, I * 24 - 7, 813 813 56, 40, 0, 0); 814 Sprite(OffScreen, HGrStdUnits, x0[ i] + 8, i* 24 - 11, 64, 44,814 Sprite(OffScreen, HGrStdUnits, x0[I] + 8, I * 24 - 11, 64, 44, 815 815 1 + HelpLineInfo.Picpix mod 10 * 65, 816 816 1 + HelpLineInfo.Picpix div 10 * 49); 817 x0[ i] := 64 + 8 + 8 + x0[i];817 x0[I] := 64 + 8 + 8 + x0[I]; 818 818 end; 819 819 pkFeature: 820 820 begin 821 DarkGradient(OffScreen.Canvas, x0[ i] + 8 - 1,822 7 + i* 24 - 3, 16, 1);823 ScreenTools.Frame(OffScreen.Canvas, x0[ i] + 8, 7 + i * 24 - 2, x0[i] + 8 + 13,824 7 + i* 24 - 2 + 13, $C0C0C0, $C0C0C0);825 Sprite(OffScreen, HGrSystem, x0[ i] + 8 + 2, 7 + i* 24, 10, 10,821 DarkGradient(OffScreen.Canvas, x0[I] + 8 - 1, 822 7 + I * 24 - 3, 16, 1); 823 ScreenTools.Frame(OffScreen.Canvas, x0[I] + 8, 7 + I * 24 - 2, x0[I] + 8 + 13, 824 7 + I * 24 - 2 + 13, $C0C0C0, $C0C0C0); 825 Sprite(OffScreen, HGrSystem, x0[I] + 8 + 2, 7 + I * 24, 10, 10, 826 826 66 + HelpLineInfo.Picpix mod 11 * 11, 827 827 137 + HelpLineInfo.Picpix div 11 * 11); 828 x0[ i] := x0[i] + 8 + 8 + 2 + 13;828 x0[I] := x0[I] + 8 + 8 + 2 + 13; 829 829 end; 830 830 pkExp: 831 831 begin 832 ScreenTools.Frame(OffScreen.Canvas, 20 - 1, 8 - 4 + i* 24, 20 + 12,833 8 + 11 + i* 24, $000000, $000000);834 Dump(OffScreen, HGrSystem, 20, 8 - 3 + i* 24, 12, 14,832 ScreenTools.Frame(OffScreen.Canvas, 20 - 1, 8 - 4 + I * 24, 20 + 12, 833 8 + 11 + I * 24, $000000, $000000); 834 Dump(OffScreen, HGrSystem, 20, 8 - 3 + I * 24, 12, 14, 835 835 121 + HelpLineInfo.Picpix * 13, 28); 836 x0[ i] := 20 + 8 + 11;836 x0[I] := 20 + 8 + 11; 837 837 end; 838 838 pkAITStat: 839 839 begin 840 Sprite(OffScreen, HGrSystem, 20, 6 + i* 24, 14, 14,840 Sprite(OffScreen, HGrSystem, 20, 6 + I * 24, 14, 14, 841 841 1 + HelpLineInfo.Picpix * 15, 316); 842 x0[ i] := 20 + 8 + 11;842 x0[I] := 20 + 8 + 11; 843 843 end; 844 844 pkGov: 845 845 begin 846 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[ i], 2 - 1 + i* 24,847 8 + xSizeSmall + x0[ i], 2 + 20 + i* 24, $000000, $000000);848 BitBltCanvas(OffScreen.Canvas, 8 + x0[ i], 2 + i* 24, xSizeSmall,846 ScreenTools.Frame(OffScreen.Canvas, 8 - 1 + x0[I], 2 - 1 + I * 24, 847 8 + xSizeSmall + x0[I], 2 + 20 + I * 24, $000000, $000000); 848 BitBltCanvas(OffScreen.Canvas, 8 + x0[I], 2 + I * 24, xSizeSmall, 849 849 ySizeSmall, SmallImp.Canvas, (HelpLineInfo.Picpix - 1) * 850 850 xSizeSmall, ySizeSmall); 851 x0[ i] := x0[i] + (8 + 8 + 36);851 x0[I] := x0[I] + (8 + 8 + 36); 852 852 end; 853 853 pkDot: 854 854 begin 855 Sprite(OffScreen, HGrSystem, x0[ i] + 18, 9 + i* 24, 8,855 Sprite(OffScreen, HGrSystem, x0[I] + 18, 9 + I * 24, 8, 856 856 8, 81, 16); 857 x0[ i] := 20 + 8 + 4;857 x0[I] := 20 + 8 + 4; 858 858 end; 859 859 pkNormal_Dot: 860 x0[ i] := 20 + 8 + 4;860 x0[I] := 20 + 8 + 4; 861 861 pkNormal_64: 862 x0[ i] := 64 + 8 + 8;862 x0[I] := 64 + 8 + 8; 863 863 else 864 x0[ i] := x0[i] + 8;864 x0[I] := x0[I] + 8; 865 865 end; 866 Self.Line(OffScreen.Canvas, i, False)866 Self.Line(OffScreen.Canvas, I, False) 867 867 end; 868 868 end; … … 873 873 begin 874 874 Sel := -1; 875 SmartUpdateContent( true)876 end; 877 878 procedure THelpDlg.Prepare(sbPos: integer = 0);875 SmartUpdateContent(True) 876 end; 877 878 procedure THelpDlg.Prepare(sbPos: Integer = 0); 879 879 var 880 i, j, Special, Domain, Headline, TerrType, TerrSubType: integer;881 s: string;882 ps: pchar;880 I, J, Special, Domain, Headline, TerrType, TerrSubType: Integer; 881 S: string; 882 ps: PChar; 883 883 List: THyperText; 884 884 CheckSeeAlso: Boolean; 885 885 886 procedure AddAdvance( i: integer);887 begin 888 MainText.AddLine(Phrases.Lookup('ADVANCES', i), pkAdvIcon, i,889 hkAdv + hkCrossLink, i);890 end; 891 892 procedure AddPreqAdv( i: integer);893 begin 894 MainText.AddLine(Phrases.Lookup('ADVANCES', i), pkAdvIcon_AsPreq, i,895 hkAdv + hkCrossLink, i);896 end; 897 898 procedure AddImprovement( i: integer);899 begin 900 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,901 hkImp + hkCrossLink, i);902 end; 903 904 procedure AddPreqImp( i: integer);905 begin 906 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon_AsPreq, i,907 hkImp + hkCrossLink, i);908 end; 909 910 procedure AddTerrain( i: integer);886 procedure AddAdvance(I: Integer); 887 begin 888 MainText.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon, I, 889 hkAdv + hkCrossLink, I); 890 end; 891 892 procedure AddPreqAdv(I: Integer); 893 begin 894 MainText.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon_AsPreq, I, 895 hkAdv + hkCrossLink, I); 896 end; 897 898 procedure AddImprovement(I: Integer); 899 begin 900 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 901 hkImp + hkCrossLink, I); 902 end; 903 904 procedure AddPreqImp(I: Integer); 905 begin 906 MainText.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon_AsPreq, I, 907 hkImp + hkCrossLink, I); 908 end; 909 910 procedure AddTerrain(I: Integer); 911 911 begin 912 912 if MainText.Count > 1 then … … 914 914 MainText.LineFeed; 915 915 end; 916 MainText.AddLine(Phrases.Lookup('TERRAIN', i), pkTer, i, hkTer, i);917 end; 918 919 procedure AddFeature( i: integer);920 begin 921 MainText.AddLine(Phrases.Lookup('FEATURES', i), pkFeature, i,922 hkFeature + hkCrossLink, i);923 end; 924 925 procedure AddModel( i: integer);916 MainText.AddLine(Phrases.Lookup('TERRAIN', I), pkTer, I, hkTer, I); 917 end; 918 919 procedure AddFeature(I: Integer); 920 begin 921 MainText.AddLine(Phrases.Lookup('FEATURES', I), pkFeature, I, 922 hkFeature + hkCrossLink, I); 923 end; 924 925 procedure AddModel(I: Integer); 926 926 var 927 pix: integer;927 pix: Integer; 928 928 Name: string; 929 929 begin 930 930 if MainText.Count > 1 then 931 931 MainText.LineFeed; 932 FindStdModelPicture(SpecialModelPictureCode[ i], pix, Name);933 MainText.AddLine(Name, pkModel, pix, hkModel + hkCrossLink, i)932 FindStdModelPicture(SpecialModelPictureCode[I], pix, Name); 933 MainText.AddLine(Name, pkModel, pix, hkModel + hkCrossLink, I) 934 934 end; 935 935 936 936 procedure AddStandardBlock(Item: string); 937 937 var 938 i: integer;938 I: Integer; 939 939 begin 940 940 with MainText do … … 947 947 else if Item = 'TECHFORMULA' then 948 948 begin 949 i:= Difficulty;950 if i= 0 then951 i:= 2;952 AddLine(Format(HelpText.Lookup('TECHFORMULA'), [TechFormula_M[ i],953 TechFormula_D[ i]]))949 I := Difficulty; 950 if I = 0 then 951 I := 2; 952 AddLine(Format(HelpText.Lookup('TECHFORMULA'), [TechFormula_M[I], 953 TechFormula_D[I]])) 954 954 end 955 955 else if Item = 'EXPERIENCE' then 956 for i:= 0 to nExp - 1 do957 AddLine(Phrases.Lookup('EXPERIENCE', i), pkExp, i)956 for I := 0 to nExp - 1 do 957 AddLine(Phrases.Lookup('EXPERIENCE', I), pkExp, I) 958 958 else if Item = 'MODERN' then 959 for i:= 1 to 3 do959 for I := 1 to 3 do 960 960 begin 961 961 LineFeed; 962 AddLine(Phrases.Lookup('TERRAIN', 3 * 12 + i), pkTer, 3 * 12 + i);962 AddLine(Phrases.Lookup('TERRAIN', 3 * 12 + I), pkTer, 3 * 12 + I); 963 963 end 964 964 else if Item = 'SAVED' then 965 965 AddLine(DataDir + 'Saved', pkNormal) 966 966 else if Item = 'AITSTAT' then 967 for i:= 0 to 3 do968 AddLine(Phrases2.Lookup('AITSTAT', i), pkAITStat, i)967 for I := 0 to 3 do 968 AddLine(Phrases2.Lookup('AITSTAT', I), pkAITStat, I) 969 969 end 970 970 end; 971 971 972 procedure DecodeItem( s: string; var Category, Index: Integer);972 procedure DecodeItem(S: string; var Category, Index: Integer); 973 973 var 974 i: Integer;975 begin 976 if (Length( s) > 0) and (s[1] = ':') then begin974 I: Integer; 975 begin 976 if (Length(S) > 0) and (S[1] = ':') then begin 977 977 Category := hkMisc; 978 978 Index := 0; 979 for i := 3 to length(s) do980 Index := Index * 10 + Ord( s[i]) - 48;981 case s[2] of979 for I := 3 to Length(S) do 980 Index := Index * 10 + Ord(S[I]) - 48; 981 case S[2] of 982 982 'A': Category := hkAdv; 983 983 'B': Category := hkImp; … … 994 994 end else begin 995 995 Category := hkText; 996 Index := HelpText.Gethandle(Copy( s, 1, 255));996 Index := HelpText.Gethandle(Copy(S, 1, 255)); 997 997 end; 998 998 end; 999 999 1000 procedure AddTextual( s: string);1000 procedure AddTextual(S: string); 1001 1001 var 1002 i: Integer;1003 p: Integer;1004 l: Integer;1002 I: Integer; 1003 P: Integer; 1004 L: Integer; 1005 1005 ofs: Integer; 1006 1006 CurrentFormat: Integer; … … 1015 1015 RightMargin := InnerWidth - 16 - GetSystemMetrics(SM_CXVSCROLL); 1016 1016 FollowFormat := pkNormal; 1017 while s<> '' do1017 while S <> '' do 1018 1018 begin 1019 1019 Picpix := 0; 1020 1020 LinkCategory := 0; 1021 1021 LinkIndex := 0; 1022 if s[1] = '$' then1022 if S[1] = '$' then 1023 1023 begin // window caption 1024 p:= 1;1024 P := 1; 1025 1025 repeat 1026 inc(p)1027 until ( p > Length(s)) or (s[p] = '\');1028 Caption := Copy( s, 2, p- 2);1029 Delete( s, 1, p);1026 Inc(P); 1027 until (P > Length(S)) or (S[P] = '\'); 1028 Caption := Copy(S, 2, P - 2); 1029 Delete(S, 1, P); 1030 1030 end 1031 else if s[1] = '&' then1031 else if S[1] = '&' then 1032 1032 begin // standard block 1033 p:= 1;1033 P := 1; 1034 1034 repeat 1035 inc(p)1036 until ( p > Length(s)) or (s[p] = '\');1037 AddStandardBlock(Copy( s, 2, p- 2));1038 Delete( s, 1, p);1035 Inc(P); 1036 until (P > Length(S)) or (S[P] = '\'); 1037 AddStandardBlock(Copy(S, 2, P - 2)); 1038 Delete(S, 1, P); 1039 1039 end 1040 else if s[1] = '@' then1040 else if S[1] = '@' then 1041 1041 begin // image 1042 if (Length( s) >= 2) and (s[2] = '@') then1042 if (Length(S) >= 2) and (S[2] = '@') then 1043 1043 begin // generate from icon 1044 1044 Picpix := 0; 1045 p:= 3;1046 while ( p <= Length(s)) and (s[p] <> '\') do1045 P := 3; 1046 while (P <= Length(S)) and (S[P] <> '\') do 1047 1047 begin 1048 Picpix := Picpix * 10 + Ord( s[p]) - 48;1049 inc(p)1048 Picpix := Picpix * 10 + Ord(S[P]) - 48; 1049 Inc(P); 1050 1050 end; 1051 1051 if (Picpix < 0) or (Picpix >= nImp) then … … 1057 1057 else 1058 1058 begin // external image 1059 p:= 1;1059 P := 1; 1060 1060 repeat 1061 Inc( p)1062 until ( p > Length(s)) or (s[p] = '\');1061 Inc(P); 1062 until (P > Length(S)) or (S[P] = '\'); 1063 1063 if LoadGraphicFile(ExtPic, LocalizedFilePath('Help' + 1064 DirectorySeparator + Copy( s, 2, p- 2)) + '.png') then1064 DirectorySeparator + Copy(S, 2, P - 2)) + '.png') then 1065 1065 begin 1066 1066 MainText.AddLine('', pkExternal); 1067 for i:= 0 to (ExtPic.Height - 12) div 24 do1067 for I := 0 to (ExtPic.Height - 12) div 24 do 1068 1068 MainText.LineFeed; 1069 1069 end; 1070 1070 end; 1071 Delete( s, 1, p);1071 Delete(S, 1, P); 1072 1072 end 1073 1073 else 1074 1074 begin 1075 case s[1] of1075 case S[1] of 1076 1076 ':', ';': 1077 1077 begin // link 1078 p:= 1;1078 P := 1; 1079 1079 repeat 1080 inc(p)1081 until ( p > Length(s)) or (s[p] = '\') or (s[p] = ' ');1082 DecodeItem(Copy( s, 2, p- 2), LinkCategory, LinkIndex);1080 Inc(P) 1081 until (P > Length(S)) or (S[P] = '\') or (S[P] = ' '); 1082 DecodeItem(Copy(S, 2, P - 2), LinkCategory, LinkIndex); 1083 1083 CurrentFormat := 0; 1084 1084 if (LinkCategory <> hkText) and (LinkIndex < 200) then … … 1112 1112 end; 1113 1113 end; 1114 if s[1] = ':' then1114 if S[1] = ':' then 1115 1115 LinkCategory := LinkCategory + hkCrossLink; 1116 if ( p > Length(s)) or (s[p] = ' ') then1117 Delete( s, 1, p)1116 if (P > Length(S)) or (S[P] = ' ') then 1117 Delete(S, 1, P) 1118 1118 else 1119 Delete( s, 1, p- 1)1119 Delete(S, 1, P - 1) 1120 1120 end; 1121 1121 '!': // highlited 1122 if (Length( s) >= 2) and (s[2] = '!') then1122 if (Length(S) >= 2) and (S[2] = '!') then 1123 1123 begin 1124 1124 if MainText.Count > 1 then … … 1126 1126 FollowFormat := pkCaption; 1127 1127 CurrentFormat := pkCaption; 1128 Delete( s, 1, 2);1128 Delete(S, 1, 2); 1129 1129 end 1130 1130 else … … 1132 1132 FollowFormat := pkSection; 1133 1133 CurrentFormat := pkSection; 1134 Delete( s, 1, 1);1134 Delete(S, 1, 1); 1135 1135 end; 1136 1136 '-': … … 1138 1138 FollowFormat := pkNormal_Dot; 1139 1139 CurrentFormat := pkDot; 1140 Delete( s, 1, 1);1140 Delete(S, 1, 1); 1141 1141 end; 1142 1142 else … … 1147 1147 else 1148 1148 ofs := 8; 1149 p:= 0;1149 P := 0; 1150 1150 repeat 1151 1151 repeat 1152 Inc( p)1153 until ( p > Length(s)) or (s[p] = ' ') or (s[p] = '\');1154 if (BiColorTextWidth(OffScreen.Canvas, Copy( s, 1, p- 1)) <=1152 Inc(P) 1153 until (P > Length(S)) or (S[P] = ' ') or (S[P] = '\'); 1154 if (BiColorTextWidth(OffScreen.Canvas, Copy(S, 1, P - 1)) <= 1155 1155 RightMargin - ofs) then 1156 l := p- 11156 L := P - 1 1157 1157 else 1158 1158 Break; 1159 until ( p >= Length(s)) or (s[l+ 1] = '\');1160 Text := Copy( s, 1, l);1161 if LinkCategory and $3 f= hkInternet then begin1159 until (P >= Length(S)) or (S[L + 1] = '\'); 1160 Text := Copy(S, 1, L); 1161 if LinkCategory and $3F = hkInternet then begin 1162 1162 if LinkIndex = 1 then Text := AITemplateManual 1163 1163 else if LinkIndex = 2 then Text := CevoHomepageShort … … 1166 1166 MainText.AddLine(Text, CurrentFormat, Picpix, LinkCategory, 1167 1167 LinkIndex); 1168 if ( l < Length(s)) and (s[l+ 1] = '\') then1168 if (L < Length(S)) and (S[L + 1] = '\') then 1169 1169 FollowFormat := pkNormal; 1170 Delete( s, 1, l+ 1);1170 Delete(S, 1, L + 1); 1171 1171 end 1172 1172 end … … 1178 1178 end; 1179 1179 1180 procedure AddModelText( i: Integer);1180 procedure AddModelText(I: Integer); 1181 1181 var 1182 1182 pix: Integer; 1183 s: string;1183 S: string; 1184 1184 begin 1185 1185 with MainText do begin … … 1188 1188 LineFeed; 1189 1189 end; 1190 FindStdModelPicture(SpecialModelPictureCode[ i], pix, s);1191 AddLine( s, pkSection);1192 AddLine(Format(HelpText.Lookup('STRENGTH'), [SpecialModel[ i].Attack,1193 SpecialModel[ i].Defense]), pkNormal_64);1190 FindStdModelPicture(SpecialModelPictureCode[I], pix, S); 1191 AddLine(S, pkSection); 1192 AddLine(Format(HelpText.Lookup('STRENGTH'), [SpecialModel[I].Attack, 1193 SpecialModel[I].Defense]), pkNormal_64); 1194 1194 AddLine(Format(HelpText.Lookup('SPEED'), 1195 [MovementToString(SpecialModel[ i].Speed)]), pkModel, pix);1195 [MovementToString(SpecialModel[I].Speed)]), pkModel, pix); 1196 1196 if Difficulty = 0 then 1197 AddLine(Format(HelpText.Lookup('BUILDCOST'), [SpecialModel[ i].Cost]),1197 AddLine(Format(HelpText.Lookup('BUILDCOST'), [SpecialModel[I].Cost]), 1198 1198 pkNormal_64) 1199 1199 else 1200 1200 AddLine(Format(HelpText.Lookup('BUILDCOST'), 1201 [SpecialModel[ i].Cost * BuildCostMod[Difficulty] div 12]),1201 [SpecialModel[I].Cost * BuildCostMod[Difficulty] div 12]), 1202 1202 pkNormal_64); 1203 s := HelpText.LookupByHandle(hSPECIALMODEL, i);1204 if ( s <> '') and (s<> '*') then1205 AddTextual( s);1206 if SpecialModelPreq[ i] >= 0 then1207 AddPreqAdv(SpecialModelPreq[ i])1208 else if SpecialModelPreq[ i] = preLighthouse then1203 S := HelpText.LookupByHandle(hSPECIALMODEL, I); 1204 if (S <> '') and (S <> '*') then 1205 AddTextual(S); 1206 if SpecialModelPreq[I] >= 0 then 1207 AddPreqAdv(SpecialModelPreq[I]) 1208 else if SpecialModelPreq[I] = preLighthouse then 1209 1209 AddPreqImp(woLighthouse) 1210 else if SpecialModelPreq[ i] = preBuilder then1210 else if SpecialModelPreq[I] = preBuilder then 1211 1211 AddPreqImp(woPyramids) 1212 else if SpecialModelPreq[ i] = preLeo then1212 else if SpecialModelPreq[I] = preLeo then 1213 1213 AddPreqImp(woLeo); 1214 if SpecialModelPreq[ i] <> preNone then1214 if SpecialModelPreq[I] <> preNone then 1215 1215 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1216 1216 [MainText[Count - 1]]); … … 1220 1220 procedure AddJobList; 1221 1221 var 1222 i, JobCost: Integer;1222 I, JobCost: Integer; 1223 1223 begin 1224 1224 with MainText do begin 1225 for i:= 0 to nJobHelp - 1 do begin1226 if i> 0 then begin1225 for I := 0 to nJobHelp - 1 do begin 1226 if I > 0 then begin 1227 1227 LineFeed; 1228 1228 LineFeed; 1229 1229 end; 1230 AddLine(Phrases.Lookup('JOBRESULT', JobHelp[ i]), pkSection);1230 AddLine(Phrases.Lookup('JOBRESULT', JobHelp[I]), pkSection); 1231 1231 AddLine; 1232 AddLine('', pkTerImp, i);1232 AddLine('', pkTerImp, I); 1233 1233 AddLine; 1234 AddTextual(HelpText.LookupByHandle(hJOBHELP, i));1234 AddTextual(HelpText.LookupByHandle(hJOBHELP, I)); 1235 1235 JobCost := -1; 1236 case JobHelp[ i] of1236 case JobHelp[I] of 1237 1237 jCanal: JobCost := CanalWork; 1238 1238 jFort: JobCost := FortWork; … … 1244 1244 else 1245 1245 AddTextual(HelpText.Lookup('JOBCOSTVAR')); 1246 if JobPreq[JobHelp[ i]] <> preNone then begin1247 AddPreqAdv(JobPreq[JobHelp[ i]]);1246 if JobPreq[JobHelp[I]] <> preNone then begin 1247 AddPreqAdv(JobPreq[JobHelp[I]]); 1248 1248 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1249 1249 [MainText[Count - 1]]); … … 1255 1255 procedure AddGraphicCredits; 1256 1256 var 1257 i: Integer;1258 s: string;1257 I: Integer; 1258 S: string; 1259 1259 sr: TSearchRec; 1260 1260 List, Plus: TStringList; … … 1271 1271 1272 1272 List.Sort; 1273 i:= 1;1274 while i< List.Count do1275 if List[ i] = List[i- 1] then1276 List.Delete( i)1273 I := 1; 1274 while I < List.Count do 1275 if List[I] = List[I - 1] then 1276 List.Delete(I) 1277 1277 else 1278 Inc( i);1279 1280 for i:= 0 to List.Count - 1 do begin1281 s := List[i];1282 while BiColorTextWidth(OffScreen.Canvas, s) > InnerWidth - 16 -1278 Inc(I); 1279 1280 for I := 0 to List.Count - 1 do begin 1281 S := List[I]; 1282 while BiColorTextWidth(OffScreen.Canvas, S) > InnerWidth - 16 - 1283 1283 GetSystemMetrics(SM_CXVSCROLL) do 1284 Delete( s, length(s), 1);1285 MainText.AddLine( s);1284 Delete(S, Length(S), 1); 1285 MainText.AddLine(S); 1286 1286 end; 1287 1287 FreeAndNil(List); … … 1290 1290 procedure AddSoundCredits; 1291 1291 var 1292 i: Integer;1293 s: string;1292 I: Integer; 1293 S: string; 1294 1294 List: TStringList; 1295 1295 begin 1296 1296 List := TStringList.Create; 1297 1297 List.LoadFromFile(GetSoundsDir + DirectorySeparator + 'sound.credits.txt'); 1298 for i:= 0 to List.Count - 1 do begin1299 s := List[i];1300 while BiColorTextWidth(OffScreen.Canvas, s) > InnerWidth - 16 -1298 for I := 0 to List.Count - 1 do begin 1299 S := List[I]; 1300 while BiColorTextWidth(OffScreen.Canvas, S) > InnerWidth - 16 - 1301 1301 GetSystemMetrics(SM_CXVSCROLL) do 1302 Delete( s, length(s), 1);1303 MainText.AddLine( s);1302 Delete(S, Length(S), 1); 1303 MainText.AddLine(S); 1304 1304 end; 1305 1305 FreeAndNil(List); … … 1349 1349 hkAdv, 200); 1350 1350 LineFeed; 1351 FindStdModelPicture(SpecialModelPictureCode[6], i, s);1352 AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkModel, i,1351 FindStdModelPicture(SpecialModelPictureCode[6], I, S); 1352 AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkModel, I, 1353 1353 hkModel, 0); 1354 1354 LineFeed; … … 1402 1402 begin 1403 1403 Caption := HelpText.Lookup('HELPTITLE_GOVLIST'); 1404 for i:= 1 to nGov do1404 for I := 1 to nGov do 1405 1405 begin 1406 AddLine(Phrases.Lookup('GOVERNMENT', imod nGov), pkSection);1406 AddLine(Phrases.Lookup('GOVERNMENT', I mod nGov), pkSection); 1407 1407 LineFeed; 1408 if i= nGov then1408 if I = nGov then 1409 1409 AddLine('', pkBigIcon, 7 * SystemIconLines + imPalace) 1410 1410 else 1411 AddLine('', pkBigIcon, i+ 6);1411 AddLine('', pkBigIcon, I + 6); 1412 1412 LineFeed; 1413 AddTextual(HelpText.LookupByHandle(hGOVHELP, imod nGov));1414 if imod nGov >= 2 then1413 AddTextual(HelpText.LookupByHandle(hGOVHELP, I mod nGov)); 1414 if I mod nGov >= 2 then 1415 1415 begin 1416 AddPreqAdv(GovPreq[ imod nGov]);1416 AddPreqAdv(GovPreq[I mod nGov]); 1417 1417 MainText[Count - 1] := Format(HelpText.Lookup('REQUIRED'), 1418 1418 [MainText[Count - 1]]); 1419 1419 end; 1420 if i< nGov then1420 if I < nGov then 1421 1421 begin 1422 1422 LineFeed; … … 1440 1440 List := THyperText.Create; 1441 1441 List.OwnsObjects := True; 1442 for j:= 0 to 3 do1442 for J := 0 to 3 do 1443 1443 begin 1444 if j> 0 then1444 if J > 0 then 1445 1445 begin 1446 1446 LineFeed; 1447 1447 LineFeed; 1448 1448 end; 1449 AddLine(HelpText.Lookup('TECHAGE', j), pkSection);1450 if j= 1 then1449 AddLine(HelpText.Lookup('TECHAGE', J), pkSection); 1450 if J = 1 then 1451 1451 AddLine(Phrases.Lookup('ADVANCES', adScience) + ' ' + 1452 1452 HelpText.Lookup('BASETECH'), pkAdvIcon, adScience, hkAdv, 1453 1453 adScience); 1454 if j= 2 then1454 if J = 2 then 1455 1455 AddLine(Phrases.Lookup('ADVANCES', adMassProduction) + ' ' + 1456 1456 HelpText.Lookup('BASETECH'), pkAdvIcon, adMassProduction, hkAdv, 1457 1457 adMassProduction); 1458 1458 List.Clear; 1459 for i:= 0 to nAdv - 1 do1460 if ( i <> adScience) and (i<> adMassProduction) and1461 (AdvValue[ i] div 1000 = j) then1462 List.AddLine(Phrases.Lookup('ADVANCES', i), pkAdvIcon, i,1463 hkAdv, i);1459 for I := 0 to nAdv - 1 do 1460 if (I <> adScience) and (I <> adMassProduction) and 1461 (AdvValue[I] div 1000 = J) then 1462 List.AddLine(Phrases.Lookup('ADVANCES', I), pkAdvIcon, I, 1463 hkAdv, I); 1464 1464 List.Sort; 1465 1465 AppendList(List); … … 1487 1487 else 1488 1488 NextSection('PREREQ'); 1489 for i:= 0 to 2 do1490 if AdvPreq[no, i] <> preNone then1491 AddPreqAdv(AdvPreq[no, i]);1489 for I := 0 to 2 do 1490 if AdvPreq[no, I] <> preNone then 1491 AddPreqAdv(AdvPreq[no, I]); 1492 1492 NextSection('GOVALLOW'); 1493 for i:= 2 to nGov - 1 do1494 if GovPreq[ i] = no then1495 AddLine(Phrases.Lookup('GOVERNMENT', i), pkGov, i,1493 for I := 2 to nGov - 1 do 1494 if GovPreq[I] = no then 1495 AddLine(Phrases.Lookup('GOVERNMENT', I), pkGov, I, 1496 1496 hkMisc + hkCrossLink, miscGovList); 1497 1497 NextSection('BUILDALLOW'); 1498 for i:= 0 to nWonder - 1 do1499 if Imp[ i].Preq = no then1500 AddImprovement( i);1501 for i:= nWonder to nImp - 1 do1502 if (Imp[ i].Preq = no) and (Imp[i].Kind <> ikCommon) then1503 AddImprovement( i);1504 for i:= nWonder to nImp - 1 do1505 if (Imp[ i].Preq = no) and (Imp[i].Kind = ikCommon) then1506 AddImprovement( i);1498 for I := 0 to nWonder - 1 do 1499 if Imp[I].Preq = no then 1500 AddImprovement(I); 1501 for I := nWonder to nImp - 1 do 1502 if (Imp[I].Preq = no) and (Imp[I].Kind <> ikCommon) then 1503 AddImprovement(I); 1504 for I := nWonder to nImp - 1 do 1505 if (Imp[I].Preq = no) and (Imp[I].Kind = ikCommon) then 1506 AddImprovement(I); 1507 1507 NextSection('MODELALLOW'); 1508 for i:= 0 to nSpecialModel - 1 do1509 if SpecialModelPreq[ i] = no then1510 AddModel( i);1508 for I := 0 to nSpecialModel - 1 do 1509 if SpecialModelPreq[I] = no then 1510 AddModel(I); 1511 1511 NextSection('FEATALLOW'); 1512 for i:= 0 to nFeature - 1 do1513 if Feature[ i].Preq = no then1514 AddFeature( i);1512 for I := 0 to nFeature - 1 do 1513 if Feature[I].Preq = no then 1514 AddFeature(I); 1515 1515 NextSection('FOLLOWADV'); 1516 for i:= 0 to nAdv - 1 do1517 if (AdvPreq[ i, 0] = no) or (AdvPreq[i, 1] = no) or1518 (AdvPreq[ i, 2] = no) then1519 AddAdvance( i);1516 for I := 0 to nAdv - 1 do 1517 if (AdvPreq[I, 0] = no) or (AdvPreq[I, 1] = no) or 1518 (AdvPreq[I, 2] = no) then 1519 AddAdvance(I); 1520 1520 NextSection('UPGRADEALLOW'); 1521 1521 for Domain := 0 to nDomains - 1 do 1522 for i:= 1 to nUpgrade - 1 do1523 if upgrade[Domain, i].Preq = no then1522 for I := 1 to nUpgrade - 1 do 1523 if upgrade[Domain, I].Preq = no then 1524 1524 begin 1525 if upgrade[Domain, i].Strength > 0 then1525 if upgrade[Domain, I].Strength > 0 then 1526 1526 AddLine(Format(HelpText.Lookup('STRENGTHUP'), 1527 1527 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, 1528 i].Strength]), pkDomain, Domain);1529 if upgrade[Domain, i].Trans > 0 then1528 I].Strength]), pkDomain, Domain); 1529 if upgrade[Domain, I].Trans > 0 then 1530 1530 AddLine(Format(HelpText.Lookup('TRANSUP'), 1531 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, i].Trans]1531 [Phrases.Lookup('DOMAIN', Domain), upgrade[Domain, I].Trans] 1532 1532 ), pkDomain, Domain); 1533 1533 if no in FutureTech then 1534 1534 AddLine(Format(HelpText.Lookup('COSTUP'), 1535 [upgrade[Domain, i].Cost]), pkNormal_Dot)1535 [upgrade[Domain, I].Cost]), pkNormal_Dot) 1536 1536 else 1537 1537 AddLine(Format(HelpText.Lookup('COSTMIN'), 1538 [upgrade[Domain, i].Cost]), pkNormal_Dot)1538 [upgrade[Domain, I].Cost]), pkNormal_Dot) 1539 1539 end; 1540 1540 NextSection('EXPIRATION'); 1541 for i:= 0 to nWonder - 1 do1542 if (Imp[ i].Preq <> preNA) and (Imp[i].Expiration = no) then1543 AddImprovement( i);1541 for I := 0 to nWonder - 1 do 1542 if (Imp[I].Preq <> preNA) and (Imp[I].Expiration = no) then 1543 AddImprovement(I); 1544 1544 NextSection('ADVEFFECT'); 1545 s:= HelpText.LookupByHandle(hADVHELP, no);1546 if s<> '*' then1547 AddTextual( s);1545 S := HelpText.LookupByHandle(hADVHELP, no); 1546 if S <> '*' then 1547 AddTextual(S); 1548 1548 NextSection('SEEALSO'); 1549 CheckSeeAlso := true1549 CheckSeeAlso := True 1550 1550 end; 1551 1551 … … 1557 1557 List := THyperText.Create; 1558 1558 List.OwnsObjects := True; 1559 for i:= nWonder to nImp - 1 do1560 if ( i <> imTrGoods) and (Imp[i].Preq <> preNA) and1561 (Imp[ i].Kind = ikCommon) then1562 List.AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon,1563 i, hkImp, i);1559 for I := nWonder to nImp - 1 do 1560 if (I <> imTrGoods) and (Imp[I].Preq <> preNA) and 1561 (Imp[I].Kind = ikCommon) then 1562 List.AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, 1563 I, hkImp, I); 1564 1564 List.Sort; 1565 1565 AppendList(List); … … 1570 1570 Caption := HelpText.Lookup('HELPTITLE_UNIQUELIST'); 1571 1571 // AddLine(HelpText.Lookup('HELPTITLE_UNIQUELIST'),pkSection); 1572 for i:= nWonder to nImp - 1 do1573 if (Imp[ i].Preq <> preNA) and1574 ((Imp[ i].Kind = ikNatLocal) or (Imp[i].Kind = ikNatGlobal)) then1575 AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,1576 hkImp, i);1572 for I := nWonder to nImp - 1 do 1573 if (Imp[I].Preq <> preNA) and 1574 ((Imp[I].Kind = ikNatLocal) or (Imp[I].Kind = ikNatGlobal)) then 1575 AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 1576 hkImp, I); 1577 1577 { LineFeed; 1578 1578 LineFeed; 1579 1579 AddLine(HelpText.Lookup('HELPTITLE_SHIPPARTLIST'),pkSection); 1580 for i:= nWonder to nImp-1 do1581 if (Imp[ i].Preq<>preNA) and (Imp[i].Kind=ikShipPart) then1582 AddLine(Phrases.Lookup('IMPROVEMENTS', i),pkSmallIcon,i,hkImp,i); }1580 for I:= nWonder to nImp-1 do 1581 if (Imp[I].Preq<>preNA) and (Imp[I].Kind=ikShipPart) then 1582 AddLine(Phrases.Lookup('IMPROVEMENTS',I),pkSmallIcon,I,hkImp,I); } 1583 1583 end 1584 1584 else if no = 202 then … … 1586 1586 Caption := HelpText.Lookup('HELPTITLE_WONDERLIST'); 1587 1587 // AddLine(HelpText.Lookup('HELPTITLE_WONDERLIST'),pkSection); 1588 for i:= 0 to nWonder - 1 do1589 if Imp[ i].Preq <> preNA then1590 AddLine(Phrases.Lookup('IMPROVEMENTS', i), pkSmallIcon, i,1591 hkImp, i);1588 for I := 0 to nWonder - 1 do 1589 if Imp[I].Preq <> preNA then 1590 AddLine(Phrases.Lookup('IMPROVEMENTS', I), pkSmallIcon, I, 1591 hkImp, I); 1592 1592 end 1593 1593 else … … 1627 1627 NextSection('COSTS'); 1628 1628 if Difficulty = 0 then 1629 s:= Format(HelpText.Lookup('BUILDCOST'), [Imp[no].Cost])1629 S := Format(HelpText.Lookup('BUILDCOST'), [Imp[no].Cost]) 1630 1630 else 1631 s:= Format(HelpText.Lookup('BUILDCOST'),1631 S := Format(HelpText.Lookup('BUILDCOST'), 1632 1632 [Imp[no].Cost * BuildCostMod[Difficulty] div 12]); 1633 AddLine( s);1633 AddLine(S); 1634 1634 if Imp[no].Maint > 0 then 1635 1635 AddLine(Format(HelpText.Lookup('MAINTCOST'), [Imp[no].Maint])); 1636 j:= 0;1637 for i:= 0 to nImpReplacement - 1 do1638 if ImpReplacement[ i].NewImp = no then1639 begin 1640 if j= 0 then1636 J := 0; 1637 for I := 0 to nImpReplacement - 1 do 1638 if ImpReplacement[I].NewImp = no then 1639 begin 1640 if J = 0 then 1641 1641 begin 1642 1642 NextSection('REPLACE'); 1643 1643 AddItem('REPLACETEXT'); 1644 j:= 1;1644 J := 1; 1645 1645 end; 1646 AddImprovement(ImpReplacement[ i].OldImp);1646 AddImprovement(ImpReplacement[I].OldImp); 1647 1647 end; 1648 1648 if Imp[no].Kind = ikShipPart then … … 1650 1650 LineFeed; 1651 1651 if no = imShipComp then 1652 i:= 11652 I := 1 1653 1653 else if no = imShipPow then 1654 i:= 21654 I := 2 1655 1655 else { if no=imShipHab then } 1656 i:= 3;1656 I := 3; 1657 1657 AddLine(Format(HelpText.Lookup('RAREREQUIRED'), 1658 [Phrases.Lookup('TERRAIN', 3 * 12 + i)]), pkTer, 3 * 12 + i);1658 [Phrases.Lookup('TERRAIN', 3 * 12 + I)]), pkTer, 3 * 12 + I); 1659 1659 end; 1660 1660 if (no < nWonder) and (Imp[no].Expiration >= 0) then 1661 1661 begin 1662 1662 NextSection('EXPIRATION'); 1663 s:= Format(HelpText.Lookup('EXPWITH'),1663 S := Format(HelpText.Lookup('EXPWITH'), 1664 1664 [Phrases.Lookup('ADVANCES', Imp[no].Expiration)]); 1665 1665 if no = woPyramids then 1666 s := s+ ' ' + HelpText.Lookup('EXPSLAVE');1667 AddTextual( s);1666 S := S + ' ' + HelpText.Lookup('EXPSLAVE'); 1667 AddTextual(S); 1668 1668 end; 1669 1669 NextSection('SEEALSO'); 1670 1670 if (no < nWonder) and (Imp[no].Expiration >= 0) then 1671 1671 AddImprovement(woEiffel); 1672 for i:= 0 to nImpReplacement - 1 do1673 if ImpReplacement[ i].OldImp = no then1674 AddImprovement(ImpReplacement[ i].NewImp);1672 for I := 0 to nImpReplacement - 1 do 1673 if ImpReplacement[I].OldImp = no then 1674 AddImprovement(ImpReplacement[I].NewImp); 1675 1675 if no = imSupermarket then 1676 1676 AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 1677 1677 hkMisc + hkCrossLink, miscJobList); 1678 CheckSeeAlso := true;1678 CheckSeeAlso := True; 1679 1679 end; 1680 1680 … … 1684 1684 Caption := HelpText.Lookup('HELPTITLE_TERLIST'); 1685 1685 // AddLine(HelpText.Lookup('HELPTITLE_TERLIST'),pkSection); 1686 for i:= 0 to nTerrainHelp - 1 do1687 AddTerrain(TerrainHelp[ i]);1686 for I := 0 to nTerrainHelp - 1 do 1687 AddTerrain(TerrainHelp[I]); 1688 1688 end 1689 1689 else … … 1746 1746 begin 1747 1747 LineFeed; 1748 i:= TransTerrain;1749 if (TerrType <> fGrass) and ( i<> fGrass) then1750 i := i+ TerrSubType * 12;1748 I := TransTerrain; 1749 if (TerrType <> fGrass) and (I <> fGrass) then 1750 I := I + TerrSubType * 12; 1751 1751 // trafo to same Special resource group 1752 1752 AddLine(Format(HelpText.Lookup('TRAFO'), 1753 [Phrases.Lookup('TERRAIN', i)]), pkTer, i,1754 hkTer + hkCrossLink, i);1753 [Phrases.Lookup('TERRAIN', I)]), pkTer, I, 1754 hkTer + hkCrossLink, I); 1755 1755 if no = fSwamp + 12 then 1756 1756 begin … … 1760 1760 TransTerrain + 24, hkTer + hkCrossLink, TransTerrain + 24); 1761 1761 end 1762 else if i= fGrass then1762 else if I = fGrass then 1763 1763 begin 1764 1764 LineFeed; … … 1790 1790 AddLine(Phrases.Lookup('TERRAIN', no + Special * 12), pkTer, 1791 1791 no + Special * 12); 1792 i:= FoodRes[Special] - FoodRes[0];1793 if i<> 0 then1792 I := FoodRes[Special] - FoodRes[0]; 1793 if I <> 0 then 1794 1794 MainText[Count - 1] := MainText[Count - 1] + 1795 Format(HelpText.Lookup('SPECIALFOOD'), [ i]);1796 i:= ProdRes[Special] - ProdRes[0];1797 if i<> 0 then1795 Format(HelpText.Lookup('SPECIALFOOD'), [I]); 1796 I := ProdRes[Special] - ProdRes[0]; 1797 if I <> 0 then 1798 1798 MainText[Count - 1] := MainText[Count - 1] + 1799 Format(HelpText.Lookup('SPECIALPROD'), [ i]);1800 i:= TradeRes[Special] - TradeRes[0];1801 if i<> 0 then1799 Format(HelpText.Lookup('SPECIALPROD'), [I]); 1800 I := TradeRes[Special] - TradeRes[0]; 1801 if I <> 0 then 1802 1802 MainText[Count - 1] := MainText[Count - 1] + 1803 Format(HelpText.Lookup('SPECIALTRADE'), [ i]);1803 Format(HelpText.Lookup('SPECIALTRADE'), [I]); 1804 1804 end; 1805 1805 end; … … 1813 1813 NextSection('SEEALSO'); 1814 1814 AddImprovement(woGardens); 1815 CheckSeeAlso := true1815 CheckSeeAlso := True 1816 1816 end; 1817 1817 end; … … 1837 1837 end; 1838 1838 List.Clear; 1839 for i:= 0 to nFeature - 1 do1840 if Feature[ i].Preq <> preNA then1839 for I := 0 to nFeature - 1 do 1840 if Feature[I].Preq <> preNA then 1841 1841 begin 1842 if i< mcFirstNonCap then1843 j:= 01844 else if iin AutoFeature then1845 j:= 21842 if I < mcFirstNonCap then 1843 J := 0 1844 else if I in AutoFeature then 1845 J := 2 1846 1846 else 1847 j:= 1;1848 if j= Special then1849 List.AddLine(Phrases.Lookup('FEATURES', i), pkFeature, i,1850 hkFeature, i);1847 J := 1; 1848 if J = Special then 1849 List.AddLine(Phrases.Lookup('FEATURES', I), pkFeature, I, 1850 hkFeature, I); 1851 1851 end; 1852 1852 List.Sort; … … 1871 1871 begin 1872 1872 NextSection('COSTS'); 1873 s:= IntToStr(Feature[no].Cost);1873 S := IntToStr(Feature[no].Cost); 1874 1874 if Feature[no].Cost >= 0 then 1875 s := '+' + s;1876 AddLine(Format(HelpText.Lookup('COSTBASE'), [ s]));1875 S := '+' + S; 1876 AddLine(Format(HelpText.Lookup('COSTBASE'), [S])); 1877 1877 if Feature[no].Weight > 0 then 1878 1878 begin … … 1901 1901 begin 1902 1902 Caption := HelpText.Lookup('HELPTITLE_MODELLIST'); 1903 for i:= 0 to nSpecialModel - 1 do1904 if i<> 2 then1905 AddModelText( i);1903 for I := 0 to nSpecialModel - 1 do 1904 if I <> 2 then 1905 AddModelText(I); 1906 1906 LineFeed; 1907 1907 AddItem('MODELNOTE'); … … 1910 1910 end; 1911 1911 if CheckSeeAlso then 1912 for i:= 0 to nSeeAlso - 1 do1913 if (SeeAlso[ i].Kind = Kind) and (SeeAlso[i].no = no) then1914 case SeeAlso[ i].SeeKind of1915 hkImp: AddImprovement(SeeAlso[ i].SeeNo);1916 hkAdv: AddAdvance(SeeAlso[ i].SeeNo);1917 hkFeature: AddFeature(SeeAlso[ i].SeeNo);1912 for I := 0 to nSeeAlso - 1 do 1913 if (SeeAlso[I].Kind = Kind) and (SeeAlso[I].no = no) then 1914 case SeeAlso[I].SeeKind of 1915 hkImp: AddImprovement(SeeAlso[I].SeeNo); 1916 hkAdv: AddAdvance(SeeAlso[I].SeeNo); 1917 hkFeature: AddFeature(SeeAlso[I].SeeNo); 1918 1918 end; 1919 1919 if (Headline >= 0) and (Count = Headline + 1) then … … 1949 1949 1950 1950 procedure THelpDlg.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; 1951 x, y: integer);1951 X, Y: Integer); 1952 1952 var 1953 1953 i0, Sel0: Integer; 1954 1954 begin 1955 y := y- WideFrame;1955 Y := Y - WideFrame; 1956 1956 i0 := ScrollBar.Position; 1957 1957 Sel0 := Sel; 1958 if ( x >= SideFrame) and (x < SideFrame + InnerWidth) and (y>= 0) and1959 ( y < InnerHeight) and (ymod 24 >= 8) then1960 Sel := ydiv 241958 if (X >= SideFrame) and (X < SideFrame + InnerWidth) and (Y >= 0) and 1959 (Y < InnerHeight) and (Y mod 24 >= 8) then 1960 Sel := Y div 24 1961 1961 else 1962 1962 Sel := -1; … … 1974 1974 1975 1975 procedure THelpDlg.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; 1976 Shift: TShiftState; x, y: integer);1976 Shift: TShiftState; X, Y: Integer); 1977 1977 begin 1978 1978 if Sel >= 0 then … … 1987 1987 begin 1988 1988 if (Link >= $8000) and (Link and $3FFF = liInvalid) then 1989 exit; // invalid link;1989 Exit; // invalid link; 1990 1990 if Link >= $8000 then 1991 1991 ShowNewContent(FWindowMode, hkText, Link and $3FFF) … … 2079 2079 procedure THelpDlg.Search(SearchString: string); 2080 2080 var 2081 h, i, PrevHandle, PrevIndex, p, RightMargin: Integer;2082 s: string;2081 H, I, PrevHandle, PrevIndex, P, RightMargin: Integer; 2082 S: string; 2083 2083 mADVHELP, mIMPHELP, mFEATUREHELP: set of 0 .. 255; 2084 2084 bGOVHELP, bSPECIALMODEL, bJOBHELP: Boolean; … … 2094 2094 // search in generic reference 2095 2095 SearchString := UpperCase(SearchString); 2096 for i:= 0 to 35 + 4 do begin2097 s := Phrases.Lookup('TERRAIN', i);2098 if pos(SearchString, UpperCase(s)) > 0 then2099 if i< 36 then2100 SearchResult.AddLine( s+ ' ' + HelpText.Lookup('HELPSPEC_TER'),2101 pkNormal, 0, hkTer + hkCrossLink, i)2096 for I := 0 to 35 + 4 do begin 2097 S := Phrases.Lookup('TERRAIN', I); 2098 if Pos(SearchString, UpperCase(S)) > 0 then 2099 if I < 36 then 2100 SearchResult.AddLine(S + ' ' + HelpText.Lookup('HELPSPEC_TER'), 2101 pkNormal, 0, hkTer + hkCrossLink, I) 2102 2102 else 2103 2103 begin … … 2105 2105 HelpText.Lookup('HELPSPEC_TER'), pkNormal, 0, 2106 2106 hkTer + hkCrossLink, 36); 2107 if i> 36 then2107 if I > 36 then 2108 2108 SearchResult.AddLine(Phrases.Lookup('IMPROVEMENTS', 2109 imShipComp + i- 37) + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'),2110 pkNormal, 0, hkImp + hkCrossLink, imShipComp + i- 37);2109 imShipComp + I - 37) + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'), 2110 pkNormal, 0, hkImp + hkCrossLink, imShipComp + I - 37); 2111 2111 Break; 2112 2112 end; 2113 2113 end; 2114 for i:= 0 to nJobHelp - 1 do2115 if pos(SearchString, UpperCase(Phrases.Lookup('JOBRESULT', JobHelp[i]))) > 02114 for I := 0 to nJobHelp - 1 do 2115 if Pos(SearchString, UpperCase(Phrases.Lookup('JOBRESULT', JobHelp[I]))) > 0 2116 2116 then 2117 2117 begin … … 2121 2121 Break; 2122 2122 end; 2123 for i:= 0 to nAdv - 1 do2124 begin 2125 s := Phrases.Lookup('ADVANCES', i);2126 if pos(SearchString, UpperCase(s)) > 0 then2123 for I := 0 to nAdv - 1 do 2124 begin 2125 S := Phrases.Lookup('ADVANCES', I); 2126 if Pos(SearchString, UpperCase(S)) > 0 then 2127 2127 begin 2128 if iin FutureTech then2129 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FUTURE')2128 if I in FutureTech then 2129 S := S + ' ' + HelpText.Lookup('HELPSPEC_FUTURE') 2130 2130 else 2131 s := s+ ' ' + HelpText.Lookup('HELPSPEC_ADV');2132 SearchResult.AddLine( s, pkNormal, 0, hkAdv + hkCrossLink, i);2133 include(mADVHELP, i);2131 S := S + ' ' + HelpText.Lookup('HELPSPEC_ADV'); 2132 SearchResult.AddLine(S, pkNormal, 0, hkAdv + hkCrossLink, I); 2133 Include(mADVHELP, I); 2134 2134 end; 2135 2135 end; 2136 for i:= 0 to nSpecialModel - 1 do2137 begin 2138 FindStdModelPicture(SpecialModelPictureCode[ i], h, s);2139 if pos(SearchString, UpperCase(s)) > 0 then2136 for I := 0 to nSpecialModel - 1 do 2137 begin 2138 FindStdModelPicture(SpecialModelPictureCode[I], H, S); 2139 if Pos(SearchString, UpperCase(S)) > 0 then 2140 2140 begin 2141 2141 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkNormal, 0, … … 2145 2145 end; 2146 2146 end; 2147 for i:= 0 to nFeature - 1 do2148 begin 2149 s := Phrases.Lookup('FEATURES', i);2150 if Pos(SearchString, UpperCase( s)) > 0 then2147 for I := 0 to nFeature - 1 do 2148 begin 2149 S := Phrases.Lookup('FEATURES', I); 2150 if Pos(SearchString, UpperCase(S)) > 0 then 2151 2151 begin 2152 if i< mcFirstNonCap then2153 s := s+ ' ' + HelpText.Lookup('HELPSPEC_CAP')2154 else if iin AutoFeature then2155 s := s+ ' ' + HelpText.Lookup('HELPSPEC_STANDARD')2152 if I < mcFirstNonCap then 2153 S := S + ' ' + HelpText.Lookup('HELPSPEC_CAP') 2154 else if I in AutoFeature then 2155 S := S + ' ' + HelpText.Lookup('HELPSPEC_STANDARD') 2156 2156 else 2157 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FEATURE');2158 SearchResult.AddLine( s, pkNormal, 0, hkFeature + hkCrossLink, i);2159 Include(mFEATUREHELP, i);2157 S := S + ' ' + HelpText.Lookup('HELPSPEC_FEATURE'); 2158 SearchResult.AddLine(S, pkNormal, 0, hkFeature + hkCrossLink, I); 2159 Include(mFEATUREHELP, I); 2160 2160 end; 2161 2161 end; 2162 for i:= 0 to nImp - 1 do2163 begin 2164 s := Phrases.Lookup('IMPROVEMENTS', i);2165 if Pos(SearchString, UpperCase( s)) > 0 then2162 for I := 0 to nImp - 1 do 2163 begin 2164 S := Phrases.Lookup('IMPROVEMENTS', I); 2165 if Pos(SearchString, UpperCase(S)) > 0 then 2166 2166 begin 2167 case Imp[ i].Kind of2167 case Imp[I].Kind of 2168 2168 ikWonder: 2169 s := s+ ' ' + HelpText.Lookup('HELPSPEC_WONDER');2169 S := S + ' ' + HelpText.Lookup('HELPSPEC_WONDER'); 2170 2170 ikCommon: 2171 s := s+ ' ' + HelpText.Lookup('HELPSPEC_IMP');2171 S := S + ' ' + HelpText.Lookup('HELPSPEC_IMP'); 2172 2172 ikShipPart: 2173 s := s+ ' ' + HelpText.Lookup('HELPSPEC_SHIPPART');2173 S := S + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'); 2174 2174 else 2175 s := s+ ' ' + HelpText.Lookup('HELPSPEC_NAT')2175 S := S + ' ' + HelpText.Lookup('HELPSPEC_NAT') 2176 2176 end; 2177 SearchResult.AddLine( s, pkNormal, 0, hkImp + hkCrossLink, i);2178 Include(mIMPHELP, i);2177 SearchResult.AddLine(S, pkNormal, 0, hkImp + hkCrossLink, I); 2178 Include(mIMPHELP, I); 2179 2179 end 2180 2180 end; 2181 for i:= 0 to nGov - 1 do2182 if Pos(SearchString, UpperCase(Phrases.Lookup('GOVERNMENT', i))) > 0 then2181 for I := 0 to nGov - 1 do 2182 if Pos(SearchString, UpperCase(Phrases.Lookup('GOVERNMENT', I))) > 0 then 2183 2183 begin 2184 2184 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkNormal, 0, … … 2189 2189 2190 2190 // full text search 2191 h:= -1;2191 H := -1; 2192 2192 repeat 2193 PrevHandle := h;2194 PrevIndex := i;2195 if not HelpText.Search(SearchString, h, i) then2193 PrevHandle := H; 2194 PrevIndex := I; 2195 if not HelpText.Search(SearchString, H, I) then 2196 2196 Break; 2197 if h= hADVHELP then2197 if H = hADVHELP then 2198 2198 begin 2199 if ( i >= 0) and ((i <> PrevIndex) or (h<> PrevHandle)) and2200 not( iin mADVHELP) then2199 if (I >= 0) and ((I <> PrevIndex) or (H <> PrevHandle)) and 2200 not(I in mADVHELP) then 2201 2201 begin 2202 s := Phrases.Lookup('ADVANCES', i);2203 if iin FutureTech then2204 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FUTURE')2202 S := Phrases.Lookup('ADVANCES', I); 2203 if I in FutureTech then 2204 S := S + ' ' + HelpText.Lookup('HELPSPEC_FUTURE') 2205 2205 else 2206 s := s+ ' ' + HelpText.Lookup('HELPSPEC_ADV');2207 SearchResult.AddLine( s, pkNormal, 0, hkAdv + hkCrossLink, i)2206 S := S + ' ' + HelpText.Lookup('HELPSPEC_ADV'); 2207 SearchResult.AddLine(S, pkNormal, 0, hkAdv + hkCrossLink, I) 2208 2208 end; 2209 2209 end 2210 else if h= hIMPHELP then2210 else if H = hIMPHELP then 2211 2211 begin 2212 if ( i >= 0) and ((i <> PrevIndex) or (h<> PrevHandle)) and2213 not( iin mIMPHELP) then2212 if (I >= 0) and ((I <> PrevIndex) or (H <> PrevHandle)) and 2213 not(I in mIMPHELP) then 2214 2214 begin 2215 s := Phrases.Lookup('IMPROVEMENTS', i);2216 case Imp[ i].Kind of2215 S := Phrases.Lookup('IMPROVEMENTS', I); 2216 case Imp[I].Kind of 2217 2217 ikWonder: 2218 s := s+ ' ' + HelpText.Lookup('HELPSPEC_WONDER');2218 S := S + ' ' + HelpText.Lookup('HELPSPEC_WONDER'); 2219 2219 ikCommon: 2220 s := s+ ' ' + HelpText.Lookup('HELPSPEC_IMP');2220 S := S + ' ' + HelpText.Lookup('HELPSPEC_IMP'); 2221 2221 ikShipPart: 2222 s := s+ ' ' + HelpText.Lookup('HELPSPEC_SHIPPART');2222 S := S + ' ' + HelpText.Lookup('HELPSPEC_SHIPPART'); 2223 2223 else 2224 s := s+ ' ' + HelpText.Lookup('HELPSPEC_NAT')2224 S := S + ' ' + HelpText.Lookup('HELPSPEC_NAT') 2225 2225 end; 2226 SearchResult.AddLine( s, pkNormal, 0, hkImp + hkCrossLink, i)2226 SearchResult.AddLine(S, pkNormal, 0, hkImp + hkCrossLink, I) 2227 2227 end; 2228 2228 end 2229 else if h= hFEATUREHELP then2229 else if H = hFEATUREHELP then 2230 2230 begin 2231 if ( i >= 0) and ((i <> PrevIndex) or (h<> PrevHandle)) and2232 not( iin mFEATUREHELP) then2231 if (I >= 0) and ((I <> PrevIndex) or (H <> PrevHandle)) and 2232 not(I in mFEATUREHELP) then 2233 2233 begin 2234 s := Phrases.Lookup('FEATURES', i);2235 if i< mcFirstNonCap then2236 s := s+ ' ' + HelpText.Lookup('HELPSPEC_CAP')2237 else if iin AutoFeature then2238 s := s+ ' ' + HelpText.Lookup('HELPSPEC_STANDARD')2234 S := Phrases.Lookup('FEATURES', I); 2235 if I < mcFirstNonCap then 2236 S := S + ' ' + HelpText.Lookup('HELPSPEC_CAP') 2237 else if I in AutoFeature then 2238 S := S + ' ' + HelpText.Lookup('HELPSPEC_STANDARD') 2239 2239 else 2240 s := s+ ' ' + HelpText.Lookup('HELPSPEC_FEATURE');2241 SearchResult.AddLine( s, pkNormal, 0, hkFeature + hkCrossLink, i);2240 S := S + ' ' + HelpText.Lookup('HELPSPEC_FEATURE'); 2241 SearchResult.AddLine(S, pkNormal, 0, hkFeature + hkCrossLink, I); 2242 2242 end; 2243 2243 end 2244 else if h= hGOVHELP then2244 else if H = hGOVHELP then 2245 2245 begin 2246 if ( i >= 0) and (h<> PrevHandle) and not bGOVHELP then2246 if (I >= 0) and (H <> PrevHandle) and not bGOVHELP then 2247 2247 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_GOVLIST'), pkNormal, 0, 2248 2248 hkMisc + hkCrossLink, miscGovList) 2249 2249 end 2250 else if h= hSPECIALMODEL then2250 else if H = hSPECIALMODEL then 2251 2251 begin 2252 if ( i >= 0) and (h<> PrevHandle) and not bSPECIALMODEL then2252 if (I >= 0) and (H <> PrevHandle) and not bSPECIALMODEL then 2253 2253 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_MODELLIST'), pkNormal, 2254 2254 0, hkModel + hkCrossLink, 0) 2255 2255 end 2256 else if h= hJOBHELP then2256 else if H = hJOBHELP then 2257 2257 begin 2258 if ( i >= 0) and (h<> PrevHandle) and not bJOBHELP then2258 if (I >= 0) and (H <> PrevHandle) and not bJOBHELP then 2259 2259 SearchResult.AddLine(HelpText.Lookup('HELPTITLE_JOBLIST'), pkNormal, 0, 2260 2260 hkMisc + hkCrossLink, miscJobList) 2261 2261 end 2262 else if { (h<>hMAIN) and } ( h<> PrevHandle) then2262 else if { (h<>hMAIN) and } (H <> PrevHandle) then 2263 2263 begin 2264 s := HelpText.LookupByHandle(h);2265 p := Pos('$', s);2266 if p> 0 then2264 S := HelpText.LookupByHandle(H); 2265 P := Pos('$', S); 2266 if P > 0 then 2267 2267 begin 2268 s := Copy(s, p+ 1, maxint);2269 p := Pos('\', s);2270 if p> 0 then2271 s := Copy(s, 1, p- 1);2272 SearchResult.AddLine( s, pkNormal, 0, hkText + hkCrossLink, h);2268 S := Copy(S, P + 1, maxint); 2269 P := Pos('\', S); 2270 if P > 0 then 2271 S := Copy(S, 1, P - 1); 2272 SearchResult.AddLine(S, pkNormal, 0, hkText + hkCrossLink, H); 2273 2273 end; 2274 2274 end; … … 2278 2278 RightMargin := InnerWidth - 16 - GetSystemMetrics(SM_CXVSCROLL); 2279 2279 OffScreen.Canvas.Font.Assign(UniFont[ftNormal]); 2280 for i:= 0 to SearchResult.Count - 1 do2280 for I := 0 to SearchResult.Count - 1 do 2281 2281 begin 2282 while BiColorTextWidth(OffScreen.Canvas, SearchResult[ i]) >2282 while BiColorTextWidth(OffScreen.Canvas, SearchResult[I]) > 2283 2283 RightMargin - 32 do 2284 SearchResult[ i] := copy(SearchResult[i], 1, length(SearchResult[i]) - 1)2284 SearchResult[I] := Copy(SearchResult[I], 1, Length(SearchResult[I]) - 1) 2285 2285 end; 2286 2286 end; -
trunk/LocalPlayer/IsoEngine.pas
r442 r447 13 13 14 14 type 15 TInitEnemyModelEvent = function(emix: integer): boolean;15 TInitEnemyModelEvent = function(emix: Integer): Boolean; 16 16 TTileSize = (tsSmall, tsMedium, tsBig); 17 17 … … 33 33 Dirx: array [0..7] of Integer = (1, 2, 1, 0, -1, -2, -1, 0); 34 34 Diry: array [0..7] of Integer = (-1, 0, 1, 2, 1, 0, -1, -2); 35 procedure CityGrid(xm, ym: integer; CityAllowClick: Boolean);36 function IsShoreTile(Loc: integer): boolean;35 procedure CityGrid(xm, ym: Integer; CityAllowClick: Boolean); 36 function IsShoreTile(Loc: Integer): Boolean; 37 37 procedure MakeDark(Line: PPixelPointer; Length: Integer); 38 38 procedure SetTileSize(AValue: TTileSize); 39 procedure ShadeOutside(x0, y0, Width, Height, xm, ym: integer);39 procedure ShadeOutside(x0, y0, Width, Height, xm, ym: Integer); 40 40 protected 41 41 FOutput: TBitmap; … … 65 65 ShowDebug: Boolean; 66 66 FoW: Boolean; 67 function Connection4(Loc, Mask, Value: integer): integer;68 function Connection8(Loc, Mask: integer): integer;69 function OceanConnection(Loc: integer): integer;70 procedure PaintShore( x, y, Loc: integer);71 procedure PaintTileExtraTerrain( x, y, Loc: integer);72 procedure PaintTileObjects( x, y, Loc, CityLoc, CityOwner: integer;73 UseBlink: boolean);74 procedure PaintGrid( x, y, nx, ny: integer);75 procedure FillRect( x, y, Width, Height, Color: integer);76 procedure Textout( x, y, Color: integer; const s: string);77 procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);78 procedure TSprite(xDst, yDst, grix: integer; PureBlack: boolean = false);67 function Connection4(Loc, Mask, Value: Integer): Integer; 68 function Connection8(Loc, Mask: Integer): Integer; 69 function OceanConnection(Loc: Integer): Integer; 70 procedure PaintShore(X, Y, Loc: Integer); 71 procedure PaintTileExtraTerrain(X, Y, Loc: Integer); 72 procedure PaintTileObjects(X, Y, Loc, CityLoc, CityOwner: Integer; 73 UseBlink: Boolean); 74 procedure PaintGrid(X, Y, nx, ny: Integer); 75 procedure FillRect(X, Y, Width, Height, Color: Integer); 76 procedure Textout(X, Y, Color: Integer; const S: string); 77 procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 78 procedure TSprite(xDst, yDst, grix: Integer; PureBlack: Boolean = False); 79 79 procedure ApplyTileSize(ATileSize: TTileSize); 80 80 public … … 89 89 procedure Reset; 90 90 procedure SetOutput(Output: TBitmap); 91 procedure SetPaintBounds(Left, Top, Right, Bottom: integer);92 procedure Paint( x, y, Loc, nx, ny, CityLoc, CityOwner: integer;93 UseBlink: boolean = false; CityAllowClick: boolean = false);94 procedure PaintUnit( x, y: integer; const UnitInfo: TUnitInfo;95 Status: integer);96 procedure PaintCity( x, y: integer; const CityInfo: TCityInfo;97 accessory: boolean = true);98 procedure BitBltBitmap(Src: TBitmap; x, y, Width, Height, xSrc, ySrc,99 Rop: integer);91 procedure SetPaintBounds(Left, Top, Right, Bottom: Integer); 92 procedure Paint(X, Y, Loc, nx, ny, CityLoc, CityOwner: Integer; 93 UseBlink: Boolean = False; CityAllowClick: Boolean = False); 94 procedure PaintUnit(X, Y: Integer; const UnitInfo: TUnitInfo; 95 Status: Integer); 96 procedure PaintCity(X, Y: Integer; const CityInfo: TCityInfo; 97 accessory: Boolean = True); 98 procedure BitBltBitmap(Src: TBitmap; X, Y, Width, Height, xSrc, ySrc, 99 Rop: Integer); 100 100 procedure AttackBegin(const ShowMove: TShowMove); 101 101 procedure AttackEffect(const ShowMove: TShowMove); 102 102 procedure AttackEnd; 103 103 procedure ReduceTerrainIconsSize; 104 property AdviceLoc: integer read FAdviceLoc write FAdviceLoc;104 property AdviceLoc: Integer read FAdviceLoc write FAdviceLoc; 105 105 property TileSize: TTileSize read FTileSize write SetTileSize; 106 106 end; … … 127 127 (X: 72; Y: 36)); 128 128 129 function IsJungle( y: integer): boolean;129 function IsJungle(Y: Integer): Boolean; 130 130 procedure Init(InitEnemyModelHandler: TInitEnemyModelEvent); 131 131 … … 173 173 IsoMapCache: array[TTileSize] of TIsoMapCache; 174 174 175 function IsJungle( y: integer): boolean;176 begin 177 result := (y > (G.ly - 2) div 4) and (G.ly - 1 - y> (G.ly - 2) div 4)175 function IsJungle(Y: Integer): Boolean; 176 begin 177 Result := (Y > (G.ly - 2) div 4) and (G.ly - 1 - Y > (G.ly - 2) div 4) 178 178 end; 179 179 … … 254 254 Mask24.BeginUpdate; 255 255 for ySrc := 0 to TerrainIconLines - 1 do begin 256 for i:= 0 to yyt * 3 - 1 do257 MaskLine[ i] := PixelPointer(Mask24, ScaleToNative(0),258 ScaleToNative(1 + ySrc * (yyt * 3 + 1) + i));256 for I := 0 to yyt * 3 - 1 do 257 MaskLine[I] := PixelPointer(Mask24, ScaleToNative(0), 258 ScaleToNative(1 + ySrc * (yyt * 3 + 1) + I)); 259 259 for xSrc := 0 to TerrainIconCols - 1 do begin 260 i:= ySrc * 9 + xSrc;261 TSpriteSize[ i].Left := 0;260 I := ySrc * 9 + xSrc; 261 TSpriteSize[I].Left := 0; 262 262 repeat 263 Border := true;264 for y:= 0 to yyt * 3 - 1 do begin265 MaskLine[ y].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[i].Left));266 if MaskLine[ y].Pixel^.B = 0 then Border := false;263 Border := True; 264 for Y := 0 to yyt * 3 - 1 do begin 265 MaskLine[Y].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[I].Left)); 266 if MaskLine[Y].Pixel^.B = 0 then Border := False; 267 267 end; 268 if Border then Inc(TSpriteSize[ i].Left);269 until not Border or (TSpriteSize[ i].Left = xxt * 2 - 1);270 TSpriteSize[ i].Top := 0;268 if Border then Inc(TSpriteSize[I].Left); 269 until not Border or (TSpriteSize[I].Left = xxt * 2 - 1); 270 TSpriteSize[I].Top := 0; 271 271 repeat 272 Border := true;273 for x:= 0 to xxt * 2 - 1 do begin274 MaskLine[TSpriteSize[ i].Top].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + x));275 if MaskLine[TSpriteSize[ i].Top].Pixel^.B = 0 then Border := false;272 Border := True; 273 for X := 0 to xxt * 2 - 1 do begin 274 MaskLine[TSpriteSize[I].Top].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + X)); 275 if MaskLine[TSpriteSize[I].Top].Pixel^.B = 0 then Border := False; 276 276 end; 277 if Border then inc(TSpriteSize[i].Top);278 until not Border or (TSpriteSize[ i].Top = yyt * 3 - 1);279 TSpriteSize[ i].Right := xxt * 2;277 if Border then Inc(TSpriteSize[I].Top); 278 until not Border or (TSpriteSize[I].Top = yyt * 3 - 1); 279 TSpriteSize[I].Right := xxt * 2; 280 280 repeat 281 Border := true;282 for y:= 0 to yyt * 3 - 1 do begin283 MaskLine[ y].SetX(ScaleToNative(xSrc * (xxt * 2 + 1) + TSpriteSize[i].Right));284 if MaskLine[ y].Pixel^.B = 0 then Border := false;281 Border := True; 282 for Y := 0 to yyt * 3 - 1 do begin 283 MaskLine[Y].SetX(ScaleToNative(xSrc * (xxt * 2 + 1) + TSpriteSize[I].Right)); 284 if MaskLine[Y].Pixel^.B = 0 then Border := False; 285 285 end; 286 if Border then Dec(TSpriteSize[ i].Right);287 until not Border or (TSpriteSize[ i].Right = TSpriteSize[i].Left);288 TSpriteSize[ i].Bottom := yyt * 3;286 if Border then Dec(TSpriteSize[I].Right); 287 until not Border or (TSpriteSize[I].Right = TSpriteSize[I].Left); 288 TSpriteSize[I].Bottom := yyt * 3; 289 289 repeat 290 Border := true;291 for x:= 0 to xxt * 2 - 1 do begin292 MaskLine[TSpriteSize[ i].Bottom - 1].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + x));293 if MaskLine[TSpriteSize[ i].Bottom - 1].Pixel^.B = 0 then Border := false;290 Border := True; 291 for X := 0 to xxt * 2 - 1 do begin 292 MaskLine[TSpriteSize[I].Bottom - 1].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + X)); 293 if MaskLine[TSpriteSize[I].Bottom - 1].Pixel^.B = 0 then Border := False; 294 294 end; 295 if Border then Dec(TSpriteSize[ i].Bottom);296 until not Border or (TSpriteSize[ i].Bottom = TSpriteSize[i].Top);295 if Border then Dec(TSpriteSize[I].Bottom); 296 until not Border or (TSpriteSize[I].Bottom = TSpriteSize[I].Top); 297 297 end; 298 298 end; … … 303 303 procedure TIsoMap.ApplyTileSize(ATileSize: TTileSize); 304 304 var 305 x: Integer;306 y: Integer;305 X: Integer; 306 Y: Integer; 307 307 xSrc: Integer; 308 308 ySrc: Integer; … … 361 361 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 362 362 363 for x:= -1 to 6 do begin364 if x= -1 then begin363 for X := -1 to 6 do begin 364 if X = -1 then begin 365 365 xSrc := ShoreDither * (xxt * 2 + 1) + 1; 366 366 ySrc := 1 + yyt; 367 367 end 368 else if x= 6 then begin368 else if X = 6 then begin 369 369 xSrc := 1 + (xxt * 2 + 1) * 2; 370 370 ySrc := 1 + yyt + (yyt * 3 + 1) * 2; 371 371 end else begin 372 xSrc := ( x+ 2) * (xxt * 2 + 1) + 1;372 xSrc := (X + 2) * (xxt * 2 + 1) + 1; 373 373 ySrc := 1 + yyt; 374 374 end; 375 for y:= -1 to 6 do376 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,375 for Y := -1 to 6 do 376 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 377 377 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc); 378 for y:= -2 to 6 do379 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt, xxt,378 for Y := -2 to 6 do 379 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, xxt, 380 380 yyt, HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 381 381 SRCPAINT); 382 for y:= -2 to 6 do383 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2) + xxt, (y+ 2) * yyt,382 for Y := -2 to 6 do 383 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2) + xxt, (Y + 2) * yyt, 384 384 xxt, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, 385 385 SRCPAINT); 386 for y:= -2 to 6 do387 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt, xxt,386 for Y := -2 to 6 do 387 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, xxt, 388 388 yyt, DitherMask.Canvas, xxt, yyt, SRCAND); 389 for y:= -2 to 6 do390 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2) + xxt, (y+ 2) * yyt,389 for Y := -2 to 6 do 390 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2) + xxt, (Y + 2) * yyt, 391 391 xxt, yyt, DitherMask.Canvas, 0, yyt, SRCAND); 392 392 end; 393 393 394 for y:= -1 to 6 do begin395 if y= -1 then begin394 for Y := -1 to 6 do begin 395 if Y = -1 then begin 396 396 xSrc := ShoreDither * (xxt * 2 + 1) + 1; 397 397 ySrc := 1 + yyt; 398 398 end 399 else if y= 6 then begin399 else if Y = 6 then begin 400 400 xSrc := 1 + 2 * (xxt * 2 + 1); 401 401 ySrc := 1 + yyt + 2 * (yyt * 3 + 1); 402 402 end else begin 403 xSrc := ( y+ 2) * (xxt * 2 + 1) + 1;403 xSrc := (Y + 2) * (xxt * 2 + 1) + 1; 404 404 ySrc := 1 + yyt; 405 405 end; 406 for x:= -2 to 6 do407 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,406 for X := -2 to 6 do 407 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 408 408 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc); 409 BitBltCanvas(LandMore.Canvas, xxt * 2, ( y+ 2) * yyt, xxt, yyt,409 BitBltCanvas(LandMore.Canvas, xxt * 2, (Y + 2) * yyt, xxt, yyt, 410 410 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT); 411 for x:= 0 to 7 do412 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2) - xxt, (y+ 2) * yyt,411 for X := 0 to 7 do 412 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2) - xxt, (Y + 2) * yyt, 413 413 xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, 414 414 SRCPAINT); 415 for x:= -2 to 6 do416 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,415 for X := -2 to 6 do 416 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 417 417 xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND); 418 418 end; 419 419 420 for x:= 0 to 3 do begin421 for y:= 0 to 3 do begin422 if ( x = 1) and (y= 1) then xSrc := 1420 for X := 0 to 3 do begin 421 for Y := 0 to 3 do begin 422 if (X = 1) and (Y = 1) then xSrc := 1 423 423 else 424 xSrc := ( xmod 2) * (xxt * 2 + 1) + 1;424 xSrc := (X mod 2) * (xxt * 2 + 1) + 1; 425 425 ySrc := 1 + yyt; 426 if ( x >= 1) = (y>= 2) then427 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,426 if (X >= 1) = (Y >= 2) then 427 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 428 428 HGrTerrain.Data.Canvas, xSrc, ySrc); 429 if ( x >= 1) and ((y < 2) or (x>= 2)) then429 if (X >= 1) and ((Y < 2) or (X >= 2)) then 430 430 begin 431 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt, yyt,431 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt, 432 432 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 433 433 SRCPAINT); 434 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y* yyt, xxt, yyt,434 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt, 435 435 HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT); 436 436 end; 437 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt, yyt,437 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt, 438 438 DitherMask.Canvas, xxt, yyt, SRCAND); 439 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y* yyt, xxt, yyt,439 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt, 440 440 DitherMask.Canvas, 0, yyt, SRCAND); 441 441 end; 442 442 end; 443 443 444 for y:= 0 to 3 do begin445 for x:= 0 to 3 do begin446 if ( x = 1) and (y= 1) then xSrc := 1444 for Y := 0 to 3 do begin 445 for X := 0 to 3 do begin 446 if (X = 1) and (Y = 1) then xSrc := 1 447 447 else 448 xSrc := ( ymod 2) * (xxt * 2 + 1) + 1;448 xSrc := (Y mod 2) * (xxt * 2 + 1) + 1; 449 449 ySrc := 1 + yyt; 450 if ( x < 1) or (y>= 2) then451 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,450 if (X < 1) or (Y >= 2) then 451 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 452 452 HGrTerrain.Data.Canvas, xSrc, ySrc); 453 if ( x = 1) and (y < 2) or (x >= 2) and (y>= 1) then453 if (X = 1) and (Y < 2) or (X >= 2) and (Y >= 1) then 454 454 begin 455 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y* yyt, xxt, yyt,455 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt, 456 456 HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, 457 457 SRCPAINT); 458 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) + xxt, y* yyt, xxt, yyt,458 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt, 459 459 HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT); 460 460 end; 461 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,461 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 462 462 DitherMask.Canvas, 0, 0, SRCAND); 463 463 end; … … 469 469 HGrTerrain.Mask.Canvas, 1, 1 + yyt, SRCPAINT); 470 470 471 for x:= -1 to 6 do472 for y:= -2 to 6 do473 BitBltCanvas(LandPatch.Canvas, ( x + 2) * (xxt * 2), (y+ 2) * yyt,471 for X := -1 to 6 do 472 for Y := -2 to 6 do 473 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, 474 474 xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND); 475 475 476 for y:= -1 to 6 do477 for x:= -2 to 7 do478 BitBltCanvas(LandMore.Canvas, ( x + 2) * (xxt * 2) - xxt, (y+ 2) * yyt,476 for Y := -1 to 6 do 477 for X := -2 to 7 do 478 BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2) - xxt, (Y + 2) * yyt, 479 479 xxt * 2, yyt, DitherMask.Canvas, 0, yyt, SRCAND); 480 480 … … 482 482 LandMore.Canvas, 0, 0, SRCPAINT); 483 483 484 for x:= 0 to 3 do485 for y:= 0 to 3 do486 BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y* yyt, xxt * 2, yyt,484 for X := 0 to 3 do 485 for Y := 0 to 3 do 486 BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt, 487 487 DitherMask.Canvas, 0, 0, SRCAND); 488 488 489 for y:= 0 to 3 do490 for x:= 0 to 4 do491 BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) - xxt, y* yyt, xxt * 2,489 for Y := 0 to 3 do 490 for X := 0 to 4 do 491 BitBltCanvas(OceanMore.Canvas, X * (xxt * 2) - xxt, Y * yyt, xxt * 2, 492 492 yyt, DitherMask.Canvas, 0, yyt, SRCAND); 493 493 … … 502 502 HGrTerrain.Mask.Canvas, 1, 1 + yyt); 503 503 504 for x:= 0 to 6 do505 BitBltCanvas(LandPatch.Canvas, ( x+ 2) * (xxt * 2), yyt, xxt * 2, yyt,504 for X := 0 to 6 do 505 BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), yyt, xxt * 2, yyt, 506 506 DitherMask.Canvas, 0, 0, SRCAND); 507 507 BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt, DitherMask.Canvas, 508 508 0, 0, DSTINVERT); 509 509 510 for y:= 0 to 6 do511 BitBltCanvas(LandPatch.Canvas, xxt * 2, ( y+ 2) * yyt, xxt * 2, yyt,510 for Y := 0 to 6 do 511 BitBltCanvas(LandPatch.Canvas, xxt * 2, (Y + 2) * yyt, xxt * 2, yyt, 512 512 DitherMask.Canvas, 0, 0, SRCAND); 513 513 … … 555 555 end; 556 556 557 procedure TIsoMap.SetPaintBounds(Left, Top, Right, Bottom: integer);557 procedure TIsoMap.SetPaintBounds(Left, Top, Right, Bottom: Integer); 558 558 begin 559 559 FLeft := Left; … … 563 563 end; 564 564 565 procedure TIsoMap.FillRect( x, y, Width, Height, Color: integer);566 begin 567 if x< FLeft then568 begin 569 Width := Width - (FLeft - x);570 x:= FLeft;571 end; 572 if y< FTop then573 begin 574 Height := Height - (FTop - y);575 y:= FTop;576 end; 577 if x+ Width >= FRight then578 Width := FRight - x;579 if y+ Height >= FBottom then580 Height := FBottom - y;565 procedure TIsoMap.FillRect(X, Y, Width, Height, Color: Integer); 566 begin 567 if X < FLeft then 568 begin 569 Width := Width - (FLeft - X); 570 X := FLeft; 571 end; 572 if Y < FTop then 573 begin 574 Height := Height - (FTop - Y); 575 Y := FTop; 576 end; 577 if X + Width >= FRight then 578 Width := FRight - X; 579 if Y + Height >= FBottom then 580 Height := FBottom - Y; 581 581 if (Width <= 0) or (Height <= 0) then 582 exit;582 Exit; 583 583 584 584 FOutput.Canvas.Brush.Color := Color; 585 FOutput.Canvas.FillRect(Rect( x, y, x + Width, y+ Height));585 FOutput.Canvas.FillRect(Rect(X, Y, X + Width, Y + Height)); 586 586 FOutput.Canvas.Brush.Style := bsClear; 587 587 end; 588 588 589 procedure TIsoMap.Textout( x, y, Color: integer; const s: string);589 procedure TIsoMap.Textout(X, Y, Color: Integer; const S: string); 590 590 begin 591 591 FOutput.Canvas.Font.Color := Color; 592 FOutput.Canvas.TextRect(Rect(FLeft, FTop, FRight, FBottom), x, y, s)593 end; 594 595 procedure TIsoMap.BitBltBitmap(Src: TBitmap; x, y, Width, Height, xSrc, ySrc,596 Rop: integer);597 begin 598 if x< FLeft then599 begin 600 Width := Width - (FLeft - x);601 xSrc := xSrc + (FLeft - x);602 x:= FLeft;603 end; 604 if y< FTop then605 begin 606 Height := Height - (FTop - y);607 ySrc := ySrc + (FTop - y);608 y:= FTop;609 end; 610 if x+ Width >= FRight then611 Width := FRight - x;612 if y+ Height >= FBottom then613 Height := FBottom - y;592 FOutput.Canvas.TextRect(Rect(FLeft, FTop, FRight, FBottom), X, Y, S) 593 end; 594 595 procedure TIsoMap.BitBltBitmap(Src: TBitmap; X, Y, Width, Height, xSrc, ySrc, 596 Rop: Integer); 597 begin 598 if X < FLeft then 599 begin 600 Width := Width - (FLeft - X); 601 xSrc := xSrc + (FLeft - X); 602 X := FLeft; 603 end; 604 if Y < FTop then 605 begin 606 Height := Height - (FTop - Y); 607 ySrc := ySrc + (FTop - Y); 608 Y := FTop; 609 end; 610 if X + Width >= FRight then 611 Width := FRight - X; 612 if Y + Height >= FBottom then 613 Height := FBottom - Y; 614 614 if (Width <= 0) or (Height <= 0) then 615 exit;616 617 BitBltCanvas(FOutput.Canvas, x, y, Width, Height, Src.Canvas, xSrc, ySrc, Rop);618 end; 619 620 procedure TIsoMap.Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);615 Exit; 616 617 BitBltCanvas(FOutput.Canvas, X, Y, Width, Height, Src.Canvas, xSrc, ySrc, Rop); 618 end; 619 620 procedure TIsoMap.Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 621 621 begin 622 622 BitBltBitmap(HGr.Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND); … … 624 624 end; 625 625 626 procedure TIsoMap.TSprite(xDst, yDst, grix: integer;627 PureBlack: boolean = false);626 procedure TIsoMap.TSprite(xDst, yDst, grix: Integer; 627 PureBlack: Boolean = False); 628 628 var 629 629 Width: Integer; 630 630 Height: Integer; 631 631 xSrc: Integer; 632 ySrc: integer;632 ySrc: Integer; 633 633 begin 634 634 Width := TSpriteSize[grix].Right - TSpriteSize[grix].Left; … … 653 653 Height := FBottom - yDst; 654 654 if (Width <= 0) or (Height <= 0) then 655 exit;655 Exit; 656 656 657 657 BitBltCanvas(FOutput.Canvas, xDst, yDst, Width, Height, MaskCanvas, xSrc, ySrc, SRCAND); … … 660 660 end; 661 661 662 procedure TIsoMap.PaintUnit( x, y: integer; const UnitInfo: TUnitInfo;663 Status: integer);664 var 665 xsh, ysh, xGr, yGr, j, mixShow: integer;662 procedure TIsoMap.PaintUnit(X, Y: Integer; const UnitInfo: TUnitInfo; 663 Status: Integer); 664 var 665 xsh, ysh, xGr, yGr, J, mixShow: Integer; 666 666 begin 667 667 with UnitInfo do 668 if (Owner = me) or (emix <> $FFFF) then668 if (Owner = Me) or (emix <> $FFFF) then 669 669 begin 670 670 if Job = jCity then … … 675 675 (@OnInitEnemyModel <> nil) then 676 676 if not OnInitEnemyModel(emix) then 677 exit;677 Exit; 678 678 xsh := Tribe[Owner].ModelPicture[mixShow].xShield; 679 679 ysh := Tribe[Owner].ModelPicture[mixShow].yShield; 680 680 {$IFNDEF SCR} if Status and usStay <> 0 then 681 j:= 19681 J := 19 682 682 else if Status and usRecover <> 0 then 683 j:= 16683 J := 16 684 684 else if Status and (usGoto or usEnhance) = usGoto or usEnhance then 685 j:= 18685 J := 18 686 686 else if Status and usEnhance <> 0 then 687 j:= 17687 J := 17 688 688 else if Status and usGoto <> 0 then 689 j:= 20689 J := 20 690 690 else {$ENDIF} if Job = jCity then 691 j:= jNone691 J := jNone 692 692 else 693 j:= Job;693 J := Job; 694 694 if Flags and unMulti <> 0 then 695 Sprite(Tribe[Owner].symHGr, x + xsh - 1 + 4, y+ ysh - 2, 14, 12,695 Sprite(Tribe[Owner].symHGr, X + xsh - 1 + 4, Y + ysh - 2, 14, 12, 696 696 33 + Tribe[Owner].sympix mod 10 * 65, 697 697 1 + Tribe[Owner].sympix div 10 * 49); 698 Sprite(Tribe[Owner].symHGr, x + xsh - 1, y+ ysh - 2, 14, 12,698 Sprite(Tribe[Owner].symHGr, X + xsh - 1, Y + ysh - 2, 14, 12, 699 699 18 + Tribe[Owner].sympix mod 10 * 65, 700 700 1 + Tribe[Owner].sympix div 10 * 49); 701 FillRect( x + xsh, y+ ysh + 5, 1 + Health * 11 div 100, 3,701 FillRect(X + xsh, Y + ysh + 5, 1 + Health * 11 div 100, 3, 702 702 ColorOfHealth(Health)); 703 if j> 0 then703 if J > 0 then 704 704 begin 705 xGr := 121 + jmod 7 * 9;706 yGr := 1 + jdiv 7 * 9;707 BitBltBitmap(HGrSystem.Mask, x + xsh + 3, y+ ysh + 9, 8, 8, xGr,705 xGr := 121 + J mod 7 * 9; 706 yGr := 1 + J div 7 * 9; 707 BitBltBitmap(HGrSystem.Mask, X + xsh + 3, Y + ysh + 9, 8, 8, xGr, 708 708 yGr, SRCAND); 709 Sprite(HGrSystem, x + xsh + 2, y+ ysh + 8, 8, 8, xGr, yGr);709 Sprite(HGrSystem, X + xsh + 2, Y + ysh + 8, 8, 8, xGr, yGr); 710 710 end; 711 711 with Tribe[Owner].ModelPicture[mixShow] do 712 Sprite(HGr, x, y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1);712 Sprite(HGr, X, Y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1); 713 713 if Flags and unFortified <> 0 then 714 714 begin 715 715 { DataCanvas:=HGrTerrain.Data.Canvas; 716 716 MaskCanvas:=HGrTerrain.Mask.Canvas; 717 TSprite( x,y+16,12*9+7); }718 Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);717 TSprite(X,Y+16,12*9+7); } 718 Sprite(HGrStdUnits, X, Y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1); 719 719 end; 720 720 end; 721 721 end; 722 722 723 procedure TIsoMap.PaintCity( x, y: integer; const CityInfo: TCityInfo;724 accessory: boolean);723 procedure TIsoMap.PaintCity(X, Y: Integer; const CityInfo: TCityInfo; 724 accessory: Boolean); 725 725 var 726 726 age: Integer; … … 733 733 LabelLength: Integer; 734 734 cpic: TCityPicture; 735 s: string;735 S: string; 736 736 begin 737 737 age := GetAge(CityInfo.Owner); … … 752 752 (cHGr.Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF) 753 753 then 754 Sprite(cHGr, x - xxc, y- 2 * yyc, xxc * 2, yyc * 3,754 Sprite(cHGr, X - xxc, Y - 2 * yyc, xxc * 2, yyc * 3, 755 755 xGr * (xxc * 2 + 1) + 1, 1 + cpix * (yyc * 3 + 1)); 756 756 if ciWalled and CityInfo.Flags <> 0 then 757 Sprite(cHGr, x - xxc, y- 2 * yyc, xxc * 2, yyc * 3,757 Sprite(cHGr, X - xxc, Y - 2 * yyc, xxc * 2, yyc * 3, 758 758 (xGr + 4) * (xxc * 2 + 1) + 1, 1 + cpix * (yyc * 3 + 1)); 759 759 end … … 761 761 begin 762 762 if ciWalled and CityInfo.Flags <> 0 then 763 Sprite(HGrCities, x - xxt, y- 2 * yyt, 2 * xxt, 3 * yyt,763 Sprite(HGrCities, X - xxt, Y - 2 * yyt, 2 * xxt, 3 * yyt, 764 764 (xGr + 4) * (2 * xxt + 1) + 1, 1 + (age - 2) * (3 * yyt + 1)) 765 765 else 766 Sprite(HGrCities, x - xxt, y- 2 * yyt, 2 * xxt, 3 * yyt,766 Sprite(HGrCities, X - xxt, Y - 2 * yyt, 2 * xxt, 3 * yyt, 767 767 xGr * (2 * xxt + 1) + 1, 1 + (age - 2) * (3 * yyt + 1)); 768 768 end; 769 769 770 770 if not accessory then 771 exit;771 Exit; 772 772 773 773 { if ciCapital and CityInfo.Flags<>0 then 774 Sprite(Tribe[CityInfo.Owner].symHGr, x+cpic.xf,y-13+cpic.yf,13,14,774 Sprite(Tribe[CityInfo.Owner].symHGr,X+cpic.xf,Y-13+cpic.yf,13,14, 775 775 1+Tribe[CityInfo.Owner].sympix mod 10 *65, 776 776 1+Tribe[CityInfo.Owner].sympix div 10 *49); {capital -- paint flag } … … 781 781 begin 782 782 cpic := Tribe[CityInfo.Owner].CityPicture[xGr]; 783 xShield := x- xxc + cpic.xShield;784 yShield := y- 2 * yyc + cpic.yShield;783 xShield := X - xxc + cpic.xShield; 784 yShield := Y - 2 * yyc + cpic.yShield; 785 785 end 786 786 else 787 787 begin 788 788 cpic := CitiesPictures.Pictures[age, xGr]; 789 xShield := x- xxt + cpic.xShield;790 yShield := y- 2 * yyt + cpic.yShield;789 xShield := X - xxt + cpic.xShield; 790 yShield := Y - 2 * yyt + cpic.yShield; 791 791 end; 792 s:= IntToStr(CityInfo.size);793 LabelLength := FOutput.Canvas.TextWidth( s);792 S := IntToStr(CityInfo.size); 793 LabelLength := FOutput.Canvas.TextWidth(S); 794 794 FillRect(xShield, yShield, LabelLength + 4, 16, $000000); 795 795 if MyMap[CityInfo.Loc] and (fUnit or fObserved) = fObserved then … … 802 802 LabelTextColor := $000000; 803 803 end; 804 Textout(xShield + 2, yShield - 1, LabelTextColor, s);805 end; 806 end; 807 808 function PoleTile(Loc: integer): integer;804 Textout(xShield + 2, yShield - 1, LabelTextColor, S); 805 end; 806 end; 807 808 function PoleTile(Loc: Integer): Integer; 809 809 begin { virtual pole tile } 810 result := fUNKNOWN;810 Result := fUNKNOWN; 811 811 if Loc < -2 * G.lx then 812 812 else if Loc < -G.lx then … … 815 815 (MyMap[dLoc(Loc, -2, 2)] and fTerrain <> fUNKNOWN) and 816 816 (MyMap[dLoc(Loc, 2, 2)] and fTerrain <> fUNKNOWN) then 817 result := fArctic;817 Result := fArctic; 818 818 if (MyMap[dLoc(Loc, 0, 2)] and fObserved <> 0) and 819 819 (MyMap[dLoc(Loc, -2, 2)] and fObserved <> 0) and 820 820 (MyMap[dLoc(Loc, 2, 2)] and fObserved <> 0) then 821 result := result or fObserved;821 Result := Result or fObserved; 822 822 end 823 823 else if Loc < 0 then … … 825 825 if (MyMap[dLoc(Loc, -1, 1)] and fTerrain <> fUNKNOWN) and 826 826 (MyMap[dLoc(Loc, 1, 1)] and fTerrain <> fUNKNOWN) then 827 result := fArctic;827 Result := fArctic; 828 828 if (MyMap[dLoc(Loc, -1, 1)] and fObserved <> 0) and 829 829 (MyMap[dLoc(Loc, 1, 1)] and fObserved <> 0) then 830 result := result or fObserved;830 Result := Result or fObserved; 831 831 end 832 832 else if Loc < G.lx * (G.ly + 1) then … … 834 834 if (MyMap[dLoc(Loc, -1, -1)] and fTerrain <> fUNKNOWN) and 835 835 (MyMap[dLoc(Loc, 1, -1)] and fTerrain <> fUNKNOWN) then 836 result := fArctic;836 Result := fArctic; 837 837 if (MyMap[dLoc(Loc, -1, -1)] and fObserved <> 0) and 838 838 (MyMap[dLoc(Loc, 1, -1)] and fObserved <> 0) then 839 result := result or fObserved;839 Result := Result or fObserved; 840 840 end 841 841 else if Loc < G.lx * (G.ly + 2) then … … 844 844 (MyMap[dLoc(Loc, -2, -2)] and fTerrain <> fUNKNOWN) and 845 845 (MyMap[dLoc(Loc, 2, -2)] and fTerrain <> fUNKNOWN) then 846 result := fArctic;846 Result := fArctic; 847 847 if (MyMap[dLoc(Loc, 0, -2)] and fObserved <> 0) and 848 848 (MyMap[dLoc(Loc, -2, -2)] and fObserved <> 0) and 849 849 (MyMap[dLoc(Loc, 2, -2)] and fObserved <> 0) then 850 result := result or fObserved;851 end; 852 end; 853 854 function TIsoMap.Connection4(Loc, Mask, Value: integer): integer;855 begin 856 result := 0;850 Result := Result or fObserved; 851 end; 852 end; 853 854 function TIsoMap.Connection4(Loc, Mask, Value: Integer): Integer; 855 begin 856 Result := 0; 857 857 if dLoc(Loc, 1, -1) >= 0 then 858 858 begin 859 859 if MyMap[dLoc(Loc, 1, -1)] and Mask = Cardinal(Value) then 860 inc(result, 1);860 Inc(Result, 1); 861 861 if MyMap[dLoc(Loc, -1, -1)] and Mask = Cardinal(Value) then 862 inc(result, 8);862 Inc(Result, 8); 863 863 end; 864 864 if dLoc(Loc, 1, 1) < G.lx * G.ly then 865 865 begin 866 866 if MyMap[dLoc(Loc, 1, 1)] and Mask = Cardinal(Value) then 867 inc(result, 2);867 Inc(Result, 2); 868 868 if MyMap[dLoc(Loc, -1, 1)] and Mask = Cardinal(Value) then 869 inc(result, 4);870 end; 871 end; 872 873 function TIsoMap.Connection8(Loc, Mask: integer): integer;869 Inc(Result, 4); 870 end; 871 end; 872 873 function TIsoMap.Connection8(Loc, Mask: Integer): Integer; 874 874 var 875 875 Dir: Integer; 876 876 ConnLoc: Integer; 877 877 begin 878 result := 0;878 Result := 0; 879 879 for Dir := 0 to 7 do 880 880 begin … … 882 882 if (ConnLoc >= 0) and (ConnLoc < G.lx * G.ly) and 883 883 (MyMap[ConnLoc] and Mask <> 0) then 884 inc(result, 1 shl Dir);885 end; 886 end; 887 888 function TIsoMap.OceanConnection(Loc: integer): integer;884 Inc(Result, 1 shl Dir); 885 end; 886 end; 887 888 function TIsoMap.OceanConnection(Loc: Integer): Integer; 889 889 var 890 890 Dir: Integer; 891 891 ConnLoc: Integer; 892 892 begin 893 result := 0;893 Result := 0; 894 894 for Dir := 0 to 7 do 895 895 begin … … 897 897 if (ConnLoc < 0) or (ConnLoc >= G.lx * G.ly) or 898 898 ((MyMap[ConnLoc] - 2) and fTerrain < 13) then 899 inc(result, 1 shl Dir);900 end; 901 end; 902 903 procedure TIsoMap.PaintShore( x, y, Loc: integer);899 Inc(Result, 1 shl Dir); 900 end; 901 end; 902 903 procedure TIsoMap.PaintShore(X, Y, Loc: Integer); 904 904 var 905 905 Conn: Integer; 906 906 Tile: Integer; 907 907 begin 908 if ( y <= FTop - yyt * 2) or (y > FBottom) or (x<= FLeft - xxt * 2) or909 ( x> FRight) then910 exit;908 if (Y <= FTop - yyt * 2) or (Y > FBottom) or (X <= FLeft - xxt * 2) or 909 (X > FRight) then 910 Exit; 911 911 if (Loc < 0) or (Loc >= G.lx * G.ly) then 912 exit;912 Exit; 913 913 Tile := MyMap[Loc]; 914 914 if Tile and fTerrain >= fGrass then 915 exit;915 Exit; 916 916 Conn := OceanConnection(Loc); 917 917 if Conn = 0 then 918 exit;919 920 BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y, xxt, yyt,918 Exit; 919 920 BitBltBitmap(HGrTerrain.Data, X + xxt div 2, Y, xxt, yyt, 921 921 1 + (Conn shr 6 + Conn and 1 shl 2) * (xxt * 2 + 1), 922 922 1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 923 BitBltBitmap(HGrTerrain.Data, x + xxt, y+ yyt div 2, xxt, yyt,923 BitBltBitmap(HGrTerrain.Data, X + xxt, Y + yyt div 2, xxt, yyt, 924 924 1 + (Conn and 7) * (xxt * 2 + 1) + xxt, 925 925 1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 926 BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y+ yyt, xxt, yyt,926 BitBltBitmap(HGrTerrain.Data, X + xxt div 2, Y + yyt, xxt, yyt, 927 927 1 + (Conn shr 2 and 7) * (xxt * 2 + 1) + xxt, 928 928 1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 929 BitBltBitmap(HGrTerrain.Data, x, y+ yyt div 2, xxt, yyt,929 BitBltBitmap(HGrTerrain.Data, X, Y + yyt div 2, xxt, yyt, 930 930 1 + (Conn shr 4 and 7) * (xxt * 2 + 1), 931 931 1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT); 932 932 Conn := Connection4(Loc, fTerrain, fUNKNOWN); { dither to black } 933 933 if Conn and 1 <> 0 then 934 BitBltBitmap(HGrTerrain.Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +934 BitBltBitmap(HGrTerrain.Mask, X + xxt, Y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) + 935 935 xxt, 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 936 936 if Conn and 2 <> 0 then 937 BitBltBitmap(HGrTerrain.Mask, x + xxt, y+ yyt, xxt, yyt,937 BitBltBitmap(HGrTerrain.Mask, X + xxt, Y + yyt, xxt, yyt, 938 938 1 + 7 * (xxt * 2 + 1) + xxt, 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND); 939 939 if Conn and 4 <> 0 then 940 BitBltBitmap(HGrTerrain.Mask, x, y+ yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),940 BitBltBitmap(HGrTerrain.Mask, X, Y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1), 941 941 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND); 942 942 if Conn and 8 <> 0 then 943 BitBltBitmap(HGrTerrain.Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),943 BitBltBitmap(HGrTerrain.Mask, X, Y, xxt, yyt, 1 + 7 * (xxt * 2 + 1), 944 944 1 + yyt + 15 * (yyt * 3 + 1), SRCAND); 945 945 end; 946 946 947 procedure TIsoMap.PaintTileExtraTerrain( x, y, Loc: integer);948 var 949 Dir, Conn, RRConn, yGr, Tile, yLoc: integer;950 begin 951 if (Loc < 0) or (Loc >= G.lx * G.ly) or ( y<= -yyt * 2) or952 ( y > FOutput.Height) or (x <= -xxt * 2) or (x> FOutput.Width) then953 exit;947 procedure TIsoMap.PaintTileExtraTerrain(X, Y, Loc: Integer); 948 var 949 Dir, Conn, RRConn, yGr, Tile, yLoc: Integer; 950 begin 951 if (Loc < 0) or (Loc >= G.lx * G.ly) or (Y <= -yyt * 2) or 952 (Y > FOutput.Height) or (X <= -xxt * 2) or (X > FOutput.Width) then 953 Exit; 954 954 Tile := MyMap[Loc]; 955 955 if Tile and fTerrain = fForest then … … 966 966 then 967 967 Conn := Conn and not 9; // no connection to north 968 TSprite( x, y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols);968 TSprite(X, Y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols); 969 969 end 970 970 else if Tile and fTerrain in [fHills, fMountains, fForest] then … … 972 972 yGr := 3 + 2 * (Tile and fTerrain - fForest); 973 973 Conn := Connection4(Loc, fTerrain, Tile and fTerrain); 974 TSprite( x, y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols);974 TSprite(X, Y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols); 975 975 end 976 976 else if Tile and fDeadLands <> 0 then 977 TSprite( x, y, spRow2);977 TSprite(X, Y, spRow2); 978 978 979 979 if ShowObjects then 980 980 begin 981 981 if Tile and fTerImp = tiFarm then 982 TSprite( x, y, spFarmLand)982 TSprite(X, Y, spFarmLand) 983 983 else if Tile and fTerImp = tiIrrigation then 984 TSprite( x, y, spIrrigation);984 TSprite(X, Y, spIrrigation); 985 985 end; 986 986 if Tile and fRiver <> 0 then … … 989 989 Connection4(Loc, fTerrain, fShore) or Connection4(Loc, fTerrain, 990 990 fUNKNOWN); 991 TSprite( x, y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols);991 TSprite(X, Y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols); 992 992 end; 993 993 … … 997 997 for Dir := 0 to 3 do 998 998 if Conn and (1 shl Dir) <> 0 then { river mouths } 999 TSprite( x, y, spRiverMouths + Dir);999 TSprite(X, Y, spRiverMouths + Dir); 1000 1000 if ShowObjects then 1001 1001 begin … … 1003 1003 for Dir := 0 to 7 do 1004 1004 if Conn and (1 shl Dir) <> 0 then { canal mouths } 1005 TSprite( x, y, spCanalMouths + 1 + Dir);1005 TSprite(X, Y, spCanalMouths + 1 + Dir); 1006 1006 end; 1007 1007 end; … … 1015 1015 if Conn = 0 then begin 1016 1016 if Tile and fCanal <> 0 then 1017 TSprite( x, y, spCanal);1017 TSprite(X, Y, spCanal); 1018 1018 end 1019 1019 else 1020 1020 for Dir := 0 to 7 do 1021 1021 if (1 shl Dir) and Conn <> 0 then 1022 TSprite( x, y, spCanal + 1 + Dir);1022 TSprite(X, Y, spCanal + 1 + Dir); 1023 1023 end; 1024 1024 … … 1032 1032 Conn := Connection8(Loc, fRoad or fRR or fCity) and not RRConn; 1033 1033 if (Conn = 0) and (Tile and (fRR or fCity) = 0) then 1034 TSprite( x, y, spRoad)1034 TSprite(X, Y, spRoad) 1035 1035 else if Conn > 0 then 1036 1036 for Dir := 0 to 7 do 1037 1037 if (1 shl Dir) and Conn <> 0 then 1038 TSprite( x, y, spRoad + 1 + Dir);1038 TSprite(X, Y, spRoad + 1 + Dir); 1039 1039 end; 1040 1040 1041 1041 // Paint railroad connections 1042 1042 if (Tile and fRR <> 0) and (RRConn = 0) then 1043 TSprite( x, y, spRailRoad)1043 TSprite(X, Y, spRailRoad) 1044 1044 else if RRConn > 0 then begin 1045 1045 for Dir := 0 to 7 do 1046 1046 if (1 shl Dir) and RRConn <> 0 then 1047 TSprite( x, y, spRailRoad + 1 + Dir);1047 TSprite(X, Y, spRailRoad + 1 + Dir); 1048 1048 end; 1049 1049 end; … … 1051 1051 1052 1052 // (x,y) is top left pixel of (2*xxt,3*yyt) rectangle 1053 procedure TIsoMap.PaintTileObjects( x, y, Loc, CityLoc, CityOwner: integer;1054 UseBlink: boolean);1055 var 1056 p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: integer;1053 procedure TIsoMap.PaintTileObjects(X, Y, Loc, CityLoc, CityOwner: Integer; 1054 UseBlink: Boolean); 1055 var 1056 p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: Integer; 1057 1057 CityInfo: TCityInfo; 1058 1058 UnitInfo: TUnitInfo; 1059 fog: boolean;1059 fog: Boolean; 1060 1060 SpecialRow: Integer; 1061 1061 SpecialCol: Integer; … … 1063 1063 procedure NameCity; 1064 1064 var 1065 cix, xs, w: integer;1065 cix, xs, W: Integer; 1066 1066 BehindCityInfo: TCityInfo; 1067 s: string;1068 IsCapital: boolean;1067 S: string; 1068 IsCapital: Boolean; 1069 1069 begin 1070 1070 BehindCityInfo.Loc := Loc - 2 * G.lx; … … 1076 1076 IsCapital := BehindCityInfo.Flags and ciCapital <> 0; 1077 1077 { if Showuix and (cix>=0) then s:=IntToStr(cix) 1078 else } s:= CityName(BehindCityInfo.ID);1079 w := FOutput.Canvas.TextWidth(s);1080 xs := x + xxt - (w+ 1) div 2;1078 else } S := CityName(BehindCityInfo.ID); 1079 W := FOutput.Canvas.TextWidth(S); 1080 xs := X + xxt - (W + 1) div 2; 1081 1081 if IsCapital then 1082 1082 FOutput.Canvas.Font.Style := FOutput.Canvas.Font.Style + [fsUnderline]; 1083 Textout(xs + 1, y - 9, $000000, s);1084 Textout(xs, y - 10, $FFFFFF, s);1083 Textout(xs + 1, Y - 9, $000000, S); 1084 Textout(xs, Y - 10, $FFFFFF, S); 1085 1085 if IsCapital then 1086 1086 FOutput.Canvas.Font.Style := FOutput.Canvas.Font.Style - [fsUnderline]; … … 1092 1092 if ShowObjects and not (moEditMode in MapOptions) and 1093 1093 (Tile and fCity <> 0) and (CityInfo.Flags and ciSpacePort <> 0) then 1094 TSprite( x + xxt, y- 6, spSpacePort);1094 TSprite(X + xxt, Y - 6, spSpacePort); 1095 1095 end; 1096 1096 1097 1097 procedure PaintBorder; 1098 1098 var 1099 dx, dy: integer;1099 dx, dy: Integer; 1100 1100 begin 1101 1101 if ShowBorder and (Loc >= 0) and (Loc < G.lx * G.ly) and 1102 1102 (Tile and fTerrain <> fUNKNOWN) then begin 1103 1103 p1 := MyRO.Territory[Loc]; 1104 if (p1 >= 0) and (ShowMyBorder or (p1 <> me)) then begin1104 if (p1 >= 0) and (ShowMyBorder or (p1 <> Me)) then begin 1105 1105 if BordersOK^ and (1 shl p1) = 0 then begin 1106 1106 UnshareBitmap(Borders); … … 1123 1123 if p2 <> p1 then 1124 1124 begin 1125 BitBltBitmap(HGrTerrain.Mask, x + dx * xxt, y+ dy * yyt, xxt,1125 BitBltBitmap(HGrTerrain.Mask, X + dx * xxt, Y + dy * yyt, xxt, 1126 1126 yyt, 1 + 8 * (xxt * 2 + 1) + dx * xxt, 1127 1127 1 + yyt + 16 * (yyt * 3 + 1) + dy * yyt, SRCAND); 1128 BitBltBitmap(Borders, x + dx * xxt, y+ dy * yyt, xxt, yyt, dx * xxt,1128 BitBltBitmap(Borders, X + dx * xxt, Y + dy * yyt, xxt, yyt, dx * xxt, 1129 1129 p1 * (yyt * 2) + dy * yyt, SRCPAINT); 1130 1130 end; … … 1143 1143 (Tile and fCity <> 0) then 1144 1144 GetCityInfo(Loc, cix, CityInfo); 1145 if ( y <= FTop - yyt * 2) or (y > FBottom) or (x<= FLeft - xxt * 2) or1146 ( x> FRight) then1145 if (Y <= FTop - yyt * 2) or (Y > FBottom) or (X <= FLeft - xxt * 2) or 1146 (X > FRight) then 1147 1147 begin 1148 1148 NameCity; 1149 1149 ShowSpacePort; 1150 exit;1150 Exit; 1151 1151 end; 1152 1152 if Tile and fTerrain = fUNKNOWN then … … 1154 1154 NameCity; 1155 1155 ShowSpacePort; 1156 exit;1156 Exit; 1157 1157 end; { square not discovered } 1158 1158 … … 1161 1161 1162 1162 if (Loc >= 0) and (Loc < G.lx * G.ly) and (Loc = FAdviceLoc) then 1163 TSprite( x, y, spPlain);1163 TSprite(X, Y, spPlain); 1164 1164 1165 1165 if (Loc >= 0) and (Loc < G.lx * G.ly) and (Tile and fSpecial <> 0) … … 1170 1170 SpecialRow := Tile and fSpecial shr 5; 1171 1171 if SpecialCol < fForest then 1172 TSprite( x, y, SpecialCol + SpecialRow * TerrainIconCols)1172 TSprite(X, Y, SpecialCol + SpecialRow * TerrainIconCols) 1173 1173 else if (SpecialCol = fForest) and IsJungle(dy) then 1174 TSprite( x, y, spJungle - 1 + SpecialRow * TerrainIconCols)1174 TSprite(X, Y, spJungle - 1 + SpecialRow * TerrainIconCols) 1175 1175 else 1176 TSprite( x, y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols);1176 TSprite(X, Y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols); 1177 1177 end; 1178 1178 … … 1180 1180 begin 1181 1181 if Tile and fTerImp = tiMine then 1182 TSprite( x, y, spMine);1182 TSprite(X, Y, spMine); 1183 1183 if Tile and fTerImp = tiBase then 1184 TSprite( x, y, spBase);1184 TSprite(X, Y, spBase); 1185 1185 if Tile and fPoll <> 0 then 1186 TSprite( x, y, spPollution);1186 TSprite(X, Y, spPollution); 1187 1187 if Tile and fTerImp = tiFort then 1188 1188 begin 1189 TSprite( x, y, spFortBack);1189 TSprite(X, Y, spFortBack); 1190 1190 if Tile and fObserved = 0 then 1191 TSprite( x, y, spFortFront);1191 TSprite(X, Y, spFortFront); 1192 1192 end; 1193 1193 end; 1194 1194 if (Tile and fDeadLands) <> 0 then 1195 TSprite( x, y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);1195 TSprite(X, Y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols); 1196 1196 1197 1197 if moEditMode in MapOptions then … … 1205 1205 if fog and ShowObjects then 1206 1206 if Loc < -G.lx then 1207 Sprite(HGrTerrain, x, y+ yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),1207 Sprite(HGrTerrain, X, Y + yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1), 1208 1208 1 + yyt * 2 + 15 * (yyt * 3 + 1)) 1209 1209 else if Loc >= G.lx * (G.ly + 1) then 1210 Sprite(HGrTerrain, x, y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),1210 Sprite(HGrTerrain, X, Y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1), 1211 1211 1 + yyt + 15 * (yyt * 3 + 1)) 1212 1212 else 1213 TSprite( x, y, spGrid, xxt <> 33);1213 TSprite(X, Y, spGrid, xxt <> 33); 1214 1214 1215 1215 if FoW and (Tile and fObserved = 0) then … … 1224 1224 if (Destination = Loc) and (Destination <> MyUn[UnFocus].Loc) then 1225 1225 if not UseBlink or BlinkOn then 1226 TSprite( x, y, spBlink1)1226 TSprite(X, Y, spBlink1) 1227 1227 else 1228 TSprite( x, y, spBlink2)1228 TSprite(X, Y, spBlink2) 1229 1229 end; 1230 1230 {$ENDIF} … … 1232 1232 begin 1233 1233 if Tile and fPrefStartPos <> 0 then 1234 TSprite( x, y, spPrefStartPos)1234 TSprite(X, Y, spPrefStartPos) 1235 1235 else if Tile and fStartPos <> 0 then 1236 TSprite( x, y, spStartPos);1236 TSprite(X, Y, spStartPos); 1237 1237 end 1238 1238 else if ShowObjects then 1239 1239 begin 1240 1240 { if (CityLoc<0) and (UnFocus>=0) and (Loc=MyUn[UnFocus].Loc) then 1241 if BlinkOn then TSprite( x,y,8+9*0)1242 else TSprite( x,y,8+9*1); }1241 if BlinkOn then TSprite(X,Y,8+9*0) 1242 else TSprite(X,Y,8+9*1); } 1243 1243 1244 1244 NameCity; 1245 1245 ShowSpacePort; 1246 1246 if Tile and fCity <> 0 then 1247 PaintCity( x + xxt, y+ yyt, CityInfo, CityOwner < 0);1247 PaintCity(X + xxt, Y + yyt, CityInfo, CityOwner < 0); 1248 1248 1249 1249 if (Tile and fUnit <> 0) and (Loc <> AttLoc) and … … 1259 1259 UnitInfo.Health := DefHealth; 1260 1260 if (UnitInfo.Owner <> CityOwner) and 1261 not((CityOwner = me) and (MyRO.Treaty[UnitInfo.Owner] = trAlliance))1261 not((CityOwner = Me) and (MyRO.Treaty[UnitInfo.Owner] = trAlliance)) 1262 1262 then 1263 1263 {$IFNDEF SCR} if (UnFocus >= 0) and (Loc = MyUn[UnFocus].Loc) then { active unit } 1264 1264 begin 1265 1265 Multi := UnitInfo.Flags and unMulti; 1266 MakeUnitInfo( me, MyUn[UnFocus], UnitInfo);1266 MakeUnitInfo(Me, MyUn[UnFocus], UnitInfo); 1267 1267 UnitInfo.Flags := UnitInfo.Flags or Multi; 1268 PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo,1268 PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 1269 1269 MyUn[UnFocus].Status); 1270 1270 end 1271 else if UnitInfo.Owner = me then1271 else if UnitInfo.Owner = Me then 1272 1272 begin 1273 1273 if ClientMode = cMovieTurn then 1274 PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo, 0)1274 PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 0) 1275 1275 // status is not set with precise timing during loading 1276 1276 else 1277 PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo,1277 PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 1278 1278 MyUn[uix].Status); 1279 1279 // if Showuix then Textout(x+16,y+5,$80FF00,IntToStr(uix)); 1280 1280 end 1281 else {$ENDIF} PaintUnit( x + (xxt - xxu), y+ (yyt - yyu_anchor), UnitInfo, 0);1281 else {$ENDIF} PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 0); 1282 1282 end 1283 1283 else if Tile and fHiddenUnit <> 0 then 1284 Sprite(HGrStdUnits, x + (xxt - xxu), y+ (yyt - yyu_anchor), xxu * 2,1284 Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2, 1285 1285 yyu * 2, 1 + 5 * (xxu * 2 + 1), 1) 1286 1286 else if Tile and fStealthUnit <> 0 then 1287 Sprite(HGrStdUnits, x + (xxt - xxu), y+ (yyt - yyu_anchor), xxu * 2,1287 Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2, 1288 1288 yyu * 2, 1 + 5 * (xxu * 2 + 1), 1 + 1 * (yyu * 2 + 1)) 1289 1289 end; … … 1291 1291 if ShowObjects and (Tile and fTerImp = tiFort) and (Tile and fObserved <> 0) 1292 1292 then 1293 TSprite( x, y, spFortFront);1293 TSprite(X, Y, spFortFront); 1294 1294 1295 1295 if (Loc >= 0) and (Loc < G.lx * G.ly) then 1296 1296 if ShowLoc then 1297 Textout( x + xxt - 16, y+ yyt - 9, $FFFF00, IntToStr(Loc))1297 Textout(X + xxt - 16, Y + yyt - 9, $FFFF00, IntToStr(Loc)) 1298 1298 else if ShowDebug and (DebugMap <> nil) and (Loc >= 0) and 1299 1299 (Loc < G.lx * G.ly) and (DebugMap[Loc] <> 0) then 1300 Textout( x + xxt - 16, y+ yyt - 9, $00E0FF,1301 IntToStr( integer(DebugMap[Loc])))1302 end; 1303 1304 procedure TIsoMap.PaintGrid( x, y, nx, ny: integer);1305 1306 procedure ClippedLine(dx0, dy0: integer; mirror: boolean);1300 Textout(X + xxt - 16, Y + yyt - 9, $00E0FF, 1301 IntToStr(Integer(DebugMap[Loc]))) 1302 end; 1303 1304 procedure TIsoMap.PaintGrid(X, Y, nx, ny: Integer); 1305 1306 procedure ClippedLine(dx0, dy0: Integer; mirror: Boolean); 1307 1307 var 1308 x0, x1, dxmin, dymin, dxmax, dymax, n: integer;1308 x0, x1, dxmin, dymin, dxmax, dymax, N: Integer; 1309 1309 begin 1310 1310 with FOutput.Canvas do 1311 1311 begin 1312 dxmin := (FLeft - x) div xxt;1313 dymin := (RealTop - y) div yyt;1314 dxmax := (FRight - x- 1) div xxt + 1;1315 dymax := (RealBottom - y- 1) div yyt + 1;1316 n:= dymax - dy0;1312 dxmin := (FLeft - X) div xxt; 1313 dymin := (RealTop - Y) div yyt; 1314 dxmax := (FRight - X - 1) div xxt + 1; 1315 dymax := (RealBottom - Y - 1) div yyt + 1; 1316 N := dymax - dy0; 1317 1317 if mirror then 1318 1318 begin 1319 if dx0 - dxmin < nthen1320 n:= dx0 - dxmin;1319 if dx0 - dxmin < N then 1320 N := dx0 - dxmin; 1321 1321 if dx0 > dxmax then 1322 1322 begin 1323 n := n- (dx0 - dxmax);1323 N := N - (dx0 - dxmax); 1324 1324 dy0 := dy0 + (dx0 - dxmax); 1325 1325 dx0 := dxmax … … 1327 1327 if dy0 < dymin then 1328 1328 begin 1329 n := n- (dymin - dy0);1329 N := N - (dymin - dy0); 1330 1330 dx0 := dx0 - (dymin - dy0); 1331 1331 dy0 := dymin … … 1334 1334 else 1335 1335 begin 1336 if dxmax - dx0 < nthen1337 n:= dxmax - dx0;1336 if dxmax - dx0 < N then 1337 N := dxmax - dx0; 1338 1338 if dx0 < dxmin then 1339 1339 begin 1340 n := n- (dxmin - dx0);1340 N := N - (dxmin - dx0); 1341 1341 dy0 := dy0 + (dxmin - dx0); 1342 1342 dx0 := dxmin … … 1344 1344 if dy0 < dymin then 1345 1345 begin 1346 n := n- (dymin - dy0);1346 N := N - (dymin - dy0); 1347 1347 dx0 := dx0 + (dymin - dy0); 1348 1348 dy0 := dymin 1349 1349 end; 1350 1350 end; 1351 if n<= 0 then1352 exit;1351 if N <= 0 then 1352 Exit; 1353 1353 if mirror then 1354 1354 begin 1355 x0 := x+ dx0 * xxt - 1;1356 x1 := x + (dx0 - n) * xxt - 1;1355 x0 := X + dx0 * xxt - 1; 1356 x1 := X + (dx0 - N) * xxt - 1; 1357 1357 end 1358 1358 else 1359 1359 begin 1360 x0 := x+ dx0 * xxt;1361 x1 := x + (dx0 + n) * xxt;1360 x0 := X + dx0 * xxt; 1361 x1 := X + (dx0 + N) * xxt; 1362 1362 end; 1363 moveto(x0, y+ dy0 * yyt);1364 lineto(x1, y + (dy0 + n) * yyt);1363 moveto(x0, Y + dy0 * yyt); 1364 lineto(x1, Y + (dy0 + N) * yyt); 1365 1365 end; 1366 1366 end; 1367 1367 1368 1368 var 1369 i: integer;1369 I: Integer; 1370 1370 begin 1371 1371 FOutput.Canvas.pen.Color := $000000; // $FF shl (8*random(3)); 1372 for i:= 0 to nx div 2 do1373 ClippedLine( i * 2, 0, false);1374 for i:= 1 to (nx + 1) div 2 do1375 ClippedLine( i * 2, 0, true);1376 for i:= 0 to ny div 2 do1377 begin 1378 ClippedLine(0, 2 * i + 2, false);1379 ClippedLine(nx + 1, 2 * i + 1 + nx and 1, true);1380 end; 1381 end; 1382 1383 function TIsoMap.IsShoreTile(Loc: integer): boolean;1372 for I := 0 to nx div 2 do 1373 ClippedLine(I * 2, 0, False); 1374 for I := 1 to (nx + 1) div 2 do 1375 ClippedLine(I * 2, 0, True); 1376 for I := 0 to ny div 2 do 1377 begin 1378 ClippedLine(0, 2 * I + 2, False); 1379 ClippedLine(nx + 1, 2 * I + 1 + nx and 1, True); 1380 end; 1381 end; 1382 1383 function TIsoMap.IsShoreTile(Loc: Integer): Boolean; 1384 1384 var 1385 1385 Dir: Integer; 1386 ConnLoc: integer;1387 begin 1388 result := false;1386 ConnLoc: Integer; 1387 begin 1388 Result := False; 1389 1389 for Dir := 0 to 7 do 1390 1390 begin … … 1392 1392 if (ConnLoc < 0) or (ConnLoc >= G.lx * G.ly) or 1393 1393 ((MyMap[ConnLoc] - 2) and fTerrain < 13) then 1394 result := true;1394 Result := True; 1395 1395 end; 1396 1396 end; … … 1401 1401 begin 1402 1402 for I := 0 to Length - 1 do begin 1403 Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7 f;1404 Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7 f;1405 Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7 f;1403 Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7F; 1404 Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7F; 1405 Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7F; 1406 1406 Line^.NextPixel; 1407 1407 end; … … 1415 1415 end; 1416 1416 1417 procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: integer);1417 procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: Integer); 1418 1418 const 1419 1419 rShade = 3.75; 1420 1420 var 1421 y, wBright: integer;1422 y_n, w_n: single;1421 Y, wBright: Integer; 1422 y_n, w_n: Single; 1423 1423 Line: TPixelPointer; 1424 1424 begin 1425 1425 FOutput.BeginUpdate; 1426 1426 Line := PixelPointer(FOutput, ScaleToNative(x0), ScaleToNative(y0)); 1427 for y:= 0 to ScaleToNative(Height) - 1 do begin1428 y_n := (ScaleFromNative( y) + y0 - ym) / yyt;1427 for Y := 0 to ScaleToNative(Height) - 1 do begin 1428 y_n := (ScaleFromNative(Y) + y0 - ym) / yyt; 1429 1429 if abs(y_n) < rShade then begin 1430 1430 // Darken left and right parts of elipsis … … 1445 1445 end; 1446 1446 1447 procedure TIsoMap.CityGrid(xm, ym: integer; CityAllowClick: Boolean);1448 var 1449 i: integer;1447 procedure TIsoMap.CityGrid(xm, ym: Integer; CityAllowClick: Boolean); 1448 var 1449 I: Integer; 1450 1450 begin 1451 1451 with FOutput.Canvas do … … 1456 1456 pen.Color := $000000; 1457 1457 pen.Width := 1; 1458 for i:= 0 to 3 do1458 for I := 0 to 3 do 1459 1459 begin 1460 moveto(xm - xxt * (4 - i), ym + yyt * (1 + i));1461 lineto(xm + xxt * (1 + i), ym - yyt * (4 - i));1462 moveto(xm - xxt * (4 - i), ym - yyt * (1 + i));1463 lineto(xm + xxt * (1 + i), ym + yyt * (4 - i));1460 moveto(xm - xxt * (4 - I), ym + yyt * (1 + I)); 1461 lineto(xm + xxt * (1 + I), ym - yyt * (4 - I)); 1462 moveto(xm - xxt * (4 - I), ym - yyt * (1 + I)); 1463 lineto(xm + xxt * (1 + I), ym + yyt * (4 - I)); 1464 1464 end; 1465 1465 moveto(xm - xxt * 4, ym + yyt * 1); … … 1475 1475 end; 1476 1476 1477 procedure TIsoMap.Paint( x, y, Loc, nx, ny, CityLoc, CityOwner: integer;1478 UseBlink: boolean; CityAllowClick: boolean);1479 var 1480 dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: integer;1481 begin 1482 FoW := true;1477 procedure TIsoMap.Paint(X, Y, Loc, nx, ny, CityLoc, CityOwner: Integer; 1478 UseBlink: Boolean; CityAllowClick: Boolean); 1479 var 1480 dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: Integer; 1481 begin 1482 FoW := True; 1483 1483 ShowLoc := moLocCodes in MapOptions; 1484 1484 ShowDebug := pDebugMap >= 0; … … 1486 1486 ShowCityNames := ShowObjects and (CityOwner < 0) and 1487 1487 (moCityNames in MapOptions); 1488 ShowBorder := true;1488 ShowBorder := True; 1489 1489 ShowMyBorder := CityOwner < 0; 1490 1490 ShowGrWall := (CityOwner < 0) and (moGreatWall in MapOptions); 1491 1491 if ShowDebug then 1492 Server(sGetDebugMap, me, pDebugMap, DebugMap)1492 Server(sGetDebugMap, Me, pDebugMap, DebugMap) 1493 1493 else 1494 1494 DebugMap := nil; 1495 1495 with FOutput.Canvas do 1496 1496 begin 1497 RealTop := y- ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt;1498 RealBottom := y+ (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) +1497 RealTop := Y - ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt; 1498 RealBottom := Y + (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) + 1499 1499 3) * yyt; 1500 1500 Brush.Color := EmptySpaceColor; … … 1573 1573 bix := 0; 1574 1574 end; 1575 BitBltBitmap(OceanPatch, x + dx * xxt, y+ dy * yyt, xxt, yyt,1575 BitBltBitmap(OceanPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1576 1576 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY) 1577 1577 end … … 1621 1621 bix := Aix; 1622 1622 if Aix = -1 then 1623 BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y+ dy * yyt, xxt,1623 BitBltBitmap(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1624 1624 yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt, 1625 1625 SRCCOPY) // arctic <-> ocean 1626 1626 else if bix = -1 then 1627 BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y+ dy * yyt, xxt,1627 BitBltBitmap(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt, 1628 1628 yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt, 1629 1629 1 + yyt * 2, SRCCOPY) // arctic <-> ocean 1630 1630 else 1631 BitBltBitmap(LandPatch, x + dx * xxt, y+ dy * yyt, xxt, yyt,1631 BitBltBitmap(LandPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt, 1632 1632 Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY) 1633 1633 end; … … 1639 1639 for dx := -1 to nx do 1640 1640 if (dx + dy) and 1 = 0 then 1641 PaintShore( x + xxt * dx, y+ yyt + yyt * dy, dLoc(Loc, dx, dy));1641 PaintShore(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy)); 1642 1642 for dy := -2 to ny + 1 do 1643 1643 for dx := -1 to nx do 1644 1644 if (dx + dy) and 1 = 0 then 1645 PaintTileExtraTerrain( x + xxt * dx, y+ yyt + yyt * dy,1645 PaintTileExtraTerrain(X + xxt * dx, Y + yyt + yyt * dy, 1646 1646 dLoc(Loc, dx, dy)); 1647 1647 if CityOwner >= 0 then … … 1653 1653 ALoc := dLoc(Loc, dx, dy); 1654 1654 if Distance(ALoc, CityLoc) > 5 then 1655 PaintTileObjects( x + xxt * dx, y+ yyt + yyt * dy, ALoc, CityLoc,1655 PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc, 1656 1656 CityOwner, UseBlink); 1657 1657 end; … … 1660 1660 * G.lx) mod (2 * G.lx) - G.lx; 1661 1661 dy := CityLoc div G.lx - (Loc + 666 * G.lx) div G.lx + 666; 1662 xm := x+ (dx + 1) * xxt;1663 ym := y+ (dy + 1) * yyt + yyt;1662 xm := X + (dx + 1) * xxt; 1663 ym := Y + (dy + 1) * yyt + yyt; 1664 1664 ShadeOutside(FLeft, FTop, FRight - FLeft, FBottom - FTop, xm, ym); 1665 1665 CityGrid(xm, ym, CityAllowClick); … … 1670 1670 ALoc := dLoc(Loc, dx, dy); 1671 1671 if Distance(ALoc, CityLoc) <= 5 then 1672 PaintTileObjects( x + xxt * dx, y+ yyt + yyt * dy, ALoc, CityLoc,1672 PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc, 1673 1673 CityOwner, UseBlink); 1674 1674 end; … … 1678 1678 if ShowLoc or (moEditMode in MapOptions) or 1679 1679 (moGrid in MapOptions) then 1680 PaintGrid( x, y, nx, ny);1680 PaintGrid(X, Y, nx, ny); 1681 1681 for dy := -2 to ny + 1 do 1682 1682 for dx := -2 to nx + 1 do 1683 1683 if (dx + dy) and 1 = 0 then 1684 PaintTileObjects( x + xxt * dx, y+ yyt + yyt * dy, dLoc(Loc, dx, dy),1684 PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy), 1685 1685 CityLoc, CityOwner, UseBlink); 1686 1686 end; -
trunk/LocalPlayer/LocalPlayer.pas
r364 r447 4 4 interface 5 5 6 procedure Client(Command, Player: integer; var Data); stdcall;7 procedure SetAIName( p: integer; Name: string);6 procedure Client(Command, Player: Integer; var Data); stdcall; 7 procedure SetAIName(P: Integer; Name: string); 8 8 9 9 implementation … … 14 14 15 15 var 16 FormsCreated: boolean;16 FormsCreated: Boolean; 17 17 18 procedure Client(Command, Player: integer; var Data);18 procedure Client(Command, Player: Integer; var Data); 19 19 begin 20 20 if not FormsCreated then 21 21 begin 22 FormsCreated := true;22 FormsCreated := True; 23 23 // TODO: Changing application name in runtime will cause change of Linux XML registry file path 24 24 // Application.MainForm := MainScreen; … … 45 45 end; 46 46 47 procedure SetAIName( p: integer; Name: string);47 procedure SetAIName(P: Integer; Name: string); 48 48 begin 49 MainScreen.SetAIName( p, Name);49 MainScreen.SetAIName(P, Name); 50 50 end; 51 51 52 52 initialization 53 53 54 FormsCreated := false;54 FormsCreated := False; 55 55 56 56 end. -
trunk/LocalPlayer/MessgEx.pas
r442 r447 39 39 IconKind: TMessageIconKind; 40 40 OpenSound: string; 41 function ShowModal: integer; override;41 function ShowModal: Integer; override; 42 42 procedure CancelMovie; 43 43 private 44 MovieCancelled: boolean;45 procedure PaintBook(ca: TCanvas; x, y, clPage, clCover: integer);44 MovieCancelled: Boolean; 45 procedure PaintBook(ca: TCanvas; X, Y, clPage, clCover: Integer); 46 46 procedure PaintMyArmy; 47 47 procedure PaintEnemyArmy; … … 53 53 54 54 procedure SoundMessageEx(SimpleText, SoundItem: string); 55 procedure TribeMessage( p: integer; SimpleText, SoundItem: string);55 procedure TribeMessage(P: Integer; SimpleText, SoundItem: string); 56 56 function SimpleQuery(QueryKind: TMessageKind; SimpleText, SoundItem: string) 57 : integer;57 : Integer; 58 58 procedure ContextMessage(SimpleText, SoundItem: string; 59 ContextKind, ContextNo: integer);59 ContextKind, ContextNo: Integer); 60 60 61 61 … … 81 81 procedure TMessgExDlg.FormShow(Sender: TObject); 82 82 var 83 i: integer;83 I: Integer; 84 84 begin 85 85 if IconKind = mikEnemyArmy then … … 150 150 end; 151 151 152 SplitText( true);152 SplitText(True); 153 153 ClientHeight := 72 + Border + TopSpace + Lines * MessageLineSpacing; 154 154 if GameMode = cMovie then … … 181 181 end; 182 182 end; 183 for i:= 0 to ControlCount - 1 do184 Controls[ i].Top := ClientHeight - (34 + Border);183 for I := 0 to ControlCount - 1 do 184 Controls[I].Top := ClientHeight - (34 + Border); 185 185 if Kind = mkModel then 186 186 EInput.Top := ClientHeight - (76 + Border); 187 187 end; 188 188 189 function TMessgExDlg.ShowModal: integer;189 function TMessgExDlg.ShowModal: Integer; 190 190 var 191 191 Ticks0: TDateTime; … … 197 197 if not((GameMode = cMovie) and (MovieSpeed = 4)) then 198 198 begin 199 MovieCancelled := false;199 MovieCancelled := False; 200 200 Show; 201 201 Ticks0 := NowPrecise; … … 207 207 Hide; 208 208 end; 209 result := mrOk;209 Result := mrOk; 210 210 end 211 211 else 212 result := inherited;212 Result := inherited; 213 213 Gtk2Fix; 214 214 end; … … 216 216 procedure TMessgExDlg.CancelMovie; 217 217 begin 218 MovieCancelled := true;219 end; 220 221 procedure TMessgExDlg.PaintBook(ca: TCanvas; x, y, clPage, clCover: integer);218 MovieCancelled := True; 219 end; 220 221 procedure TMessgExDlg.PaintBook(ca: TCanvas; X, Y, clPage, clCover: Integer); 222 222 const 223 223 xScrewed = 77; … … 228 228 TScrewed = array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of Single; 229 229 var 230 ix, iy, xDst, yDst, dx, dy, xIcon, yIcon: integer;230 ix, iy, xDst, yDst, dx, dy, xIcon, yIcon: Integer; 231 231 BookRect: TRect; 232 x1, xR, yR, share: single;232 x1, xR, yR, share: Single; 233 233 Screwed: TScrewed; 234 234 SrcPtr: TPixelPointer; … … 284 284 BookRect := SmallBook.BoundsRect; 285 285 end; 286 x := x- BookRect.Width div 2;286 X := X - BookRect.Width div 2; 287 287 288 288 // paint 289 289 UnshareBitmap(LogoBuffer); 290 BitBltCanvas(LogoBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, ca, x, y);290 BitBltCanvas(LogoBuffer.Canvas, 0, 0, BookRect.Width, BookRect.Height, ca, X, Y); 291 291 292 292 if IconIndex >= 0 then … … 301 301 ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), BookRect, clCover, clPage); 302 302 303 BitBltCanvas(ca, x, y, BookRect.Width, BookRect.Height, LogoBuffer.Canvas, 0, 0);303 BitBltCanvas(ca, X, Y, BookRect.Width, BookRect.Height, LogoBuffer.Canvas, 0, 0); 304 304 end; 305 305 … … 310 310 procedure TMessgExDlg.PaintEnemyArmy; 311 311 var 312 emix, ix, iy, x, y, count, UnitsInLine: integer;312 emix, ix, iy, X, Y, count, UnitsInLine: Integer; 313 313 begin 314 314 ix := 0; … … 321 321 for count := 0 to LostArmy[emix] - 1 do 322 322 begin 323 x:= ClientWidth div 2 + ix * 64 - UnitsInLine * 32;324 y:= 26 + Border + TopSpace + Lines * MessageLineSpacing + iy * 48;323 X := ClientWidth div 2 + ix * 64 - UnitsInLine * 32; 324 Y := 26 + Border + TopSpace + Lines * MessageLineSpacing + iy * 48; 325 325 with MyRO.EnemyModel[emix], Tribe[Owner].ModelPicture[mix] do 326 326 begin 327 BitBltCanvas(Canvas, x, y, 64, 48, HGr.Mask.Canvas,327 BitBltCanvas(Canvas, X, Y, 64, 48, HGr.Mask.Canvas, 328 328 pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCAND); 329 BitBltCanvas(Canvas, x, y, 64, 48, HGr.Data.Canvas,329 BitBltCanvas(Canvas, X, Y, 64, 48, HGr.Data.Canvas, 330 330 pix mod 10 * 65 + 1, pix div 10 * 49 + 1, SRCPAINT); 331 331 end; 332 332 333 333 // next position 334 inc(ix);334 Inc(ix); 335 335 if ix = LostUnitsPerLine then 336 336 begin // next line 337 337 ix := 0; 338 inc(iy);338 Inc(iy); 339 339 if iy = 6 then 340 exit;340 Exit; 341 341 UnitsInLine := nLostArmy - LostUnitsPerLine * iy; 342 342 if UnitsInLine > LostUnitsPerLine then … … 348 348 procedure TMessgExDlg.FormPaint(Sender: TObject); 349 349 var 350 p1, clSaveTextLight, clSaveTextShade: integer;350 p1, clSaveTextLight, clSaveTextShade: Integer; 351 351 begin 352 352 if (IconKind = mikImp) and (IconIndex = 27) then … … 394 394 end; 395 395 mikModel: 396 with Tribe[ me].ModelPicture[IconIndex] do396 with Tribe[Me].ModelPicture[IconIndex] do 397 397 begin 398 398 FrameImage(Canvas, BigImp, ClientWidth div 2 - 28, 24, xSizeBig, … … 498 498 end; 499 499 500 procedure TribeMessage( p: integer; SimpleText, SoundItem: string);500 procedure TribeMessage(P: Integer; SimpleText, SoundItem: string); 501 501 begin 502 502 with MessgExDlg do … … 506 506 Kind := mkOk; 507 507 IconKind := mikTribe; 508 IconIndex := p;508 IconIndex := P; 509 509 ShowModal; 510 510 end; … … 512 512 513 513 function SimpleQuery(QueryKind: TMessageKind; SimpleText, SoundItem: string) 514 : integer;514 : Integer; 515 515 begin 516 516 with MessgExDlg do … … 520 520 Kind := QueryKind; 521 521 ShowModal; 522 result := ModalResult;522 Result := ModalResult; 523 523 end; 524 524 end; 525 525 526 526 procedure ContextMessage(SimpleText, SoundItem: string; 527 ContextKind, ContextNo: integer);527 ContextKind, ContextNo: Integer); 528 528 begin 529 529 with MessgExDlg do -
trunk/LocalPlayer/NatStat.pas
r442 r447 25 25 procedure ToggleBtnClick(Sender: TObject); 26 26 procedure PlayerClick(Sender: TObject); 27 procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);27 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 28 28 procedure FormDestroy(Sender: TObject); 29 29 procedure ScrollUpBtnClick(Sender: TObject); … … 32 32 public 33 33 procedure CheckAge; 34 procedure ShowNewContent(NewMode: TWindowMode; p: integer = -1);34 procedure ShowNewContent(NewMode: TWindowMode; P: Integer = -1); 35 35 procedure EcoChange; 36 36 protected 37 37 procedure OffscreenPaint; override; 38 38 private 39 pView, AgePrepared, LinesDown: integer;39 pView, AgePrepared, LinesDown: Integer; 40 40 SelfReport, CurrentReport: PEnemyReport; 41 ShowContact, ContactEnabled: boolean;41 ShowContact, ContactEnabled: Boolean; 42 42 Back, Template: TBitmap; 43 43 ReportText: TStringList; … … 114 114 procedure TNatStatDlg.FormShow(Sender: TObject); 115 115 begin 116 if pView = me then116 if pView = Me then 117 117 begin 118 118 SelfReport.TurnOfCivilReport := MyRO.Turn; 119 119 SelfReport.TurnOfMilReport := MyRO.Turn; 120 move(MyRO.Treaty, SelfReport.Treaty, SizeOf(SelfReport.Treaty));120 Move(MyRO.Treaty, SelfReport.Treaty, SizeOf(SelfReport.Treaty)); 121 121 SelfReport.Government := MyRO.Government; 122 122 SelfReport.Money := MyRO.Money; 123 CurrentReport := pointer(SelfReport);123 CurrentReport := Pointer(SelfReport); 124 124 end 125 125 else 126 CurrentReport := pointer(MyRO.EnemyReport[pView]);126 CurrentReport := Pointer(MyRO.EnemyReport[pView]); 127 127 if CurrentReport.TurnOfCivilReport >= 0 then 128 128 GenerateReportText; 129 ShowContact := (pView <> me) and (not supervising or (me <> 0));130 ContactEnabled := ShowContact and not supervising and129 ShowContact := (pView <> Me) and (not Supervising or (Me <> 0)); 130 ContactEnabled := ShowContact and not Supervising and 131 131 (1 shl pView and MyRO.Alive <> 0); 132 132 ContactBtn.Visible := ContactEnabled and (MyRO.Happened and phGameEnd = 0) and … … 146 146 end; 147 147 148 procedure TNatStatDlg.ShowNewContent(NewMode: TWindowMode; p: integer);149 begin 150 if p< 0 then148 procedure TNatStatDlg.ShowNewContent(NewMode: TWindowMode; P: Integer); 149 begin 150 if P < 0 then 151 151 if ClientMode >= scContact then 152 pView := DipMem[ me].pContact152 pView := DipMem[Me].pContact 153 153 else 154 154 begin … … 156 156 while (pView < nPl) and ((MyRO.Treaty[pView] < trNone) or 157 157 (1 shl pView and MyRO.Alive = 0)) do 158 inc(pView);158 Inc(pView); 159 159 if pView >= nPl then 160 pView := me;160 pView := Me; 161 161 end 162 162 else 163 pView := p;163 pView := P; 164 164 inherited ShowNewContent(NewMode); 165 165 end; … … 174 174 List: ^TChart; 175 175 176 function StatText(no: integer): string;176 function StatText(no: Integer): string; 177 177 var 178 i: integer;178 I: Integer; 179 179 begin 180 180 if (CurrentReport.TurnOfCivilReport >= 0) and 181 (Server(sGetChart + no shl 4, me, pView, List^) >= rExecuted) then181 (Server(sGetChart + no shl 4, Me, pView, List^) >= rExecuted) then 182 182 begin 183 i:= List[CurrentReport.TurnOfCivilReport];183 I := List[CurrentReport.TurnOfCivilReport]; 184 184 case no of 185 185 stPop: 186 result := Format(Phrases.Lookup('FRSTATPOP'), [i]);186 Result := Format(Phrases.Lookup('FRSTATPOP'), [I]); 187 187 stTerritory: 188 result := Format(Phrases.Lookup('FRSTATTER'), [i]);188 Result := Format(Phrases.Lookup('FRSTATTER'), [I]); 189 189 stScience: 190 result := Format(Phrases.Lookup('FRSTATTECH'), [idiv nAdv]);190 Result := Format(Phrases.Lookup('FRSTATTECH'), [I div nAdv]); 191 191 stExplore: 192 result := Format(Phrases.Lookup('FRSTATEXP'),193 [ i* 100 div (G.lx * G.ly)]);192 Result := Format(Phrases.Lookup('FRSTATEXP'), 193 [I * 100 div (G.lx * G.ly)]); 194 194 end; 195 195 end … … 197 197 198 198 var 199 p1, Treaty: integer;200 s: string;201 HasContact, ExtinctPart: boolean;199 p1, Treaty: Integer; 200 S: string; 201 HasContact, ExtinctPart: Boolean; 202 202 begin 203 203 GetMem(List, 4 * (MyRO.Turn + 2)); … … 208 208 (1 shl pView and MyRO.Alive <> 0) then 209 209 begin 210 s:= Format(Phrases.Lookup('FROLDCIVILREP'),210 S := Format(Phrases.Lookup('FROLDCIVILREP'), 211 211 [TurnToString(CurrentReport.TurnOfCivilReport)]); 212 ReportText.Add('C' + s);212 ReportText.Add('C' + S); 213 213 ReportText.Add(''); 214 214 end; … … 223 223 ReportText.Add('S' + StatText(stScience)); 224 224 ReportText.Add('E' + StatText(stExplore)); 225 HasContact := false;225 HasContact := False; 226 226 for p1 := 0 to nPl - 1 do 227 if (p1 <> me) and (CurrentReport.Treaty[p1] > trNoContact) then228 HasContact := true;227 if (p1 <> Me) and (CurrentReport.Treaty[p1] > trNoContact) then 228 HasContact := True; 229 229 if HasContact then 230 230 begin 231 231 ReportText.Add(''); 232 232 ReportText.Add(' ' + Phrases.Lookup('FRRELATIONS')); 233 for ExtinctPart := false to true do233 for ExtinctPart := False to True do 234 234 for Treaty := trAlliance downto trNone do 235 235 for p1 := 0 to nPl - 1 do 236 if (p1 <> me) and (CurrentReport.Treaty[p1] = Treaty) and236 if (p1 <> Me) and (CurrentReport.Treaty[p1] = Treaty) and 237 237 ((1 shl p1 and MyRO.Alive = 0) = ExtinctPart) then 238 238 begin 239 s:= Tribe[p1].TString(Phrases.Lookup('HAVETREATY', Treaty));239 S := Tribe[p1].TString(Phrases.Lookup('HAVETREATY', Treaty)); 240 240 if ExtinctPart then 241 s := '(' + s+ ')';242 ReportText.Add(char(48 + Treaty) + s);241 S := '(' + S + ')'; 242 ReportText.Add(char(48 + Treaty) + S); 243 243 end; 244 244 end; … … 250 250 procedure TNatStatDlg.OffscreenPaint; 251 251 var 252 i, y: integer;253 s: string;254 ps: pchar;255 Extinct: boolean;252 I, Y: Integer; 253 S: string; 254 ps: PChar; 255 Extinct: Boolean; 256 256 257 257 begin … … 260 260 Extinct := 1 shl pView and MyRO.Alive = 0; 261 261 262 BitBltCanvas( offscreen.Canvas, 0, 0, ClientWidth, ClientHeight,262 BitBltCanvas(Offscreen.Canvas, 0, 0, ClientWidth, ClientHeight, 263 263 Back.Canvas, 0, 0); 264 264 265 offscreen.Canvas.Font.Assign(UniFont[ftCaption]);266 RisedTextout( offscreen.Canvas,265 Offscreen.Canvas.Font.Assign(UniFont[ftCaption]); 266 RisedTextout(Offscreen.Canvas, 267 267 40 { (ClientWidth-BiColorTextWidth(offscreen.canvas,caption)) div 2 } , 268 268 7, Caption); 269 269 270 offscreen.Canvas.Font.Assign(UniFont[ftNormal]);271 272 with offscreen do270 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 271 272 with Offscreen do 273 273 begin 274 274 // show leader picture … … 276 276 if Assigned(Tribe[pView].faceHGr) then 277 277 begin 278 Dump( offscreen, Tribe[pView].faceHGr, 18, yIcon - 4, 64, 48,278 Dump(Offscreen, Tribe[pView].faceHGr, 18, yIcon - 4, 64, 48, 279 279 1 + Tribe[pView].facepix mod 10 * 65, 280 280 1 + Tribe[pView].facepix div 10 * 49); 281 frame( offscreen.Canvas, 18 - 1, yIcon - 4 - 1, 18 + 64, yIcon - 4 + 48,281 frame(Offscreen.Canvas, 18 - 1, yIcon - 4 - 1, 18 + 64, yIcon - 4 + 48, 282 282 $000000, $000000); 283 283 end; 284 284 285 if (pView = me) or not Extinct then285 if (pView = Me) or not Extinct then 286 286 LoweredTextOut(Canvas, -1, MainTexture, xAttrib, yAttrib, 287 287 Phrases.Lookup('GOVERNMENT', CurrentReport.Government) + 288 288 Phrases.Lookup('FRAND')); 289 if pView = me then289 if pView = Me then 290 290 begin 291 291 LoweredTextOut(Canvas, -1, MainTexture, xAttrib, yAttrib + 19, … … 314 314 if MyRO.Treaty[pView] = trNoContact then 315 315 begin 316 s:= Phrases.Lookup('FRNOCONTACT');316 S := Phrases.Lookup('FRNOCONTACT'); 317 317 LoweredTextOut(Canvas, -1, MainTexture, 318 (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, yRelation + 9, s);318 (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, yRelation + 9, S); 319 319 end 320 320 else if ShowContact then … … 340 340 FrameImage(Canvas, BigImp, xIcon, yIcon, xSizeBig, ySizeBig, 0, 200) 341 341 { else if CurrentReport.Government=gAnarchy then 342 FrameImage( canvas,BigImp,xIcon,yIcon,xSizeBig,ySizeBig,112,400,342 FrameImage(Canvas,BigImp,xIcon,yIcon,xSizeBig,ySizeBig,112,400, 343 343 ContactEnabled and (MyRO.Happened and phGameEnd=0) and (ClientMode<scContact)) 344 344 else 345 FrameImage( canvas,BigImp,xIcon,yIcon,xSizeBig,ySizeBig,345 FrameImage(Canvas,BigImp,xIcon,yIcon,xSizeBig,ySizeBig, 346 346 56*(CurrentReport.Government-1),40, 347 347 ContactEnabled and (MyRO.Happened and phGameEnd=0) and (ClientMode<scContact)) }; … … 361 361 end; 362 362 363 y:= 0;364 for i:= 0 to ReportText.Count - 1 do365 begin 366 if ( i >= LinesDown) and (i< LinesDown + ReportLines) then363 Y := 0; 364 for I := 0 to ReportText.Count - 1 do 365 begin 366 if (I >= LinesDown) and (I < LinesDown + ReportLines) then 367 367 begin 368 s := ReportText[i];369 if s<> '' then368 S := ReportText[I]; 369 if S <> '' then 370 370 begin 371 371 // LineType:=s[1]; 372 delete(s, 1, 1);372 Delete(S, 1, 1); 373 373 BiColorTextOut(Canvas, Colors.Canvas.Pixels[clkMisc, cliPaperText], 374 $7F007F, xReport + 8, yReport + LineSpacing * y, s);374 $7F007F, xReport + 8, yReport + LineSpacing * Y, S); 375 375 end; 376 inc(y);376 Inc(Y); 377 377 end; 378 378 end; … … 380 380 else 381 381 begin 382 s:= Phrases.Lookup('FRNOCIVILREP');383 RisedTextout(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s)) div 2,384 yReport + hReport div 2 - 10, s);382 S := Phrases.Lookup('FRNOCIVILREP'); 383 RisedTextout(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) div 2, 384 yReport + hReport div 2 - 10, S); 385 385 end; 386 386 387 387 if soTellAI in OptionChecked then begin 388 Server(sGetAIInfo, me, pView, ps);388 Server(sGetAIInfo, Me, pView, ps); 389 389 LoweredTextOut(Canvas, -1, MainTexture, 42, 445, ps); 390 390 end else … … 392 392 Phrases2.Lookup('MENU_TELLAI')); 393 393 end; 394 ContactBtn.SetBack( offscreen.Canvas, ContactBtn.Left, ContactBtn.Top);394 ContactBtn.SetBack(Offscreen.Canvas, ContactBtn.Left, ContactBtn.Top); 395 395 396 396 MarkUsedOffscreen(ClientWidth, ClientHeight); … … 404 404 procedure TNatStatDlg.DialogBtnClick(Sender: TObject); 405 405 var 406 ContactResult: integer;406 ContactResult: Integer; 407 407 begin 408 408 ContactResult := MainScreen.DipCall(scContact + pView shl 4); … … 412 412 SoundMessage(Phrases.Lookup('FRCOLDWAR'), 'MSG_DEFAULT') 413 413 else if MyRO.Government = gAnarchy then 414 SoundMessage(Tribe[ me].TPhrase('FRMYANARCHY'), 'MSG_DEFAULT')414 SoundMessage(Tribe[Me].TPhrase('FRMYANARCHY'), 'MSG_DEFAULT') 415 415 else if ContactResult = eAnarchy then 416 416 if MyRO.Treaty[pView] >= trPeace then … … 428 428 procedure TNatStatDlg.ToggleBtnClick(Sender: TObject); 429 429 var 430 p1, StartCount: integer;431 m: TMenuItem;432 ExtinctPart: boolean;430 p1, StartCount: Integer; 431 M: TMenuItem; 432 ExtinctPart: Boolean; 433 433 begin 434 434 EmptyMenu(Popup.Items); 435 435 436 436 // own nation 437 if G.Difficulty[ me] <> 0 then438 begin 439 m:= TMenuItem.Create(Popup);440 m.RadioItem := true;441 m.Caption := Tribe[me].TPhrase('TITLE_NATION');442 m.Tag := me;443 m.OnClick := PlayerClick;444 if me = pView then445 m.Checked := true;446 Popup.Items.Add( m);437 if G.Difficulty[Me] <> 0 then 438 begin 439 M := TMenuItem.Create(Popup); 440 M.RadioItem := True; 441 M.Caption := Tribe[Me].TPhrase('TITLE_NATION'); 442 M.Tag := Me; 443 M.OnClick := PlayerClick; 444 if Me = pView then 445 M.Checked := True; 446 Popup.Items.Add(M); 447 447 end; 448 448 449 449 // foreign nations 450 for ExtinctPart := false to true do450 for ExtinctPart := False to True do 451 451 begin 452 452 StartCount := Popup.Items.Count; … … 456 456 (1 shl p1 and MyRO.Alive <> 0) and (MyRO.Treaty[p1] >= trNone) then 457 457 begin 458 m:= TMenuItem.Create(Popup);459 m.RadioItem := true;460 m.Caption := Tribe[p1].TPhrase('TITLE_NATION');458 M := TMenuItem.Create(Popup); 459 M.RadioItem := True; 460 M.Caption := Tribe[p1].TPhrase('TITLE_NATION'); 461 461 if ExtinctPart then 462 m.Caption := '(' + m.Caption + ')';463 m.Tag := p1;464 m.OnClick := PlayerClick;462 M.Caption := '(' + M.Caption + ')'; 463 M.Tag := p1; 464 M.OnClick := PlayerClick; 465 465 if p1 = pView then 466 m.Checked := true;467 Popup.Items.Add( m);466 M.Checked := True; 467 Popup.Items.Add(M); 468 468 end; 469 469 if (StartCount > 0) and (Popup.Items.Count > StartCount) then 470 470 begin // seperator 471 m:= TMenuItem.Create(Popup);472 m.Caption := '-';473 Popup.Items.Insert(StartCount, m);471 M := TMenuItem.Create(Popup); 472 M.Caption := '-'; 473 Popup.Items.Insert(StartCount, M); 474 474 end; 475 475 end; … … 478 478 end; 479 479 480 procedure TNatStatDlg.FormKeyDown(Sender: TObject; var Key: word;480 procedure TNatStatDlg.FormKeyDown(Sender: TObject; var Key: Word; 481 481 Shift: TShiftState); 482 482 var 483 i: integer;483 I: Integer; 484 484 begin 485 485 if Key = VK_F9 then // my key 486 486 begin // toggle nation 487 i:= 0;487 I := 0; 488 488 repeat 489 489 pView := (pView + 1) mod nPl; 490 inc(i);491 until ( i>= nPl) or (1 shl pView and MyRO.Alive <> 0) and490 Inc(I); 491 until (I >= nPl) or (1 shl pView and MyRO.Alive <> 0) and 492 492 (MyRO.Treaty[pView] >= trNone); 493 if i>= nPl then494 pView := me;493 if I >= nPl then 494 pView := Me; 495 495 Tag := pView; 496 496 PlayerClick(self); // no, this is not nice … … 502 502 procedure TNatStatDlg.EcoChange; 503 503 begin 504 if Visible and (pView = me) then504 if Visible and (pView = Me) then 505 505 begin 506 506 SelfReport.Government := MyRO.Government; … … 514 514 if LinesDown > 0 then 515 515 begin 516 dec(LinesDown);516 Dec(LinesDown); 517 517 SmartUpdateContent; 518 518 end; … … 523 523 if LinesDown + ReportLines < ReportText.Count then 524 524 begin 525 inc(LinesDown);525 Inc(LinesDown); 526 526 SmartUpdateContent; 527 527 end; -
trunk/LocalPlayer/Nego.pas
r442 r447 15 15 type 16 16 THistory = record 17 n: Integer;17 N: Integer; 18 18 Text: array[0 .. MaxHistory - 1] of ansistring; 19 19 end; … … 59 59 procedure FormDestroy(Sender: TObject); 60 60 procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 61 Shift: TShiftState; X, Y: integer);61 Shift: TShiftState; X, Y: Integer); 62 62 procedure OkBtnClick(Sender: TObject); 63 63 procedure BwdBtnClick(Sender: TObject); … … 78 78 79 79 private 80 Page, DipCommand: integer;80 Page, DipCommand: Integer; 81 81 CurrentOffer: TOffer; 82 82 MyAllowed, OppoAllowed: TPriceSet; … … 84 84 History: array [0 .. nPl - 1] of THistory; 85 85 RomanFont: TFont; 86 Costs, Delivers: array [0 .. 11] of cardinal;86 Costs, Delivers: array [0 .. 11] of Cardinal; 87 87 procedure ResetCurrentOffer; 88 88 procedure BuildCurrentOffer; 89 89 procedure FindAllowed; 90 90 procedure SplitText(Text: string; Bounds: TRect); 91 procedure PaintNationPicture(X, Y, p: integer);91 procedure PaintNationPicture(X, Y, P: Integer); 92 92 procedure SetButtonStates; 93 93 end; … … 183 183 procedure TNegoDlg.ResetCurrentOffer; 184 184 var 185 i: integer;185 I: Integer; 186 186 begin 187 187 CurrentOffer.nDeliver := 0; 188 188 CurrentOffer.nCost := 0; 189 for i:= 0 to 11 do190 Costs[ i] := $FFFFFFFF;191 for i:= 0 to 11 do192 Delivers[ i] := $FFFFFFFF;189 for I := 0 to 11 do 190 Costs[I] := $FFFFFFFF; 191 for I := 0 to 11 do 192 Delivers[I] := $FFFFFFFF; 193 193 end; 194 194 … … 201 201 else 202 202 PassBtn.SmartHint := Phrases.Lookup('BTN_PASS'); 203 case MyRO.Treaty[DipMem[ me].pContact] of203 case MyRO.Treaty[DipMem[Me].pContact] of 204 204 trNone: 205 205 begin … … 237 237 begin 238 238 if ClientMode <> scDipStart then 239 with History[ me] do240 begin 241 if n= MaxHistory then242 begin 243 move(Text[2], Text[0], (MaxHistory - 2) * sizeof(integer));244 dec(n, 2);239 with History[Me] do 240 begin 241 if N = MaxHistory then 242 begin 243 Move(Text[2], Text[0], (MaxHistory - 2) * SizeOf(Integer)); 244 Dec(N, 2); 245 245 end; 246 Text[ n] := copy(DipCommandToString(DipMem[me].pContact, me,247 DipMem[ me].FormerTreaty, DipMem[me].SentCommand, ClientMode,248 DipMem[ me].SentOffer, ReceivedOffer), 1, 255);249 inc(n);246 Text[N] := Copy(DipCommandToString(DipMem[Me].pContact, Me, 247 DipMem[Me].FormerTreaty, DipMem[Me].SentCommand, ClientMode, 248 DipMem[Me].SentOffer, ReceivedOffer), 1, 255); 249 Inc(N); 250 250 end; 251 assert(History[me].nmod 2 = 1);252 253 Page := History[ me].n;251 Assert(History[Me].N mod 2 = 1); 252 253 Page := History[Me].N; 254 254 FindAllowed; 255 255 ResetCurrentOffer; … … 283 283 procedure TNegoDlg.SplitText(Text: string; Bounds: TRect); 284 284 var 285 nLines, Line, Start, Stop, OrdinaryStop, Indent, Y: integer;286 s: string;287 preview, Dot: boolean;285 nLines, Line, Start, Stop, OrdinaryStop, Indent, Y: Integer; 286 S: string; 287 preview, Dot: Boolean; 288 288 begin 289 289 nLines := 0; 290 for preview := true downto false do290 for preview := True downto False do 291 291 begin 292 292 Start := 1; … … 295 295 while Start < Length(Text) do 296 296 begin 297 Dot := false;297 Dot := False; 298 298 if (Start = 1) or (Text[Start - 1] = '\') then 299 299 if Text[Start] = '-' then 300 300 begin 301 301 Indent := ListIndent; 302 inc(Start);302 Inc(Start); 303 303 if Start = Length(Text) then 304 break;305 Dot := true;304 Break; 305 Dot := True; 306 306 end 307 307 else … … 310 310 while (Stop < Length(Text)) and (Text[Stop] <> '\') do 311 311 begin 312 inc(Stop);312 Inc(Stop); 313 313 if BiColorTextWidth(Offscreen.Canvas, 314 copy(Text, Start, Stop - Start + 1)) > Bounds.Right - Bounds.Left -314 Copy(Text, Start, Stop - Start + 1)) > Bounds.Right - Bounds.Left - 315 315 PaperBorder_Left - PaperBorder_Right - Indent then 316 316 begin 317 dec(Stop);318 break317 Dec(Stop); 318 Break 319 319 end; 320 320 end; … … 324 324 while (Text[OrdinaryStop + 1] <> ' ') and 325 325 (Text[OrdinaryStop + 1] <> '\') do 326 dec(OrdinaryStop);326 Dec(OrdinaryStop); 327 327 if (OrdinaryStop + 1 - Start) * 2 >= Stop - Start then 328 328 Stop := OrdinaryStop … … 334 334 Sprite(Offscreen, HGrSystem, Bounds.Left + PaperBorder_Left + 335 335 (ListIndent - 14), Y + 7, 8, 8, 90, 16); 336 s := copy(Text, Start, Stop - Start + 1);336 S := Copy(Text, Start, Stop - Start + 1); 337 337 BiColorTextOut(Offscreen.Canvas, Colors.Canvas.Pixels[clkMisc, 338 338 cliPaperText], $7F007F, Bounds.Left + PaperBorder_Left + 339 Indent, Y, s);339 Indent, Y, S); 340 340 end; 341 inc(Line);341 Inc(Line); 342 342 Start := Stop + 2; 343 343 end; … … 348 348 procedure TNegoDlg.FindAllowed; 349 349 var 350 i: integer;350 I: Integer; 351 351 begin 352 352 CommandAllowed := [scDipOffer - scDipStart]; 353 353 if ClientMode <> scDipBreak then 354 include(CommandAllowed, scDipBreak - scDipStart);355 if MyRO.Treaty[DipMem[ me].pContact] >= trPeace then356 include(CommandAllowed, scDipCancelTreaty - scDipStart);357 if (ClientMode = scDipOffer) and (Server(scDipAccept - sExecute, me, 0, nil^)354 Include(CommandAllowed, scDipBreak - scDipStart); 355 if MyRO.Treaty[DipMem[Me].pContact] >= trPeace then 356 Include(CommandAllowed, scDipCancelTreaty - scDipStart); 357 if (ClientMode = scDipOffer) and (Server(scDipAccept - sExecute, Me, 0, nil^) 358 358 >= rExecuted) then 359 include(CommandAllowed, scDipAccept - scDipStart);359 Include(CommandAllowed, scDipAccept - scDipStart); 360 360 361 361 MyAllowed := [opChoose shr 24, opMoney shr 24]; 362 362 OppoAllowed := [opChoose shr 24, opMoney shr 24]; 363 if not IsCivilReportNew(DipMem[ me].pContact) then363 if not IsCivilReportNew(DipMem[Me].pContact) then 364 364 begin // no up-to-date civil report 365 365 MyAllowed := MyAllowed + [opCivilReport shr 24]; 366 for i:= 0 to nAdv - 1 do367 if MyRO.Tech[ i] >= tsApplicable then366 for I := 0 to nAdv - 1 do 367 if MyRO.Tech[I] >= tsApplicable then 368 368 begin 369 369 MyAllowed := MyAllowed + [opAllTech shr 24]; 370 break370 Break 371 371 end; 372 372 OppoAllowed := OppoAllowed + [opCivilReport shr 24, opAllTech shr 24]; … … 374 374 else 375 375 begin // check techs 376 for i:= 0 to nAdv - 1 do377 if not( iin FutureTech) then378 if (MyRO.Tech[ i] < tsSeen) and379 (MyRO.EnemyReport[DipMem[ me].pContact].Tech[i] >= tsApplicable) then376 for I := 0 to nAdv - 1 do 377 if not(I in FutureTech) then 378 if (MyRO.Tech[I] < tsSeen) and 379 (MyRO.EnemyReport[DipMem[Me].pContact].Tech[I] >= tsApplicable) then 380 380 OppoAllowed := OppoAllowed + [opAllTech shr 24] 381 else if (MyRO.EnemyReport[DipMem[ me].pContact].Tech[i] < tsSeen) and382 (MyRO.Tech[ i] >= tsApplicable) then381 else if (MyRO.EnemyReport[DipMem[Me].pContact].Tech[I] < tsSeen) and 382 (MyRO.Tech[I] >= tsApplicable) then 383 383 MyAllowed := MyAllowed + [opAllTech shr 24]; 384 384 end; 385 if not IsMilReportNew(DipMem[ me].pContact) then385 if not IsMilReportNew(DipMem[Me].pContact) then 386 386 begin // no up-to-date military report 387 387 MyAllowed := MyAllowed + [opMilReport shr 24]; … … 397 397 OppoAllowed := OppoAllowed + [opAllModel shr 24]; 398 398 end; 399 if MyRO.Treaty[DipMem[ me].pContact] < trAlliance then399 if MyRO.Treaty[DipMem[Me].pContact] < trAlliance then 400 400 begin 401 401 MyAllowed := MyAllowed + [opTreaty shr 24, opMap shr 24]; … … 407 407 OppoAllowed:=OppoAllowed+[opLowTreaty shr 24]; 408 408 end; } 409 for i:= 0 to nShipPart - 1 do410 begin 411 if MyRO.Ship[ me].Parts[i] > 0 then412 include(MyAllowed, opShipParts shr 24);413 if MyRO.Ship[DipMem[ me].pContact].Parts[i] > 0 then414 include(OppoAllowed, opShipParts shr 24);415 end; 416 MyAllowed := MyAllowed - DipMem[ me].DeliveredPrices *409 for I := 0 to nShipPart - 1 do 410 begin 411 if MyRO.Ship[Me].Parts[I] > 0 then 412 Include(MyAllowed, opShipParts shr 24); 413 if MyRO.Ship[DipMem[Me].pContact].Parts[I] > 0 then 414 Include(OppoAllowed, opShipParts shr 24); 415 end; 416 MyAllowed := MyAllowed - DipMem[Me].DeliveredPrices * 417 417 [opAllTech shr 24, opAllModel shr 24, opCivilReport shr 24, 418 418 opMilReport shr 24, opMap shr 24]; 419 OppoAllowed := OppoAllowed - DipMem[ me].ReceivedPrices *419 OppoAllowed := OppoAllowed - DipMem[Me].ReceivedPrices * 420 420 [opAllTech shr 24, opAllModel shr 24, opCivilReport shr 24, 421 421 opMilReport shr 24, opMap shr 24]; 422 422 end; 423 423 424 procedure TNegoDlg.PaintNationPicture(X, Y, p: integer);424 procedure TNegoDlg.PaintNationPicture(X, Y, P: Integer); 425 425 begin 426 426 with Offscreen.Canvas do 427 427 begin 428 428 Pen.Color := $000000; 429 Brush.Color := Tribe[ p].Color;429 Brush.Color := Tribe[P].Color; 430 430 Rectangle(X - 6, Y - 1, X + 70, Y + 49); 431 431 Brush.Color := $000000; 432 Tribe[ p].InitAge(GetAge(p));433 if Assigned(Tribe[ p].faceHGr) then434 Dump(Offscreen, Tribe[ p].faceHGr, X, Y, 64, 48,435 1 + Tribe[ p].facepix mod 10 * 65, 1 + Tribe[p].facepix div 10 * 49)432 Tribe[P].InitAge(GetAge(P)); 433 if Assigned(Tribe[P].faceHGr) then 434 Dump(Offscreen, Tribe[P].faceHGr, X, Y, 64, 48, 435 1 + Tribe[P].facepix mod 10 * 65, 1 + Tribe[P].facepix div 10 * 49) 436 436 else 437 437 FillRect(Rect(X, Y, X + 64, Y + 48)); … … 443 443 procedure TNegoDlg.SetButtonStates; 444 444 var 445 cix: integer;446 IsActionPage: boolean;447 begin 448 IsActionPage := Page = History[ me].n;445 cix: Integer; 446 IsActionPage: Boolean; 447 begin 448 IsActionPage := Page = History[Me].N; 449 449 450 450 AcceptBtn.Possible := IsActionPage and … … 483 483 procedure TNegoDlg.OffscreenPaint; 484 484 var 485 i, cred: integer;486 s: string;487 OkEnabled: boolean;485 I, cred: Integer; 486 S: string; 487 OkEnabled: Boolean; 488 488 begin 489 489 if (OffscreenUser <> nil) and (OffscreenUser <> self) then … … 492 492 OffscreenUser := self; 493 493 494 if (DipCommand >= 0) and (Page = History[ me].n) then495 History[ me].Text[History[me].n] :=496 copy(DipCommandToString(me, DipMem[me].pContact,497 MyRO.Treaty[DipMem[ me].pContact], ClientMode, DipCommand, ReceivedOffer,494 if (DipCommand >= 0) and (Page = History[Me].N) then 495 History[Me].Text[History[Me].N] := 496 Copy(DipCommandToString(Me, DipMem[Me].pContact, 497 MyRO.Treaty[DipMem[Me].pContact], ClientMode, DipCommand, ReceivedOffer, 498 498 CurrentOffer), 1, 255); 499 499 500 FwdBtn.Visible := Page < History[ me].n;500 FwdBtn.Visible := Page < History[Me].N; 501 501 BwdBtn.Visible := Page >= 2; 502 if Page < History[ me].nthen503 OkEnabled := false502 if Page < History[Me].N then 503 OkEnabled := False 504 504 else if DipCommand = scDipOffer then 505 OkEnabled := Server(scDipOffer - sExecute, me, 0, CurrentOffer) >= rExecuted505 OkEnabled := Server(scDipOffer - sExecute, Me, 0, CurrentOffer) >= rExecuted 506 506 else 507 507 OkEnabled := DipCommand >= 0; … … 532 532 yPad1 + 41 + 42 * 2, $FFFFFF, $B0B0B0); 533 533 534 PaintNationPicture(xNationPicture0, yNationPicture, DipMem[ me].pContact);535 PaintNationPicture(xNationPicture1, yNationPicture, me);536 537 if History[ me].Text[Page - 1] <> '' then534 PaintNationPicture(xNationPicture0, yNationPicture, DipMem[Me].pContact); 535 PaintNationPicture(xNationPicture1, yNationPicture, Me); 536 537 if History[Me].Text[Page - 1] <> '' then 538 538 begin 539 539 FillSeamless(Offscreen.Canvas, xText0, yText0, wText, hText, 0, 0, Paper); 540 i:= Page - 1;541 if History[ me].Text[0] = '' then542 dec(i);543 if i< 16 then540 I := Page - 1; 541 if History[Me].Text[0] = '' then 542 Dec(I); 543 if I < 16 then 544 544 begin 545 545 Offscreen.Canvas.Font.Assign(RomanFont); 546 546 Offscreen.Canvas.TextOut 547 (xText0 + (wText - Offscreen.Canvas.TextWidth(RomanNo[ i])) div 2,548 yText0 + (hText - Offscreen.Canvas.TextHeight(RomanNo[ i])) div 2,549 RomanNo[ i]);547 (xText0 + (wText - Offscreen.Canvas.TextWidth(RomanNo[I])) div 2, 548 yText0 + (hText - Offscreen.Canvas.TextHeight(RomanNo[I])) div 2, 549 RomanNo[I]); 550 550 end 551 551 end; 552 552 FillSeamless(Offscreen.Canvas, xText1, yText1, wText, hText, 0, 0, Paper); 553 i:= Page;554 if History[ me].Text[0] = '' then555 dec(i);556 if i< 16 then553 I := Page; 554 if History[Me].Text[0] = '' then 555 Dec(I); 556 if I < 16 then 557 557 begin 558 558 Offscreen.Canvas.Font.Assign(RomanFont); 559 559 Offscreen.Canvas.TextOut 560 (xText1 + (wText - Offscreen.Canvas.TextWidth(RomanNo[ i])) div 2,561 yText1 + (hText - Offscreen.Canvas.TextHeight(RomanNo[ i])) div 2,562 RomanNo[ i]);560 (xText1 + (wText - Offscreen.Canvas.TextWidth(RomanNo[I])) div 2, 561 yText1 + (hText - Offscreen.Canvas.TextHeight(RomanNo[I])) div 2, 562 RomanNo[I]); 563 563 end; 564 564 with Offscreen.Canvas do 565 565 begin 566 566 Brush.Color := MainTexture.ColorBevelShade; 567 if History[ me].Text[Page - 1] <> '' then567 if History[Me].Text[Page - 1] <> '' then 568 568 begin 569 569 FillRect(Rect(xText0 + wText, yText0 + PaperShade, … … 583 583 { if Page=History[me].n then 584 584 begin // show attitude 585 s:=Phrases.Lookup('ATTITUDE',MyRO.EnemyReport[DipMem[me].pContact].Attitude);585 S:=Phrases.Lookup('ATTITUDE',MyRO.EnemyReport[DipMem[Me].pContact].Attitude); 586 586 //LoweredTextOut(Offscreen.Canvas,-1,MainTexture, 587 587 RisedTextOut(Offscreen.Canvas,xText0+wText div 2- 588 BiColorTextWidth(Offscreen.Canvas, s) div 2,yAttitude,s);589 s:=Phrases.Lookup('ATTITUDE',MyRO.Attitude[DipMem[me].pContact]);588 BiColorTextWidth(Offscreen.Canvas,S) div 2,yAttitude,S); 589 S:=Phrases.Lookup('ATTITUDE',MyRO.Attitude[DipMem[Me].pContact]); 590 590 //LoweredTextOut(Offscreen.Canvas,-1,MainTexture, 591 591 RisedTextOut(Offscreen.Canvas,xText1+wText div 2- 592 BiColorTextWidth(Offscreen.Canvas, s) div 2,yAttitude,s);592 BiColorTextWidth(Offscreen.Canvas,S) div 2,yAttitude,S); 593 593 end; } 594 594 595 if History[ me].Text[Page - 1] <> '' then596 SplitText(History[ me].Text[Page - 1], Rect(xText0, yText0, xText0 + wText,595 if History[Me].Text[Page - 1] <> '' then 596 SplitText(History[Me].Text[Page - 1], Rect(xText0, yText0, xText0 + wText, 597 597 yText0 + hText)); 598 if (Page < History[ me].n) or OkEnabled then599 SplitText(History[ me].Text[Page], Rect(xText1, yText1, xText1 + wText,598 if (Page < History[Me].N) or OkEnabled then 599 SplitText(History[Me].Text[Page], Rect(xText1, yText1, xText1 + wText, 600 600 yText1 + hText)); 601 601 602 602 // show credibility 603 603 Offscreen.Canvas.Font.Assign(UniFont[ftTiny]); 604 cred := MyRO.EnemyReport[DipMem[ me].pContact].Credibility;604 cred := MyRO.EnemyReport[DipMem[Me].pContact].Credibility; 605 605 case cred of 606 606 0 .. 49: 607 i:= 3;607 I := 3; 608 608 50 .. 90: 609 i:= 0;609 I := 0; 610 610 91 .. 100: 611 i:= 1;612 end; 613 PaintProgressBar(Offscreen.Canvas, i, xCred0, yCred0 + 17, (cred + 2) div 5,611 I := 1; 612 end; 613 PaintProgressBar(Offscreen.Canvas, I, xCred0, yCred0 + 17, (cred + 2) div 5, 614 614 0, 20, MainTexture); 615 s:= IntToStr(cred);615 S := IntToStr(cred); 616 616 RisedTextOut(Offscreen.Canvas, xCred0 + 10 - 617 (BiColorTextWidth(Offscreen.Canvas, s) + 1) div 2, yCred0, s);617 (BiColorTextWidth(Offscreen.Canvas, S) + 1) div 2, yCred0, S); 618 618 case MyRO.Credibility of 619 619 0 .. 49: 620 i:= 3;620 I := 3; 621 621 50 .. 90: 622 i:= 0;622 I := 0; 623 623 91 .. 100: 624 i:= 1;625 end; 626 PaintProgressBar(Offscreen.Canvas, i, xCred1, yCred1 + 17,624 I := 1; 625 end; 626 PaintProgressBar(Offscreen.Canvas, I, xCred1, yCred1 + 17, 627 627 (MyRO.Credibility + 2) div 5, 0, 20, MainTexture); 628 s:= IntToStr(MyRO.Credibility);628 S := IntToStr(MyRO.Credibility); 629 629 RisedTextOut(Offscreen.Canvas, xCred1 + 10 - 630 (BiColorTextWidth(Offscreen.Canvas, s) + 1) div 2, yCred1, s);630 (BiColorTextWidth(Offscreen.Canvas, S) + 1) div 2, yCred1, S); 631 631 632 632 MarkUsedOffscreen(ClientWidth, ClientHeight); … … 635 635 procedure TNegoDlg.Initiate; 636 636 begin 637 History[ me].n:= 1;638 History[ me].Text[0] := '';637 History[Me].N := 1; 638 History[Me].Text[0] := ''; 639 639 end; 640 640 641 641 procedure TNegoDlg.Respond; 642 642 begin 643 History[ me].n:= 0;643 History[Me].N := 0; 644 644 end; 645 645 646 646 procedure TNegoDlg.FormMouseDown(Sender: TObject; Button: TMouseButton; 647 Shift: TShiftState; X, Y: integer);647 Shift: TShiftState; X, Y: Integer); 648 648 begin 649 649 if (X >= xNationPicture0) and (X < xNationPicture0 + 64) and 650 650 (Y >= yNationPicture) and (Y < yNationPicture + 48) then 651 NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), DipMem[ me].pContact)651 NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), DipMem[Me].pContact) 652 652 else if (X >= xNationPicture1) and (X < xNationPicture1 + 64) and 653 653 (Y >= yNationPicture) and (Y < yNationPicture + 48) then 654 NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), me)654 NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), Me) 655 655 end; 656 656 657 657 procedure TNegoDlg.BwdBtnClick(Sender: TObject); 658 658 begin 659 dec(Page, 2);659 Dec(Page, 2); 660 660 SetButtonStates; 661 661 SmartUpdateContent; … … 664 664 procedure TNegoDlg.FwdBtnClick(Sender: TObject); 665 665 begin 666 inc(Page, 2);666 Inc(Page, 2); 667 667 SetButtonStates; 668 668 SmartUpdateContent; … … 671 671 procedure TNegoDlg.OkBtnClick(Sender: TObject); 672 672 begin 673 inc(History[me].n);673 Inc(History[Me].N); 674 674 if DipCommand = scDipOffer then 675 675 MainScreen.OfferCall(CurrentOffer) … … 697 697 procedure TNegoDlg.BuildCurrentOffer; 698 698 var 699 i: integer;699 I: Integer; 700 700 begin 701 701 CurrentOffer.nDeliver := 0; 702 702 CurrentOffer.nCost := 0; 703 for i:= 0 to 11 do704 if Delivers[ i] <> $FFFFFFFF then705 begin 706 CurrentOffer.Price[CurrentOffer.nDeliver] := Delivers[ i];707 inc(CurrentOffer.nDeliver);703 for I := 0 to 11 do 704 if Delivers[I] <> $FFFFFFFF then 705 begin 706 CurrentOffer.Price[CurrentOffer.nDeliver] := Delivers[I]; 707 Inc(CurrentOffer.nDeliver); 708 708 end; 709 for i:= 0 to 11 do710 if Costs[ i] <> $FFFFFFFF then709 for I := 0 to 11 do 710 if Costs[I] <> $FFFFFFFF then 711 711 begin 712 712 CurrentOffer.Price[CurrentOffer.nDeliver + CurrentOffer.nCost] := 713 Costs[ i];714 inc(CurrentOffer.nCost);713 Costs[I]; 714 Inc(CurrentOffer.nCost); 715 715 end; 716 716 end; … … 718 718 procedure TNegoDlg.WantClick(Sender: TObject); 719 719 var 720 a, i, max: integer;721 Price: cardinal;722 begin 723 if (Page <> History[ me].n) or (ClientMode = scDipCancelTreaty) or720 A, I, Max: Integer; 721 Price: Cardinal; 722 begin 723 if (Page <> History[Me].N) or (ClientMode = scDipCancelTreaty) or 724 724 (ClientMode = scDipBreak) then 725 exit;725 Exit; 726 726 if Costs[TButtonN(Sender).Tag and $FF] <> $FFFFFFFF then 727 727 Price := $FFFFFFFF // toggle off … … 731 731 begin 732 732 SimpleMessage(Phrases.Lookup('MAX2WANTS')); 733 exit733 Exit 734 734 end; 735 735 Price := ButtonPrice[TButtonN(Sender).Tag and $FF]; 736 736 if not(Price shr 24 in OppoAllowed) then 737 exit;737 Exit; 738 738 case Price of 739 739 opCivilReport, opMilReport: 740 inc(Price, DipMem[me].pContact shl 16 + MyRO.Turn);740 Inc(Price, DipMem[Me].pContact shl 16 + MyRO.Turn); 741 741 // !!! choose player and year! 742 742 opMoney: … … 747 747 InputDlg.ShowModal; 748 748 if InputDlg.ModalResult <> mrOK then 749 exit;750 val(InputDlg.EInput.Text, a, i);751 if ( i <> 0) or (a <= 0) or (a>= MaxMoneyPrice) then752 exit;753 inc(Price, a);749 Exit; 750 val(InputDlg.EInput.Text, A, I); 751 if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then 752 Exit; 753 Inc(Price, A); 754 754 end; 755 755 opShipParts: … … 765 765 ShowModal; 766 766 if ModalResult <> mrOK then 767 exit767 Exit 768 768 end; 769 769 ModalSelectDlg.ShowNewContent(wmModal, kEShipPart); 770 if ModalSelectDlg. result < 0 then771 exit;772 inc(Price, ModalSelectDlg.result shl 16);773 max := MyRO.Ship[DipMem[me].pContact].Parts[ModalSelectDlg.result];770 if ModalSelectDlg.Result < 0 then 771 Exit; 772 Inc(Price, ModalSelectDlg.Result shl 16); 773 Max := MyRO.Ship[DipMem[Me].pContact].Parts[ModalSelectDlg.Result]; 774 774 InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER'); 775 775 InputDlg.EInput.Text := ''; … … 777 777 InputDlg.ShowModal; 778 778 if InputDlg.ModalResult <> mrOK then 779 exit;780 val(InputDlg.EInput.Text, a, i);781 if ( i <> 0) or (a<= 0) then782 exit;783 if a > max then784 a := max;785 if a> MaxShipPartPrice then786 a:= MaxShipPartPrice;787 inc(Price, a);779 Exit; 780 val(InputDlg.EInput.Text, A, I); 781 if (I <> 0) or (A <= 0) then 782 Exit; 783 if A > Max then 784 A := Max; 785 if A > MaxShipPartPrice then 786 A := MaxShipPartPrice; 787 Inc(Price, A); 788 788 end; 789 789 opAllTech: 790 790 begin // choose technology 791 791 ModalSelectDlg.ShowNewContent(wmModal, kChooseETech); 792 if ModalSelectDlg. result < 0 then793 exit;794 if ModalSelectDlg. result = adAll then792 if ModalSelectDlg.Result < 0 then 793 Exit; 794 if ModalSelectDlg.Result = adAll then 795 795 Price := opAllTech 796 796 else 797 Price := OpTech + ModalSelectDlg. result;797 Price := OpTech + ModalSelectDlg.Result; 798 798 end; 799 799 opAllModel: 800 800 begin // choose model 801 801 ModalSelectDlg.ShowNewContent(wmModal, kChooseEModel); 802 if ModalSelectDlg. result < 0 then803 exit;804 if ModalSelectDlg. result = mixAll then802 if ModalSelectDlg.Result < 0 then 803 Exit; 804 if ModalSelectDlg.Result = mixAll then 805 805 Price := opAllModel 806 806 else 807 Price := OpModel + MyRO.EnemyModel[ModalSelectDlg. result].mix;807 Price := OpModel + MyRO.EnemyModel[ModalSelectDlg.Result].mix; 808 808 end; 809 809 opTreaty: 810 810 begin 811 if MyRO.Treaty[DipMem[ me].pContact] < trPeace then811 if MyRO.Treaty[DipMem[Me].pContact] < trPeace then 812 812 Price := opTreaty + trPeace 813 813 else 814 Price := opTreaty + MyRO.Treaty[DipMem[ me].pContact] + 1;814 Price := opTreaty + MyRO.Treaty[DipMem[Me].pContact] + 1; 815 815 end; 816 816 { opLowTreaty: 817 817 begin 818 if MyRO.Treaty[DipMem[ me].pContact]=trNone then Price:=opTreaty+trCeaseFire819 else Price:=opTreaty+MyRO.Treaty[DipMem[ me].pContact]-1;818 if MyRO.Treaty[DipMem[Me].pContact]=trNone then Price:=opTreaty+trCeaseFire 819 else Price:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]-1; 820 820 end } 821 821 end; … … 831 831 procedure TNegoDlg.OfferClick(Sender: TObject); 832 832 var 833 a, i, max: integer;834 Price: cardinal;835 begin 836 if (Page <> History[ me].n) or (ClientMode = scDipCancelTreaty) or833 A, I, Max: Integer; 834 Price: Cardinal; 835 begin 836 if (Page <> History[Me].N) or (ClientMode = scDipCancelTreaty) or 837 837 (ClientMode = scDipBreak) then 838 exit;838 Exit; 839 839 if Delivers[TButtonN(Sender).Tag and $FF] <> $FFFFFFFF then 840 840 Price := $FFFFFFFF // toggle off … … 844 844 begin 845 845 SimpleMessage(Phrases.Lookup('MAX2OFFERS')); 846 exit;846 Exit; 847 847 end; 848 848 Price := ButtonPrice[TButtonN(Sender).Tag and $FF]; 849 849 if not(Price shr 24 in MyAllowed) then 850 exit;850 Exit; 851 851 case Price of 852 852 opCivilReport, opMilReport: 853 inc(Price, me shl 16 + MyRO.Turn); // !!! choose player and year!853 Inc(Price, Me shl 16 + MyRO.Turn); // !!! choose player and year! 854 854 opMoney: 855 855 begin // choose amount … … 859 859 InputDlg.ShowModal; 860 860 if InputDlg.ModalResult <> mrOK then 861 exit;862 val(InputDlg.EInput.Text, a, i);863 if ( i <> 0) or (a <= 0) or (a>= MaxMoneyPrice) then864 exit;865 if (Price = opMoney) and ( a> MyRO.Money) then866 a:= MyRO.Money;867 inc(Price, a);861 Exit; 862 val(InputDlg.EInput.Text, A, I); 863 if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then 864 Exit; 865 if (Price = opMoney) and (A > MyRO.Money) then 866 A := MyRO.Money; 867 Inc(Price, A); 868 868 end; 869 869 opShipParts: 870 870 begin // choose type and number 871 871 ModalSelectDlg.ShowNewContent(wmModal, kShipPart); 872 if ModalSelectDlg. result < 0 then873 exit;874 inc(Price, ModalSelectDlg.result shl 16);875 max := MyRO.Ship[me].Parts[ModalSelectDlg.result];872 if ModalSelectDlg.Result < 0 then 873 Exit; 874 Inc(Price, ModalSelectDlg.Result shl 16); 875 Max := MyRO.Ship[Me].Parts[ModalSelectDlg.Result]; 876 876 InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER'); 877 877 InputDlg.EInput.Text := ''; … … 879 879 InputDlg.ShowModal; 880 880 if InputDlg.ModalResult <> mrOK then 881 exit;882 val(InputDlg.EInput.Text, a, i);883 if ( i <> 0) or (a<= 0) then884 exit;885 if a > max then886 a := max;887 if a> MaxShipPartPrice then888 a:= MaxShipPartPrice;889 inc(Price, a);881 Exit; 882 val(InputDlg.EInput.Text, A, I); 883 if (I <> 0) or (A <= 0) then 884 Exit; 885 if A > Max then 886 A := Max; 887 if A > MaxShipPartPrice then 888 A := MaxShipPartPrice; 889 Inc(Price, A); 890 890 end; 891 891 opAllTech: 892 892 begin // choose technology 893 893 ModalSelectDlg.ShowNewContent(wmModal, kChooseTech); 894 if ModalSelectDlg. result < 0 then895 exit;896 if ModalSelectDlg. result = adAll then894 if ModalSelectDlg.Result < 0 then 895 Exit; 896 if ModalSelectDlg.Result = adAll then 897 897 Price := opAllTech 898 898 else 899 Price := OpTech + ModalSelectDlg. result;899 Price := OpTech + ModalSelectDlg.Result; 900 900 end; 901 901 opAllModel: 902 902 begin // choose model 903 903 ModalSelectDlg.ShowNewContent(wmModal, kChooseModel); 904 if ModalSelectDlg. result < 0 then905 exit;906 if ModalSelectDlg. result = mixAll then904 if ModalSelectDlg.Result < 0 then 905 Exit; 906 if ModalSelectDlg.Result = mixAll then 907 907 Price := opAllModel 908 908 else 909 Price := OpModel + ModalSelectDlg. result;909 Price := OpModel + ModalSelectDlg.Result; 910 910 end; 911 911 opTreaty: 912 912 begin 913 if MyRO.Treaty[DipMem[ me].pContact] < trPeace then913 if MyRO.Treaty[DipMem[Me].pContact] < trPeace then 914 914 Price := opTreaty + trPeace 915 915 else 916 Price := opTreaty + MyRO.Treaty[DipMem[ me].pContact] + 1;916 Price := opTreaty + MyRO.Treaty[DipMem[Me].pContact] + 1; 917 917 end; 918 918 { opLowTreaty: 919 919 begin 920 if MyRO.Treaty[DipMem[ me].pContact]=trNone then Price:=opTreaty+trCeaseFire921 else Price:=opTreaty+MyRO.Treaty[DipMem[ me].pContact]-1;920 if MyRO.Treaty[DipMem[Me].pContact]=trNone then Price:=opTreaty+trCeaseFire 921 else Price:=opTreaty+MyRO.Treaty[DipMem[Me].pContact]-1; 922 922 end } 923 923 end; … … 933 933 procedure TNegoDlg.FastBtnClick(Sender: TObject); 934 934 var 935 NewCommand: cardinal;936 begin 937 if Page <> History[ me].nthen938 exit;935 NewCommand: Cardinal; 936 begin 937 if Page <> History[Me].N then 938 Exit; 939 939 NewCommand := TButtonN(Sender).Tag and $FF + scDipStart; 940 940 if not(NewCommand - scDipStart in CommandAllowed) then 941 exit;941 Exit; 942 942 if (NewCommand = scDipCancelTreaty) and 943 (MyRO.Turn < MyRO.LastCancelTreaty[DipMem[ me].pContact] + CancelTreatyTurns)943 (MyRO.Turn < MyRO.LastCancelTreaty[DipMem[Me].pContact] + CancelTreatyTurns) 944 944 then 945 945 begin 946 946 SimpleMessage(Phrases.Lookup('CANCELTREATYRUSH')); 947 exit;947 Exit; 948 948 end; 949 949 if (NewCommand = scDipOffer) and ((ClientMode = scDipCancelTreaty) or -
trunk/LocalPlayer/PVSB.pas
r442 r447 30 30 procedure Init(Max, PageSize: Integer); 31 31 procedure SetPos(Pos: Integer); 32 function Process(const Msg: TMessage): boolean;32 function Process(const Msg: TMessage): Boolean; 33 33 function ProcessMouseWheel(Delta: Integer): Boolean; 34 procedure Show(Visible: boolean);34 procedure Show(Visible: Boolean); 35 35 procedure EndSB; 36 36 procedure SetBorderSpacing(Top, Right, Bottom: Integer); … … 63 63 end; 64 64 65 function TPVScrollBar.Process(const Msg: TMessage): boolean;65 function TPVScrollBar.Process(const Msg: TMessage): Boolean; 66 66 var 67 NewPos: integer;67 NewPos: Integer; 68 68 begin 69 69 if Max < ScrollBar.PageSize then 70 result := false70 Result := False 71 71 else 72 72 begin 73 73 if (Msg.wParam and $ffff) in [SB_THUMBPOSITION, SB_THUMBTRACK] then 74 74 begin 75 result := ((Msg.wParam shr 16) and $ffff) <> ScrollBar.Position;75 Result := ((Msg.wParam shr 16) and $ffff) <> ScrollBar.Position; 76 76 ScrollBar.Position := (Msg.wParam shr 16) and $ffff; 77 77 end else begin … … 92 92 if NewPos > Max - ScrollBar.PageSize + 1 then 93 93 NewPos := Max - ScrollBar.PageSize + 1; 94 result := NewPos <> ScrollBar.Position;94 Result := NewPos <> ScrollBar.Position; 95 95 if (NewPos <> ScrollBar.Position) or ((Msg.wParam and $ffff) = SB_ENDSCROLL) then 96 96 begin … … 103 103 function TPVScrollBar.ProcessMouseWheel(Delta: Integer): Boolean; 104 104 var 105 NewPos: integer;105 NewPos: Integer; 106 106 begin 107 107 if Max < ScrollBar.PageSize then Result := False … … 118 118 end; 119 119 120 procedure TPVScrollBar.Show(Visible: boolean);120 procedure TPVScrollBar.Show(Visible: Boolean); 121 121 begin 122 122 if not Visible or (Max < ScrollBar.PageSize) then -
trunk/LocalPlayer/Rates.pas
r442 r447 46 46 procedure TRatesDlg.OffscreenPaint; 47 47 var 48 p, x, y, current, max, i: integer;49 s, s1: string;48 P, X, Y, current, Max, I: Integer; 49 S, s1: string; 50 50 begin 51 51 if (OffscreenUser <> nil) and (OffscreenUser <> self) then … … 64 64 BtnFrame(Offscreen.Canvas, CloseBtn.BoundsRect, MainTexture); 65 65 Offscreen.Canvas.Font.Assign(UniFont[ftCaption]); 66 s:= Phrases.Lookup('TITLE_RATES');66 S := Phrases.Lookup('TITLE_RATES'); 67 67 RisedTextOut(Offscreen.Canvas, 68 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s)) div 2 - 1, 7, s);69 70 if MyRO.Wonder[woLiberty].EffectiveOwner = me then71 s:= Phrases.Lookup('NORATES')72 else 73 s:= Phrases.Lookup('RATES');68 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2 - 1, 7, S); 69 70 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 71 S := Phrases.Lookup('NORATES') 72 else 73 S := Phrases.Lookup('RATES'); 74 74 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 75 p := pos('\', s);76 if p= 0 then77 RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))78 div 2, 114, s)79 else 80 begin 81 s1 := copy(s, 1, p- 1);75 P := Pos('\', S); 76 if P = 0 then 77 RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) 78 div 2, 114, S) 79 else 80 begin 81 s1 := Copy(S, 1, P - 1); 82 82 RisedTextOut(Offscreen.Canvas, 83 83 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2, 84 84 114 - MessageLineSpacing div 2, s1); 85 s1 := copy(s, p+ 1, 255);85 s1 := Copy(S, P + 1, 255); 86 86 RisedTextOut(Offscreen.Canvas, 87 87 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2, … … 90 90 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 91 91 92 if MyRO.Wonder[woLiberty].EffectiveOwner = me then92 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 93 93 begin 94 94 GlowFrame(Offscreen, ClientWidth div 2 - xSizeBig div 2, 52, xSizeBig, 95 ySizeBig, Tribe[ me].Color);95 ySizeBig, Tribe[Me].Color); 96 96 BitBltCanvas(Offscreen.Canvas, ClientWidth div 2 - xSizeBig div 2, 52, 97 97 xSizeBig, ySizeBig, BigImp.Canvas, (woLiberty mod 7) * xSizeBig, … … 102 102 // ImageOp_CBC(Offscreen,Templates,260,40,145,112,36,36,$404000,$8B8BEB); 103 103 104 s:= Phrases.Lookup('SCIENCE');105 RisedTextOut(Offscreen.Canvas, 106 16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 44, s);107 s:= Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]);108 RisedTextOut(Offscreen.Canvas, 109 16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 60, s);104 S := Phrases.Lookup('SCIENCE'); 105 RisedTextOut(Offscreen.Canvas, 106 16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 44, S); 107 S := Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]); 108 RisedTextOut(Offscreen.Canvas, 109 16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 60, S); 110 110 // PaintProgressBar(Offscreen.Canvas,2,16,81,(100-MyRO.LuxRate-MyRO.TaxRate)*120 div 100,0,120,MainTexture); 111 111 112 112 // reverse progress bar for science 113 x:= 16;114 y:= 81;113 X := 16; 114 Y := 81; 115 115 current := (100 - MyRO.LuxRate - MyRO.TaxRate) * 120 div 100; 116 max := 120;117 Frame(Offscreen.Canvas, x - 1, y - 1, x + max, y+ 7, $000000, $000000);118 RFrame(Offscreen.Canvas, x - 2, y - 2, x + max + 1, y+ 8,116 Max := 120; 117 Frame(Offscreen.Canvas, X - 1, Y - 1, X + Max, Y + 7, $000000, $000000); 118 RFrame(Offscreen.Canvas, X - 2, Y - 2, X + Max + 1, Y + 8, 119 119 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 120 120 with Offscreen.Canvas do 121 121 begin 122 for i:= 0 to current div 8 - 1 do123 BitBltCanvas(Offscreen.Canvas, x + max - 8 - i * 8, y, 8, 7,122 for I := 0 to current div 8 - 1 do 123 BitBltCanvas(Offscreen.Canvas, X + Max - 8 - I * 8, Y, 8, 7, 124 124 HGrSystem.Data.Canvas, 104, 9 + 8 * 2); 125 BitBltCanvas(Offscreen.Canvas, x + max - current, y, current - 8 * (current div 8), 7,125 BitBltCanvas(Offscreen.Canvas, X + Max - current, Y, current - 8 * (current div 8), 7, 126 126 HGrSystem.Data.Canvas, 104, 9 + 8 * 2); 127 127 Brush.Color := $000000; 128 FillRect(Rect( x, y, x + max - current, y+ 7));128 FillRect(Rect(X, Y, X + Max - current, Y + 7)); 129 129 Brush.Style := bsClear; 130 130 end; 131 131 132 132 RisedTextOut(Offscreen.Canvas, 16 + 160, 44, Phrases.Lookup('LUX')); 133 s:= Format('%d%%', [MyRO.LuxRate]);134 RisedTextOut(Offscreen.Canvas, 135 16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, s);133 S := Format('%d%%', [MyRO.LuxRate]); 134 RisedTextOut(Offscreen.Canvas, 135 16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, S); 136 136 PaintProgressBar(Offscreen.Canvas, 5, 16 + 160, 81, 137 137 MyRO.LuxRate * 120 div 100, 0, 120, MainTexture); … … 144 144 MainTexture.ColorBevelLight); 145 145 RisedTextOut(Offscreen.Canvas, 16 + 80, 164, Phrases.Lookup('TAXRATE')); 146 s:= Format('%d%%', [MyRO.TaxRate]);146 S := Format('%d%%', [MyRO.TaxRate]); 147 147 RisedTextOut(Offscreen.Canvas, 148 16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, s);148 16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, S); 149 149 PaintProgressBar(Offscreen.Canvas, 0, 16 + 80, 201, 150 150 MyRO.TaxRate * 120 div 100, 0, 120, MainTexture); … … 164 164 begin 165 165 Caption := Phrases.Lookup('TITLE_RATES'); 166 if MyRO.Wonder[woLiberty].EffectiveOwner = me then167 begin 168 ScienceBtn.Visible := false;169 LuxBtn.Visible := false;166 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 167 begin 168 ScienceBtn.Visible := False; 169 LuxBtn.Visible := False; 170 170 end 171 171 else 172 172 begin 173 ScienceBtn.Visible := true;174 LuxBtn.Visible := true;173 ScienceBtn.Visible := True; 174 LuxBtn.Visible := True; 175 175 end; 176 176 OffscreenPaint; … … 184 184 procedure TRatesDlg.TaxLuxBtnClick(Sender: TObject); 185 185 var 186 NewTax, NewLux: integer;186 NewTax, NewLux: Integer; 187 187 begin 188 188 NewTax := MyRO.TaxRate div 10; … … 191 191 begin 192 192 if NewTax < 10 then 193 inc(NewTax);193 Inc(NewTax); 194 194 if NewTax + NewLux > 10 then 195 dec(NewLux);195 Dec(NewLux); 196 196 end 197 197 else if (Sender = TaxDownBtn) and (NewTax > 0) then 198 dec(NewTax)198 Dec(NewTax) 199 199 else if (Sender = ScienceBtn) and (NewLux > 0) then 200 dec(NewLux)200 Dec(NewLux) 201 201 else if (Sender = LuxBtn) and (NewLux + NewTax < 100) then 202 inc(NewLux);203 if Server(sSetRates, me, NewTax + NewLux shl 4, nil^) <> eNotChanged then202 Inc(NewLux); 203 if Server(sSetRates, Me, NewTax + NewLux shl 4, nil^) <> eNotChanged then 204 204 begin 205 205 CityOptimizer_BeginOfTurn; 206 206 SmartUpdateContent; 207 MainScreen.UpdateViews( true);207 MainScreen.UpdateViews(True); 208 208 end; 209 209 end; -
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 -
trunk/LocalPlayer/TechTree.pas
r426 r447 55 55 yLegendPitch = 32; 56 56 57 function min(a, b: Integer): Integer;58 begin 59 if a < bthen60 result := a57 function Min(A, B: Integer): Integer; 58 begin 59 if A < B then 60 Result := A 61 61 else 62 result := b;63 end; 64 65 function max(a, b: Integer): Integer;66 begin 67 if a > bthen68 result := a62 Result := B; 63 end; 64 65 function Max(A, B: Integer): Integer; 66 begin 67 if A > B then 68 Result := A 69 69 else 70 result := b;70 Result := B; 71 71 end; 72 72 … … 84 84 procedure TTechTreeDlg.FormPaint(Sender: TObject); 85 85 var 86 X, w: Integer;86 X, W: Integer; 87 87 begin 88 88 with Canvas do begin 89 89 // black border 90 brush.color := $000000;91 fillrect(rect(0, 0, BlackBorder, ClientHeight));92 fillrect(rect(BlackBorder, 0, ClientWidth - BlackBorder, BlackBorder));93 fillrect(rect(ClientWidth - BlackBorder, 0, ClientWidth, ClientHeight));94 fillrect(rect(BlackBorder, ClientHeight - BlackBorder,90 Brush.Color := $000000; 91 FillRect(rect(0, 0, BlackBorder, ClientHeight)); 92 FillRect(rect(BlackBorder, 0, ClientWidth - BlackBorder, BlackBorder)); 93 FillRect(rect(ClientWidth - BlackBorder, 0, ClientWidth, ClientHeight)); 94 FillRect(rect(BlackBorder, ClientHeight - BlackBorder, 95 95 ClientWidth - BlackBorder, ClientHeight)); 96 96 97 97 // texturize empty space 98 brush.color := $FFFFFF;98 Brush.Color := $FFFFFF; 99 99 if xOffset > 0 then 100 100 FillRectSeamless(Canvas, BlackBorder, BlackBorder, BlackBorder + xOffset, … … 105 105 ClientWidth - BlackBorder, ClientHeight - BlackBorder, 106 106 -BlackBorder - xOffset, -BlackBorder - yOffset, Paper); 107 X := max(BlackBorder, BlackBorder + xOffset);108 w := min(BlackBorder + xOffset + Image.width, ClientWidth - BlackBorder);107 X := Max(BlackBorder, BlackBorder + xOffset); 108 W := Min(BlackBorder + xOffset + Image.width, ClientWidth - BlackBorder); 109 109 if yOffset > 0 then 110 FillRectSeamless(Canvas, X, BlackBorder, w, BlackBorder + yOffset,110 FillRectSeamless(Canvas, X, BlackBorder, W, BlackBorder + yOffset, 111 111 -BlackBorder - xOffset, -BlackBorder - yOffset, Paper); 112 112 if yOffset + Image.height < ClientHeight - 2 * BlackBorder then 113 FillRectSeamless(Canvas, X, BlackBorder + yOffset + Image.height, w,113 FillRectSeamless(Canvas, X, BlackBorder + yOffset + Image.height, W, 114 114 ClientHeight - BlackBorder, -BlackBorder - xOffset, 115 115 -BlackBorder - yOffset, Paper); 116 116 end; 117 BitBltCanvas(Canvas, max(BlackBorder, BlackBorder + xOffset),118 max(BlackBorder, BlackBorder + yOffset),119 min(Image.width, min(Image.width + xOffset,120 min(ClientWidth - 2 * BlackBorder, ClientWidth - 2 * BlackBorder - xOffset))121 ), min(Image.height, min(Image.height + yOffset,122 min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder -123 yOffset))), Image.Canvas, max(0, -xOffset),124 max(0, -yOffset));117 BitBltCanvas(Canvas, Max(BlackBorder, BlackBorder + xOffset), 118 Max(BlackBorder, BlackBorder + yOffset), 119 Min(Image.width, Min(Image.width + xOffset, 120 Min(ClientWidth - 2 * BlackBorder, ClientWidth - 2 * BlackBorder - xOffset)) 121 ), Min(Image.height, Min(Image.height + yOffset, 122 Min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder - 123 yOffset))), Image.Canvas, Max(0, -xOffset), 124 Max(0, -yOffset)); 125 125 end; 126 126 … … 128 128 var 129 129 X, Y, ad: Integer; 130 s: string;130 S: string; 131 131 NewWidth: Integer; 132 132 NewHeight: Integer; … … 142 142 // write advance names 143 143 Font.Assign(UniFont[ftSmall]); 144 Font. color := clBlack;145 brush.Style := bsClear;144 Font.Color := clBlack; 145 Brush.Style := bsClear; 146 146 for X := 0 to (Image.width - xStart) div xPitch do 147 147 for Y := 0 to (Image.height - yStart) div yPitch do … … 150 150 if ad and $FFFF00 = 0 then 151 151 begin 152 s:= Phrases.Lookup('ADVANCES', ad);153 while TextWidth( s) > 112 do154 Delete( s, Length(s), 1);155 TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s);152 S := Phrases.Lookup('ADVANCES', ad); 153 while TextWidth(S) > 112 do 154 Delete(S, Length(S), 1); 155 TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, S); 156 156 Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1] 157 157 := TransparentColor2; … … 191 191 if Button = mbLeft then 192 192 begin 193 dragging := true;193 dragging := True; 194 194 xDown := X; 195 195 yDown := Y; … … 200 200 Shift: TShiftState; X, Y: Integer); 201 201 begin 202 dragging := false;202 dragging := False; 203 203 end; 204 204 -
trunk/LocalPlayer/Term.pas
r442 r447 232 232 procedure Timer1Timer(Sender: TObject); 233 233 procedure MapBoxMouseDown(Sender: TObject; Button: TMouseButton; 234 Shift: TShiftState; x, y: integer);234 Shift: TShiftState; X, Y: Integer); 235 235 procedure EOTClick(Sender: TObject); 236 236 procedure PanelBoxMouseDown(Sender: TObject; Button: TMouseButton; 237 Shift: TShiftState; x, y: integer);238 procedure FormKeyDown(Sender: TObject; var Key: word; Shift: TShiftState);237 Shift: TShiftState; X, Y: Integer); 238 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 239 239 procedure mDisbandOrUtilizeClick(Sender: TObject); 240 240 procedure FormResize(Sender: TObject); 241 241 procedure PanelBtnClick(Sender: TObject); 242 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);242 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 243 243 procedure Toggle(Sender: TObject); 244 244 procedure PanelBoxMouseMove(Sender: TObject; Shift: TShiftState; 245 x, y: integer);245 X, Y: Integer); 246 246 procedure PanelBoxMouseUp(Sender: TObject; Button: TMouseButton; 247 Shift: TShiftState; x, y: integer);247 Shift: TShiftState; X, Y: Integer); 248 248 procedure MapBoxMouseMove(Sender: TObject; Shift: TShiftState; 249 x, y: integer);249 X, Y: Integer); 250 250 procedure mShowClick(Sender: TObject); 251 251 procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 252 Shift: TShiftState; x, y: integer);253 procedure FormMouseMove(Sender: TObject; Shift: TShiftState; x, y: integer);252 Shift: TShiftState; X, Y: Integer); 253 procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); 254 254 procedure FormMouseUp(Sender: TObject; Button: TMouseButton; 255 Shift: TShiftState; x, y: integer);255 Shift: TShiftState; X, Y: Integer); 256 256 procedure FormPaint(Sender: TObject); 257 257 procedure mRepClicked(Sender: TObject); … … 263 263 procedure mNamesClick(Sender: TObject); 264 264 procedure MapBtnClick(Sender: TObject); 265 procedure FormKeyUp(Sender: TObject; var Key: word; Shift: TShiftState);265 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 266 266 procedure CreateUnitClick(Sender: TObject); 267 267 procedure mSoundOffClick(Sender: TObject); … … 324 324 NoMap: TIsoMap; 325 325 NoMapPanel: TIsoMap; 326 function ChooseUnusedTribe: integer;326 function ChooseUnusedTribe: Integer; 327 327 function DoJob(j0: Integer): Integer; 328 328 procedure GetTribeList; 329 329 procedure InitModule; 330 330 procedure DoneModule; 331 procedure InitTurn(NewPlayer: integer);331 procedure InitTurn(NewPlayer: Integer); 332 332 procedure SaveMenuItemsState; 333 333 procedure ScrollBarUpdate(Sender: TObject); … … 341 341 procedure FocusNextUnit(Dir: Integer = 1); 342 342 procedure NextUnit(NearLoc: Integer; AutoTurn: Boolean); 343 procedure Scroll(dx, dy: integer);344 procedure SetMapPos(Loc: integer; MapPos: TPoint);345 procedure Centre(Loc: integer);346 procedure SetTroopLoc(Loc: integer);347 procedure ProcessRect(x0, y0, nx, ny, Options: integer);348 procedure PaintLoc(Loc: integer; Radius: integer = 0);349 procedure PaintLoc_BeforeMove(FromLoc: integer);350 procedure PaintLocTemp(Loc: integer; Style: TPaintLocTempStyle = pltsNormal);351 procedure PaintBufferToScreen(xMap, yMap, width, height: integer);343 procedure Scroll(dx, dy: Integer); 344 procedure SetMapPos(Loc: Integer; MapPos: TPoint); 345 procedure Centre(Loc: Integer); 346 procedure SetTroopLoc(Loc: Integer); 347 procedure ProcessRect(x0, y0, nx, ny, Options: Integer); 348 procedure PaintLoc(Loc: Integer; Radius: Integer = 0); 349 procedure PaintLoc_BeforeMove(FromLoc: Integer); 350 procedure PaintLocTemp(Loc: Integer; Style: TPaintLocTempStyle = pltsNormal); 351 procedure PaintBufferToScreen(xMap, yMap, width, height: Integer); 352 352 procedure PaintDestination; 353 procedure SetUnFocus(uix: integer);354 function MoveUnit(dx, dy: integer; Options: integer = 0): integer;355 procedure MoveToLoc(Loc: integer; CheckSuicide: boolean);356 procedure MoveOnScreen(ShowMove: TShowMove; Step0, Step1, nStep: integer;357 Restore: boolean = true);358 procedure FocusOnLoc(Loc: integer; Options: integer = 0);359 function EndTurn(WasSkipped: boolean = false): boolean;353 procedure SetUnFocus(uix: Integer); 354 function MoveUnit(dx, dy: Integer; Options: Integer = 0): Integer; 355 procedure MoveToLoc(Loc: Integer; CheckSuicide: Boolean); 356 procedure MoveOnScreen(ShowMove: TShowMove; Step0, Step1, nStep: Integer; 357 Restore: Boolean = True); 358 procedure FocusOnLoc(Loc: Integer; Options: Integer = 0); 359 function EndTurn(WasSkipped: Boolean = False): Boolean; 360 360 procedure EndNego; 361 function IsPanelPixel( x, y: integer): boolean;361 function IsPanelPixel(X, Y: Integer): Boolean; 362 362 procedure InitPopup(Popup: TPopupMenu); 363 363 procedure SetMapOptions; … … 365 365 procedure CheckTerrainBtnVisible; 366 366 procedure RememberPeaceViolation; 367 procedure SetDebugMap( p: integer);368 procedure SetViewpoint( p: integer);369 function LocationOfScreenPixel( x, y: integer): Integer;367 procedure SetDebugMap(P: Integer); 368 procedure SetViewpoint(P: Integer); 369 function LocationOfScreenPixel(X, Y: Integer): Integer; 370 370 function GetCenterLoc: Integer; 371 371 procedure SetTileSizeCenter(TileSize: TTileSize); 372 372 procedure SetTileSize(TileSize: TTileSize; Loc: Integer; MapPos: TPoint); 373 procedure RectInvalidate(Left, Top, Rigth, Bottom: integer);373 procedure RectInvalidate(Left, Top, Rigth, Bottom: Integer); 374 374 procedure ShowEnemyShipChange(ShowShipChange: TShowShipChange); 375 procedure SmartRectInvalidate(Left, Top, Rigth, Bottom: integer);375 procedure SmartRectInvalidate(Left, Top, Rigth, Bottom: Integer); 376 376 procedure LoadSettings; 377 377 procedure SaveSettings; … … 381 381 procedure UpdateKeyShortcuts; 382 382 procedure SetFullScreen(Active: Boolean); 383 procedure PaintZoomedTile(dst: TBitmap; x, y, Loc: integer);383 procedure PaintZoomedTile(dst: TBitmap; X, Y, Loc: Integer); 384 384 public 385 385 UsedOffscreenWidth: Integer; … … 387 387 Offscreen: TBitmap; 388 388 OffscreenUser: TForm; 389 procedure Client(Command, NewPlayer: integer; var Data);390 procedure SetAIName( p: integer; Name: string);391 function ZoomToCity(Loc: integer; NextUnitOnClose: boolean = false;392 ShowEvent: integer = 0): boolean;393 procedure CityClosed(Activateuix: integer; StepFocus: boolean = false;394 SelectFocus: boolean = false);395 function DipCall(Command: integer): integer;396 function OfferCall(var Offer: TOffer): integer;397 procedure UpdateViews(UpdateCityScreen: boolean = false);398 function ContactRefused( p: integer; Item: String): boolean;389 procedure Client(Command, NewPlayer: Integer; var Data); 390 procedure SetAIName(P: Integer; Name: string); 391 function ZoomToCity(Loc: Integer; NextUnitOnClose: Boolean = False; 392 ShowEvent: Integer = 0): Boolean; 393 procedure CityClosed(Activateuix: Integer; StepFocus: Boolean = False; 394 SelectFocus: Boolean = False); 395 function DipCall(Command: Integer): Integer; 396 function OfferCall(var Offer: TOffer): Integer; 397 procedure UpdateViews(UpdateCityScreen: Boolean = False); 398 function ContactRefused(P: Integer; Item: String): Boolean; 399 399 end; 400 400 … … 407 407 408 408 TTribeInfo = record 409 trix: integer;409 trix: Integer; 410 410 FileName: ShortString; 411 411 function GetCommandDataSize: Byte; … … 415 415 416 416 TCityNameInfo = record 417 ID: integer;417 ID: Integer; 418 418 NewName: ShortString; 419 419 function GetCommandDataSize: Byte; … … 423 423 424 424 TModelNameInfo = record 425 mix: integer;425 mix: Integer; 426 426 NewName: ShortString; 427 427 function GetCommandDataSize: Byte; … … 472 472 usToldNoReturn = $100; 473 473 usPersistent = usStay or usGoto or usEnhance or usRecover or 474 integer($FFFF0000);474 Integer($FFFF0000); 475 475 476 476 { model status flags } … … 486 486 adNexus = $803; 487 487 488 SpecialModelPictureCode: array [0 .. nSpecialModel - 1] of integer = (10,488 SpecialModelPictureCode: array [0 .. nSpecialModel - 1] of Integer = (10, 489 489 11, 40, 41, 21, 30, { 50,51, } 64, 74, { 71, } 73); 490 490 … … 499 499 500 500 nCityEventPriority = 16; 501 CityEventPriority: array [0 .. nCityEventPriority - 1] of integer =501 CityEventPriority: array [0 .. nCityEventPriority - 1] of Integer = 502 502 (chDisorder, chImprovementLost, chUnitLost, chAllImpsMade, chProduction, 503 503 chOldWonder, chNoSettlerProd, chPopDecrease, chProductionSabotaged, … … 574 574 DipMem: array [0 .. nPl - 1] of TDipMem; 575 575 576 function CityEventName( i: integer): string;577 function RoughCredibility(Credibility: integer): integer;578 579 function InitEnemyModel(emix: integer): boolean;576 function CityEventName(I: Integer): string; 577 function RoughCredibility(Credibility: Integer): Integer; 578 579 function InitEnemyModel(emix: Integer): Boolean; 580 580 procedure InitAllEnemyModels; 581 procedure InitMyModel(mix: integer; final: boolean);582 583 procedure ImpImage(ca: TCanvas; x, y, iix: integer; Government: integer = -1;584 IsControl: boolean = false);581 procedure InitMyModel(mix: Integer; final: Boolean); 582 583 procedure ImpImage(ca: TCanvas; X, Y, iix: Integer; Government: Integer = -1; 584 IsControl: Boolean = False); 585 585 procedure HelpOnTerrain(Loc: Integer; NewMode: TWindowMode); 586 586 function AlignUp(Value, Alignment: Integer): Integer; … … 610 610 MoveTime = 300; // {time for moving a unit in ms} 611 611 WaitAfterShowMove = 32; 612 FastScrolling = false; // causes problems with overlapping windows612 FastScrolling = False; // causes problems with overlapping windows 613 613 614 614 nBrushTypes = 26; … … 648 648 CurrentMoveInfo: TCurrentMoveInfo; 649 649 650 function CityEventName( i: integer): string;651 begin 652 if i= 14 then // chAllImpsMade650 function CityEventName(I: Integer): string; 651 begin 652 if I = 14 then // chAllImpsMade 653 653 if not Phrases2FallenBackToEnglish then 654 result := Phrases2.Lookup('CITYEVENT_ALLIMPSMADE')654 Result := Phrases2.Lookup('CITYEVENT_ALLIMPSMADE') 655 655 else 656 result := Phrases.Lookup('CITYEVENTS', 1)656 Result := Phrases.Lookup('CITYEVENTS', 1) 657 657 else 658 result := Phrases.Lookup('CITYEVENTS', i);658 Result := Phrases.Lookup('CITYEVENTS', I); 659 659 end; 660 660 … … 666 666 TBuffer = array [0 .. 99999, 0 .. 2] of Integer; 667 667 var 668 Sum, Cnt, dx, dy, nx, ny, ix, iy, ir, x, y, c, ch: Integer;668 Sum, Cnt, dx, dy, nx, ny, ix, iy, ir, X, Y, C, ch: Integer; 669 669 xdivider, ydivider: Integer; 670 670 Resampled: ^TBuffer; … … 682 682 PixelPtr := PixelPointer(BigImp, ScaleToNative(ix * xSizeBig), 683 683 ScaleToNative(Cut + iy * ySizeBig)); 684 for y:= 0 to ScaleToNative(ySizeBig - 2 * Cut) - 1 do begin685 ydivider := (ScaleFromNative( y) * ySizeSmall div (ySizeBig - 2 * Cut) + 1) *686 (ySizeBig - 2 * Cut) - ScaleFromNative( y) * ySizeSmall;684 for Y := 0 to ScaleToNative(ySizeBig - 2 * Cut) - 1 do begin 685 ydivider := (ScaleFromNative(Y) * ySizeSmall div (ySizeBig - 2 * Cut) + 1) * 686 (ySizeBig - 2 * Cut) - ScaleFromNative(Y) * ySizeSmall; 687 687 if ydivider > ySizeSmall then 688 688 ydivider := ySizeSmall; 689 for x:= 0 to ScaleToNative(xSizeBig) - 1 do begin690 ir := ix * xSizeSmall + iy * nx * ySizeSmall + ScaleFromNative( x) *691 xSizeSmall div xSizeBig + ScaleFromNative( y) *689 for X := 0 to ScaleToNative(xSizeBig) - 1 do begin 690 ir := ix * xSizeSmall + iy * nx * ySizeSmall + ScaleFromNative(X) * 691 xSizeSmall div xSizeBig + ScaleFromNative(Y) * 692 692 ySizeSmall div (ySizeBig - 2 * Cut) * nx; 693 xdivider := (ScaleFromNative( x) * xSizeSmall div xSizeBig + 1) *694 xSizeBig - ScaleFromNative( x) * xSizeSmall;693 xdivider := (ScaleFromNative(X) * xSizeSmall div xSizeBig + 1) * 694 xSizeBig - ScaleFromNative(X) * xSizeSmall; 695 695 if xdivider > xSizeSmall then 696 696 xdivider := xSizeSmall; 697 697 for ch := 0 to 2 do begin 698 c:= PixelPtr.Pixel^.Planes[ch];699 Inc(Resampled[ir, ch], c* xdivider * ydivider);698 C := PixelPtr.Pixel^.Planes[ch]; 699 Inc(Resampled[ir, ch], C * xdivider * ydivider); 700 700 if xdivider < xSizeSmall then 701 Inc(Resampled[ir + 1, ch], c* (xSizeSmall - xdivider) *701 Inc(Resampled[ir + 1, ch], C * (xSizeSmall - xdivider) * 702 702 ydivider); 703 703 if ydivider < ySizeSmall then 704 704 Inc(Resampled[ir + nx, ch], 705 c* xdivider * (ySizeSmall - ydivider));705 C * xdivider * (ySizeSmall - ydivider)); 706 706 if (xdivider < xSizeSmall) and (ydivider < ySizeSmall) then 707 Inc(Resampled[ir + nx + 1, ch], c* (xSizeSmall - xdivider) *707 Inc(Resampled[ir + nx + 1, ch], C * (xSizeSmall - xdivider) * 708 708 (ySizeSmall - ydivider)); 709 709 end; … … 719 719 SmallImp.BeginUpdate; 720 720 PixelPtr := PixelPointer(SmallImp); 721 for y:= 0 to ScaleToNative(ny) - 1 do begin722 for x:= 0 to ScaleToNative(nx) - 1 do begin721 for Y := 0 to ScaleToNative(ny) - 1 do begin 722 for X := 0 to ScaleToNative(nx) - 1 do begin 723 723 for ch := 0 to 2 do begin 724 724 Sum := 0; 725 725 Cnt := 0; 726 726 for dy := -1 to 1 do 727 if ((dy >= 0) or (ScaleFromNative( y) mod ySizeSmall > 0)) and728 ((dy <= 0) or (ScaleFromNative( y) mod ySizeSmall < ySizeSmall - 1)) then727 if ((dy >= 0) or (ScaleFromNative(Y) mod ySizeSmall > 0)) and 728 ((dy <= 0) or (ScaleFromNative(Y) mod ySizeSmall < ySizeSmall - 1)) then 729 729 for dx := -1 to 1 do 730 if ((dx >= 0) or (ScaleFromNative( x) mod xSizeSmall > 0)) and731 ((dx <= 0) or (ScaleFromNative( x) mod xSizeSmall < xSizeSmall - 1)) then730 if ((dx >= 0) or (ScaleFromNative(X) mod xSizeSmall > 0)) and 731 ((dx <= 0) or (ScaleFromNative(X) mod xSizeSmall < xSizeSmall - 1)) then 732 732 begin 733 Inc(Sum, Resampled[ScaleFromNative( x) + dx + nx * (ScaleFromNative(y) + dy), ch]);733 Inc(Sum, Resampled[ScaleFromNative(X) + dx + nx * (ScaleFromNative(Y) + dy), ch]); 734 734 Inc(Cnt); 735 735 end; 736 Sum := ((Cnt * Sharpen + 800) * Resampled[ScaleFromNative( x) + nx * ScaleFromNative(y), ch] - Sum *736 Sum := ((Cnt * Sharpen + 800) * Resampled[ScaleFromNative(X) + nx * ScaleFromNative(Y), ch] - Sum * 737 737 Sharpen) div (800 * xSizeBig * (ySizeBig - 2 * Cut)); 738 738 if Sum < 0 then Sum := 0; … … 748 748 end; 749 749 750 procedure ImpImage(ca: TCanvas; x, y, iix: integer; Government: integer;751 IsControl: boolean);750 procedure ImpImage(ca: TCanvas; X, Y, iix: Integer; Government: Integer; 751 IsControl: Boolean); 752 752 begin 753 753 if Government < 0 then … … 755 755 if (iix = imPalace) and (Government <> gAnarchy) then 756 756 iix := Government - 8; 757 FrameImage(ca, BigImp, x, y, xSizeBig, ySizeBig, (iix + SystemIconLines * 7)757 FrameImage(ca, BigImp, X, Y, xSizeBig, ySizeBig, (iix + SystemIconLines * 7) 758 758 mod 7 * xSizeBig, (iix + SystemIconLines * 7) div 7 * ySizeBig, IsControl); 759 759 end; … … 778 778 { *** tribe management procedures *** } 779 779 780 function RoughCredibility(Credibility: integer): integer;780 function RoughCredibility(Credibility: Integer): Integer; 781 781 begin 782 782 case Credibility of 783 783 0 .. 69: 784 result := 0;784 Result := 0; 785 785 70 .. 89: 786 result := 1;786 Result := 1; 787 787 90 .. 99: 788 result := 2;788 Result := 2; 789 789 100: 790 result := 3;791 end; 792 end; 793 794 procedure ChooseModelPicture( p, mix, code, Hash, Turn: integer;795 ForceNew, final: boolean);790 Result := 3; 791 end; 792 end; 793 794 procedure ChooseModelPicture(P, mix, Code, Hash, Turn: Integer; 795 ForceNew, final: Boolean); 796 796 var 797 i: integer;797 I: Integer; 798 798 Picture: TModelPictureInfo; 799 IsNew: boolean;800 begin 801 Picture.trix := p;799 IsNew: Boolean; 800 begin 801 Picture.trix := P; 802 802 Picture.mix := mix; 803 if code = 74 then803 if Code = 74 then 804 804 begin // use correct pictures for slaves 805 if Tribe[ p].mixSlaves < 0 then806 if not TribeOriginal[ p] then807 Tribe[ p].mixSlaves := mix805 if Tribe[P].mixSlaves < 0 then 806 if not TribeOriginal[P] then 807 Tribe[P].mixSlaves := mix 808 808 else 809 809 begin 810 i := mix + pshl 16;811 Server(cSetSlaveIndex, 0, 0, i);810 I := mix + P shl 16; 811 Server(cSetSlaveIndex, 0, 0, I); 812 812 end; 813 813 if ToldSlavery = 1 then … … 817 817 Picture.Hash := 0; 818 818 Picture.GrName := 'StdUnits.png'; 819 IsNew := true;819 IsNew := True; 820 820 end 821 821 else 822 822 begin 823 823 Picture.Hash := Hash; 824 IsNew := Tribe[ p].ChooseModelPicture(Picture, code, Turn, ForceNew);824 IsNew := Tribe[P].ChooseModelPicture(Picture, Code, Turn, ForceNew); 825 825 end; 826 826 if final then 827 if not TribeOriginal[ p] then828 Tribe[ p].SetModelPicture(Picture, IsNew)827 if not TribeOriginal[P] then 828 Tribe[P].SetModelPicture(Picture, IsNew) 829 829 else if IsNew then 830 830 Server(CommandWithData(cSetNewModelPicture, Picture.GetCommandDataSize), … … 834 834 0, 0, Picture) 835 835 else 836 with Tribe[ p].ModelPicture[mix] do836 with Tribe[P].ModelPicture[mix] do 837 837 begin 838 838 HGr := LoadGraphicSet(Picture.GrName); … … 841 841 end; 842 842 843 function InitEnemyModel(emix: integer): boolean;843 function InitEnemyModel(emix: Integer): Boolean; 844 844 begin 845 845 if GameMode = cMovie then 846 846 begin 847 result := false;848 exit;847 Result := False; 848 Exit; 849 849 end; 850 850 with MyRO.EnemyModel[emix] do 851 851 ChooseModelPicture(Owner, mix, ModelCode(MyRO.EnemyModel[emix]), 852 ModelHash(MyRO.EnemyModel[emix]), MyRO.Turn, false, true);853 result := true;852 ModelHash(MyRO.EnemyModel[emix]), MyRO.Turn, False, True); 853 Result := True; 854 854 end; 855 855 856 856 procedure InitAllEnemyModels; 857 857 var 858 emix: integer;858 emix: Integer; 859 859 begin 860 860 for emix := 0 to MyRO.nEnemyModel - 1 do … … 864 864 end; 865 865 866 procedure InitMyModel(mix: integer; final: boolean);866 procedure InitMyModel(mix: Integer; final: Boolean); 867 867 var 868 868 mi: TModelInfo; 869 869 begin 870 870 if (GameMode = cMovie) and (MyModel[mix].Kind < $08) then 871 exit;871 Exit; 872 872 // don't exit for special units because cSetModelPicture comes after TellNewModels 873 MakeModelInfo( me, mix, MyModel[mix], mi);874 ChooseModelPicture( me, mix, ModelCode(mi), ModelHash(mi), MyRO.Turn,875 false, final);876 end; 877 878 function AttackSound( code: integer): string;879 begin 880 result := 'ATTACK_' + char(48 + code div 100 mod 10) +881 char(48 + code div 10 mod 10) + char(48 + code mod 10);882 end; 883 884 procedure CheckToldNoReturn(uix: integer);873 MakeModelInfo(Me, mix, MyModel[mix], mi); 874 ChooseModelPicture(Me, mix, ModelCode(mi), ModelHash(mi), MyRO.Turn, 875 False, final); 876 end; 877 878 function AttackSound(Code: Integer): string; 879 begin 880 Result := 'ATTACK_' + char(48 + Code div 100 mod 10) + 881 char(48 + Code div 10 mod 10) + char(48 + Code mod 10); 882 end; 883 884 procedure CheckToldNoReturn(uix: Integer); 885 885 // check whether aircraft survived low-fuel warning 886 886 begin 887 assert(not supervising);887 Assert(not Supervising); 888 888 with MyUn[uix] do 889 889 if (Status and usToldNoReturn <> 0) and … … 893 893 end; 894 894 895 function CreateTribe( p: integer; FileName: string; Original: boolean): boolean;895 function CreateTribe(P: Integer; FileName: string; Original: Boolean): Boolean; 896 896 begin 897 897 FileName := LocalizedFilePath('Tribes' + DirectorySeparator + FileName + … … 903 903 end; 904 904 905 TribeOriginal[ p] := Original;906 Tribe[ p] := TTribe.Create(FileName);907 with Tribe[ p] do905 TribeOriginal[P] := Original; 906 Tribe[P] := TTribe.Create(FileName); 907 with Tribe[P] do 908 908 begin 909 909 if (GameMode = cNewGame) or not Original then 910 910 begin 911 Term.ChooseModelPicture( p, 0, 010, 1, 0, true, true);912 Term.ChooseModelPicture( p, 1, 040, 1, 0, true, true);913 Term.ChooseModelPicture( p, 2, 041, 1, 0, true, true);914 Term.ChooseModelPicture( p, -1, 017, 1, 0, true, true);915 end; 916 DipMem[ p].pContact := -1;917 end; 918 result := true;911 Term.ChooseModelPicture(P, 0, 010, 1, 0, True, True); 912 Term.ChooseModelPicture(P, 1, 040, 1, 0, True, True); 913 Term.ChooseModelPicture(P, 2, 041, 1, 0, True, True); 914 Term.ChooseModelPicture(P, -1, 017, 1, 0, True, True); 915 end; 916 DipMem[P].pContact := -1; 917 end; 918 Result := True; 919 919 end; 920 920 921 921 procedure TellNewContacts; 922 922 var 923 p1: integer;924 begin 925 if not supervising then923 p1: Integer; 924 begin 925 if not Supervising then 926 926 for p1 := 0 to nPl - 1 do 927 if (p1 <> me) and (1 shl p1 and MyData.ToldContact = 0) and927 if (p1 <> Me) and (1 shl p1 and MyData.ToldContact = 0) and 928 928 (1 shl p1 and MyRO.Alive <> 0) and (MyRO.Treaty[p1] > trNoContact) then 929 929 begin … … 935 935 procedure TellNewModels; 936 936 var 937 mix: integer;937 mix: Integer; 938 938 ModelNameInfo: TModelNameInfo; 939 939 begin 940 if supervising then941 exit;942 with Tribe[ me] do940 if Supervising then 941 Exit; 942 with Tribe[Me] do 943 943 while MyData.ToldModels < MyRO.nModel do 944 944 begin { new Unit class available } … … 951 951 end; 952 952 if not Assigned(ModelPicture[MyData.ToldModels].HGr) then 953 InitMyModel(MyData.ToldModels, true);953 InitMyModel(MyData.ToldModels, True); 954 954 { only run if no researched model } 955 955 with MessgExDlg do … … 983 983 (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt); 984 984 Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize), 985 me, 0, ModelNameInfo);985 Me, 0, ModelNameInfo); 986 986 end; 987 987 end; … … 992 992 MyModel[mix].Status := MyModel[mix].Status or msObsolete; 993 993 end; 994 inc(MyData.ToldModels);994 Inc(MyData.ToldModels); 995 995 end; 996 996 end; … … 1017 1017 end; 1018 1018 1019 procedure TMainScreen.PaintZoomedTile(dst: TBitmap; x, y, Loc: integer);1020 1021 procedure TSprite(xDst, yDst, xSrc, ySrc: integer);1019 procedure TMainScreen.PaintZoomedTile(dst: TBitmap; X, Y, Loc: Integer); 1020 1021 procedure TSprite(xDst, yDst, xSrc, ySrc: Integer); 1022 1022 begin 1023 1023 with NoMapPanel do 1024 Sprite(dst, HGrTerrain, x + xDst, y+ yDst, xxt * 2, yyt * 3,1024 Sprite(dst, HGrTerrain, X + xDst, Y + yDst, xxt * 2, yyt * 3, 1025 1025 1 + xSrc * (xxt * 2 + 1), 1 + ySrc * (yyt * 3 + 1)); 1026 1026 end; 1027 1027 1028 procedure TSprite4(xSrc, ySrc: integer);1028 procedure TSprite4(xSrc, ySrc: Integer); 1029 1029 begin 1030 1030 with NoMapPanel do begin 1031 Sprite(dst, HGrTerrain, x + xxt, y+ yyt + 2, xxt * 2, yyt * 2 - 2,1031 Sprite(dst, HGrTerrain, X + xxt, Y + yyt + 2, xxt * 2, yyt * 2 - 2, 1032 1032 1 + xSrc * (xxt * 2 + 1), 3 + yyt + ySrc * (yyt * 3 + 1)); 1033 Sprite(dst, HGrTerrain, x + 4, y+ 2 * yyt, xxt * 2 - 4, yyt * 2,1033 Sprite(dst, HGrTerrain, X + 4, Y + 2 * yyt, xxt * 2 - 4, yyt * 2, 1034 1034 5 + xSrc * (xxt * 2 + 1), 1 + yyt + ySrc * (yyt * 3 + 1)); 1035 Sprite(dst, HGrTerrain, x + xxt * 2, y+ 2 * yyt, xxt * 2 - 4, yyt * 2,1035 Sprite(dst, HGrTerrain, X + xxt * 2, Y + 2 * yyt, xxt * 2 - 4, yyt * 2, 1036 1036 1 + xSrc * (xxt * 2 + 1), 1 + yyt + ySrc * (yyt * 3 + 1)); 1037 Sprite(dst, HGrTerrain, x + xxt, y+ yyt * 3, xxt * 2, yyt * 2 - 2,1037 Sprite(dst, HGrTerrain, X + xxt, Y + yyt * 3, xxt * 2, yyt * 2 - 2, 1038 1038 1 + xSrc * (xxt * 2 + 1), 1 + yyt + ySrc * (yyt * 3 + 1)); 1039 1039 end; … … 1041 1041 1042 1042 var 1043 cix, ySrc, Tile: integer;1043 cix, ySrc, Tile: Integer; 1044 1044 begin 1045 1045 with NoMapPanel do begin … … 1055 1055 cix := MyRO.nCity - 1; 1056 1056 while (cix >= 0) and (MyCity[cix].Loc <> Loc) do 1057 dec(cix);1058 assert(cix >= 0);1057 Dec(cix); 1058 Assert(cix >= 0); 1059 1059 if MyCity[cix].Built[imSupermarket] > 0 then 1060 1060 Tile := Tile or tiFarm … … 1147 1147 end; 1148 1148 1149 function ChooseResearch: boolean;1149 function ChooseResearch: Boolean; 1150 1150 var 1151 ChosenResearch: integer;1151 ChosenResearch: Integer; 1152 1152 begin 1153 1153 if (MyData.FarTech <> adNone) and (MyRO.Tech[MyData.FarTech] >= tsApplicable) … … 1158 1158 repeat 1159 1159 ModalSelectDlg.ShowNewContent(wmModal, kAdvance); 1160 if ModalSelectDlg. result < 0 then1161 begin 1162 result := false;1163 exit;1164 end; 1165 ChosenResearch := ModalSelectDlg. result;1160 if ModalSelectDlg.Result < 0 then 1161 begin 1162 Result := False; 1163 Exit; 1164 end; 1165 ChosenResearch := ModalSelectDlg.Result; 1166 1166 if ChosenResearch = adMilitary then 1167 1167 begin 1168 1168 DraftDlg.ShowNewContent(wmModal); 1169 1169 if DraftDlg.ModalResult <> mrOK then 1170 Tribe[ me].ModelPicture[MyRO.nModel].HGr := nil;1170 Tribe[Me].ModelPicture[MyRO.nModel].HGr := nil; 1171 1171 end; 1172 1172 until (ChosenResearch <> adMilitary) or (DraftDlg.ModalResult = mrOK); 1173 1173 1174 1174 if ChosenResearch = adMilitary then 1175 InitMyModel(MyRO.nModel, true)1175 InitMyModel(MyRO.nModel, True) 1176 1176 else if ChosenResearch = adFar then 1177 1177 begin 1178 1178 ModalSelectDlg.ShowNewContent(wmModal, kFarAdvance); 1179 if ModalSelectDlg. result >= 0 then1180 if (ModalSelectDlg. result = adNone) or1181 (Server(sSetResearch - sExecute, me, ModalSelectDlg.result, nil^) <1179 if ModalSelectDlg.Result >= 0 then 1180 if (ModalSelectDlg.Result = adNone) or 1181 (Server(sSetResearch - sExecute, Me, ModalSelectDlg.Result, nil^) < 1182 1182 rExecuted) then 1183 MyData.FarTech := ModalSelectDlg. result1183 MyData.FarTech := ModalSelectDlg.Result 1184 1184 else 1185 1185 begin 1186 ChosenResearch := ModalSelectDlg. result;1186 ChosenResearch := ModalSelectDlg.Result; 1187 1187 // can be researched immediately 1188 1188 MyData.FarTech := adNone; … … 1193 1193 MyData.FarTech := adNexus 1194 1194 else 1195 Server(sSetResearch, me, ChosenResearch, nil^);1195 Server(sSetResearch, Me, ChosenResearch, nil^); 1196 1196 ListDlg.TechChange; 1197 result := true;1197 Result := True; 1198 1198 end; 1199 1199 … … 1223 1223 (* ** client function handling ** *) 1224 1224 1225 function TMainScreen.DipCall(Command: integer): integer;1225 function TMainScreen.DipCall(Command: Integer): Integer; 1226 1226 var 1227 i: integer;1228 IsTreatyDeal: boolean;1229 begin 1230 result := Server(Command, me, 0, nil^);1231 if result >= rExecuted then1227 I: Integer; 1228 IsTreatyDeal: Boolean; 1229 begin 1230 Result := Server(Command, Me, 0, nil^); 1231 if Result >= rExecuted then 1232 1232 begin 1233 1233 if Command and $FF0F = scContact then 1234 1234 begin 1235 DipMem[ me].pContact := Command shr 4 and $F;1235 DipMem[Me].pContact := Command shr 4 and $F; 1236 1236 NegoDlg.Initiate; 1237 DipMem[ me].DeliveredPrices := [];1238 DipMem[ me].ReceivedPrices := [];1239 end; 1240 1241 DipMem[ me].SentCommand := Command;1242 DipMem[ me].FormerTreaty := MyRO.Treaty[DipMem[me].pContact];1237 DipMem[Me].DeliveredPrices := []; 1238 DipMem[Me].ReceivedPrices := []; 1239 end; 1240 1241 DipMem[Me].SentCommand := Command; 1242 DipMem[Me].FormerTreaty := MyRO.Treaty[DipMem[Me].pContact]; 1243 1243 if Command = scDipCancelTreaty then 1244 1244 Play('CANCELTREATY') 1245 1245 else if Command = scDipAccept then 1246 1246 begin // remember delivered and received prices 1247 for i:= 0 to ReceivedOffer.nDeliver - 1 do1248 include(DipMem[me].ReceivedPrices, ReceivedOffer.Price[i] shr 24);1249 for i:= 0 to ReceivedOffer.nCost - 1 do1250 include(DipMem[me].DeliveredPrices,1251 ReceivedOffer.Price[ReceivedOffer.nDeliver + i] shr 24);1252 IsTreatyDeal := false;1253 for i:= 0 to ReceivedOffer.nDeliver + ReceivedOffer.nCost - 1 do1254 if ReceivedOffer.Price[ i] and opMask = opTreaty then1255 IsTreatyDeal := true;1247 for I := 0 to ReceivedOffer.nDeliver - 1 do 1248 Include(DipMem[Me].ReceivedPrices, ReceivedOffer.Price[I] shr 24); 1249 for I := 0 to ReceivedOffer.nCost - 1 do 1250 Include(DipMem[Me].DeliveredPrices, 1251 ReceivedOffer.Price[ReceivedOffer.nDeliver + I] shr 24); 1252 IsTreatyDeal := False; 1253 for I := 0 to ReceivedOffer.nDeliver + ReceivedOffer.nCost - 1 do 1254 if ReceivedOffer.Price[I] and opMask = opTreaty then 1255 IsTreatyDeal := True; 1256 1256 if IsTreatyDeal then 1257 1257 Play('NEWTREATY') … … 1260 1260 end; 1261 1261 CityDlg.CloseAction := None; 1262 if G.RO[DipMem[ me].pContact] <> nil then1262 if G.RO[DipMem[Me].pContact] <> nil then 1263 1263 begin // close windows for next player 1264 1264 ApplyToVisibleForms(faClose); … … 1274 1274 end; 1275 1275 1276 function TMainScreen.OfferCall(var Offer: TOffer): integer;1277 begin 1278 result := Server(scDipOffer, me, 0, Offer);1279 if result >= rExecuted then1280 begin 1281 DipMem[ me].SentCommand := scDipOffer;1282 DipMem[ me].FormerTreaty := MyRO.Treaty[DipMem[me].pContact];1283 DipMem[ me].SentOffer := Offer;1276 function TMainScreen.OfferCall(var Offer: TOffer): Integer; 1277 begin 1278 Result := Server(scDipOffer, Me, 0, Offer); 1279 if Result >= rExecuted then 1280 begin 1281 DipMem[Me].SentCommand := scDipOffer; 1282 DipMem[Me].FormerTreaty := MyRO.Treaty[DipMem[Me].pContact]; 1283 DipMem[Me].SentOffer := Offer; 1284 1284 CityDlg.CloseAction := None; 1285 if G.RO[DipMem[ me].pContact] <> nil then1285 if G.RO[DipMem[Me].pContact] <> nil then 1286 1286 begin // close windows for next player 1287 1287 ApplyToVisibleForms(faClose); … … 1297 1297 end; 1298 1298 1299 procedure TMainScreen.SetUnFocus(uix: integer);1299 procedure TMainScreen.SetUnFocus(uix: Integer); 1300 1300 var 1301 Loc0: integer;1302 begin 1303 assert(not((uix >= 0) and supervising));1301 Loc0: Integer; 1302 begin 1303 Assert(not((uix >= 0) and Supervising)); 1304 1304 if uix <> UnFocus then 1305 1305 begin 1306 DestinationMarkON := false;1306 DestinationMarkON := False; 1307 1307 PaintDestination; 1308 1308 if uix >= 0 then 1309 1309 UnStartLoc := MyUn[uix].Loc; 1310 BlinkON := false;1310 BlinkON := False; 1311 1311 BlinkTime := -1; 1312 1312 if UnFocus >= 0 then … … 1328 1328 procedure TMainScreen.CheckTerrainBtnVisible; 1329 1329 var 1330 Tile: integer;1330 Tile: Integer; 1331 1331 mox: ^TModel; 1332 1332 begin … … 1340 1340 end 1341 1341 else 1342 TerrainBtn.Visible := false;1342 TerrainBtn.Visible := False; 1343 1343 end; 1344 1344 … … 1348 1348 begin 1349 1349 MovieSpeed1Btn.Down := MovieSpeed = 1; 1350 MovieSpeed1Btn.Visible := true;1350 MovieSpeed1Btn.Visible := True; 1351 1351 MovieSpeed2Btn.Down := MovieSpeed = 2; 1352 MovieSpeed2Btn.Visible := true;1352 MovieSpeed2Btn.Visible := True; 1353 1353 MovieSpeed3Btn.Down := MovieSpeed = 3; 1354 MovieSpeed3Btn.Visible := true;1354 MovieSpeed3Btn.Visible := True; 1355 1355 MovieSpeed4Btn.Down := MovieSpeed = 4; 1356 MovieSpeed4Btn.Visible := true;1356 MovieSpeed4Btn.Visible := True; 1357 1357 end 1358 1358 else 1359 1359 begin 1360 MovieSpeed1Btn.Visible := false;1361 MovieSpeed2Btn.Visible := false;1362 MovieSpeed3Btn.Visible := false;1363 MovieSpeed4Btn.Visible := false;1360 MovieSpeed1Btn.Visible := False; 1361 MovieSpeed2Btn.Visible := False; 1362 MovieSpeed3Btn.Visible := False; 1363 MovieSpeed4Btn.Visible := False; 1364 1364 end; 1365 1365 end; … … 1375 1375 end; 1376 1376 1377 procedure TMainScreen.UpdateViews(UpdateCityScreen: boolean);1377 procedure TMainScreen.UpdateViews(UpdateCityScreen: Boolean); 1378 1378 begin 1379 1379 SumCities(TaxSum, ScienceSum); … … 1385 1385 end; 1386 1386 1387 procedure TMainScreen.SetAIName( p: integer; Name: string);1387 procedure TMainScreen.SetAIName(P: Integer; Name: string); 1388 1388 begin 1389 1389 if Name = '' then 1390 1390 begin 1391 if AILogo[ p] <> nil then1392 begin 1393 FreeAndNil(AILogo[ p]);1391 if AILogo[P] <> nil then 1392 begin 1393 FreeAndNil(AILogo[P]); 1394 1394 end; 1395 1395 end 1396 1396 else 1397 1397 begin 1398 if AILogo[ p] = nil then1399 AILogo[ p] := TBitmap.Create;1400 if not LoadGraphicFile(AILogo[ p], HomeDir + Name + '.png', [gfNoError]) then1401 begin 1402 FreeAndNil(AILogo[ p]);1403 end; 1404 end; 1405 end; 1406 1407 function TMainScreen.ContactRefused( p: integer; Item: String): boolean;1398 if AILogo[P] = nil then 1399 AILogo[P] := TBitmap.Create; 1400 if not LoadGraphicFile(AILogo[P], HomeDir + Name + '.png', [gfNoError]) then 1401 begin 1402 FreeAndNil(AILogo[P]); 1403 end; 1404 end; 1405 end; 1406 1407 function TMainScreen.ContactRefused(P: Integer; Item: String): Boolean; 1408 1408 // return whether treaty was cancelled 1409 1409 var 1410 s: string;1411 begin 1412 assert(MyRO.Treaty[p] >= trPeace);1413 s := Tribe[p].TPhrase(Item);1414 if MyRO.Turn < MyRO.LastCancelTreaty[ p] + CancelTreatyTurns then1415 begin 1416 SimpleMessage( s);1417 result := false;1410 S: string; 1411 begin 1412 Assert(MyRO.Treaty[P] >= trPeace); 1413 S := Tribe[P].TPhrase(Item); 1414 if MyRO.Turn < MyRO.LastCancelTreaty[P] + CancelTreatyTurns then 1415 begin 1416 SimpleMessage(S); 1417 Result := False; 1418 1418 end 1419 1419 else 1420 1420 begin 1421 case MyRO.Treaty[ p] of1421 case MyRO.Treaty[P] of 1422 1422 trPeace: 1423 s := s+ ' ' + Phrases.Lookup('FRCANCELQUERY_PEACE');1423 S := S + ' ' + Phrases.Lookup('FRCANCELQUERY_PEACE'); 1424 1424 trFriendlyContact: 1425 s := s+ ' ' + Phrases.Lookup('FRCANCELQUERY_FRIENDLY');1425 S := S + ' ' + Phrases.Lookup('FRCANCELQUERY_FRIENDLY'); 1426 1426 trAlliance: 1427 s := s+ ' ' + Phrases.Lookup('FRCANCELQUERY_ALLIANCE');1428 end; 1429 result := SimpleQuery(mkYesNo, s, 'NEGO_REJECTED') = mrOK;1430 if result then1427 S := S + ' ' + Phrases.Lookup('FRCANCELQUERY_ALLIANCE'); 1428 end; 1429 Result := SimpleQuery(mkYesNo, S, 'NEGO_REJECTED') = mrOK; 1430 if Result then 1431 1431 begin 1432 1432 Play('CANCELTREATY'); 1433 Server(sCancelTreaty, me, 0, nil^);1434 if MyRO.Treaty[ p] = trNone then1433 Server(sCancelTreaty, Me, 0, nil^); 1434 if MyRO.Treaty[P] = trNone then 1435 1435 CityOptimizer_BeginOfTurn; 1436 1436 // peace treaty was cancelled -- use formerly forbidden tiles 1437 MapValid := false;1437 MapValid := False; 1438 1438 PaintAllMaps; 1439 1439 end; … … 1443 1443 procedure TMainScreen.RememberPeaceViolation; 1444 1444 var 1445 uix, p1: integer;1445 uix, p1: Integer; 1446 1446 begin 1447 1447 MyData.PeaceEvaHappened := 0; … … 1451 1451 begin 1452 1452 p1 := MyRO.Territory[Loc]; 1453 if (p1 <> me) and (p1 >= 0) and1453 if (p1 <> Me) and (p1 >= 0) and 1454 1454 (MyRO.Turn = MyRO.EvaStart[p1] + (PeaceEvaTurns - 1)) then 1455 1455 MyData.PeaceEvaHappened := MyData.PeaceEvaHappened or (1 shl p1); … … 1489 1489 1490 1490 var 1491 i, cix, mix: integer;1492 need: boolean;1491 I, cix, mix: Integer; 1492 need: Boolean; 1493 1493 mi: TModelInfo; 1494 1494 begin 1495 1495 if (sbStart in Check) and not (sbStart in SoundPreloadDone) then begin 1496 for i:= 0 to nStartBlock - 1 do1497 PreparePlay(StartBlock[ i]);1496 for I := 0 to nStartBlock - 1 do 1497 PreparePlay(StartBlock[I]); 1498 1498 SoundPreloadDone := SoundPreloadDone + [sbStart]; 1499 1499 end; 1500 1500 if (sbWonder in Check) and not (sbWonder in SoundPreloadDone) then begin 1501 need := false;1502 for i:= 0 to nWonder - 1 do1503 if MyRO.Wonder[ i].CityID <> WonderNotBuiltYet then1504 need := true;1501 need := False; 1502 for I := 0 to nWonder - 1 do 1503 if MyRO.Wonder[I].CityID <> WonderNotBuiltYet then 1504 need := True; 1505 1505 if need then begin 1506 for i:= 0 to nWonderBlock - 1 do1507 PreparePlay(WonderBlock[ i]);1506 for I := 0 to nWonderBlock - 1 do 1507 PreparePlay(WonderBlock[I]); 1508 1508 SoundPreloadDone := SoundPreloadDone + [sbWonder]; 1509 1509 end; … … 1511 1511 if ((sbScience in Check) and not (sbScience in SoundPreloadDone)) and 1512 1512 (MyRO.Tech[adScience] >= tsApplicable) then begin 1513 for i:= 0 to nScienceBlock - 1 do1514 PreparePlay(ScienceBlock[ i]);1513 for I := 0 to nScienceBlock - 1 do 1514 PreparePlay(ScienceBlock[I]); 1515 1515 SoundPreloadDone := SoundPreloadDone + [sbScience]; 1516 1516 end; 1517 1517 if ((sbContact in Check) and not (sbContact in SoundPreloadDone)) and 1518 1518 (MyRO.nEnemyModel + MyRO.nEnemyCity > 0) then begin 1519 for i:= 0 to nContactBlock - 1 do1520 PreparePlay(ContactBlock[ i]);1519 for I := 0 to nContactBlock - 1 do 1520 PreparePlay(ContactBlock[I]); 1521 1521 SoundPreloadDone := SoundPreloadDone + [sbContact]; 1522 1522 end; … … 1529 1529 with MyCity[cix] do 1530 1530 if (Loc >= 0) and (Flags and CityRepMask <> 0) then 1531 for i:= 0 to 12 do1532 if 1 shl iand Flags and CityRepMask <> 0 then1533 PreparePlay(CityEventSoundItem[ i]);1531 for I := 0 to 12 do 1532 if 1 shl I and Flags and CityRepMask <> 0 then 1533 PreparePlay(CityEventSoundItem[I]); 1534 1534 for mix := 0 to MyRO.nModel - 1 do 1535 1535 with MyModel[mix] do 1536 1536 if Attack > 0 then 1537 1537 begin 1538 MakeModelInfo( me, mix, MyModel[mix], mi);1538 MakeModelInfo(Me, mix, MyModel[mix], mi); 1539 1539 PreparePlay(AttackSound(ModelCode(mi))); 1540 1540 end; … … 1547 1547 Color: TColor; 1548 1548 Name: string; 1549 ok: boolean;1549 ok: Boolean; 1550 1550 begin 1551 1551 UnusedTribeFiles.Clear; … … 1567 1567 end; 1568 1568 1569 function TMainScreen.ChooseUnusedTribe: integer;1569 function TMainScreen.ChooseUnusedTribe: Integer; 1570 1570 var 1571 i: Integer;1572 j: Integer;1571 I: Integer; 1572 J: Integer; 1573 1573 ColorDistance: Integer; 1574 1574 BestColorDistance: Integer; … … 1576 1576 CountBest: Integer; 1577 1577 begin 1578 assert(UnusedTribeFiles.Count > 0);1579 result := -1;1578 Assert(UnusedTribeFiles.Count > 0); 1579 Result := -1; 1580 1580 BestColorDistance := -1; 1581 for j:= 0 to UnusedTribeFiles.Count - 1 do1581 for J := 0 to UnusedTribeFiles.Count - 1 do 1582 1582 begin 1583 1583 ColorDistance := 250; // consider differences more than this infinite 1584 for i:= 0 to nPl - 1 do1585 if Tribe[ i] <> nil then1586 begin 1587 TestColorDistance := abs( integer(UnusedTribeFiles.Objects[j])1588 shr 16 and $FF - Tribe[ i].Color shr 16 and $FF) +1589 abs( integer(UnusedTribeFiles.Objects[j]) shr 8 and1590 $FF - Tribe[ i].Color shr 8 and $FF) * 3 +1591 abs( integer(UnusedTribeFiles.Objects[j]) and1592 $FF - Tribe[ i].Color and $FF) * 2;1584 for I := 0 to nPl - 1 do 1585 if Tribe[I] <> nil then 1586 begin 1587 TestColorDistance := abs(Integer(UnusedTribeFiles.Objects[J]) 1588 shr 16 and $FF - Tribe[I].Color shr 16 and $FF) + 1589 abs(Integer(UnusedTribeFiles.Objects[J]) shr 8 and 1590 $FF - Tribe[I].Color shr 8 and $FF) * 3 + 1591 abs(Integer(UnusedTribeFiles.Objects[J]) and 1592 $FF - Tribe[I].Color and $FF) * 2; 1593 1593 if TestColorDistance < ColorDistance then 1594 1594 ColorDistance := TestColorDistance; … … 1601 1601 if ColorDistance = BestColorDistance then 1602 1602 begin 1603 inc(CountBest);1603 Inc(CountBest); 1604 1604 if DelphiRandom(CountBest) = 0 then 1605 result := j;1605 Result := J; 1606 1606 end; 1607 1607 end; … … 1610 1610 procedure TMainScreen.ShowEnemyShipChange(ShowShipChange: TShowShipChange); 1611 1611 var 1612 i, TestCost, MostCost: integer;1613 Ship1Plus, Ship2Plus: boolean;1612 I, TestCost, MostCost: Integer; 1613 Ship1Plus, Ship2Plus: Boolean; 1614 1614 begin 1615 1615 with ShowShipChange, MessgExDlg do … … 1634 1634 begin 1635 1635 OpenSound := 'SHIP_TRADED'; 1636 Ship1Plus := false;1637 Ship2Plus := false;1638 for i:= 0 to nShipPart - 1 do1636 Ship1Plus := False; 1637 Ship2Plus := False; 1638 for I := 0 to nShipPart - 1 do 1639 1639 begin 1640 if Ship1Change[ i] > 0 then1641 Ship1Plus := true;1642 if Ship2Change[ i] > 0 then1643 Ship2Plus := true;1640 if Ship1Change[I] > 0 then 1641 Ship1Plus := True; 1642 if Ship2Change[I] > 0 then 1643 Ship2Plus := True; 1644 1644 end; 1645 1645 if Ship1Plus and Ship2Plus then … … 1668 1668 begin 1669 1669 MostCost := 0; 1670 for i:= 0 to nShipPart - 1 do1671 begin 1672 TestCost := abs(Ship1Change[ i]) * Imp[imShipComp + i].Cost;1670 for I := 0 to nShipPart - 1 do 1671 begin 1672 TestCost := abs(Ship1Change[I]) * Imp[imShipComp + I].Cost; 1673 1673 if TestCost > MostCost then 1674 1674 begin 1675 1675 MostCost := TestCost; 1676 IconIndex := imShipComp + i;1676 IconIndex := imShipComp + I; 1677 1677 end; 1678 1678 end; … … 1686 1686 procedure TMainScreen.InitModule; 1687 1687 var 1688 i, j, Domain: integer;1688 I, J, Domain: Integer; 1689 1689 begin 1690 1690 { search icons for advances: } 1691 for i:= 0 to nAdv - 1 do1692 if iin FutureTech then1693 AdvIcon[ i] := 96 + i- futResearchTechnology1691 for I := 0 to nAdv - 1 do 1692 if I in FutureTech then 1693 AdvIcon[I] := 96 + I - futResearchTechnology 1694 1694 else 1695 1695 begin 1696 AdvIcon[ i] := -1;1696 AdvIcon[I] := -1; 1697 1697 for Domain := 0 to nDomains - 1 do 1698 for j:= 0 to nUpgrade - 1 do1699 if upgrade[Domain, j].Preq = ithen1700 if AdvIcon[ i] >= 0 then1701 AdvIcon[ i] := 851698 for J := 0 to nUpgrade - 1 do 1699 if upgrade[Domain, J].Preq = I then 1700 if AdvIcon[I] >= 0 then 1701 AdvIcon[I] := 85 1702 1702 else 1703 AdvIcon[ i] := 86 + Domain;1704 for j:= 0 to nFeature - 1 do1705 if Feature[ j].Preq = ithen1703 AdvIcon[I] := 86 + Domain; 1704 for J := 0 to nFeature - 1 do 1705 if Feature[J].Preq = I then 1706 1706 for Domain := 0 to nDomains - 1 do 1707 if 1 shl Domain and Feature[ j].Domains <> 0 then1708 if (AdvIcon[ i] >= 0) and (AdvIcon[i] <> 86 + Domain) then1709 AdvIcon[ i] := 851707 if 1 shl Domain and Feature[J].Domains <> 0 then 1708 if (AdvIcon[I] >= 0) and (AdvIcon[I] <> 86 + Domain) then 1709 AdvIcon[I] := 85 1710 1710 else 1711 AdvIcon[ i] := 86 + Domain;1712 for j:= nWonder to nImp - 1 do1713 if Imp[ j].Preq = ithen1714 AdvIcon[ i] := j;1715 for j:= nWonder to nImp - 1 do1716 if (Imp[ j].Preq = i) and (Imp[j].Kind <> ikCommon) then1717 AdvIcon[ i] := j;1718 for j:= 0 to nJob - 1 do1719 if i = JobPreq[j] then1720 AdvIcon[ i] := 84;1721 for j:= 0 to nWonder - 1 do1722 if Imp[ j].Preq = ithen1723 AdvIcon[ i] := j;1724 if AdvIcon[ i] < 0 then1725 if AdvValue[ i] < 1000 then1726 AdvIcon[ i] := -71711 AdvIcon[I] := 86 + Domain; 1712 for J := nWonder to nImp - 1 do 1713 if Imp[J].Preq = I then 1714 AdvIcon[I] := J; 1715 for J := nWonder to nImp - 1 do 1716 if (Imp[J].Preq = I) and (Imp[J].Kind <> ikCommon) then 1717 AdvIcon[I] := J; 1718 for J := 0 to nJob - 1 do 1719 if I = JobPreq[J] then 1720 AdvIcon[I] := 84; 1721 for J := 0 to nWonder - 1 do 1722 if Imp[J].Preq = I then 1723 AdvIcon[I] := J; 1724 if AdvIcon[I] < 0 then 1725 if AdvValue[I] < 1000 then 1726 AdvIcon[I] := -7 1727 1727 else 1728 AdvIcon[ i] := 24 + AdvValue[i] div 1000;1729 for j:= 2 to nGov - 1 do1730 if GovPreq[ j] = ithen1731 AdvIcon[ i] := j- 8;1728 AdvIcon[I] := 24 + AdvValue[I] div 1000; 1729 for J := 2 to nGov - 1 do 1730 if GovPreq[J] = I then 1731 AdvIcon[I] := J - 8; 1732 1732 end; 1733 1733 AdvIcon[adConscription] := 86 + dGround; 1734 1734 1735 1735 UnusedTribeFiles := tstringlist.Create; 1736 UnusedTribeFiles.Sorted := true;1736 UnusedTribeFiles.Sorted := True; 1737 1737 TribeNames := tstringlist.Create; 1738 1738 1739 1739 IsoEngine.Init(InitEnemyModel); 1740 1740 // non-default tile size is missing a file, switch to default 1741 MainMap.SetOutput( offscreen);1741 MainMap.SetOutput(Offscreen); 1742 1742 1743 1743 HGrStdUnits := LoadGraphicSet('StdUnits.png'); … … 1746 1746 InitSmallImp; 1747 1747 SoundPreloadDone := []; 1748 StartRunning := false;1749 StayOnTop_Ensured := false;1748 StartRunning := False; 1749 StayOnTop_Ensured := False; 1750 1750 1751 1751 sb := TPVScrollbar.Create(Self); … … 1761 1761 end; 1762 1762 1763 procedure TMainScreen.InitTurn(NewPlayer: integer);1763 procedure TMainScreen.InitTurn(NewPlayer: Integer); 1764 1764 const 1765 1765 nAdvBookIcon = 16; 1766 1766 AdvBookIcon: array [0 .. nAdvBookIcon - 1] of record Adv, 1767 Icon: integer end = ((Adv: adPolyTheism; Icon: woZeus),1767 Icon: Integer end = ((Adv: adPolyTheism; Icon: woZeus), 1768 1768 (Adv: adBronzeWorking; Icon: woColossus), (Adv: adMapMaking; 1769 1769 Icon: woLighthouse), (Adv: adPoetry; Icon: imTheater), (Adv: adMonotheism; … … 1777 1777 sbAll = [sbStart, sbWonder, sbScience, sbContact, sbTurn]; 1778 1778 var 1779 p1, i, ad, uix, cix, MoveOptions, MoveResult, Loc1,1779 p1, I, ad, uix, cix, MoveOptions, MoveResult, Loc1, 1780 1780 NewAgeCenterTo, Winners, NewGovAvailable, dx, 1781 dy: integer;1781 dy: Integer; 1782 1782 MoveAdviceData: TMoveAdviceData; 1783 1783 Picture: TModelPictureInfo; 1784 s, Item, Item2: string;1784 S, Item, Item2: string; 1785 1785 UpdatePanel, OwnWonder, ok, Stop, ShowCityList, WondersOnly, 1786 AllowCityScreen: boolean;1787 begin 1788 if IsMultiPlayerGame and (NewPlayer <> me) then1789 begin 1790 UnitInfoBtn.Visible := false;1791 UnitBtn.Visible := false;1792 TerrainBtn.Visible := false;1793 EOT.Visible := false;1794 end; 1795 if IsMultiPlayerGame and (NewPlayer <> me) and1786 AllowCityScreen: Boolean; 1787 begin 1788 if IsMultiPlayerGame and (NewPlayer <> Me) then 1789 begin 1790 UnitInfoBtn.Visible := False; 1791 UnitBtn.Visible := False; 1792 TerrainBtn.Visible := False; 1793 EOT.Visible := False; 1794 end; 1795 if IsMultiPlayerGame and (NewPlayer <> Me) and 1796 1796 (G.RO[0].Happened and phShipComplete = 0) then 1797 1797 begin // inter player screen 1798 for i:= 0 to ControlCount - 1 do1799 if Controls[ i] is TButtonC then1800 Controls[ i].Visible := false;1801 me := -1;1798 for I := 0 to ControlCount - 1 do 1799 if Controls[I] is TButtonC then 1800 Controls[I].Visible := False; 1801 Me := -1; 1802 1802 MainTexture.Age := -1; 1803 1803 with Panel.Canvas do … … 1815 1815 Invalidate; 1816 1816 1817 s:= TurnToString(G.RO[0].Turn);1818 if supervising then1819 SimpleMessage(Format(Phrases.Lookup('SUPERTURN'), [ s]))1817 S := TurnToString(G.RO[0].Turn); 1818 if Supervising then 1819 SimpleMessage(Format(Phrases.Lookup('SUPERTURN'), [S])) 1820 1820 else 1821 SimpleMessage(Format(Tribe[NewPlayer].TPhrase('TURN'), [ s]));1822 end; 1823 for i:= 0 to ControlCount - 1 do1824 if Controls[ i] is TButtonC then1825 Controls[ i].Visible := true;1821 SimpleMessage(Format(Tribe[NewPlayer].TPhrase('TURN'), [S])); 1822 end; 1823 for I := 0 to ControlCount - 1 do 1824 if Controls[I] is TButtonC then 1825 Controls[I].Visible := True; 1826 1826 1827 1827 ItsMeAgain(NewPlayer); 1828 1828 MyData := G.RO[NewPlayer].Data; 1829 if not supervising then1829 if not Supervising then 1830 1830 SoundPreload(sbAll); 1831 if ( me = 0) and ((MyRO.Turn = 0) or (ClientMode = cResume)) then1831 if (Me = 0) and ((MyRO.Turn = 0) or (ClientMode = cResume)) then 1832 1832 Invalidate; // colorize empty space 1833 1833 1834 if not supervising then1834 if not Supervising then 1835 1835 begin 1836 1836 … … 1842 1842 else } 1843 1843 begin 1844 Age := GetAge( me);1844 Age := GetAge(Me); 1845 1845 if MainTexture.Age <> Age then begin 1846 1846 MainTexture.Age := Age; … … 1869 1869 NatStatDlg.CheckAge; 1870 1870 UnitStatDlg.CheckAge; 1871 HelpDlg.Difficulty := G.Difficulty[ me];1871 HelpDlg.Difficulty := G.Difficulty[Me]; 1872 1872 1873 1873 UnFocus := -1; 1874 1874 MarkCityLoc := -1; 1875 BlinkON := false;1875 BlinkON := False; 1876 1876 BlinkTime := -1; 1877 Tracking := false;1878 TurnComplete := false;1877 Tracking := False; 1878 TurnComplete := False; 1879 1879 1880 1880 if (ToldSlavery < 0) or … … 1896 1896 Hash := 0; 1897 1897 GrName := 'StdUnits.png'; 1898 Tribe[p1].SetModelPicture(Picture, true);1898 Tribe[p1].SetModelPicture(Picture, True); 1899 1899 end; 1900 1900 end; 1901 1901 1902 if not supervising and (ClientMode = cTurn) then1902 if not Supervising and (ClientMode = cTurn) then 1903 1903 begin 1904 1904 for cix := 0 to MyRO.nCity - 1 do … … 1915 1915 if ClientMode = cMovieTurn then 1916 1916 begin 1917 UnitInfoBtn.Visible := false;1918 UnitBtn.Visible := false;1919 TerrainBtn.Visible := false;1917 UnitInfoBtn.Visible := False; 1918 UnitBtn.Visible := False; 1919 TerrainBtn.Visible := False; 1920 1920 EOT.Hint := Phrases.Lookup('BTN_STOP'); 1921 EOT.Visible := true;1921 EOT.Visible := True; 1922 1922 end 1923 1923 else if ClientMode < scContact then … … 1926 1926 UnitBtn.Visible := UnFocus >= 0; 1927 1927 CheckTerrainBtnVisible; 1928 TurnComplete := supervising;1928 TurnComplete := Supervising; 1929 1929 EOT.Hint := Phrases.Lookup('BTN_ENDTURN'); 1930 EOT.Visible := Server(sTurn - sExecute, me, 0, nil^) >= rExecuted;1930 EOT.Visible := Server(sTurn - sExecute, Me, 0, nil^) >= rExecuted; 1931 1931 end 1932 1932 else 1933 1933 begin 1934 UnitInfoBtn.Visible := false;1935 UnitBtn.Visible := false;1936 TerrainBtn.Visible := false;1934 UnitInfoBtn.Visible := False; 1935 UnitBtn.Visible := False; 1936 TerrainBtn.Visible := False; 1937 1937 EOT.Hint := Phrases.Lookup('BTN_NEGO'); 1938 EOT.Visible := true;1938 EOT.Visible := True; 1939 1939 end; 1940 1940 SetTroopLoc(-1); 1941 MapValid := false;1941 MapValid := False; 1942 1942 NewAgeCenterTo := 0; 1943 if ((MyRO.Turn = 0) and not supervising or IsMultiPlayerGame or1943 if ((MyRO.Turn = 0) and not Supervising or IsMultiPlayerGame or 1944 1944 (ClientMode = cResume)) and (MyRO.nCity > 0) then 1945 1945 begin … … 1986 1986 begin 1987 1987 OpenSound := 'MSG_GAMEOVER'; 1988 MessgText := Tribe[ me].TPhrase('GAMEOVER');1988 MessgText := Tribe[Me].TPhrase('GAMEOVER'); 1989 1989 IconKind := mikBigIcon; 1990 1990 IconIndex := 8; … … 1997 1997 begin 1998 1998 Winners := Winners or 1 shl p1; 1999 for i:= 0 to nShipPart - 1 do2000 if MyRO.Ship[p1].Parts[ i] < ShipNeed[i] then1999 for I := 0 to nShipPart - 1 do 2000 if MyRO.Ship[p1].Parts[I] < ShipNeed[I] then 2001 2001 Winners := Winners and not(1 shl p1); 2002 2002 end; 2003 assert(Winners <> 0);2004 if Winners and (1 shl me) <> 0 then2003 Assert(Winners <> 0); 2004 if Winners and (1 shl Me) <> 0 then 2005 2005 begin 2006 s:= '';2006 S := ''; 2007 2007 for p1 := 0 to nPl - 1 do 2008 if (p1 <> me) and (1 shl p1 and Winners <> 0) then2009 if s= '' then2010 s:= Tribe[p1].TPhrase('SHORTNAME')2008 if (p1 <> Me) and (1 shl p1 and Winners <> 0) then 2009 if S = '' then 2010 S := Tribe[p1].TPhrase('SHORTNAME') 2011 2011 else 2012 s:= Format(Phrases.Lookup('SHAREDWIN_CONCAT'),2013 [ s, Tribe[p1].TPhrase('SHORTNAME')]);2012 S := Format(Phrases.Lookup('SHAREDWIN_CONCAT'), 2013 [S, Tribe[p1].TPhrase('SHORTNAME')]); 2014 2014 2015 2015 OpenSound := 'MSG_YOUWIN'; 2016 MessgText := Tribe[ me].TPhrase('MYSPACESHIP');2017 if s<> '' then2016 MessgText := Tribe[Me].TPhrase('MYSPACESHIP'); 2017 if S <> '' then 2018 2018 MessgText := MessgText + '\' + 2019 Format(Phrases.Lookup('SHAREDWIN'), [ s]);2019 Format(Phrases.Lookup('SHAREDWIN'), [S]); 2020 2020 IconKind := mikBigIcon; 2021 2021 IconIndex := 9; … … 2023 2023 else 2024 2024 begin 2025 assert(me = 0);2025 Assert(Me = 0); 2026 2026 OpenSound := 'MSG_GAMEOVER'; 2027 2027 MessgText := ''; … … 2035 2035 else { if MyRO.Happened and fTimeUp<>0 then } 2036 2036 begin 2037 assert(me = 0);2037 Assert(Me = 0); 2038 2038 OpenSound := 'MSG_GAMEOVER'; 2039 if not supervising then2040 MessgText := Tribe[ me].TPhrase('TIMEUP')2039 if not Supervising then 2040 MessgText := Tribe[Me].TPhrase('TIMEUP') 2041 2041 else 2042 2042 MessgText := Phrases.Lookup('TIMEUPSUPER'); … … 2050 2050 p1 := 0; 2051 2051 while (p1 < nPl - 1) and (Winners and (1 shl p1) = 0) do 2052 inc(p1);2052 Inc(p1); 2053 2053 if MyRO.Happened and phShipComplete = 0 then 2054 2054 DiaDlg.ShowNewContent_Charts(wmModal); 2055 2055 end; 2056 TurnComplete := true;2057 exit;2058 end; 2059 if not supervising and (1 shl me and MyRO.Alive = 0) then2060 begin 2061 TurnComplete := true;2062 exit;2056 TurnComplete := True; 2057 Exit; 2058 end; 2059 if not Supervising and (1 shl Me and MyRO.Alive = 0) then 2060 begin 2061 TurnComplete := True; 2062 Exit; 2063 2063 end; 2064 2064 2065 2065 if (ClientMode = cContinue) and 2066 (DipMem[ me].SentCommand and $FF0F = scContact) then2066 (DipMem[Me].SentCommand and $FF0F = scContact) then 2067 2067 // contact was refused 2068 if MyRO.Treaty[DipMem[ me].pContact] >= trPeace then2069 ContactRefused(DipMem[ me].pContact, 'FRREJECTED')2068 if MyRO.Treaty[DipMem[Me].pContact] >= trPeace then 2069 ContactRefused(DipMem[Me].pContact, 'FRREJECTED') 2070 2070 else 2071 SoundMessage(Tribe[DipMem[ me].pContact].TPhrase('FRREJECTED'),2071 SoundMessage(Tribe[DipMem[Me].pContact].TPhrase('FRREJECTED'), 2072 2072 'NEGO_REJECTED'); 2073 2073 2074 if not supervising and (Age > MyData.ToldAge) and2074 if not Supervising and (Age > MyData.ToldAge) and 2075 2075 ((Age > 0) or (ClientMode <> cMovieTurn)) then 2076 2076 with MessgExDlg do … … 2080 2080 if Phrases2FallenBackToEnglish then 2081 2081 begin 2082 s := Tribe[me].TPhrase('AGE0');2082 S := Tribe[Me].TPhrase('AGE0'); 2083 2083 MessgText := 2084 Format( s, [TurnToString(MyRO.Turn), CityName(MyCity[0].ID)]);2084 Format(S, [TurnToString(MyRO.Turn), CityName(MyCity[0].ID)]); 2085 2085 end 2086 2086 else 2087 2087 begin 2088 s := Tribe[me].TString(Phrases2.Lookup('AGE0'));2089 MessgText := Format( s, [TurnToString(MyRO.Turn)]);2088 S := Tribe[Me].TString(Phrases2.Lookup('AGE0')); 2089 MessgText := Format(S, [TurnToString(MyRO.Turn)]); 2090 2090 end; 2091 2091 end 2092 2092 else 2093 2093 begin 2094 s := Tribe[me].TPhrase('AGE' + char(48 + Age));2095 MessgText := Format( s, [TurnToString(MyRO.Turn)]);2094 S := Tribe[Me].TPhrase('AGE' + char(48 + Age)); 2095 MessgText := Format(S, [TurnToString(MyRO.Turn)]); 2096 2096 end; 2097 2097 IconKind := mikAge; … … 2115 2115 begin 2116 2116 OpenSound := 'MSG_EXTINCT'; 2117 s:= Tribe[p1].TPhrase('EXTINCT');2118 MessgText := Format( s, [TurnToString(MyRO.Turn)]);2119 if MyRO.Alive = 1 shl me then2117 S := Tribe[p1].TPhrase('EXTINCT'); 2118 MessgText := Format(S, [TurnToString(MyRO.Turn)]); 2119 if MyRO.Alive = 1 shl Me then 2120 2120 MessgText := MessgText + Phrases.Lookup('EXTINCTALL'); 2121 2121 Kind := mkOk; … … 2124 2124 ShowModal; 2125 2125 end; 2126 if (ClientMode <> cMovieTurn) and not supervising then2126 if (ClientMode <> cMovieTurn) and not Supervising then 2127 2127 DiaDlg.ShowNewContent_Charts(wmModal); 2128 2128 end; 2129 2129 2130 2130 // tell changes of own credibility 2131 if not supervising then2131 if not Supervising then 2132 2132 begin 2133 2133 if RoughCredibility(MyRO.Credibility) <> … … 2136 2136 if RoughCredibility(MyRO.Credibility) > 2137 2137 RoughCredibility(MyData.ToldOwnCredibility) then 2138 s:= Phrases.Lookup('CREDUP')2138 S := Phrases.Lookup('CREDUP') 2139 2139 else 2140 s:= Phrases.Lookup('CREDDOWN');2141 TribeMessage( me, Format(s, [Phrases.Lookup('CREDIBILITY',2140 S := Phrases.Lookup('CREDDOWN'); 2141 TribeMessage(Me, Format(S, [Phrases.Lookup('CREDIBILITY', 2142 2142 RoughCredibility(MyRO.Credibility))]), ''); 2143 2143 end; … … 2145 2145 end; 2146 2146 2147 for i:= 0 to nWonder - 1 do2148 begin 2149 OwnWonder := false;2147 for I := 0 to nWonder - 1 do 2148 begin 2149 OwnWonder := False; 2150 2150 for cix := 0 to MyRO.nCity - 1 do 2151 if (MyCity[cix].Loc >= 0) and (MyCity[cix].ID = MyRO.Wonder[ i].CityID)2151 if (MyCity[cix].Loc >= 0) and (MyCity[cix].ID = MyRO.Wonder[I].CityID) 2152 2152 then 2153 OwnWonder := true;2154 if MyRO.Wonder[ i].CityID <> MyData.ToldWonders[i].CityID then2155 begin 2156 if MyRO.Wonder[ i].CityID = WonderDestroyed then2153 OwnWonder := True; 2154 if MyRO.Wonder[I].CityID <> MyData.ToldWonders[I].CityID then 2155 begin 2156 if MyRO.Wonder[I].CityID = WonderDestroyed then 2157 2157 with MessgExDlg do 2158 2158 begin { tell about destroyed wonders } 2159 2159 OpenSound := 'WONDER_DESTROYED'; 2160 2160 MessgText := Format(Phrases.Lookup('WONDERDEST'), 2161 [Phrases.Lookup('IMPROVEMENTS', i)]);2161 [Phrases.Lookup('IMPROVEMENTS', I)]); 2162 2162 Kind := mkOkHelp; 2163 2163 HelpKind := hkImp; 2164 HelpNo := i;2164 HelpNo := I; 2165 2165 IconKind := mikImp; 2166 IconIndex := i;2166 IconIndex := I; 2167 2167 ShowModal; 2168 2168 end 2169 2169 else 2170 2170 begin 2171 if i= woManhattan then2172 if MyRO.Wonder[ i].EffectiveOwner > me then2171 if I = woManhattan then 2172 if MyRO.Wonder[I].EffectiveOwner > Me then 2173 2173 MyData.ColdWarStart := MyRO.Turn - 1 2174 2174 else … … 2177 2177 with MessgExDlg do 2178 2178 begin { tell about newly built wonders } 2179 if i= woManhattan then2179 if I = woManhattan then 2180 2180 begin 2181 2181 OpenSound := 'MSG_COLDWAR'; 2182 s := Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('COLDWAR');2182 S := Tribe[MyRO.Wonder[I].EffectiveOwner].TPhrase('COLDWAR'); 2183 2183 end 2184 else if MyRO.Wonder[ i].EffectiveOwner >= 0 then2184 else if MyRO.Wonder[I].EffectiveOwner >= 0 then 2185 2185 begin 2186 2186 OpenSound := 'WONDER_BUILT'; 2187 s := Tribe[MyRO.Wonder[i].EffectiveOwner]2187 S := Tribe[MyRO.Wonder[I].EffectiveOwner] 2188 2188 .TPhrase('WONDERBUILT'); 2189 2189 end … … 2191 2191 begin 2192 2192 OpenSound := 'MSG_DEFAULT'; 2193 s:= Phrases.Lookup('WONDERBUILTEXP');2193 S := Phrases.Lookup('WONDERBUILTEXP'); 2194 2194 // already expired when built 2195 2195 end; 2196 MessgText := Format( s, [Phrases.Lookup('IMPROVEMENTS', i),2197 CityName(MyRO.Wonder[ i].CityID)]);2196 MessgText := Format(S, [Phrases.Lookup('IMPROVEMENTS', I), 2197 CityName(MyRO.Wonder[I].CityID)]); 2198 2198 Kind := mkOkHelp; 2199 2199 HelpKind := hkImp; 2200 HelpNo := i;2200 HelpNo := I; 2201 2201 IconKind := mikImp; 2202 IconIndex := i;2202 IconIndex := I; 2203 2203 ShowModal; 2204 2204 end; 2205 2205 end; 2206 2206 end 2207 else if (MyRO.Wonder[ i].EffectiveOwner <> MyData.ToldWonders[i]2208 .EffectiveOwner) and (MyRO.Wonder[ i].CityID > WonderDestroyed) then2209 if MyRO.Wonder[ i].EffectiveOwner < 0 then2207 else if (MyRO.Wonder[I].EffectiveOwner <> MyData.ToldWonders[I] 2208 .EffectiveOwner) and (MyRO.Wonder[I].CityID > WonderDestroyed) then 2209 if MyRO.Wonder[I].EffectiveOwner < 0 then 2210 2210 begin 2211 if i<> woMIR then2211 if I <> woMIR then 2212 2212 with MessgExDlg do 2213 2213 begin { tell about expired wonders } 2214 2214 OpenSound := 'WONDER_EXPIRED'; 2215 2215 MessgText := Format(Phrases.Lookup('WONDEREXP'), 2216 [Phrases.Lookup('IMPROVEMENTS', i),2217 CityName(MyRO.Wonder[ i].CityID)]);2216 [Phrases.Lookup('IMPROVEMENTS', I), 2217 CityName(MyRO.Wonder[I].CityID)]); 2218 2218 Kind := mkOkHelp; 2219 2219 HelpKind := hkImp; 2220 HelpNo := i;2220 HelpNo := I; 2221 2221 IconKind := mikImp; 2222 IconIndex := i;2222 IconIndex := I; 2223 2223 ShowModal; 2224 2224 end; 2225 2225 end 2226 else if (MyData.ToldWonders[ i].EffectiveOwner >= 0) and not OwnWonder2226 else if (MyData.ToldWonders[I].EffectiveOwner >= 0) and not OwnWonder 2227 2227 then 2228 2228 with MessgExDlg do 2229 2229 begin { tell about capture of wonders } 2230 2230 OpenSound := 'WONDER_CAPTURED'; 2231 s := Tribe[MyRO.Wonder[i].EffectiveOwner].TPhrase('WONDERCAPT');2232 MessgText := Format( s, [Phrases.Lookup('IMPROVEMENTS', i),2233 CityName(MyRO.Wonder[ i].CityID)]);2231 S := Tribe[MyRO.Wonder[I].EffectiveOwner].TPhrase('WONDERCAPT'); 2232 MessgText := Format(S, [Phrases.Lookup('IMPROVEMENTS', I), 2233 CityName(MyRO.Wonder[I].CityID)]); 2234 2234 Kind := mkOkHelp; 2235 2235 HelpKind := hkImp; 2236 HelpNo := i;2236 HelpNo := I; 2237 2237 IconKind := mikImp; 2238 IconIndex := i;2238 IconIndex := I; 2239 2239 ShowModal; 2240 2240 end; … … 2250 2250 end; // ClientMode<>cResume 2251 2251 MyData.ToldAlive := MyRO.Alive; 2252 move(MyRO.Wonder, MyData.ToldWonders, SizeOf(MyData.ToldWonders));2252 Move(MyRO.Wonder, MyData.ToldWonders, SizeOf(MyData.ToldWonders)); 2253 2253 2254 2254 NewGovAvailable := -1; … … 2274 2274 IconKind := mikBook; 2275 2275 IconIndex := -1; 2276 for i:= 0 to nAdvBookIcon - 1 do2277 if AdvBookIcon[ i].Adv = ad then2278 IconIndex := AdvBookIcon[ i].Icon;2276 for I := 0 to nAdvBookIcon - 1 do 2277 if AdvBookIcon[I].Adv = ad then 2278 IconIndex := AdvBookIcon[I].Icon; 2279 2279 ShowModal; 2280 2280 MyData.ToldTech[ad] := MyRO.Tech[ad]; 2281 for i:= gMonarchy to nGov - 1 do2282 if GovPreq[ i] = ad then2283 NewGovAvailable := i;2281 for I := gMonarchy to nGov - 1 do 2282 if GovPreq[I] = ad then 2283 NewGovAvailable := I; 2284 2284 end; 2285 2285 end; 2286 2286 2287 ShowCityList := false;2287 ShowCityList := False; 2288 2288 if ClientMode = cTurn then 2289 2289 begin … … 2291 2291 ChooseResearch; 2292 2292 2293 UpdatePanel := false;2293 UpdatePanel := False; 2294 2294 if MyRO.Happened and phChangeGov <> 0 then 2295 2295 begin 2296 2296 ModalSelectDlg.ShowNewContent(wmModal, kGov); 2297 2297 Play('NEWGOV'); 2298 Server(sSetGovernment, me, ModalSelectDlg.result, nil^);2298 Server(sSetGovernment, Me, ModalSelectDlg.Result, nil^); 2299 2299 CityOptimizer_BeginOfTurn; 2300 UpdatePanel := true;2300 UpdatePanel := True; 2301 2301 end; 2302 2302 end; // ClientMode=cTurn 2303 2303 2304 if not supervising and ((ClientMode = cTurn) or (ClientMode = cMovieTurn))2304 if not Supervising and ((ClientMode = cTurn) or (ClientMode = cMovieTurn)) 2305 2305 then 2306 2306 for cix := 0 to MyRO.nCity - 1 do … … 2312 2312 begin 2313 2313 // tell what happened in cities 2314 for WondersOnly := true downto false do2314 for WondersOnly := True downto False do 2315 2315 for cix := 0 to MyRO.nCity - 1 do 2316 2316 with MyCity[cix] do … … 2323 2323 begin { tell about newly built wonder } 2324 2324 OpenSound := 'WONDER_BUILT'; 2325 s := Tribe[me].TPhrase('WONDERBUILTOWN');2325 S := Tribe[Me].TPhrase('WONDERBUILTOWN'); 2326 2326 MessgText := 2327 Format( s, [Phrases.Lookup('IMPROVEMENTS',2327 Format(S, [Phrases.Lookup('IMPROVEMENTS', 2328 2328 Project0 and cpIndex), CityName(ID)]); 2329 2329 Kind := mkOkHelp; … … 2334 2334 ShowModal; 2335 2335 end; 2336 if not supervising and (ClientMode = cTurn) then2336 if not Supervising and (ClientMode = cTurn) then 2337 2337 begin 2338 AllowCityScreen := true;2338 AllowCityScreen := True; 2339 2339 if (Status and 7 <> 0) and 2340 2340 (Project and (cpImp + cpIndex) = cpImp + imTrGoods) then … … 2342 2342 begin 2343 2343 if AutoBuild(cix, MyData.ImpOrder[Status and 7 - 1]) then 2344 AllowCityScreen := false2344 AllowCityScreen := False 2345 2345 else if Flags and chProduction <> 0 then 2346 2346 Flags := (Flags and not chProduction) or chAllImpsMade … … 2370 2370 CityDlg.ShowNewContent(wmModal, MyCity[cix].Loc, 2371 2371 Flags and CityRepMask); 2372 UpdatePanel := true;2372 UpdatePanel := True; 2373 2373 end; 2374 2374 end … … 2376 2376 begin 2377 2377 if Flags and CityRepMask <> 0 then 2378 ShowCityList := true;2378 ShowCityList := True; 2379 2379 end; 2380 2380 end; … … 2396 2396 begin 2397 2397 Play('REVOLUTION'); 2398 Server(sRevolution, me, 0, nil^);2398 Server(sRevolution, Me, 0, nil^); 2399 2399 end; 2400 2400 end; … … 2430 2430 Application.ProcessMessages; 2431 2431 2432 if not supervising then2432 if not Supervising then 2433 2433 for uix := 0 to MyRO.nUn - 1 do 2434 2434 with MyUn[uix] do … … 2458 2458 begin // !!! Shinkansen 2459 2459 MoveResult := eOK; 2460 ok := true;2461 for i:= 0 to MoveAdviceData.nStep - 1 do2460 ok := True; 2461 for I := 0 to MoveAdviceData.nStep - 1 do 2462 2462 begin 2463 Loc1 := dLoc(Loc, MoveAdviceData.dx[ i],2464 MoveAdviceData.dy[ i]);2463 Loc1 := dLoc(Loc, MoveAdviceData.dx[I], 2464 MoveAdviceData.dy[I]); 2465 2465 if (MyMap[Loc1] and (fCity or fOwned) = fCity) 2466 2466 // don't capture cities during auto move … … 2468 2468 // don't attack during auto move 2469 2469 begin 2470 ok := false;2470 ok := False; 2471 2471 Break 2472 2472 end … … 2475 2475 if (Loc1 = MoveAdviceData.ToLoc) or 2476 2476 (MoveAdviceData.ToLoc = maNextCity) and 2477 (MyMap[dLoc(Loc, MoveAdviceData.dx[ i],2478 MoveAdviceData.dy[ i])] and fCity <> 0) then2477 (MyMap[dLoc(Loc, MoveAdviceData.dx[I], 2478 MoveAdviceData.dy[I])] and fCity <> 0) then 2479 2479 MoveOptions := muAutoNoWait 2480 2480 else 2481 2481 MoveOptions := 0; 2482 MoveResult := MoveUnit(MoveAdviceData.dx[ i],2483 MoveAdviceData.dy[ i], MoveOptions);2482 MoveResult := MoveUnit(MoveAdviceData.dx[I], 2483 MoveAdviceData.dy[I], MoveOptions); 2484 2484 if (MoveResult < rExecuted) or (MoveResult = eEnemySpotted) 2485 2485 then 2486 2486 begin 2487 ok := false;2487 ok := False; 2488 2488 Break 2489 2489 end; … … 2497 2497 begin 2498 2498 MoveResult := eOK; 2499 Stop := true;2499 Stop := True; 2500 2500 end; 2501 2501 … … 2520 2520 end; // ClientMode=cTurn 2521 2521 2522 HaveStrategyAdvice := false;2522 HaveStrategyAdvice := False; 2523 2523 // (GameMode<>cMovie) and not supervising 2524 2524 // and AdvisorDlg.HaveStrategyAdvice; 2525 GoOnPhase := true;2526 if supervising or (GameMode = cMovie) then2525 GoOnPhase := True; 2526 if Supervising or (GameMode = cMovie) then 2527 2527 begin 2528 2528 SetTroopLoc(-1); … … 2539 2539 SetUnFocus(-1) 2540 2540 else 2541 NextUnit(-1, false);2541 NextUnit(-1, False); 2542 2542 if UnFocus < 0 then 2543 2543 begin … … 2556 2556 end; 2557 2557 2558 procedure TMainScreen.Client(Command, NewPlayer: integer; var Data);2558 procedure TMainScreen.Client(Command, NewPlayer: Integer; var Data); 2559 2559 var 2560 i, j, p1, mix, ToLoc, AnimationSpeed, ShowMoveDomain, cix, ecix: integer;2560 I, J, p1, mix, ToLoc, AnimationSpeed, ShowMoveDomain, cix, ecix: Integer; 2561 2561 Color: TColor; 2562 Name, s: string;2562 Name, S: string; 2563 2563 TribeInfo: TTribeInfo; 2564 2564 mi: TModelInfo; 2565 SkipTurn, IsAlpine, IsTreatyDeal: boolean;2565 SkipTurn, IsAlpine, IsTreatyDeal: Boolean; 2566 2566 begin 2567 2567 case Command of 2568 2568 cTurn, cResume, cContinue, cMovieTurn, scContact, scDipStart .. scDipBreak: 2569 2569 begin 2570 supervising := G.Difficulty[NewPlayer] = 0;2570 Supervising := G.Difficulty[NewPlayer] = 0; 2571 2571 ArrangeMidPanel; 2572 2572 end … … 2574 2574 case Command of 2575 2575 cDebugMessage: 2576 LogDlg.Add(NewPlayer, G.RO[0].Turn, pchar(@Data));2576 LogDlg.Add(NewPlayer, G.RO[0].Turn, PChar(@Data)); 2577 2577 2578 2578 cShowNego: 2579 2579 with TShowNegoData(Data) do 2580 2580 begin 2581 s:= Format('P%d to P%d: ', [pSender, pTarget]);2581 S := Format('P%d to P%d: ', [pSender, pTarget]); 2582 2582 if (Action = scDipOffer) and (Offer.nDeliver + Offer.nCost > 0) then 2583 2583 begin 2584 s := s+ 'Offer ';2585 for i:= 0 to Offer.nDeliver + Offer.nCost - 1 do2584 S := S + 'Offer '; 2585 for I := 0 to Offer.nDeliver + Offer.nCost - 1 do 2586 2586 begin 2587 if i= Offer.nDeliver then2588 s := s+ ' for '2589 else if i> 0 then2590 s := s+ '+';2591 case Offer.Price[ i] and opMask of2587 if I = Offer.nDeliver then 2588 S := S + ' for ' 2589 else if I > 0 then 2590 S := S + '+'; 2591 case Offer.Price[I] and opMask of 2592 2592 opChoose: 2593 s := s+ 'Price of choice';2593 S := S + 'Price of choice'; 2594 2594 opCivilReport: 2595 s := s+ 'State report';2595 S := S + 'State report'; 2596 2596 opMilReport: 2597 s := s+ 'Military report';2597 S := S + 'Military report'; 2598 2598 opMap: 2599 s := s+ 'Map';2599 S := S + 'Map'; 2600 2600 opTreaty: 2601 s := s+ 'Treaty';2601 S := S + 'Treaty'; 2602 2602 opShipParts: 2603 s := s+ 'Ship part';2603 S := S + 'Ship part'; 2604 2604 opMoney: 2605 s := s + IntToStr(Offer.Price[i] and $FFFFFF) + 'o';2605 S := S + IntToStr(Offer.Price[I] and $FFFFFF) + 'o'; 2606 2606 opTribute: 2607 s := s + IntToStr(Offer.Price[i] and $FFFFFF) + 'o tribute';2607 S := S + IntToStr(Offer.Price[I] and $FFFFFF) + 'o tribute'; 2608 2608 opTech: 2609 s := s + Phrases.Lookup('ADVANCES', Offer.Price[i] and $FFFFFF);2609 S := S + Phrases.Lookup('ADVANCES', Offer.Price[I] and $FFFFFF); 2610 2610 opAllTech: 2611 s := s+ 'All advances';2611 S := S + 'All advances'; 2612 2612 opModel: 2613 s := s + Tribe[pSender].ModelName[Offer.Price[i] and $FFFFFF];2613 S := S + Tribe[pSender].ModelName[Offer.Price[I] and $FFFFFF]; 2614 2614 opAllModel: 2615 s := s+ 'All models';2615 S := S + 'All models'; 2616 2616 end; 2617 2617 end; 2618 LogDlg.Add(NewPlayer, G.RO[0].Turn, pchar(s));2618 LogDlg.Add(NewPlayer, G.RO[0].Turn, PChar(S)); 2619 2619 end 2620 2620 else if Action = scDipAccept then 2621 2621 begin 2622 s := s+ '--- ACCEPTED! ---';2623 LogDlg.Add(NewPlayer, G.RO[0].Turn, pchar(s));2622 S := S + '--- ACCEPTED! ---'; 2623 LogDlg.Add(NewPlayer, G.RO[0].Turn, PChar(S)); 2624 2624 end; 2625 2625 end; … … 2657 2657 AdvisorDlg.NewGame(Data); } 2658 2658 GenerateNames := mNames.Checked; 2659 GameOK := true;2659 GameOK := True; 2660 2660 G := TNewGameData(Data); 2661 me := -1;2661 Me := -1; 2662 2662 pLogo := -1; 2663 2663 ClientMode := -1; 2664 2664 SetMapOptions; 2665 2665 MainMap.pDebugMap := -1; 2666 idle := false;2666 Idle := False; 2667 2667 FillChar(Jump, SizeOf(Jump), 0); 2668 2668 if StartRunning then … … 2687 2687 ToldContact := 0; 2688 2688 ToldOwnCredibility := InitialCredibility; 2689 for i:= 0 to nPl - 1 do2690 if G.Difficulty[ i] > 0 then2691 inc(ToldAlive, 1 shl i);2689 for I := 0 to nPl - 1 do 2690 if G.Difficulty[I] > 0 then 2691 Inc(ToldAlive, 1 shl I); 2692 2692 PeaceEvaHappened := 0; 2693 for i:= 0 to nWonder - 1 do2694 with ToldWonders[ i] do2693 for I := 0 to nWonder - 1 do 2694 with ToldWonders[I] do 2695 2695 begin 2696 2696 CityID := -1; … … 2719 2719 Age := 0; 2720 2720 MovieSpeed := 1; 2721 LogDlg.mSlot.Visible := true;2721 LogDlg.mSlot.Visible := True; 2722 2722 LogDlg.Host := self; 2723 2723 HelpDlg.ClearHistory; … … 2725 2725 2726 2726 MiniMap.Size := Point(G.lx, G.ly); 2727 for i:= 0 to nPl - 1 do2727 for I := 0 to nPl - 1 do 2728 2728 begin 2729 Tribe[ i] := nil;2730 TribeOriginal[ i] := false;2729 Tribe[I] := nil; 2730 TribeOriginal[I] := False; 2731 2731 end; 2732 2732 ToldSlavery := -1; 2733 RepaintOnResize := false;2734 Closable := false;2735 FirstMovieTurn := true;2733 RepaintOnResize := False; 2734 Closable := False; 2735 FirstMovieTurn := True; 2736 2736 2737 2737 MenuArea.Visible := GameMode <> cMovie; … … 2744 2744 if NewPlayer = 0 then 2745 2745 begin 2746 i:= 0;2746 I := 0; 2747 2747 for p1 := 0 to nPl - 1 do 2748 2748 if (G.Difficulty[p1] > 0) and (Tribe[p1] = nil) then 2749 inc(i);2750 if i> UnusedTribeFiles.Count then2749 Inc(I); 2750 if I > UnusedTribeFiles.Count then 2751 2751 begin 2752 GameOK := false;2752 GameOK := False; 2753 2753 SimpleMessage(Phrases.Lookup('TOOFEWTRIBES')); 2754 2754 end … … 2761 2761 TribeInfo.trix := p1; 2762 2762 TribeNames.Clear; 2763 for j:= 0 to UnusedTribeFiles.Count - 1 do2763 for J := 0 to UnusedTribeFiles.Count - 1 do 2764 2764 begin 2765 GetTribeInfo(UnusedTribeFiles[ j], Name, Color);2765 GetTribeInfo(UnusedTribeFiles[J], Name, Color); 2766 2766 TribeNames.AddObject(Name, TObject(Color)); 2767 2767 end; 2768 assert(TribeNames.Count > 0);2768 Assert(TribeNames.Count > 0); 2769 2769 ModalSelectDlg.ShowNewContent(wmModal, kTribe); 2770 2770 Application.ProcessMessages; 2771 TribeInfo.FileName := UnusedTribeFiles[ModalSelectDlg. result];2772 UnusedTribeFiles.Delete(ModalSelectDlg. result);2771 TribeInfo.FileName := UnusedTribeFiles[ModalSelectDlg.Result]; 2772 UnusedTribeFiles.Delete(ModalSelectDlg.Result); 2773 2773 2774 2774 if GameMode = cLoadGame then 2775 CreateTribe(TribeInfo.trix, TribeInfo.FileName, false)2775 CreateTribe(TribeInfo.trix, TribeInfo.FileName, False) 2776 2776 else 2777 2777 Server(CommandWithData(cSetTribe, TribeInfo.GetCommandDataSize), … … 2783 2783 then 2784 2784 begin // autoselect enemy tribes 2785 j:= ChooseUnusedTribe;2786 TribeInfo.FileName := UnusedTribeFiles[ j];2787 UnusedTribeFiles.Delete( j);2785 J := ChooseUnusedTribe; 2786 TribeInfo.FileName := UnusedTribeFiles[J]; 2787 UnusedTribeFiles.Delete(J); 2788 2788 TribeInfo.trix := p1; 2789 2789 if GameMode = cLoadGame then 2790 CreateTribe(TribeInfo.trix, TribeInfo.FileName, false)2790 CreateTribe(TribeInfo.trix, TribeInfo.FileName, False) 2791 2791 else 2792 2792 Server(CommandWithData(cSetTribe, TribeInfo.GetCommandDataSize), … … 2808 2808 LogDlg.Close; 2809 2809 LogDlg.List.Clear; 2810 StartRunning := not idle and (Jump[0] > 0); // AI called Reload2811 me := -1;2812 idle := false;2810 StartRunning := not Idle and (Jump[0] > 0); // AI called Reload 2811 Me := -1; 2812 Idle := False; 2813 2813 ClientMode := -1; 2814 UnitInfoBtn.Visible := false;2815 UnitBtn.Visible := false;2816 TerrainBtn.Visible := false;2817 MovieSpeed1Btn.Visible := false;2818 MovieSpeed2Btn.Visible := false;2819 MovieSpeed3Btn.Visible := false;2820 MovieSpeed4Btn.Visible := false;2821 EOT.Visible := false;2822 for i:= 0 to ControlCount - 1 do2823 if Controls[ i] is TButtonC then2824 Controls[ i].Visible := false;2814 UnitInfoBtn.Visible := False; 2815 UnitBtn.Visible := False; 2816 TerrainBtn.Visible := False; 2817 MovieSpeed1Btn.Visible := False; 2818 MovieSpeed2Btn.Visible := False; 2819 MovieSpeed3Btn.Visible := False; 2820 MovieSpeed4Btn.Visible := False; 2821 EOT.Visible := False; 2822 for I := 0 to ControlCount - 1 do 2823 if Controls[I] is TButtonC then 2824 Controls[I].Visible := False; 2825 2825 sb.Init(0, 1); 2826 2826 for p1 := 0 to nPl - 1 do … … 2828 2828 FreeAndNil(Tribe[p1]); 2829 2829 Tribes.Done; 2830 RepaintOnResize := false;2831 Closable := true;2830 RepaintOnResize := False; 2831 Closable := True; 2832 2832 Close; 2833 2833 { if (GameMode=cNewGame) or (GameMode=cLoadGame) then … … 2852 2852 Show; 2853 2853 Update; 2854 RepaintOnResize := true;2854 RepaintOnResize := True; 2855 2855 xw := 0; 2856 2856 yw := ywcenter; 2857 2857 if not StayOnTop_Ensured then 2858 2858 begin 2859 StayOnTop_Ensured := true;2859 StayOnTop_Ensured := True; 2860 2860 CityDlg.StayOnTop_Workaround; 2861 2861 CityTypeDlg.StayOnTop_Workaround; … … 2876 2876 cShowTurnChange: 2877 2877 begin 2878 if integer(Data) >= 0 then2878 if Integer(Data) >= 0 then 2879 2879 begin 2880 pLogo := integer(Data);2880 pLogo := Integer(Data); 2881 2881 if G.RO[pLogo] = nil then 2882 2882 begin … … 2905 2905 ItsMeAgain(p1); 2906 2906 for mix := 0 to MyRO.nModel - 1 do 2907 if not Assigned(Tribe[ me].ModelPicture[mix].HGr) then2908 InitMyModel(mix, true);2907 if not Assigned(Tribe[Me].ModelPicture[mix].HGr) then 2908 InitMyModel(mix, True); 2909 2909 end; 2910 me := -1;2910 Me := -1; 2911 2911 end; 2912 2912 … … 2917 2917 Jump[pTurn] := 0 2918 2918 else 2919 dec(Jump[pTurn]);2919 Dec(Jump[pTurn]); 2920 2920 SkipTurn := Jump[pTurn] > 0; 2921 2921 if SkipTurn then … … 2926 2926 MiniMapPaint; 2927 2927 InitAllEnemyModels; // necessary for correct replay 2928 if not EndTurn( true) then2929 SkipTurn := false;2928 if not EndTurn(True) then 2929 SkipTurn := False; 2930 2930 end; 2931 2931 if not SkipTurn then … … 2934 2934 NegoDlg.Visible then 2935 2935 NegoDlg.Close; 2936 skipped := false; // always show my moves during my turn2937 idle := true;2936 skipped := False; // always show my moves during my turn 2937 Idle := True; 2938 2938 InitTurn(NewPlayer); 2939 DipMem[ me].pContact := -1;2940 (* if ( me=0) and (MyRO.Alive and (1 shl me)=0)} then2939 DipMem[Me].pContact := -1; 2940 (* if (Me=0) and (MyRO.Alive and (1 shl Me)=0)} then 2941 2941 begin 2942 2942 if SimpleQuery(Phrases.Lookup('RESIGN'))=mrIgnore then 2943 Server(sResign, me,0,nil^)2944 else Server(sBreak, me,0,nil^)2943 Server(sResign,Me,0,nil^) 2944 else Server(sBreak,Me,0,nil^) 2945 2945 end 2946 2946 else Play('TURNSTART'); *) … … 2953 2953 pTurn := NewPlayer; 2954 2954 pLogo := -1; 2955 skipped := false; // always show my moves during my turn2956 idle := true;2955 skipped := False; // always show my moves during my turn 2956 Idle := True; 2957 2957 if FirstMovieTurn then 2958 2958 begin 2959 2959 CheckMovieSpeedBtnState; 2960 FirstMovieTurn := false;2960 FirstMovieTurn := False; 2961 2961 end; 2962 2962 InitTurn(NewPlayer); … … 2975 2975 pTurn := -1; 2976 2976 pLogo := -1; 2977 MapValid := false;2977 MapValid := False; 2978 2978 ClientMode := -1; 2979 idle := false;2980 skipped := false;2979 Idle := False; 2980 skipped := False; 2981 2981 end; 2982 2982 … … 2988 2988 ItsMeAgain(0); 2989 2989 MyData := nil; 2990 UnitInfoBtn.Visible := false;2991 UnitBtn.Visible := false;2992 TerrainBtn.Visible := false;2993 MovieSpeed1Btn.Visible := false;2994 MovieSpeed2Btn.Visible := false;2995 MovieSpeed3Btn.Visible := false;2996 MovieSpeed4Btn.Visible := false;2997 EOT.Visible := false;2990 UnitInfoBtn.Visible := False; 2991 UnitBtn.Visible := False; 2992 TerrainBtn.Visible := False; 2993 MovieSpeed1Btn.Visible := False; 2994 MovieSpeed2Btn.Visible := False; 2995 MovieSpeed3Btn.Visible := False; 2996 MovieSpeed4Btn.Visible := False; 2997 EOT.Visible := False; 2998 2998 HelpDlg.Difficulty := 0; 2999 2999 BrushType := fGrass; 3000 3000 BrushLoc := -1; 3001 Edited := false;3001 Edited := False; 3002 3002 UnFocus := -1; 3003 3003 MarkCityLoc := -1; 3004 Tracking := false;3005 TurnComplete := false;3006 MapValid := false;3004 Tracking := False; 3005 TurnComplete := False; 3006 MapValid := False; 3007 3007 FormResize(nil); // calculate geometrics and paint all 3008 3008 SetTroopLoc(-1); 3009 idle := true;3009 Idle := True; 3010 3010 end; 3011 3011 … … 3017 3017 scContact: 3018 3018 begin 3019 DipMem[NewPlayer].pContact := integer(Data);3019 DipMem[NewPlayer].pContact := Integer(Data); 3020 3020 if Jump[NewPlayer] > 0 then 3021 3021 DipCall(scReject) … … 3024 3024 ClientMode := Command; 3025 3025 InitTurn(NewPlayer); 3026 MyData.ToldContact := MyData.ToldContact or (1 shl integer(Data));3026 MyData.ToldContact := MyData.ToldContact or (1 shl Integer(Data)); 3027 3027 // don't tell about new nation when already contacted by them 3028 3028 with MessgExDlg do 3029 3029 begin 3030 OpenSound := 'CONTACT_' + char(48 + MyRO.EnemyReport[ integer(Data)3030 OpenSound := 'CONTACT_' + char(48 + MyRO.EnemyReport[Integer(Data) 3031 3031 ].Attitude); 3032 MessgText := Tribe[ integer(Data)].TPhrase('FRCONTACT');3032 MessgText := Tribe[Integer(Data)].TPhrase('FRCONTACT'); 3033 3033 Kind := mkYesNo; 3034 3034 IconKind := mikTribe; 3035 IconIndex := integer(Data);3035 IconIndex := Integer(Data); 3036 3036 ShowModal; 3037 3037 if ModalResult = mrOK then 3038 3038 begin 3039 3039 NegoDlg.Respond; 3040 DipMem[ me].DeliveredPrices := [];3041 DipMem[ me].ReceivedPrices := [];3040 DipMem[Me].DeliveredPrices := []; 3041 DipMem[Me].ReceivedPrices := []; 3042 3042 DipCall(scDipStart); 3043 3043 end … … 3067 3067 else if Command = scDipAccept then 3068 3068 begin // remember delivered and received prices 3069 for i := 0 to DipMem[me].SentOffer.nDeliver - 1 do3070 include(DipMem[me].DeliveredPrices,3071 DipMem[ me].SentOffer.Price[i] shr 24);3072 for i := 0 to DipMem[me].SentOffer.nCost - 1 do3073 include(DipMem[me].ReceivedPrices,3074 DipMem[ me].SentOffer.Price[DipMem[me].SentOffer.nDeliver +3075 i] shr 24);3076 IsTreatyDeal := false;3077 for i:= 0 to ReceivedOffer.nDeliver + ReceivedOffer.nCost - 1 do3078 if DipMem[ me].SentOffer.Price[i] and opMask = opTreaty then3079 IsTreatyDeal := true;3069 for I := 0 to DipMem[Me].SentOffer.nDeliver - 1 do 3070 Include(DipMem[Me].DeliveredPrices, 3071 DipMem[Me].SentOffer.Price[I] shr 24); 3072 for I := 0 to DipMem[Me].SentOffer.nCost - 1 do 3073 Include(DipMem[Me].ReceivedPrices, 3074 DipMem[Me].SentOffer.Price[DipMem[Me].SentOffer.nDeliver + 3075 I] shr 24); 3076 IsTreatyDeal := False; 3077 for I := 0 to ReceivedOffer.nDeliver + ReceivedOffer.nCost - 1 do 3078 if DipMem[Me].SentOffer.Price[I] and opMask = opTreaty then 3079 IsTreatyDeal := True; 3080 3080 if IsTreatyDeal then 3081 3081 Play('NEWTREATY') … … 3084 3084 end; 3085 3085 NegoDlg.Start; 3086 idle := true;3086 Idle := True; 3087 3087 end; 3088 3088 … … 3090 3090 if not IsMultiPlayerGame then 3091 3091 begin 3092 case G.RO[NewPlayer].Treaty[ integer(Data)] of3092 case G.RO[NewPlayer].Treaty[Integer(Data)] of 3093 3093 trPeace: 3094 s := Tribe[integer(Data)].TPhrase('FRCANCELBYREJECT_PEACE');3094 S := Tribe[Integer(Data)].TPhrase('FRCANCELBYREJECT_PEACE'); 3095 3095 trFriendlyContact: 3096 s := Tribe[integer(Data)].TPhrase('FRCANCELBYREJECT_FRIENDLY');3096 S := Tribe[Integer(Data)].TPhrase('FRCANCELBYREJECT_FRIENDLY'); 3097 3097 trAlliance: 3098 s := Tribe[integer(Data)].TPhrase('FRCANCELBYREJECT_ALLIANCE');3098 S := Tribe[Integer(Data)].TPhrase('FRCANCELBYREJECT_ALLIANCE'); 3099 3099 end; 3100 TribeMessage( integer(Data), s, 'CANCELTREATY');3100 TribeMessage(Integer(Data), S, 'CANCELTREATY'); 3101 3101 end; 3102 3102 3103 3103 cShowCancelTreatyByAlliance: 3104 if idle and (NewPlayer = me) then3105 TribeMessage( integer(Data), Tribe[integer(Data)3104 if Idle and (NewPlayer = Me) then 3105 TribeMessage(Integer(Data), Tribe[Integer(Data) 3106 3106 ].TPhrase('FRENEMYALLIANCE'), 'CANCELTREATY'); 3107 3107 3108 3108 cShowSupportAllianceAgainst: 3109 3109 if not IsMultiPlayerGame and (Jump[0] = 0) then 3110 TribeMessage( integer(Data) and $F, Tribe[integer(Data) and $F]3111 .TPhrase('FRMYALLIANCE1') + ' ' + Tribe[ integer(Data) shr 4]3110 TribeMessage(Integer(Data) and $F, Tribe[Integer(Data) and $F] 3111 .TPhrase('FRMYALLIANCE1') + ' ' + Tribe[Integer(Data) shr 4] 3112 3112 .TPhrase('FRMYALLIANCE2'), 'CANCELTREATY'); 3113 3113 3114 3114 cShowPeaceViolation: 3115 3115 if not IsMultiPlayerGame and (Jump[0] = 0) then 3116 TribeMessage( integer(Data),3117 Format(Tribe[ integer(Data)].TPhrase('EVIOLATION'),3116 TribeMessage(Integer(Data), 3117 Format(Tribe[Integer(Data)].TPhrase('EVIOLATION'), 3118 3118 [TurnToString(MyRO.Turn + PeaceEvaTurns - 1)]), 'MSG_WITHDRAW'); 3119 3119 … … 3122 3122 3123 3123 cShowUnitChanged, cShowCityChanged, cShowAfterMove, cShowAfterAttack: 3124 if ( idle and (NewPlayer = me) or not idle and not skipped) and3124 if (Idle and (NewPlayer = Me) or not Idle and not skipped) and 3125 3125 not((GameMode = cMovie) and (MovieSpeed = 4)) then 3126 3126 begin 3127 assert(NewPlayer = me);3128 if not idle or (GameMode = cMovie) then3127 Assert(NewPlayer = Me); 3128 if not Idle or (GameMode = cMovie) then 3129 3129 Application.ProcessMessages; 3130 3130 if Command = cShowCityChanged then 3131 3131 begin 3132 CurrentMoveInfo.DoShow := false;3133 if idle then3134 CurrentMoveInfo.DoShow := true3132 CurrentMoveInfo.DoShow := False; 3133 if Idle then 3134 CurrentMoveInfo.DoShow := True 3135 3135 else if CurrentMoveInfo.IsAlly then 3136 3136 CurrentMoveInfo.DoShow := not mAlNoMoves.Checked … … 3140 3140 else if Command = cShowUnitChanged then 3141 3141 begin 3142 CurrentMoveInfo.DoShow := false;3143 if idle then3142 CurrentMoveInfo.DoShow := False; 3143 if Idle then 3144 3144 CurrentMoveInfo.DoShow := not mEffectiveMovesOnly.Checked 3145 3145 else if CurrentMoveInfo.IsAlly then … … 3155 3155 begin 3156 3156 if Command = cShowCityChanged then 3157 MapValid := false;3158 FocusOnLoc( integer(Data), flImmUpdate);3157 MapValid := False; 3158 FocusOnLoc(Integer(Data), flImmUpdate); 3159 3159 // OldUnFocus:=UnFocus; 3160 3160 // UnFocus:=-1; 3161 3161 if Command = cShowAfterMove then 3162 PaintLoc( integer(Data), CurrentMoveInfo.AfterMovePaintRadius)3162 PaintLoc(Integer(Data), CurrentMoveInfo.AfterMovePaintRadius) 3163 3163 // show discovered areas 3164 3164 else 3165 PaintLoc( integer(Data), 1);3165 PaintLoc(Integer(Data), 1); 3166 3166 // UnFocus:=OldUnFocus; 3167 3167 if (Command = cShowAfterAttack) and … … 3173 3173 Update; // remove message box from screen 3174 3174 end 3175 else if not idle then3175 else if not Idle then 3176 3176 if Command = cShowCityChanged then 3177 3177 Sleep(MoveTime * WaitAfterShowMove div 16) 3178 3178 else if (Command = cShowUnitChanged) and 3179 (MyMap[ integer(Data)] and fUnit <> 0) then3179 (MyMap[Integer(Data)] and fUnit <> 0) then 3180 3180 Sleep(MoveTime * WaitAfterShowMove div 32) 3181 3181 end // if CurrentMoveInfo.DoShow 3182 3182 else 3183 MapValid := false;3183 MapValid := False; 3184 3184 end; 3185 3185 3186 3186 cShowMoving, cShowCapturing: 3187 if ( idle and (NewPlayer = me) or not idle and not skipped and3187 if (Idle and (NewPlayer = Me) or not Idle and not skipped and 3188 3188 (TShowMove(Data).emix <> $FFFF)) and 3189 3189 not((GameMode = cMovie) and (MovieSpeed = 4)) then 3190 3190 begin 3191 assert(NewPlayer = me);3192 if not idle or (GameMode = cMovie) then3191 Assert(NewPlayer = Me); 3192 if not Idle or (GameMode = cMovie) then 3193 3193 Application.ProcessMessages; 3194 3194 with TShowMove(Data) do 3195 3195 begin 3196 CurrentMoveInfo.DoShow := false;3197 if not idle and (not Assigned(Tribe[Owner].ModelPicture[mix].HGr)) then3196 CurrentMoveInfo.DoShow := False; 3197 if not Idle and (not Assigned(Tribe[Owner].ModelPicture[mix].HGr)) then 3198 3198 InitEnemyModel(emix); 3199 3199 3200 3200 ToLoc := dLoc(FromLoc, dx, dy); 3201 if idle then3201 if Idle then 3202 3202 begin // own unit -- make discovered land visible 3203 assert(Owner = me); // no foreign moves during my turn!3203 Assert(Owner = Me); // no foreign moves during my turn! 3204 3204 CurrentMoveInfo.DoShow := not mEffectiveMovesOnly.Checked or 3205 3205 (Command = cShowCapturing); … … 3234 3234 else 3235 3235 CurrentMoveInfo.AfterMovePaintRadius := 1; 3236 if (MyRO.Wonder[woShinkansen].EffectiveOwner = me) and3236 if (MyRO.Wonder[woShinkansen].EffectiveOwner = Me) and 3237 3237 (Domain = dGround) and 3238 3238 (MyMap[FromLoc] and (fRR or fCity) <> 0) and … … 3249 3249 CurrentMoveInfo.IsAlly := MyRO.Treaty[Owner] = trAlliance; 3250 3250 if GameMode = cMovie then 3251 CurrentMoveInfo.DoShow := true3251 CurrentMoveInfo.DoShow := True 3252 3252 else if CurrentMoveInfo.IsAlly then 3253 3253 CurrentMoveInfo.DoShow := not mAlNoMoves.Checked and … … 3265 3265 cix := MyRO.nCity - 1; 3266 3266 while (cix >= 0) and (MyCity[cix].Loc <> ToLoc) do 3267 dec(cix);3268 s:= CityName(MyCity[cix].ID);3267 Dec(cix); 3268 S := CityName(MyCity[cix].ID); 3269 3269 end 3270 3270 else … … 3272 3272 ecix := MyRO.nEnemyCity - 1; 3273 3273 while (ecix >= 0) and (MyRO.EnemyCity[ecix].Loc <> ToLoc) do 3274 dec(ecix);3275 s:= CityName(MyRO.EnemyCity[ecix].ID);3274 Dec(ecix); 3275 S := CityName(MyRO.EnemyCity[ecix].ID); 3276 3276 end; 3277 3277 TribeMessage(Owner, Format(Tribe[Owner].TPhrase('CAPTURE'), 3278 [ s]), '');3278 [S]), ''); 3279 3279 Update; // remove message box from screen 3280 3280 end; … … 3361 3361 end // if CurrentMoveInfo.DoShow 3362 3362 else 3363 MapValid := false;3363 MapValid := False; 3364 3364 end; 3365 3365 end; 3366 3366 3367 3367 cShowAttacking: 3368 if ( idle and (NewPlayer = me) or not idle and not skipped and3368 if (Idle and (NewPlayer = Me) or not Idle and not skipped and 3369 3369 (TShowMove(Data).emix <> $FFFF)) and 3370 3370 not((GameMode = cMovie) and (MovieSpeed = 4)) then 3371 3371 begin 3372 assert(NewPlayer = me);3373 if not idle or (GameMode = cMovie) then3372 Assert(NewPlayer = Me); 3373 if not Idle or (GameMode = cMovie) then 3374 3374 Application.ProcessMessages; 3375 3375 with TShowMove(Data) do 3376 3376 begin 3377 3377 CurrentMoveInfo.AfterAttackExpeller := -1; 3378 CurrentMoveInfo.DoShow := false;3379 if idle then3380 CurrentMoveInfo.DoShow := true // own unit -- always show attacks3378 CurrentMoveInfo.DoShow := False; 3379 if Idle then 3380 CurrentMoveInfo.DoShow := True // own unit -- always show attacks 3381 3381 else 3382 3382 begin … … 3398 3398 cix := MyRO.nCity - 1; 3399 3399 while (cix >= 0) and (MyCity[cix].Loc <> ToLoc) do 3400 dec(cix);3400 Dec(cix); 3401 3401 if MyCity[cix].Status and csToldBombard = 0 then 3402 3402 begin 3403 if not supervising then3403 if not Supervising then 3404 3404 MyCity[cix].Status := MyCity[cix].Status or csToldBombard; 3405 s:= CityName(MyCity[cix].ID);3405 S := CityName(MyCity[cix].ID); 3406 3406 SoundMessageEx(Format(Tribe[Owner].TPhrase('BOMBARD'), 3407 [ s]), '');3407 [S]), ''); 3408 3408 Update; // remove message box from screen 3409 3409 end; … … 3414 3414 if Flags and umExpelling <> 0 then 3415 3415 Play('MOVE_EXPEL') 3416 else if Owner = me then3416 else if Owner = Me then 3417 3417 begin 3418 MakeModelInfo( me, mix, MyModel[mix], mi);3418 MakeModelInfo(Me, mix, MyModel[mix], mi); 3419 3419 Play(AttackSound(ModelCode(mi))); 3420 3420 end … … 3441 3441 MoveOnScreen(TShowMove(Data), 10, 0, 16); 3442 3442 end 3443 else if not idle then3443 else if not Idle then 3444 3444 Sleep(MoveTime div 2); 3445 3445 MainMap.AttackEnd; 3446 3446 end // if CurrentMoveInfo.DoShow 3447 3447 else 3448 MapValid := false;3448 MapValid := False; 3449 3449 end; 3450 3450 end; … … 3455 3455 else 3456 3456 begin 3457 s:= Phrases.Lookup('FOREIGNINFO');3457 S := Phrases.Lookup('FOREIGNINFO'); 3458 3458 for p1 := 0 to nPl - 1 do 3459 3459 if 3 shl (p1 * 2) and Cardinal(Data) <> 0 then 3460 s := s+ '\' + Tribe[p1].TPhrase('SHORTNAME');3461 SoundMessageEx( s, '');3460 S := S + '\' + Tribe[p1].TPhrase('SHORTNAME'); 3461 SoundMessageEx(S, ''); 3462 3462 end; 3463 3463 … … 3471 3471 begin 3472 3472 MessgText := Format(Phrases.Lookup('GRLIB_GENERAL'), 3473 [Phrases.Lookup('ADVANCES', integer(Data))]);3473 [Phrases.Lookup('ADVANCES', Integer(Data))]); 3474 3474 OpenSound := 'NEWADVANCE_GRLIB'; 3475 3475 Kind := mkOk; … … 3481 3481 cRefreshDebugMap: 3482 3482 begin 3483 if integer(Data) = MainMap.pDebugMap then3483 if Integer(Data) = MainMap.pDebugMap then 3484 3484 begin 3485 MapValid := false;3485 MapValid := False; 3486 3486 MainOffscreenPaint; 3487 3487 Update; … … 3494 3494 cSetTribe: 3495 3495 with TTribeInfo(Data) do begin 3496 i:= UnusedTribeFiles.Count - 1;3497 while ( i>= 0) and3498 (AnsiCompareFileName(UnusedTribeFiles[ i], FileName) <> 0) do3499 dec(i);3500 if i>= 0 then3501 UnusedTribeFiles.Delete( i);3502 CreateTribe(trix, FileName, true);3496 I := UnusedTribeFiles.Count - 1; 3497 while (I >= 0) and 3498 (AnsiCompareFileName(UnusedTribeFiles[I], FileName) <> 0) do 3499 Dec(I); 3500 if I >= 0 then 3501 UnusedTribeFiles.Delete(I); 3502 CreateTribe(trix, FileName, True); 3503 3503 end; 3504 3504 cSetNewModelPicture: … … 3511 3511 (TModelPictureInfo(Data), False); 3512 3512 cSetSlaveIndex: 3513 Tribe[ integer(Data) shr 16].mixSlaves := integer(Data) and $FFFF;3513 Tribe[Integer(Data) shr 16].mixSlaves := Integer(Data) and $FFFF; 3514 3514 cSetCityName: 3515 3515 with TCityNameInfo(Data) do … … 3528 3528 procedure TMainScreen.FormCreate(Sender: TObject); 3529 3529 var 3530 i, j: integer;3530 I, J: Integer; 3531 3531 begin 3532 3532 NoMap := TIsoMap.Create; … … 3570 3570 3571 3571 // tag-controlled language 3572 for i:= 0 to ComponentCount - 1 do3573 if Components[ i].Tag and $FF <> 0 then3574 if Components[ i] is TMenuItem then begin3575 TMenuItem(Components[ i]).Caption := Phrases.Lookup('CONTROLS',3576 -1 + Components[ i].Tag and $FF);3577 for j:= 0 to Length(SaveOption) - 1 do3578 if Components[ i].Tag and $FF = SaveOption[j] then3579 TMenuItem(Components[ i]).Checked := TSaveOption(j) in OptionChecked;3572 for I := 0 to ComponentCount - 1 do 3573 if Components[I].Tag and $FF <> 0 then 3574 if Components[I] is TMenuItem then begin 3575 TMenuItem(Components[I]).Caption := Phrases.Lookup('CONTROLS', 3576 -1 + Components[I].Tag and $FF); 3577 for J := 0 to Length(SaveOption) - 1 do 3578 if Components[I].Tag and $FF = SaveOption[J] then 3579 TMenuItem(Components[I]).Checked := TSaveOption(J) in OptionChecked; 3580 3580 end else 3581 if Components[ i] is TButtonBase then begin3582 TButtonBase(Components[ i]).Hint := Phrases.Lookup('CONTROLS',3583 -1 + Components[ i].Tag and $FF);3584 if (Components[ i] is TButtonC) and3585 (TButtonC(Components[ i]).ButtonIndex <> 1) then3586 TButtonC(Components[ i]).ButtonIndex :=3587 Integer(MapOptionChecked) shr (Components[ i].Tag shr 8) and 1 + 23581 if Components[I] is TButtonBase then begin 3582 TButtonBase(Components[I]).Hint := Phrases.Lookup('CONTROLS', 3583 -1 + Components[I].Tag and $FF); 3584 if (Components[I] is TButtonC) and 3585 (TButtonC(Components[I]).ButtonIndex <> 1) then 3586 TButtonC(Components[I]).ButtonIndex := 3587 Integer(MapOptionChecked) shr (Components[I].Tag shr 8) and 1 + 2 3588 3588 end; 3589 3589 … … 3598 3598 ManagementArea.Hint := Phrases2.Lookup('BTN_MANAGE'); 3599 3599 end; 3600 for i:= 0 to mRep.Count - 1 do3601 begin 3602 j := mRep[i].Tag shr 8;3603 mRep[ i].Caption := CityEventName(j);3604 mRep[ i].Checked := CityRepMask and (1 shl j) <> 0;3600 for I := 0 to mRep.Count - 1 do 3601 begin 3602 J := mRep[I].Tag shr 8; 3603 mRep[I].Caption := CityEventName(J); 3604 mRep[I].Checked := CityRepMask and (1 shl J) <> 0; 3605 3605 end; 3606 3606 … … 3621 3621 else Buffer.height := 3 * ySizeBig; 3622 3622 Buffer.Canvas.Font.Assign(UniFont[ftSmall]); 3623 for i:= 0 to nPl - 1 do3624 AILogo[ i] := nil;3623 for I := 0 to nPl - 1 do 3624 AILogo[I] := nil; 3625 3625 Canvas.Font.Assign(UniFont[ftSmall]); 3626 3626 InitButtons; … … 3639 3639 FreeAndNil(Panel); 3640 3640 for I := 0 to nPl - 1 do 3641 if AILogo[ i] <> nil then3641 if AILogo[I] <> nil then 3642 3642 FreeAndNil(AILogo[I]); 3643 3643 FreeAndNil(Offscreen); … … 3699 3699 Status := Status and ($FFFF - usRecover - usGoto - usEnhance); 3700 3700 if Job > jNone then 3701 Server(sStartJob + jNone shl 4, me, UnFocus, nil^);3701 Server(sStartJob + jNone shl 4, Me, UnFocus, nil^); 3702 3702 end; 3703 3703 end; … … 3725 3725 if DoJob(jCity) = eCity then 3726 3726 begin 3727 MapValid := false;3727 MapValid := False; 3728 3728 PaintAll; 3729 ZoomToCity(Loc0, true, chFounded);3729 ZoomToCity(Loc0, True, chFounded); 3730 3730 end; 3731 3731 end else begin 3732 3732 CityOptimizer_BeforeRemoveUnit(UnFocus); 3733 ServerResult := Server(sAddToCity, me, UnFocus, nil^);3733 ServerResult := Server(sAddToCity, Me, UnFocus, nil^); 3734 3734 if ServerResult >= rExecuted then 3735 3735 begin 3736 3736 cix := MyRO.nCity - 1; 3737 3737 while (cix >= 0) and (MyCity[cix].Loc <> Loc0) do 3738 dec(cix);3739 assert(cix >= 0);3738 Dec(cix); 3739 Assert(cix >= 0); 3740 3740 CityOptimizer_CityChange(cix); 3741 3741 CityOptimizer_AfterRemoveUnit; // does nothing here 3742 3742 SetTroopLoc(Loc0); 3743 UpdateViews( true);3744 DestinationMarkON := false;3743 UpdateViews(True); 3744 DestinationMarkON := False; 3745 3745 PaintDestination; 3746 3746 UnFocus := -1; 3747 3747 PaintLoc(Loc0); 3748 NextUnit(UnStartLoc, true);3748 NextUnit(UnStartLoc, True); 3749 3749 end 3750 3750 else if ServerResult = eMaxSize then … … 3829 3829 Destination := Status shr 16; 3830 3830 Status := Status and not(usStay or usRecover) or usWaiting; 3831 MoveToLoc(Destination, true);3831 MoveToLoc(Destination, True); 3832 3832 end; 3833 3833 end; … … 3850 3850 begin 3851 3851 cixOldHome := Home; 3852 if Server(sSetUnitHome, me, UnFocus, nil^) >= rExecuted then3852 if Server(sSetUnitHome, Me, UnFocus, nil^) >= rExecuted then 3853 3853 begin 3854 3854 CityOptimizer_CityChange(cixOldHome); 3855 3855 CityOptimizer_CityChange(Home); 3856 UpdateViews( true);3856 UpdateViews(True); 3857 3857 end 3858 3858 else … … 3862 3862 begin 3863 3863 Status := Status and not(usStay or usRecover or usEnhance); 3864 MoveToLoc(maNextCity, true);3864 MoveToLoc(maNextCity, True); 3865 3865 end; 3866 3866 end; … … 3882 3882 procedure TMainScreen.mJumpClick(Sender: TObject); 3883 3883 begin 3884 if supervising then3884 if Supervising then 3885 3885 Jump[0] := 20 3886 3886 else 3887 Jump[ me] := 20;3888 EndTurn( true);3887 Jump[Me] := 20; 3888 EndTurn(True); 3889 3889 end; 3890 3890 … … 3895 3895 if UnFocus >= 0 then 3896 3896 with MyUn[UnFocus] do begin 3897 i := Server(sLoadUnit, me, UnFocus, nil^);3898 if i>= rExecuted then3897 I := Server(sLoadUnit, Me, UnFocus, nil^); 3898 if I >= rExecuted then 3899 3899 begin 3900 3900 if MyModel[mix].Domain = dAir then … … 3902 3902 else 3903 3903 Play('MOVE_LOAD'); 3904 DestinationMarkON := false;3904 DestinationMarkON := False; 3905 3905 PaintDestination; 3906 3906 Status := Status and ($FFFF - usWaiting - usStay - usRecover - usGoto - usEnhance); 3907 NextUnit(UnStartLoc, true);3907 NextUnit(UnStartLoc, True); 3908 3908 end 3909 else if i= eNoTime_Load then3909 else if I = eNoTime_Load then 3910 3910 if MyModel[mix].Domain = dAir then 3911 3911 SoundMessage(Phrases.Lookup('NOTIMELOADAIR'), 'NOMOVE_TIME') … … 3942 3942 with MyUn[UnFocus] do begin 3943 3943 Status := Status and not usWaiting; 3944 NextUnit(UnStartLoc, true);3944 NextUnit(UnStartLoc, True); 3945 3945 end; 3946 3946 end; … … 3971 3971 if not Edited or (SimpleQuery(mkYesNo, Phrases.Lookup('MAP_RANDOM'), '') 3972 3972 = mrOK) then begin 3973 Server(sRandomMap, me, 0, nil^);3974 Edited := true;3975 MapValid := false;3973 Server(sRandomMap, Me, 0, nil^); 3974 Edited := True; 3975 MapValid := False; 3976 3976 PaintAllMaps; 3977 3977 end; … … 3982 3982 if UnFocus >= 0 then 3983 3983 with MyUn[UnFocus] do begin 3984 DestinationMarkON := false;3984 DestinationMarkON := False; 3985 3985 PaintDestination; 3986 3986 Status := Status and ($FFFF - usStay - usGoto - usEnhance) or usRecover; 3987 3987 if Job > jNone then 3988 Server(sStartJob + jNone shl 4, me, UnFocus, nil^);3989 NextUnit(UnStartLoc, true);3988 Server(sStartJob + jNone shl 4, Me, UnFocus, nil^); 3989 NextUnit(UnStartLoc, True); 3990 3990 end; 3991 3991 end; … … 3999 3999 QueryText := Phrases.Lookup('MAP_CLOSE'); 4000 4000 case SimpleQuery(mkYesNoCancel, QueryText, '') of 4001 mrIgnore: Server(sAbandonMap, me, 0, nil^);4002 mrOK: Server(sSaveMap, me, 0, nil^);4001 mrIgnore: Server(sAbandonMap, Me, 0, nil^); 4002 mrOK: Server(sSaveMap, Me, 0, nil^); 4003 4003 end; 4004 4004 end else 4005 Server(sAbandonMap, me, 0, nil^);4005 Server(sAbandonMap, Me, 0, nil^); 4006 4006 end else begin 4007 4007 if Server(sGetGameChanged, 0, 0, nil^) = eOK then begin … … 4022 4022 I: Integer; 4023 4023 begin 4024 AltGovs := false;4025 for i:= 2 to nGov - 1 do4026 if (GovPreq[ i] <> preNA) and4027 ((GovPreq[ i] = preNone) or (MyRO.Tech[GovPreq[i]] >= tsApplicable)) then4028 AltGovs := true;4024 AltGovs := False; 4025 for I := 2 to nGov - 1 do 4026 if (GovPreq[I] <> preNA) and 4027 ((GovPreq[I] = preNone) or (MyRO.Tech[GovPreq[I]] >= tsApplicable)) then 4028 AltGovs := True; 4029 4029 4030 4030 if not AltGovs then … … 4032 4032 else 4033 4033 begin 4034 RevolutionChanged := false;4034 RevolutionChanged := False; 4035 4035 if MyRO.Happened and phChangeGov <> 0 then 4036 4036 begin 4037 4037 ModalSelectDlg.ShowNewContent(wmModal, kGov); 4038 if ModalSelectDlg. result >= 0 then4038 if ModalSelectDlg.Result >= 0 then 4039 4039 begin 4040 4040 Play('NEWGOV'); 4041 Server(sSetGovernment, me, ModalSelectDlg.result, nil^);4041 Server(sSetGovernment, Me, ModalSelectDlg.Result, nil^); 4042 4042 CityOptimizer_BeginOfTurn; 4043 RevolutionChanged := true;4043 RevolutionChanged := True; 4044 4044 end; 4045 4045 end … … 4047 4047 with MessgExDlg do 4048 4048 begin // revolution! 4049 MessgExDlg.MessgText := Tribe[ me].TPhrase('REVOLUTION');4049 MessgExDlg.MessgText := Tribe[Me].TPhrase('REVOLUTION'); 4050 4050 MessgExDlg.Kind := mkYesNo; 4051 4051 MessgExDlg.IconKind := mikPureIcon; … … 4055 4055 begin 4056 4056 Play('REVOLUTION'); 4057 Server(sRevolution, me, 0, nil^);4058 RevolutionChanged := true;4057 Server(sRevolution, Me, 0, nil^); 4058 RevolutionChanged := True; 4059 4059 if NatStatDlg.Visible then 4060 4060 NatStatDlg.Close; … … 4064 4064 end; 4065 4065 if RevolutionChanged then 4066 UpdateViews( true);4066 UpdateViews(True); 4067 4067 end; 4068 4068 end; … … 4084 4084 procedure TMainScreen.mRunClick(Sender: TObject); 4085 4085 begin 4086 if supervising then4086 if Supervising then 4087 4087 Jump[0] := 999999 4088 4088 else 4089 Jump[ me] := 999999;4090 EndTurn( true);4089 Jump[Me] := 999999; 4090 EndTurn(True); 4091 4091 end; 4092 4092 … … 4100 4100 if UnFocus >= 0 then 4101 4101 with TUn(MyUn[UnFocus]) do 4102 Server(sSelectTransport, me, UnFocus, nil^);4102 Server(sSelectTransport, Me, UnFocus, nil^); 4103 4103 end; 4104 4104 … … 4112 4112 if UnFocus >= 0 then 4113 4113 with TUn(MyUn[UnFocus]) do begin 4114 DestinationMarkON := false;4114 DestinationMarkON := False; 4115 4115 PaintDestination; 4116 4116 Status := Status and ($FFFF - usRecover - usGoto - usEnhance) or usStay; 4117 4117 if Job > jNone then 4118 Server(sStartJob + jNone shl 4, me, UnFocus, nil^);4119 NextUnit(UnStartLoc, true);4118 Server(sStartJob + jNone shl 4, Me, UnFocus, nil^); 4119 NextUnit(UnStartLoc, True); 4120 4120 end; 4121 4121 end; … … 4137 4137 I: Integer; 4138 4138 begin 4139 if G.Difficulty[ me] > 0 then4140 ListDlg.ShowNewContent_MilReport(wmPersistent, me)4139 if G.Difficulty[Me] > 0 then 4140 ListDlg.ShowNewContent_MilReport(wmPersistent, Me) 4141 4141 else 4142 4142 begin 4143 i:= 1;4144 while ( i < nPl) and (1 shl iand MyRO.Alive = 0) do4145 inc(i);4146 if i< nPl then4147 ListDlg.ShowNewContent_MilReport(wmPersistent, i);4143 I := 1; 4144 while (I < nPl) and (1 shl I and MyRO.Alive = 0) do 4145 Inc(I); 4146 if I < nPl then 4147 ListDlg.ShowNewContent_MilReport(wmPersistent, I); 4148 4148 end; 4149 4149 end; … … 4160 4160 if Master >= 0 then begin 4161 4161 OldMaster := Master; 4162 i := Server(sUnloadUnit, me, UnFocus, nil^);4163 if i>= rExecuted then4162 I := Server(sUnloadUnit, Me, UnFocus, nil^); 4163 if I >= rExecuted then 4164 4164 begin 4165 4165 if MyModel[mix].Domain = dAir then … … 4173 4173 Status := Status and not usWaiting; 4174 4174 if MyModel[mix].Domain <> dAir then 4175 NextUnit(Loc, true)4175 NextUnit(Loc, True) 4176 4176 else 4177 4177 PanelPaint; 4178 4178 end 4179 else if i= eNoTime_Load then4179 else if I = eNoTime_Load then 4180 4180 if MyModel[mix].Domain = dAir then 4181 4181 SoundMessage(Phrases.Lookup('NOTIMELOADAIR'), 'NOMOVE_TIME') … … 4186 4186 NewFocus := -1; 4187 4187 uix := UnFocus; 4188 for i:= 1 to MyRO.nUn - 1 do4188 for I := 1 to MyRO.nUn - 1 do 4189 4189 begin 4190 4190 uix := (uix + MyRO.nUn - 1) mod MyRO.nUn; 4191 4191 if (MyUn[uix].Master = UnFocus) and 4192 (MyUn[uix].Movement = integer(MyModel[MyUn[uix].mix].speed)) then4192 (MyUn[uix].Movement = Integer(MyModel[MyUn[uix].mix].speed)) then 4193 4193 begin 4194 4194 MyUn[uix].Status := MyUn[uix].Status or usWaiting; … … 4210 4210 if UnFocus >= 0 then 4211 4211 with MyUn[UnFocus] do begin 4212 DestinationMarkON := false;4212 DestinationMarkON := False; 4213 4213 PaintDestination; 4214 4214 Status := Status and ($FFFF - usStay - usRecover - usGoto - usEnhance) or usWaiting; 4215 4215 end; 4216 NextUnit(-1, false);4216 NextUnit(-1, False); 4217 4217 end; 4218 4218 … … 4229 4229 procedure TMainScreen.FormResize(Sender: TObject); 4230 4230 var 4231 MiniFrame, MaxMapWidth: integer;4231 MiniFrame, MaxMapWidth: Integer; 4232 4232 begin 4233 4233 SmallScreen := ClientWidth < 1024; … … 4307 4307 begin 4308 4308 RectInvalidate(0, TopBarHeight, ClientWidth, TopBarHeight + MapHeight); 4309 MapValid := false;4309 MapValid := False; 4310 4310 PaintAll; 4311 4311 end; 4312 4312 end; 4313 4313 4314 procedure TMainScreen.FormCloseQuery(Sender: TObject; var CanClose: boolean);4314 procedure TMainScreen.FormCloseQuery(Sender: TObject; var CanClose: Boolean); 4315 4315 begin 4316 4316 CanClose := Closable; 4317 if not Closable and idle and (me = 0) and (ClientMode < scContact) then4317 if not Closable and Idle and (Me = 0) and (ClientMode < scContact) then 4318 4318 mResign.Click; 4319 4319 end; … … 4337 4337 begin 4338 4338 MessgExDlg.CancelMovie; 4339 Server(sBreak, me, 0, nil^);4339 Server(sBreak, Me, 0, nil^); 4340 4340 end 4341 4341 else if ClientMode < 0 then 4342 skipped := true4342 skipped := True 4343 4343 else if ClientMode >= scContact then 4344 4344 NegoDlg.ShowNewContent(wmPersistent) … … 4346 4346 begin 4347 4347 Jump[pTurn] := 0; 4348 StartRunning := false;4348 StartRunning := False; 4349 4349 end 4350 4350 else … … 4359 4359 else 4360 4360 with MainMap do begin 4361 if supervising then4361 if Supervising then 4362 4362 xTerrain := xMidPanel + 2 * xxt + 14 4363 4363 else if ClientWidth < 1280 then … … 4366 4366 xTerrain := ClientWidth div 2; 4367 4367 xTroop := xTerrain + 2 * xxt + 12; 4368 if SmallScreen and not supervising then4368 if SmallScreen and not Supervising then 4369 4369 xTroop := xRightPanel + 10 - 3 * 66 - 4370 4370 GetSystemMetrics(SM_CXVSCROLL) - 19 - 4; … … 4375 4375 end; 4376 4376 4377 function TMainScreen.EndTurn(WasSkipped: boolean): boolean;4378 4379 function IsResourceUnused(cix, NeedFood, NeedProd: integer): boolean;4377 function TMainScreen.EndTurn(WasSkipped: Boolean): Boolean; 4378 4379 function IsResourceUnused(cix, NeedFood, NeedProd: Integer): Boolean; 4380 4380 var 4381 dx, dy, fix: integer;4381 dx, dy, fix: Integer; 4382 4382 CityAreaInfo: TCityAreaInfo; 4383 4383 TileInfo: TTileInfo; 4384 4384 begin 4385 Server(sGetCityAreaInfo, me, cix, CityAreaInfo);4385 Server(sGetCityAreaInfo, Me, cix, CityAreaInfo); 4386 4386 for dy := -3 to 3 do 4387 4387 for dx := -3 to 3 do … … 4393 4393 begin 4394 4394 TileInfo.ExplCity := cix; 4395 Server(sGetHypoCityTileInfo, me, dLoc(MyCity[cix].Loc, dx, dy),4395 Server(sGetHypoCityTileInfo, Me, dLoc(MyCity[cix].Loc, dx, dy), 4396 4396 TileInfo); 4397 4397 if (TileInfo.Food >= NeedFood) and (TileInfo.Prod >= NeedProd) then 4398 4398 begin 4399 result := true;4400 exit4399 Result := True; 4400 Exit 4401 4401 end; 4402 4402 end 4403 4403 end; 4404 result := false;4404 Result := False; 4405 4405 end; 4406 4406 4407 4407 var 4408 p1, uix, cix, CenterLoc: integer;4408 p1, uix, cix, CenterLoc: Integer; 4409 4409 MsgItem: string; 4410 4410 CityReport: TCityReport; 4411 4411 PlaneReturnData: TPlaneReturnData; 4412 Zoom: boolean;4413 begin 4414 result := false;4412 Zoom: Boolean; 4413 begin 4414 Result := False; 4415 4415 if ClientMode >= scDipOffer then 4416 4416 Exit; 4417 4417 4418 if supervising and (me <> 0) then begin4418 if Supervising and (Me <> 0) then begin 4419 4419 ApplyToVisibleForms(faClose); 4420 4420 ItsMeAgain(0); … … 4435 4435 PlaneReturnData.Loc := Loc; 4436 4436 PlaneReturnData.Movement := 0; // end turn without further movement? 4437 if Server(sGetPlaneReturn, me, uix, PlaneReturnData) = eNoWay then4437 if Server(sGetPlaneReturn, Me, uix, PlaneReturnData) = eNoWay then 4438 4438 begin 4439 4439 CenterLoc := Loc + G.lx * 6; 4440 4440 // centering the unit itself would make it covered by the query dialog 4441 4441 while CenterLoc >= G.lx * G.ly do 4442 dec(CenterLoc, G.lx * 2);4442 Dec(CenterLoc, G.lx * 2); 4443 4443 Centre(CenterLoc); 4444 4444 SetTroopLoc(-1); … … 4455 4455 SetTroopLoc(Loc); 4456 4456 PanelPaint; 4457 exit;4457 Exit; 4458 4458 end; 4459 4459 MyUn[uix].Status := MyUn[uix].Status or usToldNoReturn; … … 4461 4461 end; 4462 4462 4463 if not supervising and (MyRO.TestFlags and tfImmImprove = 0) and4463 if not Supervising and (MyRO.TestFlags and tfImmImprove = 0) and 4464 4464 (MyRO.Government <> gAnarchy) and (MyRO.Money + TaxSum < 0) and 4465 4465 (MyRO.TaxRate < 100) then // low funds! … … 4473 4473 ShowModal; 4474 4474 if ModalResult <> mrOK then 4475 exit;4475 Exit; 4476 4476 end; 4477 4477 … … 4481 4481 if (Loc >= 0) and (Flags and chCaptured = 0) then 4482 4482 begin 4483 Zoom := false;4483 Zoom := False; 4484 4484 CityReport.HypoTiles := -1; 4485 4485 CityReport.HypoTax := -1; 4486 4486 CityReport.HypoLux := -1; 4487 Server(sGetCityReport, me, cix, CityReport);4487 Server(sGetCityReport, Me, cix, CityReport); 4488 4488 4489 4489 if (CityReport.Working - CityReport.Happy > Size shr 1) and … … 4576 4576 else 4577 4577 EOT.Hint := Phrases.Lookup('BTN_SKIP'); 4578 result := true;4578 Result := True; 4579 4579 SetTroopLoc(-1); 4580 4580 pTurn := -1; 4581 4581 pLogo := -1; 4582 UnitInfoBtn.Visible := false;4583 UnitBtn.Visible := false;4584 TerrainBtn.Visible := false;4582 UnitInfoBtn.Visible := False; 4583 UnitBtn.Visible := False; 4584 TerrainBtn.Visible := False; 4585 4585 EOT.ButtonIndex := eotCancel; 4586 EOT.Visible := true;4587 MapValid := false;4586 EOT.Visible := True; 4587 MapValid := False; 4588 4588 PanelPaint; 4589 4589 Update; 4590 4590 ClientMode := -1; 4591 idle := false;4591 Idle := False; 4592 4592 skipped := WasSkipped; 4593 4593 for p1 := 1 to nPl - 1 do 4594 4594 if G.RO[p1] <> nil then 4595 skipped := true; // don't show enemy moves in hotseat mode4595 skipped := True; // don't show enemy moves in hotseat mode 4596 4596 end 4597 4597 else … … 4603 4603 if NegoDlg.Visible then 4604 4604 NegoDlg.Close; 4605 HaveStrategyAdvice := false;4605 HaveStrategyAdvice := False; 4606 4606 // AdvisorDlg.HaveStrategyAdvice; 4607 4607 // negotiation might have changed advices 4608 4608 EOT.ButtonIndex := eotCancel; 4609 EOT.Visible := true;4609 EOT.Visible := True; 4610 4610 PanelPaint; 4611 4611 Update; 4612 4612 ClientMode := -1; 4613 idle := false;4614 end; 4615 4616 procedure TMainScreen.ProcessRect(x0, y0, nx, ny, Options: integer);4613 Idle := False; 4614 end; 4615 4616 procedure TMainScreen.ProcessRect(x0, y0, nx, ny, Options: Integer); 4617 4617 var 4618 xs, ys, xl, yl: integer;4618 xs, ys, xl, yl: Integer; 4619 4619 begin 4620 4620 with MainMap do begin … … 4625 4625 while abs(2 * (xs + G.lx * (xxt * 2)) + xl - MapWidth) < 4626 4626 abs(2 * xs + xl - MapWidth) do 4627 inc(xs, G.lx * (xxt * 2));4627 Inc(xs, G.lx * (xxt * 2)); 4628 4628 ys := (y0 - yw) * yyt - yyt; 4629 4629 if xs + xl > MapWidth then … … 4632 4632 yl := MapHeight - ys; 4633 4633 if (xl <= 0) or (yl <= 0) then 4634 exit;4634 Exit; 4635 4635 if Options and prPaint <> 0 then begin 4636 4636 if Options and prAutoBounds <> 0 then … … 4644 4644 end; 4645 4645 4646 procedure TMainScreen.PaintLoc(Loc: integer; Radius: integer = 0);4646 procedure TMainScreen.PaintLoc(Loc: Integer; Radius: Integer = 0); 4647 4647 var 4648 yLoc, x0: integer;4648 yLoc, x0: Integer; 4649 4649 begin 4650 4650 if MapValid then begin 4651 4651 yLoc := (Loc + G.lx * 1024) div G.lx - 1024; 4652 4652 x0 := (Loc + (yLoc and 1 - 2 * Radius + G.lx * 1024) div 2) mod G.lx; 4653 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);4653 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 4654 4654 ProcessRect(x0, yLoc - 2 * Radius, 4 * Radius + 1, 4 * Radius + 1, 4655 4655 prPaint or prAutoBounds or prInvalidate); … … 4658 4658 end; 4659 4659 4660 procedure TMainScreen.PaintLocTemp(Loc: integer; Style: TPaintLocTempStyle);4660 procedure TMainScreen.PaintLocTemp(Loc: Integer; Style: TPaintLocTempStyle); 4661 4661 var 4662 y0, x0, xMap, yMap: integer;4662 y0, x0, xMap, yMap: Integer; 4663 4663 begin 4664 4664 with NoMap do begin 4665 4665 if not MapValid then 4666 exit;4666 Exit; 4667 4667 Buffer.Canvas.Font.Assign(UniFont[ftSmall]); 4668 4668 y0 := Loc div G.lx; … … 4672 4672 while abs(2 * (xMap + G.lx * (xxt * 2)) + 2 * xxt - MapWidth) < 4673 4673 abs(2 * xMap + 2 * xxt - MapWidth) do 4674 inc(xMap, G.lx * (xxt * 2));4674 Inc(xMap, G.lx * (xxt * 2)); 4675 4675 yMap := (y0 - yw) * yyt - yyt; 4676 4676 NoMap.SetOutput(Buffer); … … 4684 4684 // panel protusions are added 4685 4685 // NoMap must be set to buffer and bounds before 4686 procedure TMainScreen.PaintBufferToScreen(xMap, yMap, width, height: integer);4686 procedure TMainScreen.PaintBufferToScreen(xMap, yMap, width, height: Integer); 4687 4687 begin 4688 4688 if xMap + width > MapWidth then … … 4692 4692 if (width <= 0) or (height <= 0) or (width + xMap <= 0) or (height + yMap <= 0) 4693 4693 then 4694 exit;4694 Exit; 4695 4695 4696 4696 NoMap.BitBltBitmap(Panel, -xMap - MapOffset, -yMap + MapHeight - overlap, xMidPanel, … … 4719 4719 end; 4720 4720 4721 procedure TMainScreen.PaintLoc_BeforeMove(FromLoc: integer);4721 procedure TMainScreen.PaintLoc_BeforeMove(FromLoc: Integer); 4722 4722 var 4723 yLoc, x0: integer;4723 yLoc, x0: Integer; 4724 4724 begin 4725 4725 if MapValid then … … 4727 4727 yLoc := (FromLoc + G.lx * 1024) div G.lx - 1024; 4728 4728 x0 := (FromLoc + (yLoc and 1 + G.lx * 1024) div 2) mod G.lx; 4729 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);4729 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 4730 4730 ProcessRect(x0, yLoc, 1, 1, prPaint or prAutoBounds); 4731 4731 end … … 4734 4734 procedure TMainScreen.PaintDestination; 4735 4735 var 4736 Destination: integer;4736 Destination: Integer; 4737 4737 begin 4738 4738 if (UnFocus >= 0) and (MyUn[UnFocus].Status and usGoto <> 0) then … … 4755 4755 procedure TMainScreen.MainOffscreenPaint; 4756 4756 var 4757 ProcessOptions: integer;4757 ProcessOptions: Integer; 4758 4758 rec: TRect; 4759 DoInvalidate: boolean;4760 begin 4761 if me < 0 then4762 with offscreen.Canvas do4759 DoInvalidate: Boolean; 4760 begin 4761 if Me < 0 then 4762 with Offscreen.Canvas do 4763 4763 begin 4764 4764 Brush.Color := $000000; … … 4766 4766 Brush.Style := bsClear; 4767 4767 OffscreenUser := self; 4768 exit;4768 Exit; 4769 4769 end; 4770 4770 … … 4777 4777 if MapValid and (xwd = xw) and (ywd = yw) then 4778 4778 MainMap.SetPaintBounds(0, 0, UsedOffscreenWidth, UsedOffscreenHeight); 4779 MapValid := false;4779 MapValid := False; 4780 4780 OffscreenUser := self; 4781 4781 end; … … 4790 4790 (ywd - yw > MapHeight div yyt) then 4791 4791 begin 4792 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);4792 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 4793 4793 ProcessRect(xw, yw, MapWidth div xxt, MapHeight div yyt, 4794 4794 prPaint or prInvalidate); 4795 4795 end else begin 4796 4796 if (xwd = xw) and (ywd = yw) then 4797 exit; { map window not moved }4798 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);4797 Exit; { map window not moved } 4798 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 4799 4799 rec := Rect(0, 0, MapWidth, MapHeight); 4800 4800 {$IFDEF WINDOWS} 4801 ScrollDC( offscreen.Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,4801 ScrollDC(Offscreen.Canvas.Handle, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt, 4802 4802 rec, rec, 0, nil); 4803 4803 {$ENDIF} 4804 4804 {$IFDEF UNIX} 4805 ScrollDC( offscreen.Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,4805 ScrollDC(Offscreen.Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt, 4806 4806 rec, rec, 0, nil); 4807 4807 {$ENDIF} 4808 for DoInvalidate := false to FastScrolling do begin4808 for DoInvalidate := False to FastScrolling do begin 4809 4809 if DoInvalidate then begin 4810 4810 rec.Bottom := MapHeight - overlap; … … 4863 4863 xwd := xw; 4864 4864 ywd := yw; 4865 MapValid := true;4865 MapValid := True; 4866 4866 end; 4867 4867 … … 4920 4920 function MovementToString(var Un: TUn): string; 4921 4921 begin 4922 result := ScreenTools.MovementToString(Un.Movement);4922 Result := ScreenTools.MovementToString(Un.Movement); 4923 4923 if Un.Master >= 0 then 4924 result := '(' + result + ')'4924 Result := '(' + Result + ')' 4925 4925 else if (MyModel[Un.mix].Domain = dAir) and 4926 4926 (MyModel[Un.mix].Kind <> mkSpecial_Glider) then 4927 result := Format('%s(%d)', [result, Un.Fuel]);4927 Result := Format('%s(%d)', [Result, Un.Fuel]); 4928 4928 end; 4929 4929 4930 4930 var 4931 i, uix, uixDefender, x, xSrc, ySrc, xSrcBase, ySrcBase, CostFactor, Count,4931 I, uix, uixDefender, X, xSrc, ySrc, xSrcBase, ySrcBase, CostFactor, Count, 4932 4932 mixShow, xTreasurySection, xResearchSection, JobFocus, TrueMoney, 4933 TrueResearch: integer;4933 TrueResearch: Integer; 4934 4934 Tile: Cardinal; 4935 s: string;4935 S: string; 4936 4936 unx: TUn; 4937 4937 UnitInfo: TUnitInfo; 4938 4938 JobProgressData: TJobProgressData; 4939 Prio: boolean;4939 Prio: Boolean; 4940 4940 begin 4941 4941 if not Assigned(MyRO) then Exit; … … 5014 5014 CopyMiniToPanel; 5015 5015 if ClientMode <> cEditMap then // MapBtn icons 5016 for i:= 0 to 5 do5017 if i<> 3 then5018 Dump(Panel, HGrSystem, xMini + G.lx - 42 + 16 * i, PanelHeight - 26,5019 8, 8, 121 + i* 9, 61);5016 for I := 0 to 5 do 5017 if I <> 3 then 5018 Dump(Panel, HGrSystem, xMini + G.lx - 42 + 16 * I, PanelHeight - 26, 5019 8, 8, 121 + I * 9, 61); 5020 5020 5021 5021 if ClientMode = cEditMap then 5022 5022 begin 5023 for i:= 0 to TrRow - 1 do5024 trix[ i] := -1;5023 for I := 0 to TrRow - 1 do 5024 trix[I] := -1; 5025 5025 Count := 0; 5026 for i:= 0 to nBrushTypes - 1 do5026 for I := 0 to nBrushTypes - 1 do 5027 5027 begin // display terrain types 5028 5028 if (Count >= TrRow * sb.Position) and (Count < TrRow * (sb.Position + 1)) 5029 5029 then 5030 5030 begin 5031 trix[Count - TrRow * sb.Position] := BrushTypes[ i];5032 x:= (Count - TrRow * sb.Position) * TrPitch;5031 trix[Count - TrRow * sb.Position] := BrushTypes[I]; 5032 X := (Count - TrRow * sb.Position) * TrPitch; 5033 5033 xSrcBase := -1; 5034 case BrushTypes[ i] of5034 case BrushTypes[I] of 5035 5035 0 .. 8: 5036 5036 begin 5037 xSrc := BrushTypes[ i];5037 xSrc := BrushTypes[I]; 5038 5038 ySrc := 0 5039 5039 end; … … 5043 5043 ySrcBase := 2; 5044 5044 xSrc := 0; 5045 ySrc := 2 * integer(BrushTypes[i]) - 155045 ySrc := 2 * Integer(BrushTypes[I]) - 15 5046 5046 end; 5047 5047 fRiver: … … 5076 5076 ySrcBase := 2; 5077 5077 xSrc := 8; 5078 ySrc := 12 + BrushTypes[ i] shr 25;5078 ySrc := 12 + BrushTypes[I] shr 25; 5079 5079 end; 5080 5080 tiIrrigation, tiFarm, tiMine, tiBase: 5081 5081 begin 5082 xSrc := BrushTypes[ i] shr 12 - 1;5082 xSrc := BrushTypes[I] shr 12 - 1; 5083 5083 ySrc := 12 5084 5084 end; … … 5103 5103 with MainMap do begin 5104 5104 if xSrcBase >= 0 then 5105 Sprite(Panel, HGrTerrain, xTroop + 2 + x, yTroop + 9 - yyt, xxt * 2,5105 Sprite(Panel, HGrTerrain, xTroop + 2 + X, yTroop + 9 - yyt, xxt * 2, 5106 5106 yyt * 3, 1 + xSrcBase * (xxt * 2 + 1), 5107 5107 1 + ySrcBase * (yyt * 3 + 1)); 5108 Sprite(Panel, HGrTerrain, xTroop + 2 + x, yTroop + 9 - yyt, xxt * 2,5108 Sprite(Panel, HGrTerrain, xTroop + 2 + X, yTroop + 9 - yyt, xxt * 2, 5109 5109 yyt * 3, 1 + xSrc * (xxt * 2 + 1), 1 + ySrc * (yyt * 3 + 1)); 5110 if BrushTypes[ i] = BrushType then begin5111 ScreenTools.Frame(Panel.Canvas, xTroop + 2 + x,5112 yTroop + 7 - yyt div 2, xTroop + 2 * xxt + x,5110 if BrushTypes[I] = BrushType then begin 5111 ScreenTools.Frame(Panel.Canvas, xTroop + 2 + X, 5112 yTroop + 7 - yyt div 2, xTroop + 2 * xxt + X, 5113 5113 yTroop + 2 * yyt + 11, $000000, $000000); 5114 ScreenTools.Frame(Panel.Canvas, xTroop + 1 + x,5115 yTroop + 6 - yyt div 2, xTroop + 2 * xxt - 1 + x,5114 ScreenTools.Frame(Panel.Canvas, xTroop + 1 + X, 5115 yTroop + 6 - yyt div 2, xTroop + 2 * xxt - 1 + X, 5116 5116 yTroop + 2 * yyt + 10, MainTexture.ColorMark, MainTexture.ColorMark); 5117 5117 end; 5118 5118 end; 5119 5119 end; 5120 inc(Count)5120 Inc(Count) 5121 5121 end; 5122 5122 case BrushType of 5123 5123 fDesert, fPrairie, fTundra, fArctic, fSwamp, fHills, fMountains: 5124 s:= Phrases.Lookup('TERRAIN', BrushType);5124 S := Phrases.Lookup('TERRAIN', BrushType); 5125 5125 fShore: 5126 s:= Format(Phrases.Lookup('TWOTERRAINS'),5126 S := Format(Phrases.Lookup('TWOTERRAINS'), 5127 5127 [Phrases.Lookup('TERRAIN', fOcean), Phrases.Lookup('TERRAIN', 5128 5128 fShore)]); 5129 5129 fGrass: 5130 s:= Format(Phrases.Lookup('TWOTERRAINS'),5130 S := Format(Phrases.Lookup('TWOTERRAINS'), 5131 5131 [Phrases.Lookup('TERRAIN', fGrass), Phrases.Lookup('TERRAIN', 5132 5132 fGrass + 12)]); 5133 5133 fForest: 5134 s:= Format(Phrases.Lookup('TWOTERRAINS'),5134 S := Format(Phrases.Lookup('TWOTERRAINS'), 5135 5135 [Phrases.Lookup('TERRAIN', fForest), Phrases.Lookup('TERRAIN', 5136 5136 fJungle)]); 5137 5137 fRiver: 5138 s:= Phrases.Lookup('RIVER');5138 S := Phrases.Lookup('RIVER'); 5139 5139 fDeadLands, fDeadLands or fCobalt, fDeadLands or fUranium, 5140 5140 fDeadLands or fMercury: 5141 s:= Phrases.Lookup('TERRAIN', 3 * 12 + BrushType shr 25);5141 S := Phrases.Lookup('TERRAIN', 3 * 12 + BrushType shr 25); 5142 5142 fPrefStartPos: 5143 s:= Phrases.Lookup('MAP_PREFSTART');5143 S := Phrases.Lookup('MAP_PREFSTART'); 5144 5144 fStartPos: 5145 s:= Phrases.Lookup('MAP_START');5145 S := Phrases.Lookup('MAP_START'); 5146 5146 fPoll: 5147 s:= Phrases.Lookup('POLL');5147 S := Phrases.Lookup('POLL'); 5148 5148 else // terrain improvements 5149 5149 begin 5150 5150 case BrushType of 5151 5151 fRoad: 5152 i:= 1;5152 I := 1; 5153 5153 fRR: 5154 i:= 2;5154 I := 2; 5155 5155 tiIrrigation: 5156 i:= 4;5156 I := 4; 5157 5157 tiFarm: 5158 i:= 5;5158 I := 5; 5159 5159 tiMine: 5160 i:= 7;5160 I := 7; 5161 5161 fCanal: 5162 i:= 8;5162 I := 8; 5163 5163 tiFort: 5164 i:= 10;5164 I := 10; 5165 5165 tiBase: 5166 i:= 12;5166 I := 12; 5167 5167 end; 5168 s := Phrases.Lookup('JOBRESULT', i);5168 S := Phrases.Lookup('JOBRESULT', I); 5169 5169 end 5170 5170 end; 5171 5171 LoweredTextOut(Panel.Canvas, -1, MainTexture, xTroop + 1, 5172 PanelHeight - 19, s);5172 PanelHeight - 19, S); 5173 5173 end 5174 5174 else if TroopLoc >= 0 then … … 5183 5183 else 5184 5184 mixShow := mix; 5185 with Tribe[ me].ModelPicture[mixShow] do5185 with Tribe[Me].ModelPicture[mixShow] do 5186 5186 begin 5187 5187 Sprite(Panel, HGr, xMidPanel + 7 + 12, yTroop + 1, 64, 48, … … 5193 5193 5194 5194 MakeBlue(Panel, xMidPanel + 7 + 12 + 10, yTroop - 13, 44, 12); 5195 s:= MovementToString(MyUn[UnFocus]);5195 S := MovementToString(MyUn[UnFocus]); 5196 5196 RisedTextOut(Panel.Canvas, xMidPanel + 7 + 12 + 32 - 5197 BiColorTextWidth(Panel.Canvas, s) div 2, yTroop - 16, s);5198 5199 s:= IntToStr(Health) + '%';5197 BiColorTextWidth(Panel.Canvas, S) div 2, yTroop - 16, S); 5198 5199 S := IntToStr(Health) + '%'; 5200 5200 LightGradient(Panel.Canvas, xMidPanel + 7 + 12 + 7, PanelHeight - 22, 5201 5201 (Health + 1) div 2, (ColorOfHealth(Health) and $FEFEFE shr 2) * 3); … … 5204 5204 div 2, PanelHeight - 22, 50 - (Health + 1) div 2, $000000); 5205 5205 RisedTextOut(Panel.Canvas, xMidPanel + 7 + 12 + 32 - 5206 BiColorTextWidth(Panel.Canvas, s) div 2, PanelHeight - 23, s);5206 BiColorTextWidth(Panel.Canvas, S) div 2, PanelHeight - 23, S); 5207 5207 5208 5208 FrameImage(Panel.Canvas, HGrSystem.Data, … … 5210 5210 121 + Exp div ExpCost * 13, 28); 5211 5211 if Job = jCity then 5212 s := Tribe[me].ModelName[-1]5212 S := Tribe[Me].ModelName[-1] 5213 5213 else 5214 s := Tribe[me].ModelName[mix];5214 S := Tribe[Me].ModelName[mix]; 5215 5215 if Home >= 0 then 5216 5216 begin 5217 5217 LoweredTextOut(Panel.Canvas, -1, MainTexture, 5218 xMidPanel + 7 + xUnitText + 18, yTroop + 5, s);5218 xMidPanel + 7 + xUnitText + 18, yTroop + 5, S); 5219 5219 LoweredTextOut(Panel.Canvas, -1, MainTexture, 5220 5220 xMidPanel + 7 + xUnitText + 18, yTroop + 21, … … 5223 5223 else 5224 5224 LoweredTextOut(Panel.Canvas, -1, MainTexture, 5225 xMidPanel + 7 + xUnitText + 18, yTroop + 13, s);5225 xMidPanel + 7 + xUnitText + 18, yTroop + 13, S); 5226 5226 end; 5227 5227 5228 5228 if (UnFocus >= 0) and (MyUn[UnFocus].Loc <> TroopLoc) then 5229 5229 begin // divide panel 5230 if SmallScreen and not supervising then5231 x:= xTroop - 85230 if SmallScreen and not Supervising then 5231 X := xTroop - 8 5232 5232 else 5233 x:= xTroop - 152;5233 X := xTroop - 152; 5234 5234 Pen.Color := MainTexture.ColorBevelShade; 5235 MoveTo( x- 1, PanelHeight - MidPanelHeight + 2);5236 LineTo( x- 1, PanelHeight);5235 MoveTo(X - 1, PanelHeight - MidPanelHeight + 2); 5236 LineTo(X - 1, PanelHeight); 5237 5237 Pen.Color := MainTexture.ColorBevelLight; 5238 MoveTo( x, PanelHeight - MidPanelHeight + 2);5239 LineTo( x, PanelHeight);5240 end; 5241 5242 for i:= 0 to 23 do5243 trix[ i] := -1;5238 MoveTo(X, PanelHeight - MidPanelHeight + 2); 5239 LineTo(X, PanelHeight); 5240 end; 5241 5242 for I := 0 to 23 do 5243 trix[I] := -1; 5244 5244 if MyMap[TroopLoc] and fUnit <> 0 then 5245 5245 begin … … 5251 5251 LoweredTextOut(Panel.Canvas, -1, MainTexture, xTroop + 10, 5252 5252 PanelHeight - 24, Phrases.Lookup('PRESENT')); 5253 Server(sGetDefender, me, TroopLoc, uixDefender);5253 Server(sGetDefender, Me, TroopLoc, uixDefender); 5254 5254 Count := 0; 5255 for Prio := true downto false do5255 for Prio := True downto False do 5256 5256 for uix := 0 to MyRO.nUn - 1 do 5257 5257 if (uix = uixDefender) = Prio then … … 5264 5264 begin 5265 5265 trix[Count - TrRow * sb.Position] := uix; 5266 MakeUnitInfo( me, unx, UnitInfo);5267 x:= (Count - TrRow * sb.Position) * TrPitch;5266 MakeUnitInfo(Me, unx, UnitInfo); 5267 X := (Count - TrRow * sb.Position) * TrPitch; 5268 5268 if uix = UnFocus then 5269 5269 begin 5270 ScreenTools.Frame(Panel.Canvas, xTroop + 4 + x,5271 yTroop + 3, xTroop + 64 + x, yTroop + 47,5270 ScreenTools.Frame(Panel.Canvas, xTroop + 4 + X, 5271 yTroop + 3, xTroop + 64 + X, yTroop + 47, 5272 5272 $000000, $000000); 5273 ScreenTools.Frame(Panel.Canvas, xTroop + 3 + x,5274 yTroop + 2, xTroop + 63 + x, yTroop + 46,5273 ScreenTools.Frame(Panel.Canvas, xTroop + 3 + X, 5274 yTroop + 2, xTroop + 63 + X, yTroop + 46, 5275 5275 MainTexture.ColorMark, MainTexture.ColorMark); 5276 5276 end 5277 5277 else if (unx.Master >= 0) and (unx.Master = UnFocus) then 5278 5278 begin 5279 CFrame(Panel.Canvas, xTroop + 4 + x, yTroop + 3,5280 xTroop + 64 + x, yTroop + 47, 8, $000000);5281 CFrame(Panel.Canvas, xTroop + 3 + x, yTroop + 2,5282 xTroop + 63 + x, yTroop + 46, 8, MainTexture.ColorMark);5279 CFrame(Panel.Canvas, xTroop + 4 + X, yTroop + 3, 5280 xTroop + 64 + X, yTroop + 47, 8, $000000); 5281 CFrame(Panel.Canvas, xTroop + 3 + X, yTroop + 2, 5282 xTroop + 63 + X, yTroop + 46, 8, MainTexture.ColorMark); 5283 5283 end; 5284 5284 NoMapPanel.SetOutput(Panel); 5285 NoMapPanel.PaintUnit(xTroop + 2 + x, yTroop + 1, UnitInfo,5285 NoMapPanel.PaintUnit(xTroop + 2 + X, yTroop + 1, UnitInfo, 5286 5286 unx.Status); 5287 5287 if (ClientMode < scContact) and … … 5289 5289 (unx.Status and (usStay or usRecover or usGoto) <> 0)) 5290 5290 then 5291 Sprite(Panel, HGrSystem, xTroop + 2 + 60 - 20 + x,5291 Sprite(Panel, HGrSystem, xTroop + 2 + 60 - 20 + X, 5292 5292 yTroop + 35, 20, 20, 81, 25); 5293 5293 5294 if not supervising then5294 if not Supervising then 5295 5295 begin 5296 MakeBlue(Panel, xTroop + 2 + 10 + x,5296 MakeBlue(Panel, xTroop + 2 + 10 + X, 5297 5297 yTroop - 13, 44, 12); 5298 s:= MovementToString(unx);5298 S := MovementToString(unx); 5299 5299 RisedTextOut(Panel.Canvas, 5300 xTroop + x + 34 - BiColorTextWidth(Panel.Canvas, s)5301 div 2, yTroop - 16, s);5300 xTroop + X + 34 - BiColorTextWidth(Panel.Canvas, S) 5301 div 2, yTroop - 16, S); 5302 5302 end; 5303 5303 end; 5304 inc(Count)5304 Inc(Count) 5305 5305 end; 5306 5306 end; // for uix:=0 to MyRO.nUn-1 5307 assert(Count = TrCnt);5307 Assert(Count = TrCnt); 5308 5308 end; 5309 5309 end … … 5312 5312 LoweredTextOut(Panel.Canvas, -1, MainTexture, xTroop + 8, 5313 5313 PanelHeight - 24, Phrases.Lookup('PRESENT')); 5314 Server(sGetUnits, me, TroopLoc, Count);5315 for i:= 0 to Count - 1 do5316 if ( i >= TrRow * sb.Position) and (i< TrRow * (sb.Position + 1)) then5314 Server(sGetUnits, Me, TroopLoc, Count); 5315 for I := 0 to Count - 1 do 5316 if (I >= TrRow * sb.Position) and (I < TrRow * (sb.Position + 1)) then 5317 5317 begin // display enemy units 5318 trix[ i - TrRow * sb.Position] := i;5319 x := (i- TrRow * sb.Position) * TrPitch;5318 trix[I - TrRow * sb.Position] := I; 5319 X := (I - TrRow * sb.Position) * TrPitch; 5320 5320 NoMapPanel.SetOutput(Panel); 5321 NoMapPanel.PaintUnit(xTroop + 2 + x, yTroop + 1,5322 MyRO.EnemyUn[MyRO.nEnemyUn + i], 0);5321 NoMapPanel.PaintUnit(xTroop + 2 + X, yTroop + 1, 5322 MyRO.EnemyUn[MyRO.nEnemyUn + I], 0); 5323 5323 end; 5324 5324 end; 5325 5325 end; 5326 if not SmallScreen or supervising then5326 if not SmallScreen or Supervising then 5327 5327 begin // show terrain and improvements 5328 5328 with NoMapPanel do … … 5330 5330 if (UnFocus >= 0) and (MyUn[UnFocus].Job <> jNone) then begin 5331 5331 JobFocus := MyUn[UnFocus].Job; 5332 Server(sGetJobProgress, me, MyUn[UnFocus].Loc, JobProgressData);5332 Server(sGetJobProgress, Me, MyUn[UnFocus].Loc, JobProgressData); 5333 5333 MakeBlue(Panel, xTerrain - 72, 148 - 17, 144, 31); 5334 5334 PaintRelativeProgressBar(Panel.Canvas, 3, xTerrain - 68, 148 + 3, 63, 5335 5335 JobProgressData[JobFocus].Done, 5336 5336 JobProgressData[JobFocus].NextTurnPlus, 5337 JobProgressData[JobFocus].Required, true, MainTexture);5338 s:= Format('%s/%s',5337 JobProgressData[JobFocus].Required, True, MainTexture); 5338 S := Format('%s/%s', 5339 5339 [ScreenTools.MovementToString(JobProgressData[JobFocus].Done), 5340 5340 ScreenTools.MovementToString(JobProgressData[JobFocus].Required)]); 5341 RisedTextOut(Panel.Canvas, xTerrain + 6, 148 - 3, s);5341 RisedTextOut(Panel.Canvas, xTerrain + 6, 148 - 3, S); 5342 5342 Tile := MyMap[MyUn[UnFocus].Loc]; 5343 5343 if (JobFocus = jRoad) and (Tile and fRiver <> 0) then … … 5354 5354 JobFocus := nJob + 4 5355 5355 end; 5356 s:= Phrases.Lookup('JOBRESULT', JobFocus);5356 S := Phrases.Lookup('JOBRESULT', JobFocus); 5357 5357 RisedTextOut(Panel.Canvas, xTerrain - BiColorTextWidth(Panel.Canvas, 5358 s) div 2, 148 - 19, s);5358 S) div 2, 148 - 19, S); 5359 5359 end; 5360 5360 if MyMap[TroopLoc] and (fTerrain or fSpecial) = fGrass or fSpecial1 then 5361 s:= Phrases.Lookup('TERRAIN', fGrass + 12)5361 S := Phrases.Lookup('TERRAIN', fGrass + 12) 5362 5362 else if MyMap[TroopLoc] and fDeadLands <> 0 then 5363 s:= Phrases.Lookup('TERRAIN', 3 * 12)5363 S := Phrases.Lookup('TERRAIN', 3 * 12) 5364 5364 else if (MyMap[TroopLoc] and fTerrain = fForest) and 5365 5365 IsJungle(TroopLoc div G.lx) then 5366 s:= Phrases.Lookup('TERRAIN', fJungle)5366 S := Phrases.Lookup('TERRAIN', fJungle) 5367 5367 else 5368 s:= Phrases.Lookup('TERRAIN', MyMap[TroopLoc] and fTerrain);5369 RisedTextOut(Panel.Canvas, xTerrain - BiColorTextWidth(Panel.Canvas, s)5370 div 2, 99, s);5368 S := Phrases.Lookup('TERRAIN', MyMap[TroopLoc] and fTerrain); 5369 RisedTextOut(Panel.Canvas, xTerrain - BiColorTextWidth(Panel.Canvas, S) 5370 div 2, 99, S); 5371 5371 end; 5372 5372 … … 5379 5379 end; 5380 5380 5381 for i:= 0 to ControlCount - 1 do5382 if Controls[ i] is TButtonB then5383 with TButtonB(Controls[ i]) do5381 for I := 0 to ControlCount - 1 do 5382 if Controls[I] is TButtonB then 5383 with TButtonB(Controls[I]) do 5384 5384 begin 5385 5385 if Visible then … … 5397 5397 if ClientMode <> cEditMap then 5398 5398 begin 5399 for i:= 0 to ControlCount - 1 do5400 if Controls[ i] is TButtonC then5401 with TButtonC(Controls[ i]) do5399 for I := 0 to ControlCount - 1 do 5400 if Controls[I] is TButtonC then 5401 with TButtonC(Controls[I]) do 5402 5402 begin 5403 5403 Dump(Panel, HGrSystem, Left, Top - self.ClientHeight + PanelHeight, … … 5439 5439 TrueMoney := MyRO.Money; 5440 5440 TrueResearch := MyRO.Research; 5441 if supervising then5441 if Supervising then 5442 5442 begin // normalize values from after-turn state 5443 dec(TrueMoney, TaxSum);5443 Dec(TrueMoney, TaxSum); 5444 5444 if TrueMoney < 0 then 5445 5445 TrueMoney := 0; // shouldn't happen 5446 dec(TrueResearch, ScienceSum);5446 Dec(TrueResearch, ScienceSum); 5447 5447 if TrueResearch < 0 then 5448 5448 TrueResearch := 0; // shouldn't happen … … 5452 5452 ImageOp_BCC(TopBar, Templates.Data, Point(xTreasurySection + 8, 1), TreasuryIcon.BoundsRect, 5453 5453 $40A040, $4030C0); 5454 s:= IntToStr(TrueMoney);5454 S := IntToStr(TrueMoney); 5455 5455 LoweredTextOut(TopBar.Canvas, -1, MainTexture, xTreasurySection + 48, 0, 5456 s+ '%c');5456 S + '%c'); 5457 5457 if MyRO.Government <> gAnarchy then 5458 5458 begin … … 5460 5460 $0000C0, $0080C0); 5461 5461 if TaxSum >= 0 then 5462 s:= Format(Phrases.Lookup('MONEYGAINPOS'), [TaxSum])5462 S := Format(Phrases.Lookup('MONEYGAINPOS'), [TaxSum]) 5463 5463 else 5464 s:= Format(Phrases.Lookup('MONEYGAINNEG'), [TaxSum]);5464 S := Format(Phrases.Lookup('MONEYGAINNEG'), [TaxSum]); 5465 5465 LoweredTextOut(TopBar.Canvas, -1, MainTexture, xTreasurySection + 48 + 5466 15, 18, s);5466 15, 18, S); 5467 5467 end; 5468 5468 … … 5484 5484 else 5485 5485 CostFactor := 2; 5486 Server(sGetTechCost, me, 0, i);5486 Server(sGetTechCost, Me, 0, I); 5487 5487 CostFactor := CostFactor * 22; // length of progress bar 5488 5488 PaintRelativeProgressBar(TopBar.Canvas, 2, xResearchSection + 48 + 1, 26, 5489 CostFactor, TrueResearch, ScienceSum, i, true, MainTexture);5489 CostFactor, TrueResearch, ScienceSum, I, True, MainTexture); 5490 5490 5491 5491 if MyRO.ResearchTech < 0 then 5492 s:= Phrases.Lookup('SCIENCE')5492 S := Phrases.Lookup('SCIENCE') 5493 5493 else if MyRO.ResearchTech = adMilitary then 5494 s:= Phrases.Lookup('INITUNIT')5494 S := Phrases.Lookup('INITUNIT') 5495 5495 else 5496 5496 begin 5497 s:= Phrases.Lookup('ADVANCES', MyRO.ResearchTech);5497 S := Phrases.Lookup('ADVANCES', MyRO.ResearchTech); 5498 5498 if MyRO.ResearchTech in FutureTech then 5499 5499 if MyRO.Tech[MyRO.ResearchTech] >= 1 then 5500 s := s+ ' ' + IntToStr(MyRO.Tech[MyRO.ResearchTech] + 1)5500 S := S + ' ' + IntToStr(MyRO.Tech[MyRO.ResearchTech] + 1) 5501 5501 else 5502 s := s+ ' 1';5502 S := S + ' 1'; 5503 5503 end; 5504 5504 if ScienceSum > 0 then 5505 5505 begin 5506 5506 { j:=(i-MyRO.Research-1) div ScienceSum +1; 5507 if j<1 then j:=1;5508 if j>1 then5509 s:=Format(Phrases.Lookup('TECHWAIT'),[s,j]); }5507 if J<1 then J:=1; 5508 if J>1 then 5509 S:=Format(Phrases.Lookup('TECHWAIT'),[S,J]); } 5510 5510 LoweredTextOut(TopBar.Canvas, -1, MainTexture, 5511 xResearchSection + 48, 0, s);5511 xResearchSection + 48, 0, S); 5512 5512 end 5513 5513 else 5514 5514 LoweredTextOut(TopBar.Canvas, -1, MainTexture, 5515 xResearchSection + 48, 0, s);5515 xResearchSection + 48, 0, S); 5516 5516 end 5517 5517 else … … 5521 5521 ImageOp_BCC(TopBar, Templates.Data, Point(xResearchSection + 48 + CostFactor + 11, 5522 5522 22), ChangeIcon.BoundsRect, $0000C0, $0080C0); 5523 s:= Format(Phrases.Lookup('TECHGAIN'), [ScienceSum]);5523 S := Format(Phrases.Lookup('TECHGAIN'), [ScienceSum]); 5524 5524 LoweredTextOut(TopBar.Canvas, -1, MainTexture, xResearchSection + 48 + 5525 CostFactor + 26, 18, s);5525 CostFactor + 26, 18, S); 5526 5526 end; 5527 5527 end; … … 5529 5529 begin 5530 5530 TopBar.Canvas.Font.Assign(UniFont[ftCaption]); 5531 s:= TurnToString(MyRO.Turn);5531 S := TurnToString(MyRO.Turn); 5532 5532 RisedTextOut(TopBar.Canvas, 5533 40 + (xTreasurySection - 40 - BiColorTextWidth(TopBar.Canvas, s))5534 div 2, 6, s);5533 40 + (xTreasurySection - 40 - BiColorTextWidth(TopBar.Canvas, S)) 5534 div 2, 6, S); 5535 5535 TopBar.Canvas.Font.Assign(UniFont[ftNormal]); 5536 5536 end; … … 5540 5540 procedure TMainScreen.FocusNextUnit(Dir: Integer); 5541 5541 var 5542 i, uix, NewFocus: Integer;5542 I, uix, NewFocus: Integer; 5543 5543 begin 5544 5544 if ClientMode >= scContact then … … 5547 5547 PaintDestination; 5548 5548 NewFocus := -1; 5549 for i:= 1 to MyRO.nUn do begin5550 uix := (UnFocus + i* Dir + MyRO.nUn) mod MyRO.nUn;5549 for I := 1 to MyRO.nUn do begin 5550 uix := (UnFocus + I * Dir + MyRO.nUn) mod MyRO.nUn; 5551 5551 if (MyUn[uix].Loc >= 0) and (MyUn[uix].Status and usStay = 0) then begin 5552 5552 NewFocus := uix; … … 5561 5561 end; 5562 5562 5563 procedure TMainScreen.FocusOnLoc(Loc: integer; Options: integer = 0);5563 procedure TMainScreen.FocusOnLoc(Loc: Integer; Options: Integer = 0); 5564 5564 var 5565 dx: integer;5566 Outside, Changed: boolean;5565 dx: Integer; 5566 Outside, Changed: Boolean; 5567 5567 begin 5568 5568 with MainMap do begin … … 5572 5572 (Loc div G.lx >= yw + (MapHeight - 1) div yyt - 2)); 5573 5573 end; 5574 Changed := true;5574 Changed := True; 5575 5575 if Outside then begin 5576 5576 Centre(Loc); … … 5580 5580 PaintAllMaps 5581 5581 else 5582 Changed := false;5582 Changed := False; 5583 5583 if Options and flRepaintPanel <> 0 then 5584 5584 PanelPaint; … … 5590 5590 var 5591 5591 Dist, TestDist: Single; 5592 i, uix, NewFocus: Integer;5592 I, uix, NewFocus: Integer; 5593 5593 GotoOnly: Boolean; 5594 5594 begin … … 5600 5600 for GotoOnly := GoOnPhase downto False do begin 5601 5601 NewFocus := -1; 5602 for i:= 1 to MyRO.nUn do begin5603 uix := (UnFocus + i) mod MyRO.nUn;5602 for I := 1 to MyRO.nUn do begin 5603 uix := (UnFocus + I) mod MyRO.nUn; 5604 5604 if (MyUn[uix].Loc >= 0) and (MyUn[uix].Job = jNone) and 5605 5605 (MyUn[uix].Status and (usStay or usRecover or usWaiting) = usWaiting) … … 5640 5640 end; 5641 5641 5642 procedure TMainScreen.Scroll(dx, dy: integer);5642 procedure TMainScreen.Scroll(dx, dy: Integer); 5643 5643 begin 5644 5644 xw := (xw + G.lx + dx) mod G.lx; … … 5664 5664 procedure TMainScreen.Timer1Timer(Sender: TObject); 5665 5665 var 5666 dx, dy, ScrollSpeed: integer;5667 begin 5668 if idle and (me >= 0) and (GameMode <> cMovie) then5666 dx, dy, ScrollSpeed: Integer; 5667 begin 5668 if Idle and (Me >= 0) and (GameMode <> cMovie) then 5669 5669 if (fsModal in Screen.ActiveForm.FormState) or 5670 5670 (Screen.ActiveForm is TBufferedDrawDlg) and … … 5674 5674 if not BlinkON then 5675 5675 begin 5676 BlinkON := true;5676 BlinkON := True; 5677 5677 if UnFocus >= 0 then 5678 5678 PaintLocTemp(MyUn[UnFocus].Loc) 5679 else if TurnComplete and not supervising then5679 else if TurnComplete and not Supervising then 5680 5680 EOT.SetButtonIndexFast(eotBlinkOn); 5681 5681 end; … … 5689 5689 dx := 0; 5690 5690 dy := 0; 5691 if Mouse.CursorPos. y< Screen.height - PanelHeight then5692 if Mouse.CursorPos. x= 0 then5691 if Mouse.CursorPos.Y < Screen.height - PanelHeight then 5692 if Mouse.CursorPos.X = 0 then 5693 5693 dx := -ScrollSpeed // scroll left 5694 else if Mouse.CursorPos. x= Screen.width - 1 then5694 else if Mouse.CursorPos.X = Screen.width - 1 then 5695 5695 dx := ScrollSpeed; // scroll right 5696 if Mouse.CursorPos. y= 0 then5696 if Mouse.CursorPos.Y = 0 then 5697 5697 dy := -ScrollSpeed // scroll up 5698 else if (Mouse.CursorPos. y= Screen.height - 1) and5699 (Mouse.CursorPos. x>= TerrainBtn.Left + TerrainBtn.width) and5700 (Mouse.CursorPos. x< xRightPanel + 10 - 8) then5698 else if (Mouse.CursorPos.Y = Screen.height - 1) and 5699 (Mouse.CursorPos.X >= TerrainBtn.Left + TerrainBtn.width) and 5700 (Mouse.CursorPos.X < xRightPanel + 10 - 8) then 5701 5701 dy := ScrollSpeed; // scroll down 5702 5702 if (dx <> 0) or (dy <> 0) then … … 5711 5711 BlinkTime := (BlinkTime + 1) mod (BlinkOnTime + BlinkOffTime); 5712 5712 BlinkON := BlinkTime >= BlinkOffTime; 5713 DestinationMarkON := true;5713 DestinationMarkON := True; 5714 5714 if UnFocus >= 0 then 5715 5715 begin … … 5722 5722 end; 5723 5723 end 5724 else if TurnComplete and not supervising then5724 else if TurnComplete and not Supervising then 5725 5725 begin 5726 5726 if BlinkTime = 0 then … … 5732 5732 end; 5733 5733 5734 procedure TMainScreen.SetMapPos(Loc: integer; MapPos: TPoint);5734 procedure TMainScreen.SetMapPos(Loc: Integer; MapPos: TPoint); 5735 5735 begin 5736 5736 with MainMap do begin … … 5750 5750 end; 5751 5751 5752 procedure TMainScreen.Centre(Loc: integer);5752 procedure TMainScreen.Centre(Loc: Integer); 5753 5753 begin 5754 5754 SetMapPos(Loc, Point(MapWidth div 2, MapHeight div 2)); 5755 5755 end; 5756 5756 5757 function TMainScreen.ZoomToCity(Loc: integer; NextUnitOnClose: boolean = false;5758 ShowEvent: integer = 0): boolean;5759 begin 5760 result := MyMap[Loc] and (fOwned or fSpiedOut) <> 0;5761 if result then5757 function TMainScreen.ZoomToCity(Loc: Integer; NextUnitOnClose: Boolean = False; 5758 ShowEvent: Integer = 0): Boolean; 5759 begin 5760 Result := MyMap[Loc] and (fOwned or fSpiedOut) <> 0; 5761 if Result then 5762 5762 with CityDlg do 5763 5763 begin … … 5785 5785 end; 5786 5786 5787 function TMainScreen.LocationOfScreenPixel( x, y: integer): Integer;5787 function TMainScreen.LocationOfScreenPixel(X, Y: Integer): Integer; 5788 5788 var 5789 qx, qy: integer;5789 qx, qy: Integer; 5790 5790 begin 5791 5791 with MainMap do begin 5792 qx := ( x * (yyt * 2) + y* (xxt * 2) + xxt * yyt * 2) div (xxt * yyt * 4) - 1;5793 qy := ( y * (xxt * 2) - x* (yyt * 2) - xxt * yyt * 2 + 4000 * xxt * yyt)5792 qx := (X * (yyt * 2) + Y * (xxt * 2) + xxt * yyt * 2) div (xxt * yyt * 4) - 1; 5793 qy := (Y * (xxt * 2) - X * (yyt * 2) - xxt * yyt * 2 + 4000 * xxt * yyt) 5794 5794 div (xxt * yyt * 4) - 999; 5795 5795 Result := (xw + (qx - qy + 2048) div 2 - 1024 + G.lx) mod G.lx + G.lx * … … 5805 5805 5806 5806 procedure TMainScreen.MapBoxMouseDown(Sender: TObject; Button: TMouseButton; 5807 Shift: TShiftState; x, y: integer);5807 Shift: TShiftState; X, Y: Integer); 5808 5808 var 5809 i, uix, emix, p1, dx, dy, MouseLoc: integer;5809 I, uix, emix, p1, dx, dy, MouseLoc: Integer; 5810 5810 EditTileData: TEditTileData; 5811 m, m2: TMenuItem;5811 M, m2: TMenuItem; 5812 5812 MoveAdviceData: TMoveAdviceData; 5813 DoCenter: boolean;5813 DoCenter: Boolean; 5814 5814 begin 5815 5815 if GameMode = cMovie then 5816 exit;5816 Exit; 5817 5817 5818 5818 if CityDlg.Visible then … … 5820 5820 if UnitStatDlg.Visible then 5821 5821 UnitStatDlg.Close; 5822 MouseLoc := LocationOfScreenPixel( x, y);5822 MouseLoc := LocationOfScreenPixel(X, Y); 5823 5823 if (MouseLoc < 0) or (MouseLoc >= G.lx * G.ly) then 5824 exit;5824 Exit; 5825 5825 if (Button = mbLeft) and not(ssShift in Shift) then 5826 5826 begin 5827 DoCenter := true;5827 DoCenter := True; 5828 5828 if ClientMode = cEditMap then 5829 5829 begin 5830 DoCenter := false;5830 DoCenter := False; 5831 5831 EditTileData.Loc := MouseLoc; 5832 5832 if ssCtrl in Shift then // toggle special resource … … 5866 5866 else 5867 5867 EditTileData.NewTile := MyMap[MouseLoc] xor BrushType; 5868 Server(sEditTile, me, 0, EditTileData);5869 Edited := true;5868 Server(sEditTile, Me, 0, EditTileData); 5869 Edited := True; 5870 5870 BrushLoc := MouseLoc; 5871 5871 PaintLoc(MouseLoc, 2); … … 5893 5893 begin 5894 5894 ZoomToCity(MouseLoc); 5895 DoCenter := false;5895 DoCenter := False; 5896 5896 end 5897 5897 else 5898 5898 begin 5899 5899 UnitStatDlg.ShowNewContent_EnemyCity(wmPersistent, MouseLoc); 5900 DoCenter := false;5900 DoCenter := False; 5901 5901 end; 5902 5902 end … … 5904 5904 if MyMap[MouseLoc] and fOwned <> 0 then 5905 5905 begin 5906 DoCenter := false;5907 if not supervising and (ClientMode < scContact) then5906 DoCenter := False; 5907 if not Supervising and (ClientMode < scContact) then 5908 5908 begin // not in negotiation mode 5909 5909 if (UnFocus >= 0) and (MyUn[UnFocus].Loc = MouseLoc) then 5910 5910 begin // rotate 5911 5911 uix := (UnFocus + 1) mod MyRO.nUn; 5912 i:= MyRO.nUn - 1;5913 while i> 0 do5912 I := MyRO.nUn - 1; 5913 while I > 0 do 5914 5914 begin 5915 5915 if (MyUn[uix].Loc = MouseLoc) and (MyUn[uix].Job = jNone) and … … 5917 5917 usWaiting) = usWaiting) then 5918 5918 Break; 5919 dec(i);5919 Dec(I); 5920 5920 uix := (uix + 1) mod MyRO.nUn; 5921 5921 end; 5922 if i= 0 then5922 if I = 0 then 5923 5923 uix := UnFocus; 5924 5924 end 5925 5925 else 5926 Server(sGetDefender, me, MouseLoc, uix);5926 Server(sGetDefender, Me, MouseLoc, uix); 5927 5927 if uix <> UnFocus then 5928 5928 SetUnFocus(uix); 5929 TurnComplete := false;5929 TurnComplete := False; 5930 5930 EOT.ButtonIndex := eotGray; 5931 5931 end; … … 5935 5935 else if (MyMap[MouseLoc] and fSpiedOut <> 0) and not(ssCtrl in Shift) then 5936 5936 begin 5937 DoCenter := false;5937 DoCenter := False; 5938 5938 SetTroopLoc(MouseLoc); 5939 5939 PanelPaint; … … 5941 5941 else 5942 5942 begin 5943 DoCenter := false;5943 DoCenter := False; 5944 5944 UnitStatDlg.ShowNewContent_EnemyLoc(wmPersistent, MouseLoc); 5945 5945 end; … … 5953 5953 not(ssShift in Shift) then 5954 5954 begin 5955 if supervising then5955 if Supervising then 5956 5956 begin 5957 5957 EditLoc := MouseLoc; 5958 Server(sGetModels, me, 0, nil^);5958 Server(sGetModels, Me, 0, nil^); 5959 5959 EmptyMenu(mCreateUnit); 5960 5960 for p1 := 0 to nPl - 1 do 5961 5961 if 1 shl p1 and MyRO.Alive <> 0 then 5962 5962 begin 5963 m:= TMenuItem.Create(mCreateUnit);5964 m.Caption := Tribe[p1].TPhrase('SHORTNAME');5963 M := TMenuItem.Create(mCreateUnit); 5964 M.Caption := Tribe[p1].TPhrase('SHORTNAME'); 5965 5965 for emix := MyRO.nEnemyModel - 1 downto 0 do 5966 5966 if (MyRO.EnemyModel[emix].Owner = p1) and 5967 (Server(sCreateUnit - sExecute + p1 shl 4, me,5967 (Server(sCreateUnit - sExecute + p1 shl 4, Me, 5968 5968 MyRO.EnemyModel[emix].mix, MouseLoc) >= rExecuted) then 5969 5969 begin 5970 5970 if not Assigned(Tribe[p1].ModelPicture[MyRO.EnemyModel[emix].mix].HGr) then 5971 5971 InitEnemyModel(emix); 5972 m2 := TMenuItem.Create( m);5972 m2 := TMenuItem.Create(M); 5973 5973 m2.Caption := Tribe[p1].ModelName[MyRO.EnemyModel[emix].mix]; 5974 5974 m2.Tag := p1 shl 16 + MyRO.EnemyModel[emix].mix; 5975 5975 m2.OnClick := CreateUnitClick; 5976 m.Add(m2);5976 M.Add(m2); 5977 5977 end; 5978 m.Visible := m.Count > 0;5979 mCreateUnit.Add( m);5978 M.Visible := M.Count > 0; 5979 mCreateUnit.Add(M); 5980 5980 end; 5981 5981 if FullScreen then 5982 EditPopup.Popup(Left + x, Top + y)5982 EditPopup.Popup(Left + X, Top + Y) 5983 5983 else 5984 EditPopup.Popup(Left + x+ 4,5985 Top + y+ GetSystemMetrics(SM_CYCAPTION) + 4);5984 EditPopup.Popup(Left + X + 4, 5985 Top + Y + GetSystemMetrics(SM_CYCAPTION) + 4); 5986 5986 end 5987 5987 else if (UnFocus >= 0) and (MyUn[UnFocus].Loc <> MouseLoc) then … … 5994 5994 if abs(dx) + abs(dy) < 3 then 5995 5995 begin 5996 DestinationMarkON := false;5996 DestinationMarkON := False; 5997 5997 PaintDestination; 5998 5998 Status := Status and ($FFFF - usStay - usRecover - usGoto - usEnhance) … … 6007 6007 with MyUn[UnFocus], BattleDlg.Forecast do 6008 6008 begin 6009 pAtt := me;6009 pAtt := Me; 6010 6010 mixAtt := mix; 6011 6011 HealthAtt := Health; … … 6014 6014 end; 6015 6015 BattleDlg.Forecast.Movement := MyUn[UnFocus].Movement; 6016 if (Server(sGetBattleForecastEx, me, MouseLoc, BattleDlg.Forecast)6016 if (Server(sGetBattleForecastEx, Me, MouseLoc, BattleDlg.Forecast) 6017 6017 >= rExecuted) and (BattleDlg.Forecast.EndHealthAtt <= 0) then 6018 6018 begin 6019 6019 BattleDlg.uix := UnFocus; 6020 6020 BattleDlg.ToLoc := MouseLoc; 6021 BattleDlg.IsSuicideQuery := true;6021 BattleDlg.IsSuicideQuery := True; 6022 6022 BattleDlg.ShowModal; 6023 6023 if BattleDlg.ModalResult <> mrOK then 6024 exit;6024 Exit; 6025 6025 end; 6026 6026 end; 6027 DestinationMarkON := false;6027 DestinationMarkON := False; 6028 6028 PaintDestination; 6029 6029 Status := Status and not(usStay or usRecover or usEnhance) or 6030 6030 usWaiting; 6031 MoveToLoc(MouseLoc, false); { goto }6031 MoveToLoc(MouseLoc, False); { goto } 6032 6032 end; 6033 6033 end; … … 6036 6036 (MyModel[MyUn[UnFocus].mix].Kind in [mkSettler, mkSlaves]) then 6037 6037 begin 6038 DestinationMarkON := false;6038 DestinationMarkON := False; 6039 6039 PaintDestination; 6040 6040 MyUn[UnFocus].Status := MyUn[UnFocus].Status and … … 6042 6042 uix := UnFocus; 6043 6043 if MouseLoc <> MyUn[uix].Loc then 6044 MoveToLoc(MouseLoc, true); { goto }6044 MoveToLoc(MouseLoc, True); { goto } 6045 6045 if (UnFocus = uix) and (MyUn[uix].Loc = MouseLoc) then 6046 6046 mEnhance.Click; … … 6055 6055 with MyUn[UnFocus], BattleDlg.Forecast do 6056 6056 begin 6057 pAtt := me;6057 pAtt := Me; 6058 6058 mixAtt := mix; 6059 6059 HealthAtt := Health; … … 6062 6062 end; 6063 6063 BattleDlg.Forecast.Movement := MyUn[UnFocus].Movement; 6064 if Server(sGetBattleForecastEx, me, MouseLoc, BattleDlg.Forecast) >= rExecuted6064 if Server(sGetBattleForecastEx, Me, MouseLoc, BattleDlg.Forecast) >= rExecuted 6065 6065 then 6066 6066 begin 6067 6067 BattleDlg.uix := UnFocus; 6068 6068 BattleDlg.ToLoc := MouseLoc; 6069 BattleDlg.Left := x- BattleDlg.width div 2;6069 BattleDlg.Left := X - BattleDlg.width div 2; 6070 6070 if BattleDlg.Left < 0 then 6071 6071 BattleDlg.Left := 0 6072 6072 else if BattleDlg.Left + BattleDlg.width > Screen.width then 6073 6073 BattleDlg.Left := Screen.width - BattleDlg.width; 6074 BattleDlg.Top := y- BattleDlg.height div 2;6074 BattleDlg.Top := Y - BattleDlg.height div 2; 6075 6075 if BattleDlg.Top < 0 then 6076 6076 BattleDlg.Top := 0 6077 6077 else if BattleDlg.Top + BattleDlg.height > Screen.height then 6078 6078 BattleDlg.Top := Screen.height - BattleDlg.height; 6079 BattleDlg.IsSuicideQuery := false;6079 BattleDlg.IsSuicideQuery := False; 6080 6080 BattleDlg.Show; 6081 6081 end; … … 6083 6083 end; 6084 6084 6085 function TMainScreen.MoveUnit(dx, dy: integer; Options: integer): integer;6085 function TMainScreen.MoveUnit(dx, dy: Integer; Options: Integer): Integer; 6086 6086 // move focused unit to adjacent tile 6087 6087 var 6088 i, cix, uix, euix, FromLoc, ToLoc, DirCode, UnFocus0, Defender, Mission, p1,6089 NewTiles, cixChanged: integer;6088 I, cix, uix, euix, FromLoc, ToLoc, DirCode, UnFocus0, Defender, Mission, p1, 6089 NewTiles, cixChanged: Integer; 6090 6090 OldToTile: Cardinal; 6091 6091 CityCaptured, IsAttack, OldUnrest, NewUnrest, NeedEcoUpdate, NeedRepaintPanel, 6092 ToTransport, ToShip: boolean;6092 ToTransport, ToShip: Boolean; 6093 6093 PlaneReturnData: TPlaneReturnData; 6094 6094 QueryItem: string; 6095 6095 begin 6096 result := eInvalid;6096 Result := eInvalid; 6097 6097 UnFocus0 := UnFocus; 6098 6098 FromLoc := MyUn[UnFocus].Loc; … … 6100 6100 if (ToLoc < 0) or (ToLoc >= G.lx * G.ly) then 6101 6101 begin 6102 result := eInvalid;6103 exit;6102 Result := eInvalid; 6103 Exit; 6104 6104 end; 6105 6105 if MyMap[ToLoc] and fStealthUnit <> 0 then 6106 6106 begin 6107 6107 SoundMessage(Phrases.Lookup('ATTACKSTEALTH'), ''); 6108 exit;6108 Exit; 6109 6109 end; 6110 6110 if MyMap[ToLoc] and fHiddenUnit <> 0 then 6111 6111 begin 6112 6112 SoundMessage(Phrases.Lookup('ATTACKSUB'), ''); 6113 exit;6113 Exit; 6114 6114 end; 6115 6115 … … 6121 6121 begin 6122 6122 SoundMessage(Phrases.Lookup('NOATTACKER'), ''); 6123 exit;6123 Exit; 6124 6124 end; 6125 6125 euix := MyRO.nEnemyUn - 1; 6126 6126 while (euix >= 0) and (MyRO.EnemyUn[euix].Loc <> ToLoc) do 6127 dec(euix);6127 Dec(euix); 6128 6128 end; 6129 6129 6130 6130 DirCode := dx and 7 shl 4 + dy and 7 shl 7; 6131 result := Server(sMoveUnit - sExecute + DirCode, me, UnFocus, nil^);6132 if ( result < rExecuted) and (MyUn[UnFocus].Job > jNone) then6133 Server(sStartJob + jNone shl 4, me, UnFocus, nil^);6134 if ( result < rExecuted) and (result <> eNoTime_Move) then6135 begin 6136 case result of6131 Result := Server(sMoveUnit - sExecute + DirCode, Me, UnFocus, nil^); 6132 if (Result < rExecuted) and (MyUn[UnFocus].Job > jNone) then 6133 Server(sStartJob + jNone shl 4, Me, UnFocus, nil^); 6134 if (Result < rExecuted) and (Result <> eNoTime_Move) then 6135 begin 6136 case Result of 6137 6137 eNoTime_Load: 6138 6138 if MyModel[MyUn[UnFocus].mix].Domain = dAir then … … 6170 6170 (MyMap[ToLoc] and (fUnit or fOwned) = fUnit or fOwned) then 6171 6171 begin // false load attempt 6172 ToShip := false;6173 ToTransport := false;6172 ToShip := False; 6173 ToTransport := False; 6174 6174 for uix := 0 to MyRO.nUn - 1 do 6175 6175 if (MyUn[uix].Loc = ToLoc) and 6176 6176 (MyModel[MyUn[uix].mix].Domain = dSea) then 6177 6177 begin 6178 ToShip := true;6178 ToShip := True; 6179 6179 if MyModel[MyUn[uix].mix].Cap[mcSeaTrans] > 0 then 6180 ToTransport := true;6180 ToTransport := True; 6181 6181 end; 6182 6182 if ToTransport then … … 6193 6193 Play('NOMOVE_DEFAULT'); 6194 6194 end; 6195 exit;6196 end; 6197 6198 if (( result = eWon) or (result = eLost) or (result = eBloody)) and6195 Exit; 6196 end; 6197 6198 if ((Result = eWon) or (Result = eLost) or (Result = eBloody)) and 6199 6199 (MyUn[UnFocus].Movement < 100) and 6200 6200 (MyModel[MyUn[UnFocus].mix].Cap[mcWill] = 0) then … … 6203 6203 [MyUn[UnFocus].Movement]), 'NOMOVE_TIME') <> mrOK then 6204 6204 begin 6205 result := eInvalid;6206 exit;6205 Result := eInvalid; 6206 Exit; 6207 6207 end; 6208 6208 Update; // remove message box from screen 6209 6209 end; 6210 6210 6211 OldUnrest := false;6212 NewUnrest := false;6213 if ( result >= rExecuted) and (result and rUnitRemoved = 0) and6211 OldUnrest := False; 6212 NewUnrest := False; 6213 if (Result >= rExecuted) and (Result and rUnitRemoved = 0) and 6214 6214 (MyMap[ToLoc] and (fUnit or fOwned) <> fUnit) then 6215 6215 begin … … 6221 6221 begin 6222 6222 QueryItem := 'UNREST_NOTOWN'; 6223 p1 := me;6223 p1 := Me; 6224 6224 end 6225 6225 else … … 6238 6238 if ModalResult <> mrOK then 6239 6239 begin 6240 result := eInvalid;6241 exit;6240 Result := eInvalid; 6241 Exit; 6242 6242 end; 6243 6243 end; … … 6246 6246 end; 6247 6247 6248 if ( result >= rExecuted) and (MyModel[MyUn[UnFocus].mix].Domain = dAir) and6248 if (Result >= rExecuted) and (MyModel[MyUn[UnFocus].mix].Domain = dAir) and 6249 6249 (MyUn[UnFocus].Status and usToldNoReturn = 0) then 6250 6250 begin // can plane return? … … 6266 6266 PlaneReturnData.Movement := MyUn[UnFocus].Movement - 150; 6267 6267 end; 6268 if Server(sGetPlaneReturn, me, UnFocus, PlaneReturnData) = eNoWay then6268 if Server(sGetPlaneReturn, Me, UnFocus, PlaneReturnData) = eNoWay then 6269 6269 begin 6270 6270 if MyModel[MyUn[UnFocus].mix].Kind = mkSpecial_Glider then … … 6275 6275 <> mrOK then 6276 6276 begin 6277 result := eInvalid;6278 exit;6277 Result := eInvalid; 6278 Exit; 6279 6279 end; 6280 6280 Update; // remove message box from screen … … 6283 6283 end; 6284 6284 6285 if result = eMissionDone then6285 if Result = eMissionDone then 6286 6286 begin 6287 6287 ModalSelectDlg.ShowNewContent(wmModal, kMission); 6288 6288 Update; // dialog still on screen 6289 Mission := ModalSelectDlg. result;6289 Mission := ModalSelectDlg.Result; 6290 6290 if Mission < 0 then 6291 exit;6292 Server(sSetSpyMission + Mission shl 4, me, 0, nil^);6293 end; 6294 6295 CityCaptured := false;6296 if result = eNoTime_Move then6291 Exit; 6292 Server(sSetSpyMission + Mission shl 4, Me, 0, nil^); 6293 end; 6294 6295 CityCaptured := False; 6296 if Result = eNoTime_Move then 6297 6297 Play('NOMOVE_TIME') 6298 6298 else 6299 6299 begin 6300 NeedEcoUpdate := false;6301 DestinationMarkON := false;6300 NeedEcoUpdate := False; 6301 DestinationMarkON := False; 6302 6302 PaintDestination; 6303 if result and rUnitRemoved <> 0 then6303 if Result and rUnitRemoved <> 0 then 6304 6304 CityOptimizer_BeforeRemoveUnit(UnFocus); 6305 IsAttack := ( result = eBombarded) or (result <> eMissionDone) and6305 IsAttack := (Result = eBombarded) or (Result <> eMissionDone) and 6306 6306 (MyMap[ToLoc] and (fUnit or fOwned) = fUnit); 6307 6307 if not IsAttack then … … 6309 6309 cix := MyRO.nCity - 1; { look for own city at dest location } 6310 6310 while (cix >= 0) and (MyCity[cix].Loc <> ToLoc) do 6311 dec(cix);6312 if ( result <> eMissionDone) and (MyMap[ToLoc] and fCity <> 0) and (cix < 0)6311 Dec(cix); 6312 if (Result <> eMissionDone) and (MyMap[ToLoc] and fCity <> 0) and (cix < 0) 6313 6313 then 6314 CityCaptured := true;6315 result := Server(sMoveUnit + DirCode, me, UnFocus, nil^);6316 case result of6314 CityCaptured := True; 6315 Result := Server(sMoveUnit + DirCode, Me, UnFocus, nil^); 6316 case Result of 6317 6317 eHiddenUnit: 6318 6318 begin … … 6332 6332 rExecuted .. maxint: 6333 6333 begin 6334 if result and rUnitRemoved <> 0 then6334 if Result and rUnitRemoved <> 0 then 6335 6335 UnFocus := -1 // unit died 6336 6336 else 6337 6337 begin 6338 assert(UnFocus >= 0);6338 Assert(UnFocus >= 0); 6339 6339 MyUn[UnFocus].Status := MyUn[UnFocus].Status and 6340 6340 not(usStay or usRecover); … … 6346 6346 begin // borders have moved, unrest might have changed in any city 6347 6347 CityOptimizer_BeginOfTurn; 6348 NeedEcoUpdate := true;6348 NeedEcoUpdate := True; 6349 6349 end 6350 6350 else … … 6356 6356 if MyUn[uix].Master = UnFocus then 6357 6357 CityOptimizer_CityChange(MyUn[uix].Home); 6358 NeedEcoUpdate := true;6358 NeedEcoUpdate := True; 6359 6359 end; 6360 6360 if (MyRO.Government = gDespotism) and … … 6366 6366 while (cixChanged >= 0) and 6367 6367 (MyCity[cixChanged].Loc <> FromLoc) do 6368 dec(cixChanged);6369 assert(cixChanged >= 0);6368 Dec(cixChanged); 6369 Assert(cixChanged >= 0); 6370 6370 if cixChanged >= 0 then 6371 6371 begin 6372 6372 CityOptimizer_CityChange(cixChanged); 6373 NeedEcoUpdate := true;6373 NeedEcoUpdate := True; 6374 6374 end; 6375 6375 end; … … 6379 6379 while (cixChanged >= 0) and 6380 6380 (MyCity[cixChanged].Loc <> ToLoc) do 6381 dec(cixChanged);6382 assert(cixChanged >= 0);6381 Dec(cixChanged); 6382 Assert(cixChanged >= 0); 6383 6383 if cixChanged >= 0 then 6384 6384 begin 6385 6385 CityOptimizer_CityChange(cixChanged); 6386 NeedEcoUpdate := true;6386 NeedEcoUpdate := True; 6387 6387 end; 6388 6388 end; … … 6392 6392 end; 6393 6393 else 6394 assert(false);6394 Assert(False); 6395 6395 end; 6396 6396 SetTroopLoc(ToLoc); … … 6398 6398 else 6399 6399 begin { enemy unit -- attack } 6400 if result = eBombarded then6400 if Result = eBombarded then 6401 6401 Defender := MyRO.Territory[ToLoc] 6402 6402 else … … 6405 6405 if SimpleQuery(mkYesNo,Phrases.Lookup('FRCANCELQUERY_CEASEFIRE'), 6406 6406 'MSG_DEFAULT')<>mrOK then 6407 exit; }6408 if (Options and muNoSuicideCheck = 0) and ( result and rUnitRemoved <> 0)6409 and ( result <> eMissionDone) then6407 Exit; } 6408 if (Options and muNoSuicideCheck = 0) and (Result and rUnitRemoved <> 0) 6409 and (Result <> eMissionDone) then 6410 6410 begin // suicide query 6411 6411 with MyUn[UnFocus], BattleDlg.Forecast do 6412 6412 begin 6413 pAtt := me;6413 pAtt := Me; 6414 6414 mixAtt := mix; 6415 6415 HealthAtt := Health; … … 6418 6418 end; 6419 6419 BattleDlg.Forecast.Movement := MyUn[UnFocus].Movement; 6420 Server(sGetBattleForecastEx, me, ToLoc, BattleDlg.Forecast);6420 Server(sGetBattleForecastEx, Me, ToLoc, BattleDlg.Forecast); 6421 6421 BattleDlg.uix := UnFocus; 6422 6422 BattleDlg.ToLoc := ToLoc; 6423 BattleDlg.IsSuicideQuery := true;6423 BattleDlg.IsSuicideQuery := True; 6424 6424 BattleDlg.ShowModal; 6425 6425 if BattleDlg.ModalResult <> mrOK then 6426 exit;6426 Exit; 6427 6427 end; 6428 6428 6429 6429 cixChanged := -1; 6430 if ( result and rUnitRemoved <> 0) and (MyRO.Government = gDespotism) and6430 if (Result and rUnitRemoved <> 0) and (MyRO.Government = gDespotism) and 6431 6431 (MyModel[MyUn[UnFocus].mix].Kind = mkSpecial_TownGuard) and 6432 6432 (MyMap[FromLoc] and fCity <> 0) then … … 6434 6434 cixChanged := MyRO.nCity - 1; 6435 6435 while (cixChanged >= 0) and (MyCity[cixChanged].Loc <> FromLoc) do 6436 dec(cixChanged);6437 assert(cixChanged >= 0);6438 end; 6439 6440 for i:= 0 to MyRO.nEnemyModel - 1 do6441 LostArmy[ i] := MyRO.EnemyModel[i].Lost;6436 Dec(cixChanged); 6437 Assert(cixChanged >= 0); 6438 end; 6439 6440 for I := 0 to MyRO.nEnemyModel - 1 do 6441 LostArmy[I] := MyRO.EnemyModel[I].Lost; 6442 6442 OldToTile := MyMap[ToLoc]; 6443 result := Server(sMoveUnit + DirCode, me, UnFocus, nil^);6443 Result := Server(sMoveUnit + DirCode, Me, UnFocus, nil^); 6444 6444 nLostArmy := 0; 6445 for i:= 0 to MyRO.nEnemyModel - 1 do6446 begin 6447 LostArmy[ i] := MyRO.EnemyModel[i].Lost - LostArmy[i];6448 inc(nLostArmy, LostArmy[i]);6449 end; 6450 if result and rUnitRemoved <> 0 then6445 for I := 0 to MyRO.nEnemyModel - 1 do 6446 begin 6447 LostArmy[I] := MyRO.EnemyModel[I].Lost - LostArmy[I]; 6448 Inc(nLostArmy, LostArmy[I]); 6449 end; 6450 if Result and rUnitRemoved <> 0 then 6451 6451 begin 6452 6452 UnFocus := -1; … … 6457 6457 begin // city was destroyed, borders have moved, unrest might have changed in any city 6458 6458 CityOptimizer_BeginOfTurn; 6459 NeedEcoUpdate := true;6459 NeedEcoUpdate := True; 6460 6460 end 6461 6461 else … … 6464 6464 begin 6465 6465 CityOptimizer_CityChange(cixChanged); 6466 NeedEcoUpdate := true;6466 NeedEcoUpdate := True; 6467 6467 end; 6468 if ( result = eWon) or (result = eBloody) or (result = eExpelled) then6468 if (Result = eWon) or (Result = eBloody) or (Result = eExpelled) then 6469 6469 begin 6470 6470 CityOptimizer_TileBecomesAvailable(ToLoc); 6471 NeedEcoUpdate := true;6471 NeedEcoUpdate := True; 6472 6472 end; 6473 6473 end; … … 6484 6484 end; 6485 6485 end; 6486 if result and rUnitRemoved <> 0 then6486 if Result and rUnitRemoved <> 0 then 6487 6487 begin 6488 6488 CityOptimizer_AfterRemoveUnit; 6489 6489 ListDlg.RemoveUnit; 6490 NeedEcoUpdate := true;6490 NeedEcoUpdate := True; 6491 6491 end; 6492 6492 if NeedEcoUpdate then 6493 6493 begin 6494 UpdateViews( true);6494 UpdateViews(True); 6495 6495 Update; 6496 6496 end; 6497 6497 end; 6498 6498 6499 if result = eMissionDone then6499 if Result = eMissionDone then 6500 6500 begin 6501 6501 p1 := MyRO.Territory[ToLoc]; … … 6503 6503 smStealMap: 6504 6504 begin 6505 MapValid := false;6505 MapValid := False; 6506 6506 PaintAllMaps 6507 6507 end; … … 6516 6516 CheckToldNoReturn(UnFocus); 6517 6517 6518 NeedRepaintPanel := false;6519 if result >= rExecuted then6518 NeedRepaintPanel := False; 6519 if Result >= rExecuted then 6520 6520 begin 6521 6521 if CityCaptured and (MyMap[ToLoc] and fCity = 0) then 6522 6522 begin // city destroyed 6523 for i:= 0 to nWonder - 1 do { tell about destroyed wonders }6524 if (MyRO.Wonder[ i].CityID = WonderDestroyed) and (MyData.ToldWonders[i].CityID <> WonderDestroyed)6523 for I := 0 to nWonder - 1 do { tell about destroyed wonders } 6524 if (MyRO.Wonder[I].CityID = WonderDestroyed) and (MyData.ToldWonders[I].CityID <> WonderDestroyed) 6525 6525 then 6526 6526 with MessgExDlg do 6527 6527 begin 6528 6528 if WondersDlg.Visible then 6529 WondersDlg.SmartUpdateContent( false);6529 WondersDlg.SmartUpdateContent(False); 6530 6530 OpenSound := 'WONDER_DESTROYED'; 6531 6531 MessgText := Format(Phrases.Lookup('WONDERDEST'), 6532 [Phrases.Lookup('IMPROVEMENTS', i)]);6532 [Phrases.Lookup('IMPROVEMENTS', I)]); 6533 6533 Kind := mkOkHelp; 6534 6534 HelpKind := hkImp; 6535 HelpNo := i;6535 HelpNo := I; 6536 6536 IconKind := mikImp; 6537 IconIndex := i;6537 IconIndex := I; 6538 6538 ShowModal; 6539 MyData.ToldWonders[ i] := MyRO.Wonder[i];6539 MyData.ToldWonders[I] := MyRO.Wonder[I]; 6540 6540 end; 6541 6541 end; … … 6543 6543 begin // city captured 6544 6544 ListDlg.AddCity; 6545 for i:= 0 to nWonder - 1 do { tell about capture of wonders }6546 if MyRO.City[MyRO.nCity - 1].Built[ i] > 0 then6545 for I := 0 to nWonder - 1 do { tell about capture of wonders } 6546 if MyRO.City[MyRO.nCity - 1].Built[I] > 0 then 6547 6547 with MessgExDlg do 6548 6548 begin 6549 6549 if WondersDlg.Visible then 6550 WondersDlg.SmartUpdateContent( false);6550 WondersDlg.SmartUpdateContent(False); 6551 6551 OpenSound := 'WONDER_CAPTURED'; 6552 MessgText := Format(Tribe[ me].TPhrase('WONDERCAPTOWN'),6553 [Phrases.Lookup('IMPROVEMENTS', i)]);6552 MessgText := Format(Tribe[Me].TPhrase('WONDERCAPTOWN'), 6553 [Phrases.Lookup('IMPROVEMENTS', I)]); 6554 6554 Kind := mkOkHelp; 6555 6555 HelpKind := hkImp; 6556 HelpNo := i;6556 HelpNo := I; 6557 6557 IconKind := mikImp; 6558 IconIndex := i;6558 IconIndex := I; 6559 6559 ShowModal; 6560 MyData.ToldWonders[ i] := MyRO.Wonder[i];6560 MyData.ToldWonders[I] := MyRO.Wonder[I]; 6561 6561 end; 6562 6562 … … 6564 6564 begin { Temple of Zeus -- choose advance to steal } 6565 6565 ModalSelectDlg.ShowNewContent(wmModal, kStealTech); 6566 Server(sStealTech, me, ModalSelectDlg.result, nil^);6566 Server(sStealTech, Me, ModalSelectDlg.Result, nil^); 6567 6567 end; 6568 6568 TellNewModels; … … 6570 6570 cix := MyRO.nCity - 1; 6571 6571 while (cix >= 0) and (MyCity[cix].Loc <> ToLoc) do 6572 dec(cix);6573 assert(cix >= 0);6572 Dec(cix); 6573 Assert(cix >= 0); 6574 6574 MyCity[cix].Status := MyCity[cix].Status and not csResourceWeightsMask or 6575 6575 (3 shl 4); 6576 6576 // captured city, set to maximum growth 6577 6577 NewTiles := 1 shl 13; { exploit central tile only } 6578 Server(sSetCityTiles, me, cix, NewTiles);6578 Server(sSetCityTiles, Me, cix, NewTiles); 6579 6579 end 6580 6580 else 6581 NeedRepaintPanel := true;6581 NeedRepaintPanel := True; 6582 6582 end; 6583 6583 TellNewContacts; … … 6593 6593 if Options and (muAutoNoWait or muAutoNext) <> 0 then 6594 6594 begin 6595 if (UnFocus >= 0) and (( result = eNoTime_Move) or UnitExhausted(UnFocus) or6595 if (UnFocus >= 0) and ((Result = eNoTime_Move) or UnitExhausted(UnFocus) or 6596 6596 (MyUn[UnFocus].Master >= 0) or (MyModel[MyUn[UnFocus].mix].Domain = dAir) 6597 6597 and ((MyMap[MyUn[UnFocus].Loc] and fCity <> 0) … … 6607 6607 end 6608 6608 else 6609 NextUnit(UnStartLoc, true);6609 NextUnit(UnStartLoc, True); 6610 6610 end 6611 6611 else if (UnFocus < 0) and (Options and muAutoNext <> 0) then 6612 NextUnit(UnStartLoc, result <> eMissionDone);6612 NextUnit(UnStartLoc, Result <> eMissionDone); 6613 6613 end; 6614 6614 … … 6618 6618 else 6619 6619 begin 6620 assert(result <> eMissionDone);6620 Assert(Result <> eMissionDone); 6621 6621 CheckTerrainBtnVisible; 6622 6622 FocusOnLoc(ToLoc, flRepaintPanel or flImmUpdate); 6623 6623 end; 6624 6624 6625 if ( result >= rExecuted) and CityCaptured and (MyMap[ToLoc] and fCity <> 0)6625 if (Result >= rExecuted) and CityCaptured and (MyMap[ToLoc] and fCity <> 0) 6626 6626 then 6627 6627 ZoomToCity(ToLoc, UnFocus < 0, chCaptured); // show captured city … … 6629 6629 6630 6630 procedure TMainScreen.MoveOnScreen(ShowMove: TShowMove; 6631 Step0, Step1, nStep: integer; Restore: boolean = true);6631 Step0, Step1, nStep: Integer; Restore: Boolean = True); 6632 6632 var 6633 6633 ToLoc, xFromLoc, yFromLoc, xToLoc, yToLoc, xFrom, yFrom, xTo, yTo, xMin, yMin, 6634 xRange, yRange, xw1, Step, xMoving, yMoving, SliceCount: integer;6634 xRange, yRange, xw1, Step, xMoving, yMoving, SliceCount: Integer; 6635 6635 UnitInfo: TUnitInfo; 6636 6636 Ticks0, Ticks: TDateTime; 6637 6637 begin 6638 Timer1.Enabled := false;6638 Timer1.Enabled := False; 6639 6639 Ticks0 := NowPrecise; 6640 6640 with ShowMove do … … 6645 6645 UnitInfo.Job := jNone; 6646 6646 UnitInfo.Flags := Flags; 6647 if Owner <> me then6647 if Owner <> Me then 6648 6648 UnitInfo.emix := emix; 6649 6649 … … 6664 6664 * xxt - MapWidth) < abs(((xFromLoc - xw1) * 2 + yFromLoc and 1 + 1) * xxt 6665 6665 * 2 + dx * xxt - MapWidth) do 6666 dec(xw1, G.lx);6666 Dec(xw1, G.lx); 6667 6667 6668 6668 xTo := (xToLoc - xw1) * (xxt * 2) + yToLoc and 1 * xxt + (xxt - xxu); … … 6684 6684 yRange := yFrom - yTo; 6685 6685 end; 6686 inc(xRange, xxt * 2);6687 inc(yRange, yyt * 3);6686 Inc(xRange, xxt * 2); 6687 Inc(yRange, yyt * 3); 6688 6688 end; 6689 6689 … … 6694 6694 begin 6695 6695 BitBltCanvas(Buffer.Canvas, 0, 0, xRange, yRange, 6696 offscreen.Canvas, xMin, yMin);6696 Offscreen.Canvas, xMin, yMin); 6697 6697 if Step1 <> Step0 then 6698 6698 begin … … 6723 6723 < MoveTime) then 6724 6724 begin 6725 if not idle or (GameMode = cMovie) then6725 if not Idle or (GameMode = cMovie) then 6726 6726 Application.ProcessMessages; 6727 6727 Sleep(1); 6728 inc(SliceCount)6728 Inc(SliceCount) 6729 6729 end; 6730 6730 Ticks := NowPrecise; … … 6735 6735 if Restore then 6736 6736 begin 6737 BitBltCanvas(Buffer.Canvas, 0, 0, xRange, yRange, offscreen.Canvas, xMin, yMin);6737 BitBltCanvas(Buffer.Canvas, 0, 0, xRange, yRange, Offscreen.Canvas, xMin, yMin); 6738 6738 PaintBufferToScreen(xMin, yMin, xRange, yRange); 6739 6739 end; 6740 6740 BlinkTime := -1; 6741 Timer1.Enabled := true;6742 end; 6743 6744 procedure TMainScreen.MoveToLoc(Loc: integer; CheckSuicide: boolean);6741 Timer1.Enabled := True; 6742 end; 6743 6744 procedure TMainScreen.MoveToLoc(Loc: Integer; CheckSuicide: Boolean); 6745 6745 // path finder: move focused unit to loc, start multi-turn goto if too far 6746 6746 var 6747 uix, i, MoveOptions, NextLoc, MoveResult: integer;6747 uix, I, MoveOptions, NextLoc, MoveResult: Integer; 6748 6748 MoveAdviceData: TMoveAdviceData; 6749 6749 StopReason: (None, Arrived, Dead, NoTime, EnemySpotted, MoveError); 6750 6750 begin 6751 6751 if MyUn[UnFocus].Job > jNone then 6752 Server(sStartJob + jNone shl 4, me, UnFocus, nil^);6752 Server(sStartJob + jNone shl 4, Me, UnFocus, nil^); 6753 6753 if GetMoveAdvice(UnFocus, Loc, MoveAdviceData) >= rExecuted then 6754 6754 begin … … 6756 6756 StopReason := None; 6757 6757 repeat 6758 for i:= 0 to MoveAdviceData.nStep - 1 do6759 begin 6760 if i= MoveAdviceData.nStep - 1 then6758 for I := 0 to MoveAdviceData.nStep - 1 do 6759 begin 6760 if I = MoveAdviceData.nStep - 1 then 6761 6761 MoveOptions := muAutoNext 6762 6762 else 6763 6763 MoveOptions := 0; 6764 NextLoc := dLoc(MyUn[uix].Loc, MoveAdviceData.dx[ i],6765 MoveAdviceData.dy[ i]);6764 NextLoc := dLoc(MyUn[uix].Loc, MoveAdviceData.dx[I], 6765 MoveAdviceData.dy[I]); 6766 6766 if (NextLoc = Loc) or (Loc = maNextCity) and 6767 6767 (MyMap[NextLoc] and fCity <> 0) then … … 6769 6769 if not CheckSuicide and (NextLoc = Loc) then 6770 6770 MoveOptions := MoveOptions or muNoSuicideCheck; 6771 MoveResult := MoveUnit(MoveAdviceData.dx[ i], MoveAdviceData.dy[i],6771 MoveResult := MoveUnit(MoveAdviceData.dx[I], MoveAdviceData.dy[I], 6772 6772 MoveOptions); 6773 6773 if MoveResult < rExecuted then … … 6781 6781 end; 6782 6782 if (StopReason = None) and ((MoveAdviceData.nStep < 25) or 6783 (MyRO.Wonder[woShinkansen].EffectiveOwner <> me)) then6783 (MyRO.Wonder[woShinkansen].EffectiveOwner <> Me)) then 6784 6784 StopReason := NoTime; 6785 6785 if StopReason <> None then … … 6787 6787 if GetMoveAdvice(UnFocus, Loc, MoveAdviceData) < rExecuted then 6788 6788 begin 6789 assert(false);6789 Assert(False); 6790 6790 Break; 6791 6791 end; 6792 until false;6792 until False; 6793 6793 6794 6794 case StopReason of 6795 6795 None: 6796 assert(false);6796 Assert(False); 6797 6797 Arrived: 6798 6798 MyUn[uix].Status := MyUn[uix].Status and ($FFFF - usGoto); 6799 6799 Dead: 6800 6800 if UnFocus < 0 then 6801 NextUnit(UnStartLoc, false);6801 NextUnit(UnStartLoc, False); 6802 6802 else 6803 6803 begin // multi-turn goto … … 6812 6812 begin 6813 6813 MyUn[uix].Status := MyUn[uix].Status and not usWaiting; 6814 NextUnit(UnStartLoc, true);6814 NextUnit(UnStartLoc, True); 6815 6815 end; 6816 6816 end; … … 6820 6820 6821 6821 procedure TMainScreen.PanelBoxMouseDown(Sender: TObject; Button: TMouseButton; 6822 Shift: TShiftState; x, y: integer);6822 Shift: TShiftState; X, Y: Integer); 6823 6823 var 6824 i, xMouse, MouseLoc, p1: integer;6824 I, xMouse, MouseLoc, p1: Integer; 6825 6825 begin 6826 6826 if GameMode = cMovie then 6827 exit;6827 Exit; 6828 6828 6829 6829 if Button = mbLeft then 6830 6830 begin 6831 if ( x >= xMini + 2) and (y >= yMini + 2) and (x< xMini + 2 + 2 * G.lx) and6832 ( y< yMini + 2 + G.ly) then6831 if (X >= xMini + 2) and (Y >= yMini + 2) and (X < xMini + 2 + 2 * G.lx) and 6832 (Y < yMini + 2 + G.ly) then 6833 6833 if ssShift in Shift then 6834 6834 begin 6835 6835 with MainMap do 6836 xMouse := (xwMini + ( x- (xMini + 2) + MapWidth div (xxt * 2) + G.lx)6836 xMouse := (xwMini + (X - (xMini + 2) + MapWidth div (xxt * 2) + G.lx) 6837 6837 div 2) mod G.lx; 6838 MouseLoc := xMouse + G.lx * ( y- (yMini + 2));6838 MouseLoc := xMouse + G.lx * (Y - (yMini + 2)); 6839 6839 if MyMap[MouseLoc] and fTerrain <> fUNKNOWN then 6840 6840 begin 6841 6841 p1 := MyRO.Territory[MouseLoc]; 6842 if (p1 = me) or (p1 >= 0) and (MyRO.Treaty[p1] >= trNone) then6842 if (p1 = Me) or (p1 >= 0) and (MyRO.Treaty[p1] >= trNone) then 6843 6843 NatStatDlg.ShowNewContent(wmPersistent, p1); 6844 6844 end; … … 6850 6850 if UnitStatDlg.Visible then 6851 6851 UnitStatDlg.Close; 6852 Tracking := true;6853 PanelBoxMouseMove(Sender, Shift + [ssLeft], x, y);6852 Tracking := True; 6853 PanelBoxMouseMove(Sender, Shift + [ssLeft], X, Y); 6854 6854 end 6855 else if (ClientMode <> cEditMap) and ( x>= ClientWidth - xPalace) and6856 ( y >= yPalace) and (x< ClientWidth - xPalace + xSizeBig) and6857 ( y< yPalace + ySizeBig) then6855 else if (ClientMode <> cEditMap) and (X >= ClientWidth - xPalace) and 6856 (Y >= yPalace) and (X < ClientWidth - xPalace + xSizeBig) and 6857 (Y < yPalace + ySizeBig) then 6858 6858 begin 6859 6859 InitPopup(StatPopup); … … 6866 6866 GetSystemMetrics(SM_CYCAPTION) + 3) 6867 6867 end 6868 (* else if ( x>=xAdvisor-3) and (y>=yAdvisor-3)6869 and ( x<xAdvisor+16+3) and (y<yAdvisor+16+3) and HaveStrategyAdvice then6868 (* else if (X>=xAdvisor-3) and (Y>=yAdvisor-3) 6869 and (X<xAdvisor+16+3) and (Y<yAdvisor+16+3) and HaveStrategyAdvice then 6870 6870 AdviceBtnClick *) 6871 else if ( x >= xTroop + 1) and (y>= yTroop + 1) and6872 ( x < xTroop + TrRow * TrPitch) and (y<= yTroop + 55) then6873 begin 6874 i := (x- xTroop - 1) div TrPitch;6875 if trix[ i] >= 0 then6871 else if (X >= xTroop + 1) and (Y >= yTroop + 1) and 6872 (X < xTroop + TrRow * TrPitch) and (Y <= yTroop + 55) then 6873 begin 6874 I := (X - xTroop - 1) div TrPitch; 6875 if trix[I] >= 0 then 6876 6876 if ClientMode = cEditMap then 6877 6877 begin 6878 BrushType := trix[ i];6878 BrushType := trix[I]; 6879 6879 PanelPaint 6880 6880 end … … 6884 6884 if ssShift in Shift then 6885 6885 UnitStatDlg.ShowNewContent_OwnModel(wmPersistent, 6886 MyUn[trix[ i]].mix)6887 else if not supervising and (ClientMode < scContact) and6888 ( x - xTroop - 1 - i * TrPitch >= 60 - 20) and (y>= yTroop + 35)6889 and ((MyUn[trix[ i]].Job > jNone) or (MyUn[trix[i]].Status and6886 MyUn[trix[I]].mix) 6887 else if not Supervising and (ClientMode < scContact) and 6888 (X - xTroop - 1 - I * TrPitch >= 60 - 20) and (Y >= yTroop + 35) 6889 and ((MyUn[trix[I]].Job > jNone) or (MyUn[trix[I]].Status and 6890 6890 (usStay or usRecover or usGoto) <> 0)) then 6891 6891 begin // wake up 6892 MyUn[trix[ i]].Status := MyUn[trix[i]].Status and6892 MyUn[trix[I]].Status := MyUn[trix[I]].Status and 6893 6893 ($FFFF - usStay - usRecover - usGoto - usEnhance) or usWaiting; 6894 if MyUn[trix[ i]].Job > jNone then6895 Server(sStartJob + jNone shl 4, me, trix[i], nil^);6894 if MyUn[trix[I]].Job > jNone then 6895 Server(sStartJob + jNone shl 4, Me, trix[I], nil^); 6896 6896 if (UnFocus < 0) and not CityDlg.Visible then 6897 6897 begin 6898 SetUnFocus(trix[ i]);6899 SetTroopLoc(MyUn[trix[ i]].Loc);6898 SetUnFocus(trix[I]); 6899 SetTroopLoc(MyUn[trix[I]].Loc); 6900 6900 FocusOnLoc(TroopLoc, flRepaintPanel) 6901 6901 end … … 6903 6903 begin 6904 6904 if CityDlg.Visible and (CityDlg.RestoreUnFocus < 0) then 6905 CityDlg.RestoreUnFocus := trix[ i];6905 CityDlg.RestoreUnFocus := trix[I]; 6906 6906 PanelPaint; 6907 6907 end … … 6909 6909 else if (ClientMode < scContact) then 6910 6910 begin 6911 if supervising then6912 UnitStatDlg.ShowNewContent_OwnUnit(wmPersistent, trix[ i])6911 if Supervising then 6912 UnitStatDlg.ShowNewContent_OwnUnit(wmPersistent, trix[I]) 6913 6913 else if CityDlg.Visible then 6914 6914 begin … … 6916 6916 CityDlg.Close; 6917 6917 SumCities(TaxSum, ScienceSum); 6918 SetUnFocus(trix[ i]);6918 SetUnFocus(trix[I]); 6919 6919 end 6920 6920 else 6921 6921 begin 6922 DestinationMarkON := false;6922 DestinationMarkON := False; 6923 6923 PaintDestination; 6924 UnFocus := trix[ i];6924 UnFocus := trix[I]; 6925 6925 UnStartLoc := TroopLoc; 6926 6926 BlinkTime := 0; 6927 BlinkON := false;6927 BlinkON := False; 6928 6928 PaintLoc(TroopLoc); 6929 6929 end; 6930 6930 if UnFocus >= 0 then 6931 6931 begin 6932 UnitInfoBtn.Visible := true;6933 UnitBtn.Visible := true;6934 TurnComplete := false;6932 UnitInfoBtn.Visible := True; 6933 UnitBtn.Visible := True; 6934 TurnComplete := False; 6935 6935 EOT.ButtonIndex := eotGray; 6936 6936 end; … … 6939 6939 end; 6940 6940 end 6941 else if Server(sGetUnits, me, TroopLoc, TrCnt) >= rExecuted then6941 else if Server(sGetUnits, Me, TroopLoc, TrCnt) >= rExecuted then 6942 6942 if ssShift in Shift then 6943 6943 UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, 6944 MyRO.EnemyUn[MyRO.nEnemyUn + trix[ i]].emix) // model info6944 MyRO.EnemyUn[MyRO.nEnemyUn + trix[I]].emix) // model info 6945 6945 else 6946 6946 UnitStatDlg.ShowNewContent_EnemyUnit(wmPersistent, 6947 MyRO.nEnemyUn + trix[ i]); // unit info6948 end; 6949 end; 6950 end; 6951 6952 procedure TMainScreen.SetTroopLoc(Loc: integer);6947 MyRO.nEnemyUn + trix[I]); // unit info 6948 end; 6949 end; 6950 end; 6951 6952 procedure TMainScreen.SetTroopLoc(Loc: Integer); 6953 6953 var 6954 trixFocus, uix, uixDefender: integer;6955 Prio: boolean;6954 trixFocus, uix, uixDefender: Integer; 6955 Prio: Boolean; 6956 6956 begin 6957 6957 TroopLoc := Loc; … … 6965 6965 if MyMap[Loc] and fOwned <> 0 then 6966 6966 begin // count own units here 6967 Server(sGetDefender, me, TroopLoc, uixDefender);6968 for Prio := true downto false do6967 Server(sGetDefender, Me, TroopLoc, uixDefender); 6968 for Prio := True downto False do 6969 6969 for uix := 0 to MyRO.nUn - 1 do 6970 6970 if ((uix = uixDefender) = Prio) and (MyUn[uix].Loc = Loc) then … … 6972 6972 if uix = UnFocus then 6973 6973 trixFocus := TrCnt; 6974 inc(TrCnt);6974 Inc(TrCnt); 6975 6975 end; 6976 6976 end 6977 6977 else // count enemy units here 6978 Server(sGetUnits, me, Loc, TrCnt);6978 Server(sGetUnits, Me, Loc, TrCnt); 6979 6979 if TrCnt = 0 then 6980 6980 sb.Init(0, 1) … … 6987 6987 end; 6988 6988 6989 (* procedure TMainScreen.ShowMoveHint(ToLoc: integer; Force: boolean = false);6989 (* procedure TMainScreen.ShowMoveHint(ToLoc: Integer; Force: Boolean = False); 6990 6990 var 6991 Step,Loc,x0,y0,xs,ys: integer;6991 Step,Loc,x0,y0,xs,ys: Integer; 6992 6992 Info: string; 6993 6993 InfoSize: TSize; … … 7002 7002 MoveAdvice.MoreTurns:=0; 7003 7003 MoveAdvice.MaxHostile_MovementLeft:=MyUn[UnFocus].Health-50; 7004 if Server(sGetMoveAdvice, me,UnFocus,MoveAdvice)<rExecuted then7004 if Server(sGetMoveAdvice,Me,UnFocus,MoveAdvice)<rExecuted then 7005 7005 ToLoc:=-1 7006 7006 end; 7007 if (ToLoc=MoveHintToLoc) and not Force then exit;7007 if (ToLoc=MoveHintToLoc) and not Force then Exit; 7008 7008 if (ToLoc<>MoveHintToLoc) and (MoveHintToLoc>=0) then 7009 7009 begin invalidate; update end; // clear old hint from screen 7010 7010 MoveHintToLoc:=ToLoc; 7011 if ToLoc<0 then exit;7012 7013 with canvas do7011 if ToLoc<0 then Exit; 7012 7013 with Canvas do 7014 7014 begin 7015 7015 Pen.Color:=$80C0FF; … … 7022 7022 xs:=(x0-xw)*66+y0 and 1*33-G.lx*66; 7023 7023 while abs(2*(xs+G.lx*66)-MapWidth)<abs(2*xs-MapWidth) do 7024 inc(xs,G.lx*66);7024 Inc(xs,G.lx*66); 7025 7025 ys:=(y0-yw)*16; 7026 7026 if Step=0 then moveto(xs+33,ys+16) … … 7030 7030 end; 7031 7031 Brush.Color:=$80C0FF; 7032 Info:=' '+ inttostr(88)+' ';7032 Info:=' '+IntToStr(88)+' '; 7033 7033 InfoSize:=TextExtent(Info); 7034 7034 TextOut(xs+33-InfoSize.cx div 2, ys+16-InfoSize.cy div 2, Info); … … 7037 7037 end; *) 7038 7038 7039 procedure TMainScreen.SetDebugMap( p: integer);7040 begin 7041 MainMap.pDebugMap := p;7039 procedure TMainScreen.SetDebugMap(P: Integer); 7040 begin 7041 MainMap.pDebugMap := P; 7042 7042 MapOptions := MapOptions - [moLocCodes]; 7043 mLocCodes.Checked := false;7044 MapValid := false;7043 mLocCodes.Checked := False; 7044 MapValid := False; 7045 7045 MainOffscreenPaint; 7046 7046 end; 7047 7047 7048 procedure TMainScreen.SetViewpoint( p: integer);7048 procedure TMainScreen.SetViewpoint(P: Integer); 7049 7049 var 7050 i: Integer;7051 begin 7052 if supervising and (G.RO[0].Turn > 0) and7053 (( p = 0) or (1 shl pand G.RO[0].Alive <> 0)) then7050 I: Integer; 7051 begin 7052 if Supervising and (G.RO[0].Turn > 0) and 7053 ((P = 0) or (1 shl P and G.RO[0].Alive <> 0)) then 7054 7054 begin 7055 7055 ApplyToVisibleForms(faClose); 7056 ItsMeAgain( p);7056 ItsMeAgain(P); 7057 7057 SumCities(TaxSum, ScienceSum); 7058 for i:= 0 to MyRO.nModel - 1 do7059 if not Assigned(Tribe[ me].ModelPicture[i].HGr) then7060 InitMyModel( i, True);7058 for I := 0 to MyRO.nModel - 1 do 7059 if not Assigned(Tribe[Me].ModelPicture[I].HGr) then 7060 InitMyModel(I, True); 7061 7061 7062 7062 SetTroopLoc(-1); … … 7146 7146 end; 7147 7147 7148 procedure TMainScreen.FormKeyDown(Sender: TObject; var Key: word;7148 procedure TMainScreen.FormKeyDown(Sender: TObject; var Key: Word; 7149 7149 Shift: TShiftState); 7150 7150 … … 7156 7156 end; 7157 7157 7158 procedure SetViewpointMe( p: Integer);7159 begin 7160 if p = me then SetViewpoint(p)7161 else SetViewpoint( p);7158 procedure SetViewpointMe(P: Integer); 7159 begin 7160 if P = Me then SetViewpoint(P) 7161 else SetViewpoint(P); 7162 7162 end; 7163 7163 … … 7195 7195 'A': 7196 7196 begin // auto symmetry 7197 Server($7F0, me,0,nil^);7198 MapValid:= false;7197 Server($7F0,Me,0,nil^); 7198 MapValid:=False; 7199 7199 PaintAll; 7200 7200 end; … … 7203 7203 dy:=0; 7204 7204 for dx:=G.lx to G.lx*(G.ly-1)-1 do 7205 if MyMap[dx] and fTerrain>=fGrass then inc(dy);7205 if MyMap[dx] and fTerrain>=fGrass then Inc(dy); 7206 7206 dy:=dy 7207 7207 end; … … 7330 7330 function TMainScreen.DoJob(j0: Integer): Integer; 7331 7331 var 7332 Loc0, Movement0: integer;7332 Loc0, Movement0: Integer; 7333 7333 begin 7334 7334 with MyUn[UnFocus] do 7335 7335 begin 7336 DestinationMarkON := false;7336 DestinationMarkON := False; 7337 7337 PaintDestination; 7338 7338 Loc0 := Loc; 7339 7339 Movement0 := Movement; 7340 7340 if j0 < 0 then 7341 result := ProcessEnhancement(UnFocus, MyData.EnhancementJobs)7341 Result := ProcessEnhancement(UnFocus, MyData.EnhancementJobs) 7342 7342 // terrain enhancement 7343 7343 else 7344 result := Server(sStartJob + j0 shl 4, me, UnFocus, nil^);7345 if result >= rExecuted then7346 begin 7347 if result = eDied then7344 Result := Server(sStartJob + j0 shl 4, Me, UnFocus, nil^); 7345 if Result >= rExecuted then 7346 begin 7347 if Result = eDied then 7348 7348 UnFocus := -1; 7349 7349 PaintLoc(Loc0); 7350 7350 if UnFocus >= 0 then 7351 7351 begin 7352 if (j0 < 0) and ( result <> eJobDone) then7352 if (j0 < 0) and (Result <> eJobDone) then 7353 7353 // multi-turn terrain enhancement 7354 7354 Status := Status and ($FFFF - usStay - usRecover - usGoto) or … … 7360 7360 begin 7361 7361 Status := Status and not usWaiting; 7362 NextUnit(UnStartLoc, true);7362 NextUnit(UnStartLoc, True); 7363 7363 end 7364 7364 else … … 7366 7366 end 7367 7367 else 7368 NextUnit(UnStartLoc, true);7369 end; 7370 end; 7371 case result of7368 NextUnit(UnStartLoc, True); 7369 end; 7370 end; 7371 case Result of 7372 7372 eNoBridgeBuilding: 7373 7373 SoundMessage(Phrases.Lookup('NOBB'), 'INVALID'); … … 7378 7378 'NOMOVE_TREATY'); 7379 7379 else 7380 if result < rExecuted then7380 if Result < rExecuted then 7381 7381 Play('INVALID'); 7382 7382 end; … … 7390 7390 with TUn(MyUn[UnFocus]) do begin 7391 7391 if (Sender = mUtilize) and 7392 not(Server(sRemoveUnit - sExecute, me, UnFocus, nil^) = eUtilized) then7392 not(Server(sRemoveUnit - sExecute, Me, UnFocus, nil^) = eUtilized) then 7393 7393 begin 7394 7394 SimpleMessage(Phrases2.Lookup('SHIP_UTILIZE')); 7395 7395 // freight for colony ship is the only case in which the command is 7396 7396 // available to player though not valid 7397 exit;7397 Exit; 7398 7398 end; 7399 7399 if (Sender = mUtilize) and (Health < 100) then 7400 7400 if SimpleQuery(mkYesNo, Phrases.Lookup('DAMAGED_UTILIZE'), '') <> mrOK 7401 7401 then 7402 exit;7402 Exit; 7403 7403 Loc0 := Loc; 7404 7404 CityOptimizer_BeforeRemoveUnit(UnFocus); 7405 if Server(sRemoveUnit, me, UnFocus, nil^) = eUtilized then7405 if Server(sRemoveUnit, Me, UnFocus, nil^) = eUtilized then 7406 7406 Play('CITY_UTILIZE') 7407 7407 else … … 7409 7409 CityOptimizer_AfterRemoveUnit; 7410 7410 SetTroopLoc(Loc0); 7411 UpdateViews( true);7412 DestinationMarkON := false;7411 UpdateViews(True); 7412 DestinationMarkON := False; 7413 7413 PaintDestination; 7414 7414 UnFocus := -1; 7415 7415 PaintLoc(Loc0); 7416 NextUnit(UnStartLoc, true);7416 NextUnit(UnStartLoc, True); 7417 7417 end; 7418 7418 end; … … 7420 7420 procedure TMainScreen.InitPopup(Popup: TPopupMenu); 7421 7421 var 7422 i, p1, Tile, Test: integer;7423 NoSuper, extended, Multi, NeedSep, HaveCities: boolean;7424 LastSep, m: TMenuItem;7422 I, p1, Tile, Test: Integer; 7423 NoSuper, Extended, Multi, NeedSep, HaveCities: Boolean; 7424 LastSep, M: TMenuItem; 7425 7425 mox: ^TModel; 7426 7426 begin 7427 NoSuper := not supervising and (1 shl me and MyRO.Alive <> 0);7428 HaveCities := false;7429 for i:= 0 to MyRO.nCity - 1 do7430 if MyCity[ i].Loc >= 0 then7431 begin 7432 HaveCities := true;7427 NoSuper := not Supervising and (1 shl Me and MyRO.Alive <> 0); 7428 HaveCities := False; 7429 for I := 0 to MyRO.nCity - 1 do 7430 if MyCity[I].Loc >= 0 then 7431 begin 7432 HaveCities := True; 7433 7433 Break; 7434 7434 end; … … 7436 7436 begin 7437 7437 mTechTree.Visible := ClientMode <> cEditMap; 7438 mResign.Enabled := supervising or (me = 0) and (ClientMode < scContact);7438 mResign.Enabled := Supervising or (Me = 0) and (ClientMode < scContact); 7439 7439 mRandomMap.Visible := (ClientMode = cEditMap) and 7440 (Server(sMapGeneratorRequest, me, 0, nil^) = eOK);7440 (Server(sMapGeneratorRequest, Me, 0, nil^) = eOK); 7441 7441 mOptions.Visible := ClientMode <> cEditMap; 7442 7442 mManip.Visible := ClientMode <> cEditMap; … … 7452 7452 case SoundMode of 7453 7453 smOff: 7454 mSoundOff.Checked := true;7454 mSoundOff.Checked := True; 7455 7455 smOn: 7456 mSoundOn.Checked := true;7456 mSoundOn.Checked := True; 7457 7457 smOnAlt: 7458 mSoundOnAlt.Checked := true;7459 end; 7460 7461 for i:= 0 to nTestFlags - 1 do7462 mManip[ i].Checked := MyRO.TestFlags and (1 shl i) <> 0;7463 mManip.Enabled := supervising or (me = 0);7464 7465 Multi := false;7458 mSoundOnAlt.Checked := True; 7459 end; 7460 7461 for I := 0 to nTestFlags - 1 do 7462 mManip[I].Checked := MyRO.TestFlags and (1 shl I) <> 0; 7463 mManip.Enabled := Supervising or (Me = 0); 7464 7465 Multi := False; 7466 7466 for p1 := 1 to nPl - 1 do 7467 7467 if G.RO[p1] <> nil then 7468 Multi := true;7468 Multi := True; 7469 7469 mEnemyMovement.Visible := not Multi; 7470 7470 end; … … 7472 7472 if NoSuper and (ClientMode < scContact) then 7473 7473 begin 7474 mCityTypes.Enabled := false;7474 mCityTypes.Enabled := False; 7475 7475 // check if city types already usefull: 7476 7476 if MyRO.nCity > 0 then 7477 for i:= nWonder to nImp - 1 do7478 if ( i <> imTrGoods) and (Imp[i].Kind = ikCommon) and7479 (Imp[ i].Preq <> preNA) and7480 ((Imp[ i].Preq = preNone) or (MyRO.Tech[Imp[i].Preq] >= tsApplicable))7477 for I := nWonder to nImp - 1 do 7478 if (I <> imTrGoods) and (Imp[I].Kind = ikCommon) and 7479 (Imp[I].Preq <> preNA) and 7480 ((Imp[I].Preq = preNone) or (MyRO.Tech[Imp[I].Preq] >= tsApplicable)) 7481 7481 then 7482 7482 begin 7483 mCityTypes.Enabled := true;7483 mCityTypes.Enabled := True; 7484 7484 Break 7485 7485 end; 7486 7486 end; 7487 mViewpoint.Visible := (ClientMode <> cEditMap) and supervising;7487 mViewpoint.Visible := (ClientMode <> cEditMap) and Supervising; 7488 7488 mViewpoint.Enabled := G.RO[0].Turn > 0; 7489 if supervising then7489 if Supervising then 7490 7490 begin 7491 7491 EmptyMenu(mViewpoint); … … 7493 7493 if (p1 = 0) or (1 shl p1 and G.RO[0].Alive <> 0) then 7494 7494 begin 7495 m:= TMenuItem.Create(mViewpoint);7495 M := TMenuItem.Create(mViewpoint); 7496 7496 if p1 = 0 then 7497 m.Caption := Phrases.Lookup('SUPER')7497 M.Caption := Phrases.Lookup('SUPER') 7498 7498 else 7499 m.Caption := Tribe[p1].TString(Phrases2.Lookup('BELONG'));7500 m.Tag := p1;7501 m.OnClick := ViewpointClick;7499 M.Caption := Tribe[p1].TString(Phrases2.Lookup('BELONG')); 7500 M.Tag := p1; 7501 M.OnClick := ViewpointClick; 7502 7502 if p1 < 10 then 7503 m.ShortCut := ShortCut(48 + p1, [ssCtrl]);7504 m.RadioItem := true;7505 if p1 = me then7506 m.Checked := true;7507 mViewpoint.Add( m);7503 M.ShortCut := ShortCut(48 + p1, [ssCtrl]); 7504 M.RadioItem := True; 7505 if p1 = Me then 7506 M.Checked := True; 7507 mViewpoint.Add(M); 7508 7508 end 7509 7509 end; 7510 mDebugMap.Visible := (ClientMode <> cEditMap) and supervising;7511 if supervising then7510 mDebugMap.Visible := (ClientMode <> cEditMap) and Supervising; 7511 if Supervising then 7512 7512 begin 7513 7513 EmptyMenu(mDebugMap); … … 7515 7515 if (p1 = 0) or (1 shl p1 and G.RO[0].Alive <> 0) then 7516 7516 begin 7517 m:= TMenuItem.Create(mDebugMap);7517 M := TMenuItem.Create(mDebugMap); 7518 7518 if p1 = 0 then 7519 m.Caption := Phrases2.Lookup('MENU_DEBUGMAPOFF')7519 M.Caption := Phrases2.Lookup('MENU_DEBUGMAPOFF') 7520 7520 else 7521 m.Caption := Tribe[p1].TString(Phrases2.Lookup('BELONG'));7521 M.Caption := Tribe[p1].TString(Phrases2.Lookup('BELONG')); 7522 7522 if p1 = 0 then 7523 m.Tag := -17523 M.Tag := -1 7524 7524 else 7525 m.Tag := p1;7526 m.OnClick := DebugMapClick;7525 M.Tag := p1; 7526 M.OnClick := DebugMapClick; 7527 7527 if p1 < 10 then 7528 m.ShortCut := ShortCut(48 + p1, [ssAlt]);7529 m.RadioItem := true;7530 if m.Tag = MainMap.pDebugMap then7531 m.Checked := true;7532 mDebugMap.Add( m);7528 M.ShortCut := ShortCut(48 + p1, [ssAlt]); 7529 M.RadioItem := True; 7530 if M.Tag = MainMap.pDebugMap then 7531 M.Checked := True; 7532 mDebugMap.Add(M); 7533 7533 end; 7534 7534 end; … … 7545 7545 (ClientMode < scContact); 7546 7546 mUnitStat.Enabled := NoSuper or (MyRO.Turn > 0); 7547 mCityStat.Visible := 1 shl me and MyRO.Alive <> 0;7547 mCityStat.Visible := 1 shl Me and MyRO.Alive <> 0; 7548 7548 mCityStat.Enabled := HaveCities; 7549 mScienceStat.Visible := true;7549 mScienceStat.Visible := True; 7550 7550 mScienceStat.Enabled := not NoSuper or (MyRO.ResearchTech >= 0) or 7551 7551 (MyRO.Happened and phTech <> 0) or (MyRO.Happened and phGameEnd <> 0) … … 7554 7554 mEUnitStat.Enabled := MyRO.nEnemyModel > 0; 7555 7555 { mWonders.Enabled:= false; 7556 for i:=0 to nWonder - 1 do if MyRO.Wonder[i].CityID <> WonderNotBuiltYet then7557 mWonders.Enabled:= true; }7556 for I:=0 to nWonder - 1 do if MyRO.Wonder[I].CityID <> WonderNotBuiltYet then 7557 mWonders.Enabled:=True; } 7558 7558 mDiagram.Enabled := MyRO.Turn >= 2; 7559 mShips.Enabled := false;7559 mShips.Enabled := False; 7560 7560 for p1 := 0 to nPl - 1 do 7561 7561 if MyRO.Ship[p1].Parts[spComp] + MyRO.Ship[p1].Parts[spPow] + 7562 7562 MyRO.Ship[p1].Parts[spHab] > 0 then 7563 mShips.Enabled := true;7563 mShips.Enabled := True; 7564 7564 end 7565 7565 else if Popup = UnitPopup then … … 7567 7567 mox := @MyModel[MyUn[UnFocus].mix]; 7568 7568 Tile := MyMap[MyUn[UnFocus].Loc]; 7569 extended := Tile and fCity = 0;7570 if extended then7569 Extended := Tile and fCity = 0; 7570 if Extended then 7571 7571 begin 7572 7572 mCity.Caption := Phrases.Lookup('BTN_FOUND'); … … 7579 7579 end; 7580 7580 7581 extended := extended and ((mox.Kind = mkSettler) or (mox.Kind = mkSlaves)7581 Extended := Extended and ((mox.Kind = mkSettler) or (mox.Kind = mkSlaves) 7582 7582 and (MyRO.Wonder[woPyramids].EffectiveOwner >= 0)) and 7583 7583 (MyUn[UnFocus].Master < 0) and (Tile and fDeadLands = 0); 7584 7584 if (mox.Kind = mkFreight) and (Tile and fCity <> 0) and 7585 7585 not Phrases2FallenBackToEnglish or 7586 (Server(sRemoveUnit - sExecute, me, UnFocus, nil^) = eUtilized) then7587 begin 7588 mDisband.Visible := false;7589 mUtilize.Visible := true;7586 (Server(sRemoveUnit - sExecute, Me, UnFocus, nil^) = eUtilized) then 7587 begin 7588 mDisband.Visible := False; 7589 mUtilize.Visible := True; 7590 7590 if mox.Kind = mkFreight then 7591 7591 mUtilize.Caption := Phrases.Lookup('UTILIZE') … … 7595 7595 else 7596 7596 begin 7597 mDisband.Visible := true;7598 mUtilize.Visible := false7597 mDisband.Visible := True; 7598 mUtilize.Visible := False 7599 7599 end; 7600 7600 mGoOn.Visible := MyUn[UnFocus].Status and (usGoto or usWaiting) = usGoto or … … 7603 7603 mRecover.Visible := (MyUn[UnFocus].Health < 100) and 7604 7604 (Tile and fTerrain >= fGrass) and 7605 ((MyRO.Wonder[woGardens].EffectiveOwner = me) or7605 ((MyRO.Wonder[woGardens].EffectiveOwner = Me) or 7606 7606 (Tile and fTerrain <> fArctic) and (Tile and fTerrain <> fDesert)) and 7607 7607 not((mox.Domain = dAir) and (Tile and fCity = 0) and … … 7609 7609 mStay.Visible := not((mox.Domain = dAir) and (Tile and fCity = 0) and 7610 7610 (Tile and fTerImp <> tiBase)); 7611 mCity.Visible := extended and (mox.Kind = mkSettler) or7611 mCity.Visible := Extended and (mox.Kind = mkSettler) or 7612 7612 (Tile and fCity <> 0) and ((mox.Kind in [mkSettler, mkSlaves]) or 7613 7613 (MyUn[UnFocus].Flags and unConscripts <> 0)); … … 7617 7617 (MyUn[UnFocus].Status and (usRecover or usGoto) <> 0); 7618 7618 7619 Test := Server(sLoadUnit - sExecute, me, UnFocus, nil^);7619 Test := Server(sLoadUnit - sExecute, Me, UnFocus, nil^); 7620 7620 mLoad.Visible := (Test >= rExecuted) or (Test = eNoTime_Load); 7621 7621 mUnload.Visible := (MyUn[UnFocus].Master >= 0) or 7622 7622 (MyUn[UnFocus].TroopLoad + MyUn[UnFocus].AirLoad > 0); 7623 mSelectTransport.Visible := Server(sSelectTransport - sExecute, me, UnFocus,7623 mSelectTransport.Visible := Server(sSelectTransport - sExecute, Me, UnFocus, 7624 7624 nil^) >= rExecuted; 7625 7625 end … … 7628 7628 mox := @MyModel[MyUn[UnFocus].mix]; 7629 7629 Tile := MyMap[MyUn[UnFocus].Loc]; 7630 extended := Tile and fCity = 0;7630 Extended := Tile and fCity = 0; 7631 7631 7632 7632 if (Tile and fRiver <> 0) and (MyRO.Tech[adBridgeBuilding] >= tsApplicable) … … 7648 7648 mClear.Caption := Phrases.Lookup('BTN_DRAIN'); 7649 7649 7650 extended := extended and ((mox.Kind = mkSettler) or (mox.Kind = mkSlaves)7650 Extended := Extended and ((mox.Kind = mkSettler) or (mox.Kind = mkSlaves) 7651 7651 and (MyRO.Wonder[woPyramids].EffectiveOwner >= 0)) and 7652 7652 (MyUn[UnFocus].Master < 0); 7653 if extended then7653 if Extended then 7654 7654 begin 7655 7655 mRoad.Visible := JobTest(UnFocus, jRoad, [eNoBridgeBuilding, eTreaty]); … … 7671 7671 else 7672 7672 begin 7673 for i:= 0 to Popup.Items.Count - 1 do7674 Popup.Items[ i].Visible := false;7673 for I := 0 to Popup.Items.Count - 1 do 7674 Popup.Items[I].Visible := False; 7675 7675 end; 7676 7676 end; … … 7678 7678 // set menu seperators 7679 7679 LastSep := nil; 7680 NeedSep := false;7681 for i:= 0 to Popup.Items.Count - 1 do7682 if Popup.Items[ i].Caption = '-' then7683 begin 7684 Popup.Items[ i].Visible := NeedSep;7680 NeedSep := False; 7681 for I := 0 to Popup.Items.Count - 1 do 7682 if Popup.Items[I].Caption = '-' then 7683 begin 7684 Popup.Items[I].Visible := NeedSep; 7685 7685 if NeedSep then 7686 LastSep := Popup.Items[ i];7687 NeedSep := false7686 LastSep := Popup.Items[I]; 7687 NeedSep := False 7688 7688 end 7689 else if Popup.Items[ i].Visible then7690 NeedSep := true;7689 else if Popup.Items[I].Visible then 7690 NeedSep := True; 7691 7691 if (LastSep <> nil) and not NeedSep then 7692 LastSep.Visible := false7692 LastSep.Visible := False 7693 7693 end; 7694 7694 … … 7709 7709 end; 7710 7710 7711 procedure TMainScreen.CityClosed(Activateuix: integer; StepFocus: boolean;7712 SelectFocus: boolean);7713 begin 7714 if supervising then7711 procedure TMainScreen.CityClosed(Activateuix: Integer; StepFocus: Boolean; 7712 SelectFocus: Boolean); 7713 begin 7714 if Supervising then 7715 7715 begin 7716 7716 SetTroopLoc(-1); … … 7729 7729 end 7730 7730 else if StepFocus then 7731 NextUnit(TroopLoc, true)7731 NextUnit(TroopLoc, True) 7732 7732 else 7733 7733 begin … … 7744 7744 7745 7745 procedure TMainScreen.PanelBoxMouseMove(Sender: TObject; Shift: TShiftState; 7746 x, y: integer);7746 X, Y: Integer); 7747 7747 var 7748 xCentre, yCentre: integer;7748 xCentre, yCentre: Integer; 7749 7749 begin 7750 7750 if Tracking and (ssLeft in Shift) then 7751 7751 with MainMap do begin 7752 if ( x >= xMini + 2) and (y >= yMini + 2) and (x< xMini + 2 + 2 * G.lx) and7753 ( y< yMini + 2 + G.ly) then7754 begin 7755 xCentre := (xwMini + ( x- xMini - 2) div 2 + G.lx div 2 +7752 if (X >= xMini + 2) and (Y >= yMini + 2) and (X < xMini + 2 + 2 * G.lx) and 7753 (Y < yMini + 2 + G.ly) then 7754 begin 7755 xCentre := (xwMini + (X - xMini - 2) div 2 + G.lx div 2 + 7756 7756 MapWidth div (xxt * 4)) mod G.lx; 7757 yCentre := ( y- yMini - 2);7757 yCentre := (Y - yMini - 2); 7758 7758 xw := (xCentre - MapWidth div (xxt * 4) + G.lx) mod G.lx; 7759 7759 if ywmax <= 0 then … … 7769 7769 BitBltCanvas(Buffer.Canvas, 0, 0, G.lx * 2, G.ly, MiniMap.Bitmap.Canvas, 0, 0); 7770 7770 if ywmax <= 0 then 7771 Frame(Buffer.Canvas, x- xMini - 2 - MapWidth div (xxt * 2), 0,7772 x- xMini - 2 + MapWidth div (xxt * 2) - 1, G.ly - 1,7771 Frame(Buffer.Canvas, X - xMini - 2 - MapWidth div (xxt * 2), 0, 7772 X - xMini - 2 + MapWidth div (xxt * 2) - 1, G.ly - 1, 7773 7773 MainTexture.ColorMark, MainTexture.ColorMark) 7774 7774 else 7775 Frame(Buffer.Canvas, x- xMini - 2 - MapWidth div (xxt * 2), yw,7776 x- xMini - 2 + MapWidth div (xxt * 2) - 1, yw + MapHeight div yyt -7775 Frame(Buffer.Canvas, X - xMini - 2 - MapWidth div (xxt * 2), yw, 7776 X - xMini - 2 + MapWidth div (xxt * 2) - 1, yw + MapHeight div yyt - 7777 7777 2, MainTexture.ColorMark, MainTexture.ColorMark); 7778 7778 BitBltCanvas(Panel.Canvas, xMini + 2, yMini + 2, G.lx * 2, G.ly, … … 7786 7786 end 7787 7787 else 7788 Tracking := false;7788 Tracking := False; 7789 7789 end; 7790 7790 7791 7791 procedure TMainScreen.PanelBoxMouseUp(Sender: TObject; Button: TMouseButton; 7792 Shift: TShiftState; x, y: integer);7792 Shift: TShiftState; X, Y: Integer); 7793 7793 begin 7794 7794 if Tracking then 7795 7795 begin 7796 Tracking := false;7796 Tracking := False; 7797 7797 xwMini := xw; 7798 7798 ywMini := yw; … … 7803 7803 7804 7804 procedure TMainScreen.MapBoxMouseMove(Sender: TObject; Shift: TShiftState; 7805 x, y: integer);7805 X, Y: Integer); 7806 7806 var 7807 MouseLoc: integer;7808 begin 7809 xMouse := x;7810 yMouse := y;7807 MouseLoc: Integer; 7808 begin 7809 xMouse := X; 7810 yMouse := Y; 7811 7811 if (ClientMode = cEditMap) and (ssLeft in Shift) and not Tracking then 7812 7812 begin 7813 MouseLoc := LocationOfScreenPixel( x, y);7813 MouseLoc := LocationOfScreenPixel(X, Y); 7814 7814 if MouseLoc <> BrushLoc then 7815 MapBoxMouseDown(nil, mbLeft, Shift, x, y);7815 MapBoxMouseDown(nil, mbLeft, Shift, X, Y); 7816 7816 end 7817 (* else if idle and (UnFocus>=0) then7817 (* else if Idle and (UnFocus>=0) then 7818 7818 begin 7819 7819 qx:=(xMouse*32+yMouse*66+16*66) div(32*66)-1; … … 7828 7828 TMenuItem(Sender).Checked := not TMenuItem(Sender).Checked; 7829 7829 SetMapOptions; 7830 MapValid := false;7830 MapValid := False; 7831 7831 PaintAllMaps; 7832 7832 end; … … 7834 7834 procedure TMainScreen.mNamesClick(Sender: TObject); 7835 7835 var 7836 p1: integer;7836 p1: Integer; 7837 7837 begin 7838 7838 mNames.Checked := not mNames.Checked; … … 7844 7844 else 7845 7845 Tribe[p1].NumberName := p1; 7846 MapValid := false;7846 MapValid := False; 7847 7847 PaintAll; 7848 7848 end; 7849 7849 7850 function TMainScreen.IsPanelPixel( x, y: integer): boolean;7851 begin 7852 result := (y >= TopBarHeight + MapHeight) or (y>= ClientHeight - PanelHeight)7853 and (( x < xMidPanel) or (x>= xRightPanel));7850 function TMainScreen.IsPanelPixel(X, Y: Integer): Boolean; 7851 begin 7852 Result := (Y >= TopBarHeight + MapHeight) or (Y >= ClientHeight - PanelHeight) 7853 and ((X < xMidPanel) or (X >= xRightPanel)); 7854 7854 end; 7855 7855 7856 7856 procedure TMainScreen.FormMouseDown(Sender: TObject; Button: TMouseButton; 7857 Shift: TShiftState; x, y: integer);7858 begin 7859 if idle then7860 if ( x < 40) and (y< 40) then7857 Shift: TShiftState; X, Y: Integer); 7858 begin 7859 if Idle then 7860 if (X < 40) and (Y < 40) then 7861 7861 begin 7862 7862 if GameMode <> cMovie then … … 7870 7870 end; 7871 7871 end 7872 else if IsPanelPixel( x, y) then7873 PanelBoxMouseDown(Sender, Button, Shift, x,7874 y- (ClientHeight - PanelHeight))7875 else if ( y >= TopBarHeight) and (x>= MapOffset) and7876 ( x< MapOffset + MapWidth) then7877 MapBoxMouseDown(Sender, Button, Shift, x - MapOffset, y- TopBarHeight)7872 else if IsPanelPixel(X, Y) then 7873 PanelBoxMouseDown(Sender, Button, Shift, X, 7874 Y - (ClientHeight - PanelHeight)) 7875 else if (Y >= TopBarHeight) and (X >= MapOffset) and 7876 (X < MapOffset + MapWidth) then 7877 MapBoxMouseDown(Sender, Button, Shift, X - MapOffset, Y - TopBarHeight) 7878 7878 end; 7879 7879 7880 7880 procedure TMainScreen.FormMouseMove(Sender: TObject; Shift: TShiftState; 7881 x, y: integer);7882 begin 7883 if idle then7884 if IsPanelPixel( x, y) then7885 PanelBoxMouseMove(Sender, Shift, x, y- (ClientHeight - PanelHeight))7886 else if ( y >= TopBarHeight) and (x>= MapOffset) and7887 ( x< MapOffset + MapWidth) then7888 MapBoxMouseMove(Sender, Shift, x - MapOffset, y- TopBarHeight);7881 X, Y: Integer); 7882 begin 7883 if Idle then 7884 if IsPanelPixel(X, Y) then 7885 PanelBoxMouseMove(Sender, Shift, X, Y - (ClientHeight - PanelHeight)) 7886 else if (Y >= TopBarHeight) and (X >= MapOffset) and 7887 (X < MapOffset + MapWidth) then 7888 MapBoxMouseMove(Sender, Shift, X - MapOffset, Y - TopBarHeight); 7889 7889 end; 7890 7890 7891 7891 procedure TMainScreen.FormMouseUp(Sender: TObject; Button: TMouseButton; 7892 Shift: TShiftState; x, y: integer);7893 begin 7894 if idle then7895 PanelBoxMouseUp(Sender, Button, Shift, x, y- (ClientHeight - PanelHeight));7892 Shift: TShiftState; X, Y: Integer); 7893 begin 7894 if Idle then 7895 PanelBoxMouseUp(Sender, Button, Shift, X, Y - (ClientHeight - PanelHeight)); 7896 7896 end; 7897 7897 … … 7902 7902 with Canvas do 7903 7903 begin // pillarbox, make left and right border black 7904 if me < 0 then7904 if Me < 0 then 7905 7905 Brush.Color := $000000 7906 7906 else … … 7929 7929 end; 7930 7930 BitBltCanvas(Canvas, MapOffset, TopBarHeight, MapWidth, MapHeight - overlap, 7931 offscreen.Canvas, 0, 0);7931 Offscreen.Canvas, 0, 0); 7932 7932 BitBltCanvas(Canvas, 0, 0, ClientWidth, TopBarHeight, TopBar.Canvas, 7933 7933 0, 0); 7934 7934 if xMidPanel > MapOffset then 7935 7935 BitBltCanvas(Canvas, xMidPanel, TopBarHeight + MapHeight - overlap, 7936 ClientWidth div 2 - xMidPanel, overlap, offscreen.Canvas,7936 ClientWidth div 2 - xMidPanel, overlap, Offscreen.Canvas, 7937 7937 xMidPanel - MapOffset, MapHeight - overlap) 7938 7938 else 7939 7939 BitBltCanvas(Canvas, MapOffset, TopBarHeight + MapHeight - overlap, 7940 ClientWidth div 2 - MapOffset, overlap, offscreen.Canvas, 0,7940 ClientWidth div 2 - MapOffset, overlap, Offscreen.Canvas, 0, 7941 7941 MapHeight - overlap); 7942 7942 if xRightPanel < MapOffset + MapWidth then 7943 7943 BitBltCanvas(Canvas, ClientWidth div 2, TopBarHeight + MapHeight - overlap, 7944 xRightPanel - ClientWidth div 2, overlap, offscreen.Canvas,7944 xRightPanel - ClientWidth div 2, overlap, Offscreen.Canvas, 7945 7945 ClientWidth div 2 - MapOffset, MapHeight - overlap) 7946 7946 else 7947 7947 BitBltCanvas(Canvas, ClientWidth div 2, TopBarHeight + MapHeight - overlap, 7948 7948 MapOffset + MapWidth - ClientWidth div 2, overlap, 7949 offscreen.Canvas, ClientWidth div 2 - MapOffset,7949 Offscreen.Canvas, ClientWidth div 2 - MapOffset, 7950 7950 MapHeight - overlap); 7951 7951 BitBltCanvas(Canvas, 0, TopBarHeight + MapHeight - overlap, xMidPanel, … … 7960 7960 end; 7961 7961 7962 procedure TMainScreen.RectInvalidate(Left, Top, Rigth, Bottom: integer);7962 procedure TMainScreen.RectInvalidate(Left, Top, Rigth, Bottom: Integer); 7963 7963 var 7964 7964 r0: HRgn; 7965 7965 begin 7966 7966 r0 := CreateRectRgn(Left, Top, Rigth, Bottom); 7967 InvalidateRgn(Handle, r0, false);7967 InvalidateRgn(Handle, r0, False); 7968 7968 DeleteObject(r0); 7969 7969 end; 7970 7970 7971 procedure TMainScreen.SmartRectInvalidate(Left, Top, Rigth, Bottom: integer);7971 procedure TMainScreen.SmartRectInvalidate(Left, Top, Rigth, Bottom: Integer); 7972 7972 var 7973 i: integer;7973 I: Integer; 7974 7974 r0, r1: HRgn; 7975 7975 begin 7976 7976 r0 := CreateRectRgn(Left, Top, Rigth, Bottom); 7977 for i:= 0 to ControlCount - 1 do7978 if not(Controls[ i] is TArea) and Controls[i].Visible then7979 begin 7980 with Controls[ i].BoundsRect do7977 for I := 0 to ControlCount - 1 do 7978 if not(Controls[I] is TArea) and Controls[I].Visible then 7979 begin 7980 with Controls[I].BoundsRect do 7981 7981 r1 := CreateRectRgn(Left, Top, Right, Bottom); 7982 7982 CombineRgn(r0, r0, r1, RGN_DIFF); 7983 7983 DeleteObject(r1); 7984 7984 end; 7985 InvalidateRgn(Handle, r0, false);7985 InvalidateRgn(Handle, r0, False); 7986 7986 DeleteObject(r0); 7987 7987 end; … … 8048 8048 procedure TMainScreen.FormClose(Sender: TObject; var Action: TCloseAction); 8049 8049 begin 8050 Timer1.Enabled := false;8050 Timer1.Enabled := False; 8051 8051 end; 8052 8052 8053 8053 procedure TMainScreen.Radio(Sender: TObject); 8054 8054 begin 8055 TMenuItem(Sender).Checked := true;8055 TMenuItem(Sender).Checked := True; 8056 8056 end; 8057 8057 8058 8058 procedure TMainScreen.mManipClick(Sender: TObject); 8059 8059 var 8060 Flag: integer;8060 Flag: Integer; 8061 8061 begin 8062 8062 with TMenuItem(Sender) do … … 8070 8070 Play('CHEAT'); 8071 8071 end; 8072 if not supervising then8072 if not Supervising then 8073 8073 begin 8074 8074 if Flag = tfUncover then 8075 8075 begin 8076 MapValid := false;8076 MapValid := False; 8077 8077 PaintAllMaps; 8078 8078 end … … 8098 8098 else 8099 8099 begin 8100 MapValid := false;8100 MapValid := False; 8101 8101 PaintAllMaps; 8102 8102 end; // update main map … … 8117 8117 end; 8118 8118 SetMapOptions; 8119 MapValid := false;8119 MapValid := False; 8120 8120 PaintAllMaps; 8121 8121 end; … … 8135 8135 end; 8136 8136 SetMapOptions; 8137 MapValid := false;8137 MapValid := False; 8138 8138 PaintAllMaps; 8139 8139 end; 8140 8140 8141 procedure TMainScreen.FormKeyUp(Sender: TObject; var Key: word;8141 procedure TMainScreen.FormKeyUp(Sender: TObject; var Key: Word; 8142 8142 Shift: TShiftState); 8143 8143 begin 8144 if idle and (Key = VK_APPS) then8144 if Idle and (Key = VK_APPS) then 8145 8145 begin 8146 8146 InitPopup(GamePopup); … … 8150 8150 GamePopup.Popup(Left + 4, Top + GetSystemMetrics(SM_CYCAPTION) + 4 + 8151 8151 TopBarHeight - 1); 8152 exit;8152 Exit; 8153 8153 end; // windows menu button calls game menu 8154 8154 end; … … 8156 8156 procedure TMainScreen.CreateUnitClick(Sender: TObject); 8157 8157 var 8158 p1, mix: integer;8158 p1, mix: Integer; 8159 8159 begin 8160 8160 p1 := TComponent(Sender).Tag shr 16; 8161 8161 mix := TComponent(Sender).Tag and $FFFF; 8162 if Server(sCreateUnit + p1 shl 4, me, mix, EditLoc) >= rExecuted then8162 if Server(sCreateUnit + p1 shl 4, Me, mix, EditLoc) >= rExecuted then 8163 8163 PaintLoc(EditLoc); 8164 8164 end; … … 8181 8181 { procedure TMainScreen.AdviceBtnClick; 8182 8182 var 8183 OldAdviceLoc: integer;8184 begin 8185 DestinationMarkON:= false;8183 OldAdviceLoc: Integer; 8184 begin 8185 DestinationMarkON:=False; 8186 8186 PaintDestination; 8187 8187 AdvisorDlg.GiveStrategyAdvice; … … 8193 8193 { procedure TMainScreen.SetAdviceLoc(Loc: integer; AvoidRect: TRect); 8194 8194 var 8195 OldAdviceLoc, x,y: integer;8195 OldAdviceLoc,X,Y: Integer; 8196 8196 begin 8197 8197 if Loc<>MainMap.AdviceLoc then … … 8199 8199 if Loc>=0 then 8200 8200 begin // center 8201 y:=Loc div G.lx;8202 x:=(Loc+G.lx - AvoidRect.Right div (2*66)) mod G.lx;8203 Centre( y*G.lx+x);8201 Y:=Loc div G.lx; 8202 X:=(Loc+G.lx - AvoidRect.Right div (2*66)) mod G.lx; 8203 Centre(Y*G.lx+X); 8204 8204 PaintAllMaps; 8205 8205 end; … … 8259 8259 procedure TMainScreen.SaveMenuItemsState; 8260 8260 var 8261 i, j: integer;8261 I, J: Integer; 8262 8262 begin 8263 8263 if soTellAI in OptionChecked then OptionChecked := [soTellAI] 8264 8264 else OptionChecked := []; 8265 for i:= 0 to ComponentCount - 1 do8266 if Components[ i] is TMenuItem then8267 for j:= 0 to Length(SaveOption) - 1 do8268 if TMenuItem(Components[ i]).Checked and8269 (TMenuItem(Components[ i]).Tag = SaveOption[j]) then8270 OptionChecked := OptionChecked + [TSaveOption( j)];8265 for I := 0 to ComponentCount - 1 do 8266 if Components[I] is TMenuItem then 8267 for J := 0 to Length(SaveOption) - 1 do 8268 if TMenuItem(Components[I]).Checked and 8269 (TMenuItem(Components[I]).Tag = SaveOption[J]) then 8270 OptionChecked := OptionChecked + [TSaveOption(J)]; 8271 8271 end; 8272 8272 … … 8280 8280 with Reg do 8281 8281 try 8282 OpenKey(AppRegistryKey, true);8282 OpenKey(AppRegistryKey, True); 8283 8283 WriteInteger('TileSize', Integer(MainMap.TileSize)); 8284 8284 WriteInteger('OptionChecked', Integer(OptionChecked)); 8285 8285 WriteInteger('MapOptionChecked', Integer(MapOptionChecked)); 8286 WriteInteger('CityReport', integer(CityRepMask));8286 WriteInteger('CityReport', Integer(CityRepMask)); 8287 8287 finally 8288 8288 Free; -
trunk/LocalPlayer/Tribes.pas
r438 r447 49 49 constructor Create(FileName: string); 50 50 destructor Destroy; override; 51 function GetCityName( i: Integer): string;52 {$IFNDEF SCR} procedure SetCityName( i: Integer; NewName: string); {$ENDIF}51 function GetCityName(I: Integer): string; 52 {$IFNDEF SCR} procedure SetCityName(I: Integer; NewName: string); {$ENDIF} 53 53 {$IFNDEF SCR} function TString(Template: string): string; 54 54 function TPhrase(Item: string): string; {$ENDIF} … … 74 74 procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string); 75 75 function GetTribeInfo(FileName: string; var Name: string; var Color: TColor): Boolean; 76 procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor;76 procedure FindPosition(HGr: TGraphicSet; X, Y, xmax, ymax: Integer; Mark: TColor; 77 77 var xp, yp: Integer); 78 78 … … 215 215 function Get: string; 216 216 var 217 p: Integer;217 P: Integer; 218 218 begin 219 219 while (Input <> '') and ((Input[1] = ' ') or (Input[1] = #9)) do 220 220 Delete(Input, 1, 1); 221 p:= Pos(',', Input);222 if p= 0 then223 p:= Length(Input) + 1;224 Result := Copy(Input, 1, p- 1);225 Delete(Input, 1, p);221 P := Pos(',', Input); 222 if P = 0 then 223 P := Length(Input) + 1; 224 Result := Copy(Input, 1, P - 1); 225 Delete(Input, 1, P); 226 226 end; 227 227 228 228 function GetNum: Integer; 229 229 var 230 i: Integer;231 begin 232 Val(Get, Result, i);233 if i<> 0 then230 I: Integer; 231 begin 232 Val(Get, Result, I); 233 if I <> 0 then 234 234 Result := 0; 235 235 end; … … 237 237 procedure FindStdModelPicture(Code: Integer; var pix: Integer; var Name: string); 238 238 var 239 i: Integer;240 begin 241 for i:= 0 to StdUnitScript.Count - 1 do239 I: Integer; 240 begin 241 for I := 0 to StdUnitScript.Count - 1 do 242 242 begin // look through StdUnits 243 Input := StdUnitScript[ i];243 Input := StdUnitScript[I]; 244 244 pix := GetNum; 245 245 if Code = GetNum then … … 340 340 end; 341 341 342 procedure FindPosition(HGr: TGraphicSet; x, y, xmax, ymax: Integer; Mark: TColor;342 procedure FindPosition(HGr: TGraphicSet; X, Y, xmax, ymax: Integer; Mark: TColor; 343 343 var xp, yp: Integer); 344 344 begin 345 345 xp := 0; 346 while (xp < xmax) and (HGr.Data.Canvas.Pixels[ x + 1 + xp, y] <> Mark) do346 while (xp < xmax) and (HGr.Data.Canvas.Pixels[X + 1 + xp, Y] <> Mark) do 347 347 Inc(xp); 348 348 yp := 0; 349 while (yp < ymax) and (HGr.Data.Canvas.Pixels[ x, y+ 1 + yp] <> Mark) do349 while (yp < ymax) and (HGr.Data.Canvas.Pixels[X, Y + 1 + yp] <> Mark) do 350 350 Inc(yp); 351 351 end; 352 352 353 function TTribe.GetCityName( i: Integer): string;353 function TTribe.GetCityName(I: Integer): string; 354 354 begin 355 355 Result := ''; 356 if nCityLines > ithen357 begin 358 Result := Script[CityLine0 + i];356 if nCityLines > I then 357 begin 358 Result := Script[CityLine0 + I]; 359 359 while (Result <> '') and ((Result[1] = ' ') or (Result[1] = #9)) do 360 360 Delete(Result, 1, 1); … … 362 362 {$IFNDEF SCR} 363 363 else 364 Result := Format(TPhrase('GENCITY'), [ i+ 1]);364 Result := Format(TPhrase('GENCITY'), [I + 1]); 365 365 {$ENDIF} 366 366 end; 367 367 368 368 {$IFNDEF SCR} 369 procedure TTribe.SetCityName( i: Integer; NewName: string);370 begin 371 while nCityLines <= ido369 procedure TTribe.SetCityName(I: Integer; NewName: string); 370 begin 371 while nCityLines <= I do 372 372 begin 373 373 Script.Insert(CityLine0 + nCityLines, Format(TPhrase('GENCITY'), … … 375 375 Inc(nCityLines); 376 376 end; 377 Script[CityLine0 + i] := NewName;377 Script[CityLine0 + I] := NewName; 378 378 end; 379 379 380 380 function TTribe.TString(Template: string): string; 381 381 var 382 p: Integer;382 P: Integer; 383 383 Variant: Char; 384 384 CaseUp: Boolean; 385 385 begin 386 386 repeat 387 p := pos('#', Template);388 if ( p = 0) or (p= Length(Template)) then387 P := Pos('#', Template); 388 if (P = 0) or (P = Length(Template)) then 389 389 Break; 390 Variant := Template[ p+ 1];390 Variant := Template[P + 1]; 391 391 CaseUp := Variant in ['A' .. 'Z']; 392 392 if CaseUp then 393 393 Inc(Variant, 32); 394 Delete(Template, p, 2);394 Delete(Template, P, 2); 395 395 if Variant in ['a' .. 'z'] then 396 396 begin 397 397 if NumberName < 0 then 398 Insert(Name[Variant], Template, p)398 Insert(Name[Variant], Template, P) 399 399 else 400 Insert(Format('P%d', [NumberName]), Template, p);401 if CaseUp and (Length(Template) >= p) and402 (Template[ p] in ['a' .. 'z', #$E0 .. #$FF]) then403 Dec(Template[ p], 32);400 Insert(Format('P%d', [NumberName]), Template, P); 401 if CaseUp and (Length(Template) >= P) and 402 (Template[P] in ['a' .. 'z', #$E0 .. #$FF]) then 403 Dec(Template[P], 32); 404 404 end 405 405 until False; … … 418 418 TLine = array [0 .. 649, 0 .. 2] of Byte; 419 419 var 420 i, x, Gray: Integer;420 I, X, Gray: Integer; 421 421 Item: string; 422 422 begin … … 426 426 with Script do 427 427 begin 428 i:= 0;429 while ( i < Count) and (Copy(Strings[i], 1, 6) <>428 I := 0; 429 while (I < Count) and (Copy(Strings[I], 1, 6) <> 430 430 '#AGE' + char(48 + Age) + ' ') do 431 Inc( i);432 if i< Count then433 begin 434 Input := Strings[ i];431 Inc(I); 432 if I < Count then 433 begin 434 Input := Strings[I]; 435 435 system.Delete(Input, 1, 6); 436 436 Item := Get; … … 448 448 end; 449 449 cHGr := LoadGraphicSet(Item + '.png'); 450 for x:= 0 to 3 do451 with CityPicture[ x] do begin452 FindPosition(cHGr, x* 65, cpix * 49, 63, 47, $00FFFF,450 for X := 0 to 3 do 451 with CityPicture[X] do begin 452 FindPosition(cHGr, X * 65, cpix * 49, 63, 47, $00FFFF, 453 453 xShield, yShield); 454 454 // FindPosition(cHGr,x*65,cpix*49,$FFFFFF,xf,yf); … … 486 486 procedure TTribe.SetModelPicture(const Info: TModelPictureInfo; IsNew: Boolean); 487 487 var 488 i: Integer;488 I: Integer; 489 489 ok: Boolean; 490 490 begin … … 493 493 if not IsNew then 494 494 begin 495 i:= nPictureList - 1;496 while ( i >= 0) and (PictureList[i].Hash <> Info.Hash) do497 Dec( i);498 assert(i>= 0);499 assert(PictureList[i].HGr = LoadGraphicSet(GrName));500 assert(PictureList[i].pix = pix);501 ModelPicture[mix].HGr := PictureList[ i].HGr;502 ModelPicture[mix].pix := PictureList[ i].pix;503 ModelName[mix] := PictureList[ i].ModelName;495 I := nPictureList - 1; 496 while (I >= 0) and (PictureList[I].Hash <> Info.Hash) do 497 Dec(I); 498 Assert(I >= 0); 499 Assert(PictureList[I].HGr = LoadGraphicSet(GrName)); 500 Assert(PictureList[I].pix = pix); 501 ModelPicture[mix].HGr := PictureList[I].HGr; 502 ModelPicture[mix].pix := PictureList[I].pix; 503 ModelName[mix] := PictureList[I].ModelName; 504 504 end 505 505 else … … 515 515 // read model name from tribe script 516 516 ok := False; 517 for i:= 0 to Script.Count - 1 do518 begin 519 Input := Script[ i];517 for I := 0 to Script.Count - 1 do 518 begin 519 Input := Script[I]; 520 520 if Input = '#UNITS ' + ExtractFileNameOnly(GrName) then 521 521 ok := True … … 531 531 if ModelName[mix] = '' then 532 532 begin // read model name from StdUnits.txt 533 for i:= 0 to StdUnitScript.Count - 1 do533 for I := 0 to StdUnitScript.Count - 1 do 534 534 begin 535 Input := StdUnitScript[ i];535 Input := StdUnitScript[I]; 536 536 if GetNum = pix then 537 537 begin … … 567 567 Code, Turn: Integer; ForceNew: Boolean): Boolean; 568 568 var 569 i: Integer;569 I: Integer; 570 570 Cnt: Integer; 571 571 HGr: TGraphicSet; … … 606 606 if not ForceNew and (Picture.Hash > 0) then 607 607 begin 608 for i:= 0 to nPictureList - 1 do609 if PictureList[ i].Hash = Picture.Hash then610 begin 611 Picture.GrName := PictureList[ i].HGr.Name;612 Picture.pix := PictureList[ i].pix;608 for I := 0 to nPictureList - 1 do 609 if PictureList[I].Hash = Picture.Hash then 610 begin 611 Picture.GrName := PictureList[I].HGr.Name; 612 Picture.pix := PictureList[I].pix; 613 613 Result := False; 614 614 Exit; … … 622 622 TestPic.GrName := 'StdUnits.png'; 623 623 HGr := HGrStdUnits; 624 for i:= 0 to StdUnitScript.Count - 1 do624 for I := 0 to StdUnitScript.Count - 1 do 625 625 begin // look through StdUnits 626 Input := StdUnitScript[ i];626 Input := StdUnitScript[I]; 627 627 Check; 628 628 end; 629 629 630 630 ok := False; 631 for i:= 0 to Script.Count - 1 do631 for I := 0 to Script.Count - 1 do 632 632 begin // look through units defined in tribe script 633 Input := Script[ i];633 Input := Script[I]; 634 634 if Copy(Input, 1, 6) = '#UNITS' then 635 635 begin -
trunk/LocalPlayer/UKeyBindings.pas
r424 r447 397 397 end. 398 398 399 -
trunk/LocalPlayer/UnitStat.pas
r442 r447 28 28 public 29 29 procedure CheckAge; 30 procedure ShowNewContent_OwnModel(NewMode: TWindowMode; mix: integer);31 procedure ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: integer);32 procedure ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: integer);33 procedure ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: integer);34 procedure ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: integer);35 procedure ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: integer);30 procedure ShowNewContent_OwnModel(NewMode: TWindowMode; mix: Integer); 31 procedure ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: Integer); 32 procedure ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: Integer); 33 procedure ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: Integer); 34 procedure ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: Integer); 35 procedure ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: Integer); 36 36 37 37 protected 38 38 mixShow, // for dkOwnModel 39 uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: integer;39 uixShow, euixShow, ecixShow, UnitLoc, AgePrepared: Integer; 40 40 // for dkEnemyUnit, euixShow=-1 -> 41 41 mox: ^TModelInfo; // for dkEnemyModel … … 121 121 procedure TUnitStatDlg.FormShow(Sender: TObject); 122 122 var 123 owner, mix: integer;124 IsSpecialUnit: boolean;123 owner, mix: Integer; 124 IsSpecialUnit: Boolean; 125 125 begin 126 126 if Kind in [dkEnemyUnit, dkEnemyCityDefense, dkEnemyCity] then … … 132 132 euixShow := MyRO.nEnemyUn - 1; 133 133 while (euixShow >= 0) and (MyRO.EnemyUn[euixShow].Loc <> UnitLoc) do 134 dec(euixShow);135 assert(euixShow >= 0);134 Dec(euixShow); 135 Assert(euixShow >= 0); 136 136 end; 137 137 with MyRO.EnemyUn[euixShow] do … … 148 148 ecixShow := MyRO.nEnemyCity - 1; 149 149 while (ecixShow >= 0) and (MyRO.EnemyCity[ecixShow].Loc <> UnitLoc) do 150 dec(ecixShow);151 assert(ecixShow >= 0);150 Dec(ecixShow); 151 Assert(ecixShow >= 0); 152 152 end; 153 153 end; … … 178 178 end; 179 179 180 SwitchBtn.Visible := not supervising and (Kind = dkOwnModel);181 ConscriptsBtn.Visible := not supervising and (Kind = dkOwnModel) and180 SwitchBtn.Visible := not Supervising and (Kind = dkOwnModel); 181 ConscriptsBtn.Visible := not Supervising and (Kind = dkOwnModel) and 182 182 (MyRO.Tech[adConscription] >= tsApplicable) and 183 183 (MyModel[mixShow].Domain = dGround) and (MyModel[mixShow].Kind < mkScout); 184 IsSpecialUnit := false;184 IsSpecialUnit := False; 185 185 if Kind in [dkEnemyCity, dkEnemyCityDefense] then 186 186 Caption := CityName(MyRO.EnemyCity[ecixShow].ID) … … 190 190 dkOwnModel: 191 191 begin 192 owner := me;192 owner := Me; 193 193 mix := mixShow; 194 194 IsSpecialUnit := MyModel[mix].Kind >= $10; … … 196 196 dkOwnUnit: 197 197 begin 198 owner := me;198 owner := Me; 199 199 mix := MyUn[uixShow].mix; 200 200 IsSpecialUnit := MyModel[mix].Kind >= $10; … … 218 218 end; 219 219 220 procedure TUnitStatDlg.ShowNewContent_OwnModel(NewMode: TWindowMode; mix: integer);220 procedure TUnitStatDlg.ShowNewContent_OwnModel(NewMode: TWindowMode; mix: Integer); 221 221 begin 222 222 Kind := dkOwnModel; … … 225 225 end; 226 226 227 procedure TUnitStatDlg.ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: integer);227 procedure TUnitStatDlg.ShowNewContent_OwnUnit(NewMode: TWindowMode; uix: Integer); 228 228 begin 229 229 Kind := dkOwnUnit; … … 232 232 end; 233 233 234 procedure TUnitStatDlg.ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: integer);234 procedure TUnitStatDlg.ShowNewContent_EnemyUnit(NewMode: TWindowMode; euix: Integer); 235 235 begin 236 236 Kind := dkEnemyUnit; … … 240 240 end; 241 241 242 procedure TUnitStatDlg.ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: integer);242 procedure TUnitStatDlg.ShowNewContent_EnemyLoc(NewMode: TWindowMode; Loc: Integer); 243 243 begin 244 244 Kind := dkEnemyUnit; … … 248 248 end; 249 249 250 procedure TUnitStatDlg.ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: integer);250 procedure TUnitStatDlg.ShowNewContent_EnemyModel(NewMode: TWindowMode; emix: Integer); 251 251 begin 252 252 Kind := dkEnemyModel; … … 255 255 end; 256 256 257 procedure TUnitStatDlg.ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: integer);257 procedure TUnitStatDlg.ShowNewContent_EnemyCity(NewMode: TWindowMode; Loc: Integer); 258 258 begin 259 259 if MyMap[Loc] and fUnit <> 0 then … … 286 286 PPicture: ^TModelPicture; 287 287 288 function IsToCount(emix: integer): boolean;288 function IsToCount(emix: Integer): Boolean; 289 289 var 290 290 PTestPicture: ^TModelPicture; … … 294 294 PTestPicture := @Tribe[MyRO.EnemyModel[emix].owner].ModelPicture 295 295 [MyRO.EnemyModel[emix].mix]; 296 result := (PPicture.HGr = PTestPicture.HGr) and296 Result := (PPicture.HGr = PTestPicture.HGr) and 297 297 (PPicture.pix = PTestPicture.pix) and 298 298 (ModelHash(mox^) = ModelHash(MyRO.EnemyModel[emix])); 299 299 end 300 300 else 301 result := (MyRO.EnemyModel[emix].owner = mox.owner) and301 Result := (MyRO.EnemyModel[emix].owner = mox.owner) and 302 302 (MyRO.EnemyModel[emix].mix = mox.mix); 303 303 end; 304 304 305 procedure FeatureBar(dst: TBitmap; x, y: integer; const mi: TModelInfo;305 procedure FeatureBar(dst: TBitmap; X, Y: Integer; const mi: TModelInfo; 306 306 T: TTexture); 307 307 var 308 i, w, dx, num: integer;309 s: string;310 begin 311 DarkGradient(dst.Canvas, x - 6, y+ 1, 180, 1);308 I, W, dx, num: Integer; 309 S: string; 310 begin 311 DarkGradient(dst.Canvas, X - 6, Y + 1, 180, 1); 312 312 with dst.Canvas do 313 313 if mi.Kind >= $10 then 314 314 begin 315 s:= Phrases.Lookup('UNITSPECIAL');315 S := Phrases.Lookup('UNITSPECIAL'); 316 316 Font.Color := $000000; 317 Textout( x - 1, y + 1, s);317 Textout(X - 1, Y + 1, S); 318 318 Font.Color := $B0B0B0; 319 Textout( x - 2, y, s);319 Textout(X - 2, Y, S); 320 320 end 321 321 else … … 323 323 Font.Color := $000000; 324 324 dx := 2; 325 for i:= 3 to nFeature - 1 do325 for I := 3 to nFeature - 1 do 326 326 begin 327 327 num := 0; 328 case iof328 case I of 329 329 mcSeaTrans: 330 330 if mi.Domain = dSea then … … 342 342 num := mi.TTrans; 343 343 mcFirstNonCap .. nFeature - 1: 344 if mi.Cap and (1 shl ( i- mcFirstNonCap)) <> 0 then344 if mi.Cap and (1 shl (I - mcFirstNonCap)) <> 0 then 345 345 num := 1 346 346 end; 347 347 if (num > 0) and 348 (( i<> mcSE) or (mi.Cap and (1 shl (mcNP - mcFirstNonCap)) = 0))348 ((I <> mcSE) or (mi.Cap and (1 shl (mcNP - mcFirstNonCap)) = 0)) 349 349 then 350 350 begin 351 351 if num > 1 then 352 352 begin 353 s:= IntToStr(num);354 w := TextWidth(s);353 S := IntToStr(num); 354 W := TextWidth(S); 355 355 Brush.Color := $FFFFFF; 356 FillRect(Rect( x - 3 + dx, y + 2, x + w - 1 + dx, y+ 16));356 FillRect(Rect(X - 3 + dx, Y + 2, X + W - 1 + dx, Y + 16)); 357 357 Brush.Style := bsClear; 358 Textout( x - 3 + dx + 1, y, s);359 inc(dx, w+ 1)358 Textout(X - 3 + dx + 1, Y, S); 359 Inc(dx, W + 1) 360 360 end; 361 361 Brush.Color := $C0C0C0; 362 FrameRect(Rect( x - 3 + dx, y + 2, x + 11 + dx, y+ 16));362 FrameRect(Rect(X - 3 + dx, Y + 2, X + 11 + dx, Y + 16)); 363 363 Brush.Style := bsClear; 364 Sprite(dst, HGrSystem, x - 1 + dx, y+ 4, 10, 10,365 66 + i mod 11 * 11, 137 + idiv 11 * 11);366 inc(dx, 15)364 Sprite(dst, HGrSystem, X - 1 + dx, Y + 4, 10, 10, 365 66 + I mod 11 * 11, 137 + I div 11 * 11); 366 Inc(dx, 15) 367 367 end; 368 368 end; … … 370 370 end; { featurebar } 371 371 372 procedure NumberBarS(dst: TBitmap; x, y: integer; Cap, s: string; T: TTexture);373 begin 374 DLine(dst.Canvas, x - 2, x + 170, y+ 16, T.ColorBevelShade, T.ColorBevelLight);375 LoweredTextOut(dst.Canvas, -1, T, x - 2, y, Cap);376 RisedTextout(dst.Canvas, x + 170 - BiColorTextWidth(dst.Canvas, s), y, s);372 procedure NumberBarS(dst: TBitmap; X, Y: Integer; Cap, S: string; T: TTexture); 373 begin 374 DLine(dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade, T.ColorBevelLight); 375 LoweredTextOut(dst.Canvas, -1, T, X - 2, Y, Cap); 376 RisedTextout(dst.Canvas, X + 170 - BiColorTextWidth(dst.Canvas, S), Y, S); 377 377 end; 378 378 379 379 var 380 i, j, x, y, cix, uix, emix, InProd, Available, Destroyed, Loc, Cnt, yView,381 yTotal, yCaption: integer;382 s: string;380 I, J, X, Y, cix, uix, emix, InProd, Available, Destroyed, Loc, Cnt, yView, 381 yTotal, yCaption: Integer; 382 S: string; 383 383 ui: TUnitInfo; 384 384 mi: TModelInfo; … … 389 389 dkOwnModel: 390 390 begin 391 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hOwnModel,391 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hOwnModel, 392 392 Back.Canvas, 0, 0); 393 393 yView := 13; … … 396 396 dkEnemyModel: 397 397 begin 398 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyModel,398 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyModel, 399 399 Back.Canvas, wCommon, 0); 400 400 yView := 13; … … 403 403 dkEnemyUnit, dkOwnUnit: 404 404 begin 405 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyUnit,405 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyUnit, 406 406 Back.Canvas, 2 * wCommon, 0); 407 407 yView := 13; … … 410 410 dkEnemyCityDefense: 411 411 begin 412 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense,412 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCityDefense, 413 413 Back.Canvas, 3 * wCommon, 0); 414 414 yView := 171; … … 417 417 dkEnemyCity: 418 418 begin 419 BitBltCanvas( offscreen.Canvas, 0, 0, wCommon, hEnemyCity,419 BitBltCanvas(Offscreen.Canvas, 0, 0, wCommon, hEnemyCity, 420 420 Back.Canvas, 4 * wCommon, 0); 421 421 end; … … 427 427 begin // show city defense facilities 428 428 Cnt := 0; 429 for i:= 0 to 3 do430 if MyRO.EnemyCity[ecixShow].Flags and (2 shl i) <> 0 then431 inc(Cnt);432 x:= (wCommon - Cnt * xSizeSmall) div 2 - (Cnt - 1) * 2;433 for i:= 0 to 3 do434 if MyRO.EnemyCity[ecixShow].Flags and (2 shl i) <> 0 then435 begin 436 case iof437 0: j:= imWalls;438 1: j:= imCoastalFort;439 2: j:= imMissileBat;440 3: j:= imBunker429 for I := 0 to 3 do 430 if MyRO.EnemyCity[ecixShow].Flags and (2 shl I) <> 0 then 431 Inc(Cnt); 432 X := (wCommon - Cnt * xSizeSmall) div 2 - (Cnt - 1) * 2; 433 for I := 0 to 3 do 434 if MyRO.EnemyCity[ecixShow].Flags and (2 shl I) <> 0 then 435 begin 436 case I of 437 0: J := imWalls; 438 1: J := imCoastalFort; 439 2: J := imMissileBat; 440 3: J := imBunker 441 441 end; 442 Frame( offscreen.Canvas, x - 1, yImp - 1, x+ xSizeSmall,442 Frame(Offscreen.Canvas, X - 1, yImp - 1, X + xSizeSmall, 443 443 yImp + ySizeSmall, MainTexture.ColorBevelLight, 444 444 MainTexture.ColorBevelShade); 445 BitBltCanvas( offscreen.Canvas, x, yImp, xSizeSmall, ySizeSmall,446 SmallImp.Canvas, jmod 7 * xSizeSmall,447 ( j+ SystemIconLines * 7) div 7 * ySizeSmall);448 inc(x, xSizeSmall + 4);445 BitBltCanvas(Offscreen.Canvas, X, yImp, xSizeSmall, ySizeSmall, 446 SmallImp.Canvas, J mod 7 * xSizeSmall, 447 (J + SystemIconLines * 7) div 7 * ySizeSmall); 448 Inc(X, xSizeSmall + 4); 449 449 end; 450 450 end; … … 454 454 PPicture := @Tribe[mox.owner].ModelPicture[mox.mix]; 455 455 Available := 0; 456 if G.Difficulty[ me] = 0 then // supervisor -- count stacked units too456 if G.Difficulty[Me] = 0 then // supervisor -- count stacked units too 457 457 for Loc := 0 to G.lx * G.ly - 1 do 458 458 begin 459 459 if MyMap[Loc] and fUnit <> 0 then 460 460 begin 461 Server(sGetUnits, me, Loc, Cnt);461 Server(sGetUnits, Me, Loc, Cnt); 462 462 for uix := 0 to Cnt - 1 do 463 463 if IsToCount(MyRO.EnemyUn[MyRO.nEnemyUn + uix].emix) then 464 inc(Available);464 Inc(Available); 465 465 end; 466 466 end … … 469 469 if (MyRO.EnemyUn[uix].Loc >= 0) and IsToCount(MyRO.EnemyUn[uix].emix) 470 470 then 471 inc(Available);471 Inc(Available); 472 472 Destroyed := 0; 473 473 for emix := 0 to MyRO.nEnemyModel - 1 do 474 474 if IsToCount(emix) then 475 inc(Destroyed, MyRO.EnemyModel[emix].Lost);475 Inc(Destroyed, MyRO.EnemyModel[emix].Lost); 476 476 end 477 477 else … … 480 480 for uix := 0 to MyRO.nUn - 1 do 481 481 if (MyUn[uix].Loc >= 0) and (MyUn[uix].mix = mixShow) then 482 inc(Available);482 Inc(Available); 483 483 InProd := 0; 484 484 for cix := 0 to MyRO.nCity - 1 do 485 485 if (MyCity[cix].Loc >= 0) and 486 486 (MyCity[cix].Project and (cpImp + cpIndex) = mixShow) then 487 inc(InProd);488 end; 489 490 offscreen.Canvas.Font.Assign(UniFont[ftSmall]);487 Inc(InProd); 488 end; 489 490 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 491 491 if Kind in [dkEnemyCityDefense, dkEnemyCity] then 492 492 begin 493 NoMap.SetOutput( offscreen);494 NoMap.PaintCity(ClientWidth div 2, 53, MyRO.EnemyCity[ecixShow], false);495 496 s:= Tribe[MyRO.EnemyCity[ecixShow].owner].TPhrase('UNITOWNER');497 LoweredTextOut( offscreen.Canvas, -1, MainTexture,498 (ClientWidth - BiColorTextWidth( offscreen.Canvas, s)) div 2, 105, s);493 NoMap.SetOutput(Offscreen); 494 NoMap.PaintCity(ClientWidth div 2, 53, MyRO.EnemyCity[ecixShow], False); 495 496 S := Tribe[MyRO.EnemyCity[ecixShow].owner].TPhrase('UNITOWNER'); 497 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 498 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 105, S); 499 499 end; 500 500 … … 502 502 begin // show unit stats 503 503 if Kind = dkOwnModel then 504 MakeModelInfo( me, mixShow, MyModel[mixShow], mi)504 MakeModelInfo(Me, mixShow, MyModel[mixShow], mi) 505 505 else if Kind = dkOwnUnit then 506 506 begin 507 MakeUnitInfo( me, MyUn[uixShow], ui);508 MakeModelInfo( me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi);507 MakeUnitInfo(Me, MyUn[uixShow], ui); 508 MakeModelInfo(Me, MyUn[uixShow].mix, MyModel[MyUn[uixShow].mix], mi); 509 509 end 510 510 else … … 522 522 { Frame(offscreen.canvas,xView-1,yView-1,xView+64,yView+48, 523 523 MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); 524 RFrame( offscreen.canvas,xView-2,yView-2,xView+65,yView+49,524 RFrame(Offscreen.Canvas,xView-2,yView-2,xView+65,yView+49, 525 525 MainTexture.ColorBevelShade,MainTexture.ColorBevelLight); } 526 with offscreen.Canvas do526 with Offscreen.Canvas do 527 527 begin 528 528 Brush.Color := HGrSystem.Data.Canvas.Pixels[98, 67]; 529 offscreen.Canvas.FillRect(Rect(xView, yView, xView + 64,529 Offscreen.Canvas.FillRect(Rect(xView, yView, xView + 64, 530 530 yView + 16)); 531 531 Brush.Style := bsClear; … … 534 534 if MyMap[Loc] and fTerrain >= fForest then 535 535 begin 536 x:= 1 + 2 * (xxt * 2 + 1);537 y:= 1 + yyt + 2 * (yyt * 3 + 1);536 X := 1 + 2 * (xxt * 2 + 1); 537 Y := 1 + yyt + 2 * (yyt * 3 + 1); 538 538 end 539 539 else 540 540 begin 541 x := integer(MyMap[Loc] and fTerrain) * (xxt * 2 + 1) + 1;542 y:= 1 + yyt;541 X := Integer(MyMap[Loc] and fTerrain) * (xxt * 2 + 1) + 1; 542 Y := 1 + yyt; 543 543 end; 544 for j:= -1 to 1 do545 for i:= -1 to 1 do546 if ( i + j) and 1 = 0 then544 for J := -1 to 1 do 545 for I := -1 to 1 do 546 if (I + J) and 1 = 0 then 547 547 begin 548 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2,549 yyt * 2, x, y);548 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, 549 yyt * 2, X, Y); 550 550 if MyMap[Loc] and (fTerrain or fSpecial) = fGrass or fSpecial1 551 551 then 552 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2, yyt * 2,552 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, yyt * 2, 553 553 1 + 2 * (xxt * 2 + 1), 1 + yyt + 1 * (yyt * 3 + 1)) 554 554 else if (MyMap[Loc] and fTerrain = fForest) and 555 555 IsJungle(Loc div G.lx) then 556 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2, yyt * 2,556 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, yyt * 2, 557 557 1 + 7 * (xxt * 2 + 1), 1 + yyt + 19 * (yyt * 3 + 1)) 558 558 else if MyMap[Loc] and fTerrain >= fForest then 559 Sprite(Buffer, HGrTerrain, i * xxt, j* yyt, xxt * 2, yyt * 2,559 Sprite(Buffer, HGrTerrain, I * xxt, J * yyt, xxt * 2, yyt * 2, 560 560 1 + 7 * (xxt * 2 + 1), 561 1 + yyt + 2 * integer(2 + MyMap[Loc] and fTerrain - fForest)561 1 + yyt + 2 * Integer(2 + MyMap[Loc] and fTerrain - fForest) 562 562 * (yyt * 3 + 1)); 563 563 end; 564 BitBltCanvas( offscreen.Canvas, xView, yView + 16, 64, 32,564 BitBltCanvas(Offscreen.Canvas, xView, yView + 16, 64, 32, 565 565 Buffer.Canvas, 1, 0); 566 566 567 567 // show unit, experience and health 568 Sprite( offscreen, HGr, xView, yView, 64, 48, pix mod 10 * 65 + 1,568 Sprite(Offscreen, HGr, xView, yView, 64, 48, pix mod 10 * 65 + 1, 569 569 pix div 10 * 49 + 1); 570 570 if Flags and unFortified <> 0 then 571 Sprite( offscreen, HGrStdUnits, xView, yView, xxu * 2, yyu * 2,571 Sprite(Offscreen, HGrStdUnits, xView, yView, xxu * 2, yyu * 2, 572 572 1 + 6 * (xxu * 2 + 1), 1); 573 FrameImage( offscreen.Canvas, HGrSystem.Data, xView - 20,573 FrameImage(Offscreen.Canvas, HGrSystem.Data, xView - 20, 574 574 yView + 5, 12, 14, 121 + Exp div ExpCost * 13, 28); 575 575 if Health < 100 then 576 576 begin 577 s:= IntToStr(Health) + '%';578 LightGradient( offscreen.Canvas, xView - 45, yView + 24, 38,577 S := IntToStr(Health) + '%'; 578 LightGradient(Offscreen.Canvas, xView - 45, yView + 24, 38, 579 579 (ColorOfHealth(Health) and $FEFEFE shr 2) * 3); 580 RisedTextout( offscreen.Canvas, xView - 45 + 20 -581 BiColorTextWidth( offscreen.Canvas, s) div 2, yView + 23, s);580 RisedTextout(Offscreen.Canvas, xView - 45 + 20 - 581 BiColorTextWidth(Offscreen.Canvas, S) div 2, yView + 23, S); 582 582 end; 583 583 584 584 if Kind = dkEnemyUnit then 585 585 begin 586 s:= Tribe[mox.owner].TPhrase('UNITOWNER');587 LoweredTextOut( offscreen.Canvas, -1, MainTexture,588 (ClientWidth - BiColorTextWidth( offscreen.Canvas, s)) div 2,589 yView + 80, s);586 S := Tribe[mox.owner].TPhrase('UNITOWNER'); 587 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, 588 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2, 589 yView + 80, S); 590 590 end; 591 591 end 592 592 else 593 593 begin 594 FrameImage( offscreen.Canvas, BigImp, xView + 4, yView, 56, 40, 0, 0);595 Sprite( offscreen, HGr, xView, yView - 4, 64, 44, pix mod 10 * 65 + 1,594 FrameImage(Offscreen.Canvas, BigImp, xView + 4, yView, 56, 40, 0, 0); 595 Sprite(Offscreen, HGr, xView, yView - 4, 64, 44, pix mod 10 * 65 + 1, 596 596 pix div 10 * 49 + 1); 597 597 end; 598 598 599 DarkGradient( offscreen.Canvas, xTotal - 6, yTotal + 1, 180, 2);600 RisedTextout( offscreen.Canvas, xTotal - 2, yTotal,599 DarkGradient(Offscreen.Canvas, xTotal - 6, yTotal + 1, 180, 2); 600 RisedTextout(Offscreen.Canvas, xTotal - 2, yTotal, 601 601 Phrases.Lookup('UNITSTRENGTH')); 602 s:= IntToStr(mi.Attack) + '/' + IntToStr(mi.Defense);603 RisedTextout( offscreen.Canvas,604 xTotal + 170 - BiColorTextWidth( offscreen.Canvas, s), yTotal, s);605 FeatureBar( offscreen, xTotal, yTotal + 19, mi, MainTexture);606 NumberBarS( offscreen, xTotal, yTotal + 38, Phrases.Lookup('UNITSPEED'),602 S := IntToStr(mi.Attack) + '/' + IntToStr(mi.Defense); 603 RisedTextout(Offscreen.Canvas, 604 xTotal + 170 - BiColorTextWidth(Offscreen.Canvas, S), yTotal, S); 605 FeatureBar(Offscreen, xTotal, yTotal + 19, mi, MainTexture); 606 NumberBarS(Offscreen, xTotal, yTotal + 38, Phrases.Lookup('UNITSPEED'), 607 607 MovementToString(mi.Speed), MainTexture); 608 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2, yTotal + 57,608 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, yTotal + 57, 609 609 Phrases.Lookup('UNITCOST')); 610 DLine( offscreen.Canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16,610 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 170, yTotal + 57 + 16, 611 611 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 612 if G.Difficulty[ me] = 0 then613 s:= IntToStr(mi.cost)612 if G.Difficulty[Me] = 0 then 613 S := IntToStr(mi.cost) 614 614 else 615 s := IntToStr(mi.cost * BuildCostMod[G.Difficulty[me]] div 12);616 RisedTextout( offscreen.Canvas,617 xTotal + 159 - BiColorTextWidth( offscreen.Canvas, s), yTotal + 57, s);618 Sprite( offscreen, HGrSystem, xTotal + 160, yTotal + 57 + 5, 10,615 S := IntToStr(mi.cost * BuildCostMod[G.Difficulty[Me]] div 12); 616 RisedTextout(Offscreen.Canvas, 617 xTotal + 159 - BiColorTextWidth(Offscreen.Canvas, S), yTotal + 57, S); 618 Sprite(Offscreen, HGrSystem, xTotal + 160, yTotal + 57 + 5, 10, 619 619 10, 88, 115); 620 620 … … 624 624 begin 625 625 if MyModel[mixShow].Kind = mkEnemyDeveloped then 626 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2,626 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, 627 627 (yTotal + StatDown - 19), Phrases.Lookup('UNITADOPT')) 628 628 else 629 LoweredTextOut( offscreen.Canvas, -1, MainTexture, xTotal - 2,629 LoweredTextOut(Offscreen.Canvas, -1, MainTexture, xTotal - 2, 630 630 (yTotal + StatDown - 19), Phrases.Lookup('UNITINTRO')); 631 DLine( offscreen.Canvas, xTotal - 2, xTotal + 170,631 DLine(Offscreen.Canvas, xTotal - 2, xTotal + 170, 632 632 (yTotal + StatDown - 19) + 16, MainTexture.ColorTextShade, 633 633 MainTexture.ColorTextLight); 634 s:= TurnToString(MyModel[mixShow].IntroTurn);635 RisedTextout( offscreen.Canvas,636 xTotal + 170 - BiColorTextWidth( offscreen.Canvas, s),637 (yTotal + StatDown - 19), s);634 S := TurnToString(MyModel[mixShow].IntroTurn); 635 RisedTextout(Offscreen.Canvas, 636 xTotal + 170 - BiColorTextWidth(Offscreen.Canvas, S), 637 (yTotal + StatDown - 19), S); 638 638 end; 639 639 640 NumberBar( offscreen, xTotal, yTotal + StatDown,640 NumberBar(Offscreen, xTotal, yTotal + StatDown, 641 641 Phrases.Lookup('UNITBUILT'), MyModel[mixShow].Built, MainTexture); 642 642 if MyModel[mixShow].Lost > 0 then 643 NumberBar( offscreen, xTotal, yTotal + StatDown + 19,643 NumberBar(Offscreen, xTotal, yTotal + StatDown + 19, 644 644 Phrases.Lookup('UNITLOST'), MyModel[mixShow].Lost, MainTexture); 645 645 if InProd > 0 then 646 NumberBar( offscreen, xTotal, yTotal + StatDown + 57,646 NumberBar(Offscreen, xTotal, yTotal + StatDown + 57, 647 647 Phrases.Lookup('UNITINPROD'), InProd, MainTexture); 648 648 if Available > 0 then 649 NumberBar( offscreen, xTotal, yTotal + StatDown + 38,649 NumberBar(Offscreen, xTotal, yTotal + StatDown + 38, 650 650 Phrases.Lookup('UNITAVAILABLE'), Available, MainTexture); 651 651 … … 674 674 begin 675 675 if Destroyed > 0 then 676 NumberBar( offscreen, xTotal, yTotal + StatDown - 19,676 NumberBar(Offscreen, xTotal, yTotal + StatDown - 19, 677 677 Phrases.Lookup('UNITDESTROYED'), Destroyed, MainTexture); 678 678 if Available > 0 then 679 NumberBar( offscreen, xTotal, yTotal + StatDown,679 NumberBar(Offscreen, xTotal, yTotal + StatDown, 680 680 Phrases.Lookup('UNITKNOWN'), Available, MainTexture); 681 681 end; … … 683 683 end; 684 684 685 offscreen.Canvas.Font.Assign(UniFont[ftNormal]);685 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 686 686 case Kind of 687 687 dkOwnModel, dkEnemyModel: … … 692 692 yCaption := 79; 693 693 end; 694 RisedTextout( offscreen.Canvas,695 (ClientWidth - BiColorTextWidth( offscreen.Canvas, Caption)) div 2,694 RisedTextout(Offscreen.Canvas, 695 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, Caption)) div 2, 696 696 yCaption, Caption); 697 697 end; -
trunk/LocalPlayer/Wonders.pas
r442 r447 23 23 Selection: Integer; 24 24 Center: TPoint; 25 procedure DarkIcon( i: Integer);26 procedure Glow( i, GlowColor: Integer);25 procedure DarkIcon(I: Integer); 26 procedure Glow(I, GlowColor: Integer); 27 27 procedure PaintBackgroundShape; 28 28 public … … 116 116 for Y := 0 to Height - 1 do begin 117 117 for X := 0 to Width - 1 do begin 118 r:= X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4));118 R := X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4)); 119 119 ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y; 120 if ( r< ScaleToNative(8) * Height * Width * Width) and121 (( r>= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and120 if (R < ScaleToNative(8) * Height * Width * Width) and 121 ((R >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and 122 122 ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and 123 123 ((ax < amax1 * X) or (ax > amin3 * X))) then begin 124 124 for ch := 0 to 2 do begin 125 c:= Line[0].Pixel^.Planes[ch] - Darken;126 if c< 0 then Line[0].Pixel^.Planes[ch] := 0127 else Line[0].Pixel^.Planes[ch] := c;128 c:= Line[1].Pixel^.Planes[ch] - Darken;129 if c< 0 then Line[1].Pixel^.Planes[ch] := 0130 else Line[1].Pixel^.Planes[ch] := c;131 c:= Line[2].Pixel^.Planes[ch] - Darken;132 if c< 0 then Line[2].Pixel^.Planes[ch] := 0133 else Line[2].Pixel^.Planes[ch] := c;134 c:= Line[3].Pixel^.Planes[ch] - Darken;135 if c< 0 then Line[3].Pixel^.Planes[ch] := 0136 else Line[3].Pixel^.Planes[ch] := c;125 C := Line[0].Pixel^.Planes[ch] - Darken; 126 if C < 0 then Line[0].Pixel^.Planes[ch] := 0 127 else Line[0].Pixel^.Planes[ch] := C; 128 C := Line[1].Pixel^.Planes[ch] - Darken; 129 if C < 0 then Line[1].Pixel^.Planes[ch] := 0 130 else Line[1].Pixel^.Planes[ch] := C; 131 C := Line[2].Pixel^.Planes[ch] - Darken; 132 if C < 0 then Line[2].Pixel^.Planes[ch] := 0 133 else Line[2].Pixel^.Planes[ch] := C; 134 C := Line[3].Pixel^.Planes[ch] - Darken; 135 if C < 0 then Line[3].Pixel^.Planes[ch] := 0 136 else Line[3].Pixel^.Planes[ch] := C; 137 137 end; 138 138 end; … … 150 150 end; 151 151 152 procedure TWondersDlg.DarkIcon( i: Integer);153 var 154 X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, c: Integer;152 procedure TWondersDlg.DarkIcon(I: Integer); 153 var 154 X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, C: Integer; 155 155 Src, Dst: TPixelPointer; 156 156 begin 157 157 Offscreen.BeginUpdate; 158 x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[ i].X;159 y0Dst := ClientHeight div 2 - ySizeBig div 2 + RingPosition[ i].Y;160 x0Src := ( imod 7) * xSizeBig;161 y0Src := ( idiv 7 + SystemIconLines) * ySizeBig;158 x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[I].X; 159 y0Dst := ClientHeight div 2 - ySizeBig div 2 + RingPosition[I].Y; 160 x0Src := (I mod 7) * xSizeBig; 161 y0Src := (I div 7 + SystemIconLines) * ySizeBig; 162 162 Src := PixelPointer(BigImp, ScaleToNative(x0Src), ScaleToNative(y0Src)); 163 163 Dst := PixelPointer(Offscreen, ScaleToNative(x0Dst), ScaleToNative(y0Dst)); … … 167 167 15 + (255 - Src.Pixel^.R) * 9) div 128; 168 168 for ch := 0 to 2 do begin 169 c:= Dst.Pixel^.Planes[ch] - Darken;170 if c< 0 then Dst.Pixel^.Planes[ch] := 0171 else Dst.Pixel^.Planes[ch] := c;169 C := Dst.Pixel^.Planes[ch] - Darken; 170 if C < 0 then Dst.Pixel^.Planes[ch] := 0 171 else Dst.Pixel^.Planes[ch] := C; 172 172 end; 173 173 Src.NextPixel; … … 180 180 end; 181 181 182 procedure TWondersDlg.Glow( i, GlowColor: Integer);182 procedure TWondersDlg.Glow(I, GlowColor: Integer); 183 183 begin 184 184 GlowFrame(Offscreen, 185 ClientWidth div 2 - xSizeBig div 2 + RingPosition[ i].X,186 ClientHeight div 2 - ySizeBig div 2 + RingPosition[ i].Y,185 ClientWidth div 2 - xSizeBig div 2 + RingPosition[I].X, 186 ClientHeight div 2 - ySizeBig div 2 + RingPosition[I].Y, 187 187 xSizeBig, ySizeBig, GlowColor); 188 188 end;
Note:
See TracChangeset
for help on using the changeset viewer.