Changeset 447 for trunk/LocalPlayer/CityScreen.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.