Changeset 425 for trunk/CityProcessing.pas
- Timestamp:
- Apr 26, 2022, 7:34:12 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CityProcessing.pas
r328 r425 34 34 procedure ReleaseGame; 35 35 36 36 37 implementation 37 38 38 39 type 39 40 TTradeProcessing = record 40 TaxBonus, LuxBonus, ScienceBonus, FutResBonus, ScienceDoubling, 41 HappyBase: integer; 42 RelCorr: single; 43 FlexibleLuxury: boolean; 41 TaxBonus: Integer; 42 LuxBonus: Integer; 43 ScienceBonus: Integer; 44 FutResBonus: Integer; 45 ScienceDoubling: Integer; 46 HappyBase: Integer; 47 RelCorr: Single; 48 FlexibleLuxury: Boolean; 44 49 end; 45 50 46 51 TProdProcessing = record 47 ProdBonus, PollBonus, FutProdBonus, PollThreshold: integer; 52 ProdBonus: Integer; 53 PollBonus: Integer; 54 FutProdBonus: Integer; 55 PollThreshold: Integer; 48 56 end; 49 57 … … 51 59 52 60 TCityReportEx = record 53 BaseHappiness, BaseControl, Material: integer; 61 BaseHappiness: Integer; 62 BaseControl: Integer; 63 Material: Integer; 54 64 ProdProcessing: TProdProcessing; 55 65 TradeProcessing: TTradeProcessing; … … 59 69 MaxDist: integer; 60 70 61 62 63 64 71 { 72 Reporting 73 ____________________________________________________________________ 74 } 65 75 procedure GetCityAreaInfo(p, Loc: integer; var CityAreaInfo: TCityAreaInfo); 66 76 var … … 88 98 Available[V21] := faNotAvailable 89 99 else 90 Available[V21] := faAvailable 91 end 92 end; 93 end 100 Available[V21] := faAvailable; 101 end; 102 end; 103 end; 94 104 end; 95 105 … … 224 234 RelCorr := 1.0; 225 235 HappyBase := Size + HappinessBeforeLux; 226 end 236 end; 227 237 end; 228 238 … … 280 290 result := result - 3 * i; 281 291 if result <= 0 then 282 result := i 292 result := i; 283 293 end 284 294 else if RW[p].Model[Project and cpIndex].Cap[mcLine] > 0 then … … 287 297 result := result shr 1 288 298 else 289 result := result * 2 299 result := result * 2; 290 300 end 291 301 else … … 297 307 end; 298 308 result := result * BuildCostMod[Difficulty[p]] div 12; 299 end 309 end; 300 310 end; 301 311 … … 330 340 begin 331 341 Happy := Size; 332 Control := Size 342 Control := Size; 333 343 end // !!! old bug, kept for compatibility 334 344 else 335 345 begin 336 346 Happy := 0; 337 Control := 0 347 Control := 0; 338 348 end; 339 349 … … 374 384 begin 375 385 inc(Happy); 376 inc(BaseHappiness, 2) 386 inc(BaseHappiness, 2); 377 387 end; 378 388 if Built[imTemple] = 1 then 379 389 begin 380 390 inc(Happy); 381 inc(BaseHappiness, 2) 391 inc(BaseHappiness, 2); 382 392 end; 383 393 if Built[imCathedral] = 1 then … … 388 398 begin 389 399 inc(Happy); 390 inc(BaseHappiness, 2) 400 inc(BaseHappiness, 2); 391 401 end; 392 402 end; … … 394 404 begin 395 405 inc(Happy, 2); 396 inc(BaseHappiness, 4) 406 inc(BaseHappiness, 4); 397 407 end; 398 408 … … 433 443 begin 434 444 inc(Happy); 435 inc(Control, 2) 445 inc(Control, 2); 436 446 end; 437 447 gFundamentalism: … … 439 449 BaseHappiness := 0; // done by control 440 450 Happy := Size; 441 Control := Size 451 Control := Size; 442 452 end; 443 453 end; … … 463 473 begin 464 474 result := eInvalid; 465 exit 475 exit; 466 476 end; 467 477 GetTileInfo(p, cix, Loc1, TileInfo); … … 472 482 (RW[p].Tech[adMassProduction] >= tsApplicable) then 473 483 inc(RareOK[RealMap[Loc1] shr 25 and 3]); 474 inc(Working) 484 inc(Working); 475 485 end; 476 486 if Built[imAlgae] = 1 then … … 501 511 end; 502 512 result := eOk; 503 end; { GetSmallCityReport }513 end; 504 514 505 515 function GetCityReport(p, cix: integer; var CityReport: TCityReport): integer; … … 582 592 SelectedLoc := Loc1; 583 593 SelectedV21 := V21; 584 Most := Resources 585 end 586 end 587 end 594 Most := Resources; 595 end; 596 end; 597 end; 588 598 end; 589 599 end; … … 617 627 SelectedLoc := Loc1; 618 628 SelectedV21 := V21; 619 Least := Resources 620 end 621 end; 622 end 623 end 629 Least := Resources; 630 end; 631 end; 632 end; 633 end; 624 634 end; 625 635 … … 680 690 assert(1 shl V21 and Tiles = 0); 681 691 Tiles := Tiles or (1 shl V21); 682 UsedByCity[TileLoc] := Loc 683 end 692 UsedByCity[TileLoc] := Loc; 693 end; 684 694 end; 685 695 … … 704 714 assert(1 shl V21 and Tiles = 0); 705 715 Tiles := Tiles or (1 shl V21); 706 UsedByCity[TileLoc] := Loc 707 end 708 end; 709 end 716 UsedByCity[TileLoc] := Loc; 717 end; 718 end; 719 end; 710 720 end; 711 721 … … 729 739 assert(1 shl V21 and Tiles <> 0); 730 740 Tiles := Tiles and not(1 shl V21); 731 UsedByCity[TileLoc] := -1 741 UsedByCity[TileLoc] := -1; 732 742 end 733 743 else { test whether exploitation of tile would lead to disorder } … … 742 752 assert(1 shl V21 and Tiles <> 0); 743 753 Tiles := Tiles and not(1 shl V21); 744 UsedByCity[TileLoc] := -1 745 end 746 end; 747 end 754 UsedByCity[TileLoc] := -1; 755 end; 756 end; 757 end; 748 758 end; 749 759 … … 760 770 inc(Flags, chPollution); 761 771 RealMap[PollutionLoc] := RealMap[PollutionLoc] or fPoll; 762 end 772 end; 763 773 end; 764 774 end; … … 790 800 GrWallContinent[p] := -1; 791 801 end; 792 inc(Flags, chImprovementLost) 793 end 802 inc(Flags, chImprovementLost); 803 end; 794 804 end; 795 805 end; … … 846 856 begin 847 857 inc(Money, Prod - CityProjectCost); 848 Prod := CityProjectCost 858 Prod := CityProjectCost; 849 859 end; 850 860 if Production < 0 then … … 888 898 begin 889 899 if CanCityGrow(p, cix) then 890 inc(SizeMod) 900 inc(SizeMod); 891 901 end 892 902 else if CheckGrow and (Food >= CityStorage) then { normal growth } … … 898 908 else 899 909 dec(Food, CityStorage); 900 inc(SizeMod) 901 end 910 inc(SizeMod); 911 end; 902 912 end 903 913 else if Food < 0 then { famine } … … 924 934 begin 925 935 dec(SizeMod); 926 inc(Flags, chPopDecrease) 936 inc(Flags, chPopDecrease); 927 937 end 928 938 end; … … 954 964 begin 955 965 uix := i; 956 Det := TestDet 966 Det := TestDet; 957 967 end; 958 968 end; … … 961 971 RemoveUnit_UpdateMap(p, uix); 962 972 inc(Flags, chUnitLost); 963 end 964 end 973 end; 974 end; 965 975 end; 966 976 … … 1008 1018 Exp := ExpCost * 2; { vet } 1009 1019 if Project and cpConscripts <> 0 then 1010 Flags := Flags or unConscripts 1020 Flags := Flags or unConscripts; 1011 1021 end; 1012 1022 PlaceUnit(p, nUn - 1); … … 1065 1075 if (City[cix2].Loc >= 0) and (City[cix2].Built[i] = 1) 1066 1076 then 1067 GWonder[i].EffectiveOwner := p 1077 GWonder[i].EffectiveOwner := p; 1068 1078 end; 1069 1079 woLighthouse: … … 1085 1095 IntroduceEnemy(p, p1); 1086 1096 GiveCivilReport(p, p1); 1087 GiveMilReport(p, p1) 1097 GiveMilReport(p, p1); 1088 1098 end; 1089 end 1099 end; 1090 1100 end; 1091 1101 end; … … 1113 1123 end; 1114 1124 Prod0 := Prod; 1115 inc(Flags, chProduction) 1125 inc(Flags, chProduction); 1116 1126 end 1117 1127 else … … 1133 1143 begin 1134 1144 CityShrink(p, cix); 1135 inc(SizeMod) 1136 end; 1137 end 1138 end; // CityTurn1145 inc(SizeMod); 1146 end; 1147 end; 1148 end; 1139 1149 1140 1150 { … … 1179 1189 begin 1180 1190 result := eTileNotAvailable; 1181 exit 1191 exit; 1182 1192 end; 1183 1193 // not more tiles than inhabitants … … 1189 1199 begin 1190 1200 result := eNoWorkerAvailable; 1191 exit 1201 exit; 1192 1202 end; 1193 1203 end; … … 1208 1218 // should only happen during loading, because of wrong sSetCityTiles command order 1209 1219 else 1210 UsedByCity[Loc1] := -1 // unemploy tile1211 end; 1212 Tiles := NewTiles 1213 end 1220 UsedByCity[Loc1] := -1; // unemploy tile 1221 end; 1222 Tiles := NewTiles; 1223 end; 1214 1224 end; 1215 1225 end; … … 1223 1233 type 1224 1234 TTileData = record 1225 Food, Prod, Trade, SubValue, V21: integer; 1235 Food: Integer; 1236 Prod: Integer; 1237 Trade: Integer; 1238 SubValue: Integer; 1239 V21: Integer; 1226 1240 end; 1227 1241 var … … 1364 1378 (RealMap[Loc1] and fModern = cardinal(NeedRare)) then 1365 1379 RareTiles := RareTiles or (1 shl V21); 1366 end 1380 end; 1367 1381 end; 1368 1382 … … 1654 1668 TestReport.Lux shr 1; 1655 1669 Advice.CityReport := TestReport; 1656 end 1657 end // if (SuperPlus>0) or (ValuePlus>=0.0)1658 end // if SuperPlus>=01659 end 1670 end; 1671 end; // if (SuperPlus>0) or (ValuePlus>=0.0) 1672 end; // if SuperPlus>=0 1673 end; 1660 1674 end; 1661 1675 … … 1691 1705 Advice.Tiles := BestTiles; 1692 1706 Advice.CityReport.HypoTiles := BestTiles; 1693 end; // GetCityTileAdvice1707 end; 1694 1708 1695 1709 {
Note:
See TracChangeset
for help on using the changeset viewer.