Changeset 457 for trunk/Protocol.pas
- Timestamp:
- Nov 27, 2023, 12:10:57 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Protocol.pas
r447 r457 18 18 ExpCost = 50; { received damage required for next experience level } 19 19 MaxFutureTech = 25; 20 // maximum number of future techs of one kind except computing technology20 // Maximum number of future techs of one kind except computing technology 21 21 MaxFutureTech_Computing = 100; 22 // maximum number of computing technology future techs22 // Maximum number of computing technology future techs 23 23 CountryRadius = 9; 24 24 MaxCitySize = 30; … … 36 36 CancelTreatyTurns = 3; 37 37 PeaceEvaTurns = 5; 38 // should be less then 2*CancelTreatyTurns, so that you can't attack an ally without re-entering38 // Should be less then 2*CancelTreatyTurns, so that you can't attack an ally without re-entering 39 39 ColdWarTurns = 40; 40 40 DesertThurst = 20; // damage for turn in desert … … 49 49 InitialCredibility = 95; 50 50 51 // aimodule flags (for TInitModuleData.Flags)51 // AI module flags (for TInitModuleData.Flags) 52 52 aiThreaded = $01; 53 53 54 // difficulty settings54 // Difficulty settings 55 55 MaxDiff = 4; { maximum difficulty level } 56 56 StorageSize: array [1 .. MaxDiff] of Integer = (30, 40, 50, 60); … … 59 59 BuildCostMod: array [1 .. MaxDiff] of Integer = (9, 12, 15, 18); // in 1/12 60 60 61 // test flags61 // Test flags 62 62 nTestFlags = 7; // max. 11 63 63 tfAllTechs = $001; { all nations get all techs } … … 70 70 tfTested = $800; // at least one test flag was set 71 71 72 { server commands72 { Server commands 73 73 IMPORTANT: lowest 4 bits must indicate size in DWORDS of data parameter, 74 74 except for request commands } … … 191 191 sSetCityTiles = $7201; 192 192 193 // free command space193 // Free command space 194 194 sctUnused = $3800; 195 195 196 { client commands }196 { Client commands } 197 197 cInitModule = $0000; 198 198 cReleaseModule = $0100; … … 241 241 cRefreshDebugMap = $3F90; 242 242 243 // diplomacy commands equal to server, see below243 // Diplomacy commands equal to server, see below 244 244 245 245 cDebugMessage = $7000; 246 246 cShowNego = $7010; 247 247 248 // commands same for server and client248 // Commands same for server and client 249 249 scContact = $4900; // + concerned player shl 4 for server call 250 250 scReject = $4A00; … … 256 256 scDipBreak = $4BF0; 257 257 258 { server return codes: flags }258 { Server return codes: flags } 259 259 rExecuted = $40000000; 260 260 rEffective = $20000000; … … 262 262 rEnemySpotted = $08000000; 263 263 264 { server return codes: command executed }265 // note: the same return code might have a different meaning for different server functions!264 { Server return codes: command executed } 265 // Note: the same return code might have a different meaning for different server functions! 266 266 eOK = $60000000; // ok 267 267 eEnemySpotted = $68000000; // unit move ok, new enemy unit/city spotted 268 268 eDied = $70000000; // move executed, unit died due to hostile terrain 269 269 eEnemySpotted_Died = $78000000; 270 // unit move ok, new enemy unit/city spotted, unit died due to hostile terrain270 // Unit move ok, new enemy unit/city spotted, unit died due to hostile terrain 271 271 eLoaded = $60000002; // unit move caused loading to transport ship 272 272 eLost = $70000004; // attack executed, battle lost, unit is dead … … 276 276 eExpelled = $60000007; // friendly unit expelled 277 277 eMissionDone = $70000008; 278 // spy moved into city: mission done, spy no longer exists278 // Spy moved into city: mission done, spy no longer exists 279 279 eJobDone = $60000001; // settler job started and already done 280 280 eJobDone_Died = $70000001; 281 // settler job started and already done, unit died due to hostile terrain281 // Settler job started and already done, unit died due to hostile terrain 282 282 eCity = $70000002; // city founded, settler no more exists 283 283 eRemoved = $70000000; // sRemoveUnit: unit removed … … 285 285 286 286 eNotChanged = $40000000; 287 // ok, but no effect (e.g. current city project set again)288 289 { server return codes: command not executed }287 // Ok, but no effect (e.g. current city project set again) 288 289 { Server return codes: command not executed } 290 290 eHiddenUnit = $20000013; 291 // unit move: not possible, destination tile occupied by hidden foreign submarine291 // Unit move: not possible, destination tile occupied by hidden foreign submarine 292 292 eStealthUnit = $2000001A; 293 // unit move: not possible, destination tile occupied by foreign stealth unit293 // Unit move: not possible, destination tile occupied by foreign stealth unit 294 294 eZOC_EnemySpotted = $28000014; 295 // unit move: not possible, new enemy unit spotted, ZOC violation295 // Unit move: not possible, new enemy unit spotted, ZOC violation 296 296 297 297 eInvalid = $0000; // command not allowed now or parameter out of allowed range … … 308 308 309 309 eDomainMismatch = $0011; 310 // move/attack: action not allowed for this unit domain310 // Move/attack: action not allowed for this unit domain 311 311 eNoCapturer = $0012; 312 // unit move: this type of unit is not allowed to capture a city312 // Unit move: this type of unit is not allowed to capture a city 313 313 eZOC = $0014; // unit move: not possible, ZOC violation 314 314 eTreaty = $0015; // move/attack: not possible, peace treaty violation … … 320 320 321 321 eMaxSize = $0020; 322 // add to city: bigger size not allowed due to missing aqueduct/sewer322 // Add to city: bigger size not allowed due to missing aqueduct/sewer 323 323 eNoCityTerrain = $0022; // found city: not possible in this terrain 324 324 eNoBridgeBuilding = $0023; … … 332 332 eNoWorkerAvailable = $0051; 333 333 eOnlyOnce = $0058; 334 // sell/rebuild city improvement: only once per city and turn!334 // Sell/rebuild city improvement: only once per city and turn! 335 335 eObsolete = $0059; // city project: more advanced improvement already exists 336 336 eOutOfControl = $005A; 337 // buy/sell/rebuild improvement: not in anarchy, not in captured cities337 // Buy/sell/rebuild improvement: not in anarchy, not in captured cities 338 338 339 339 eNoWay = $0100; // sGetMoveAdvice: no way found 340 340 341 // chart types341 // Chart types 342 342 nStat = 6; 343 343 stPop = 0; … … 348 348 stWork = 5; 349 349 350 { tile flags: terrain type }350 { Tile flags: terrain type } 351 351 fTerrain = $1F; // mask for terrain type 352 352 fOcean = $00; … … 363 363 fUNKNOWN = fTerrain; 364 364 365 { tile flags: terrain improvements }365 { Tile flags: terrain improvements } 366 366 fTerImp = $0000F000; // mask for terrain improvement 367 367 tiNone = $00000000; … … 372 372 tiBase = $00005000; 373 373 374 { tile flags: add ons }374 { Tile flags: add ons } 375 375 fSpecial = $00000060; 376 376 fSpecial1 = $00000020; … … 389 389 fMercury = $06000000; 390 390 391 { tile flags: redundant helper info }391 { Tile flags: redundant helper info } 392 392 fGrWall = $00010000; // tile protected by great wall 393 393 fSpiedOut = $00020000; … … 400 400 fOwnZoCUnit = $10000000; // own ZoC unit present at this tile 401 401 fInEnemyZoC = $20000000; 402 // tile is adjacent to known foreign ZoC unit (not allied)402 // Tile is adjacent to known foreign ZoC unit (not allied) 403 403 fPeace = $40000000; 404 404 // tile belongs to territory of nation that we are in peace with but not allied 405 405 406 // city project flags406 // City project flags 407 407 cpIndex = $1FF; 408 408 cpConscripts = $200; // produce unit as conscripts 409 409 cpDisbandCity = $400; 410 // allow to disband city when settlers/conscripts are produced410 // Allow to disband city when settlers/conscripts are produced 411 411 cpImp = $800; // 0: index refers to model, 1: index refers to city improvement 412 412 cpRepeat = $1000; … … 414 414 cpAuto = $F000; // for internal use only 415 415 416 // tech status indicators416 // Tech status indicators 417 417 tsNA = -2; 418 418 tsSeen = -1; … … 422 422 tsApplicable = tsResearched; 423 423 424 // nation treaties424 // Nation treaties 425 425 trNoContact = -1; 426 426 trNone = 0; … … 429 429 trAlliance = 4; 430 430 431 // attitudes431 // Attitudes 432 432 nAttitude = 7; 433 433 atHostile = 0; … … 439 439 atEnth = 6; 440 440 441 // offer prices441 // Offer prices 442 442 opChoose = $00000000; 443 443 opCivilReport = $11000000; // + turn + concerned player shl 16 … … 455 455 opMask = $FF000000; 456 456 457 // improvement kinds457 // Improvement kinds 458 458 ikTrGoods = 0; 459 459 ikCommon = 1; … … 464 464 ikNA = $7F; 465 465 466 { model domains }466 { Model domains } 467 467 nDomains = 3; 468 468 dGround = 0; … … 470 470 dAir = 2; 471 471 472 { model kinds }472 { Model kinds } 473 473 mkSelfDeveloped = $00; 474 474 mkEnemyDeveloped = $01; … … 483 483 mkFreight = $24; 484 484 485 { unit flags }485 { Unit flags } 486 486 unFortified = $01; 487 487 unBombsLoaded = $02; … … 491 491 unMulti = $80; 492 492 493 // unit report flags493 // Unit report flags 494 494 urfAlwaysSupport = $01; 495 495 urfDeployed = $02; 496 496 497 // unit moves497 // Unit moves 498 498 umCapturing = $0100; 499 499 umSpyMission = $0200; … … 505 505 umPlaneUnloading = $8000; 506 506 507 { model flags }507 { Model flags } 508 508 mdZOC = $01; 509 509 mdCivil = $02; 510 510 mdDoubleSupport = $04; 511 511 512 { player happened flags }512 { Player happened flags } 513 513 phTech = $01; 514 514 phStealTech = $02; … … 523 523 phGameEnd = $F000; 524 524 525 { city happened flags }525 { City happened flags } 526 526 chDisorder = $01; 527 527 chProduction = $02; … … 541 541 chImprovementSold = $80000000; 542 542 543 { city info flags }543 { City info flags } 544 544 ciCapital = $01; 545 545 ciWalled = $02; … … 549 549 ciSpacePort = $20; 550 550 551 { city tile available values }551 { City tile available values } 552 552 faAvailable = 0; 553 553 faNotAvailable = 1; … … 556 556 faInvalid = $FF; 557 557 558 // battle history flags558 // Battle history flags 559 559 bhEnemyAttack = $01; 560 560 bhMyUnitLost = $02; 561 561 bhEnemyUnitLost = $04; 562 562 563 { move advice special destinations }563 { Move advice special destinations } 564 564 maNextCity = -1; 565 565 566 { goverment forms }566 { Goverment forms } 567 567 nGov = 8; 568 568 gAnarchy = 0; … … 575 575 gFuture = 7; 576 576 577 // ship change reasons577 // Ship change reasons 578 578 scrProduction = 0; 579 579 scrDestruction = 1; … … 581 581 scrCapture = 3; 582 582 583 { unit jobs }583 { Unit jobs } 584 584 nJob = 15; 585 585 jNone = 0; … … 599 599 jCity = 14; 600 600 601 // job preconditions are:601 // Job preconditions are: 602 602 // technology JobPreq is available, no city, plus the following: 603 603 // jRoad: no river when bridge building unavailable … … 614 614 // jCity, jFort, jBase: none 615 615 616 // spy mission616 // Spy mission 617 617 nSpyMission = 5; 618 618 smSabotageProd = 0; … … 622 622 smStealMilReport = 4; 623 623 624 // resource weights624 // Resource weights 625 625 rwOff = $00000000; 626 626 rwMaxGrowth = $3F514141; // 120*F + 1/8*P + 1/16*T + 1/16*S … … 630 630 rwForceScience = $F1010101; // F^1/2 * (1*P + 1*T + 1*S) 631 631 632 { advances }632 { Advances } 633 633 adAdvancedFlight = 0; 634 634 adAmphibiousWarfare = 1; … … 731 731 adMilitary = $800; // Military Research 732 732 733 { wonders }733 { Wonders } 734 734 woPyramids = 00; 735 735 woZeus = 01; … … 752 752 woMir = 20; 753 753 754 { city improvements }754 { City improvements } 755 755 imTrGoods = 28; 756 756 imBarracks = 29; … … 801 801 // in 1/2*city size 802 802 803 // special prerequisite values803 // Special prerequisite values 804 804 preNone = -1; 805 805 preLighthouse = -2; … … 813 813 adExplosives, adConstruction, preNone, adMedicine, preNone, preNone); 814 814 815 AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of Integer = { advance prerequisites }815 AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of Integer = { Advance prerequisites } 816 816 ((adFlight, adRobotics, preNone), // adAdvancedFlight 817 817 (adNavigation, adTactics, preNone), // adAmphibiousWarfare … … 910 910 (adSmartWeapons, preNone, preNone)); // futMissileTechnology 911 911 912 Imp: array [0 .. nImp - 1] of // city improvements912 Imp: array [0 .. nImp - 1] of // City improvements 913 913 record 914 914 Kind: Integer; … … 1019 1019 (NewImp: imMilAcademy; OldImp: imBarracks)); 1020 1020 1021 // colony ship1021 // Colony ship 1022 1022 nShipPart = 3; 1023 1023 spComp = 0; … … 1099 1099 TradeRes: (0, 0, 7); Filler: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); { Mou } 1100 1100 1101 // settler work required MP1101 // Settler work required MP 1102 1102 PillageWork = 100; 1103 1103 CityWork = 900; … … 1112 1112 PollWork = 1800; 1113 1113 1114 // upgrades for new unit models1114 // Upgrades for new unit models 1115 1115 // upgrade[domain,0].preq is domain precondition advance 1116 1116 // cost values accumulate if prerequisite is future tech / are maximized if not 1117 1117 nUpgrade = 15; 1118 upgrade: array [0 .. nDomains - 1, 0 ..nUpgrade - 1] of record1118 Upgrade: array [0..nDomains - 1, 0..nUpgrade - 1] of record 1119 1119 Preq: Integer; 1120 1120 Strength: Integer; … … 1168 1168 (Preq: preNA; Strength: 0; Trans: 0; Cost: 0))); 1169 1169 1170 { model features }1170 { Model features } 1171 1171 nFeature = 27; 1172 1172 mcWeapons = 0; … … 1200 1200 AutoFeature: set of mcFirstNonCap .. nFeature - 1 = [mcNav, mcSE, mcNP, mcJet, 1201 1201 mcAcademy]; 1202 // unit class advances, automatically applied if available1203 1204 Feature: array [0 .. nFeature - 1] of { unit model features }1202 // Unit class advances, automatically applied if available 1203 1204 Feature: array [0 .. nFeature - 1] of { Unit model features } 1205 1205 record 1206 1206 Domains: Integer; … … 1243 1243 INFIN = 999999; 1244 1244 1245 // for backward compatibility1245 // For backward compatibility 1246 1246 fRare = fDeadLands; 1247 1247 fRare1 = fCobalt; … … 1322 1322 cmRefreshDebugMap = $3F90, 1323 1323 1324 // diplomacy commands equal to server, see below1324 // Diplomacy commands equal to server, see below 1325 1325 1326 1326 cmDebugMessage = $7000, … … 1385 1385 Cost: Word; 1386 1386 MStrength: Word; 1387 // construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped1387 // Construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped 1388 1388 MTrans: Byte; 1389 1389 MCost: Byte; 1390 1390 Weight: Byte; 1391 1391 MaxWeight: Byte; 1392 // weight and maximum weight (construction time)1392 // Weight and maximum weight (construction time) 1393 1393 Upgrades: Cardinal; // bitarray indicating all upgrades 1394 1394 Flags: Cardinal; … … 1525 1525 TCityReportNew = record 1526 1526 HypoTiles: Integer; 1527 // tiles that should be considered as exploited (for the current adjustment, set this to -1 or to TCity.Tiles of the city)1527 // Tiles that should be considered as exploited (for the current adjustment, set this to -1 or to TCity.Tiles of the city) 1528 1528 HypoTaxRate: Integer; 1529 1529 HypoLuxuryRate: Integer; 1530 // tax and luxury rate that should be assumed (for current rates, set this to -1 or to RO.TaxRate resp. RO.LuxRate)1530 // Tax and luxury rate that should be assumed (for current rates, set this to -1 or to RO.TaxRate resp. RO.LuxRate) 1531 1531 Morale: Integer; 1532 1532 FoodSupport: Integer; 1533 1533 MaterialSupport: Integer; 1534 // food and material taken for unit support1534 // Food and material taken for unit support 1535 1535 ProjectCost: Integer; // material cost of current project 1536 1536 Storage: Integer; // size of food storage … … 1540 1540 CollectedMaterial: Integer; 1541 1541 CollectedTrade: Integer; 1542 // raw control, food, material and trade as collected by the citizens1542 // Raw control, food, material and trade as collected by the citizens 1543 1543 Working: Integer; // number of exploited tiles including city tile 1544 1544 FoodSurplus: Integer; 1545 1545 Production: Integer; 1546 1546 AddPollution: Integer; 1547 // food surplus, production gain and pollution after all effects1547 // Food surplus, production gain and pollution after all effects 1548 1548 Corruption: Integer; 1549 1549 Tax: Integer; 1550 1550 Science: Integer; 1551 1551 Luxury: Integer; 1552 // corruption, tax, science and wealth after all effects1552 // Corruption, tax, science and wealth after all effects 1553 1553 HappinessBalance: Integer; 1554 1554 // = (Morale+Wealth+Control) - (Size+Unrest), value < 0 means disorder … … 1600 1600 Movement: Integer; 1601 1601 EndHealthDef: Integer; 1602 EndHealthAtt: Integer; // must be same as in TBattleForecast1602 EndHealthAtt: Integer; // Must be same as in TBattleForecast 1603 1603 AStr: Integer; 1604 1604 DStr: Integer; … … 1665 1665 Data: Pointer; 1666 1666 Map: ^TTileList; 1667 { the playground, a list of tiles with index = location, see tile flags }1667 { The playground, a list of tiles with index = location, see tile flags } 1668 1668 MapObservedLast: ^TTileObservedLastList; 1669 // turn in which the tile was observed last, index = location1669 // Turn in which the tile was observed last, index = location 1670 1670 Territory: ^TOwnerList; // nation to which's territory a tile belongs, -1 indicates none 1671 1671 Un: ^TUnList; { units } … … 1695 1695 LuxRate: Integer; 1696 1696 Research: Integer; 1697 { collected research points for currently researched tech }1697 { Collected research points for currently researched tech } 1698 1698 ResearchTech: Integer; // currently researched tech 1699 1699 DevModel: TModel; { unit model currently under development } … … 1730 1730 MaxTurn: Integer; 1731 1731 Difficulty: array [0 .. nPl - 1] of Integer; 1732 { difficulty levels of the players, if it's 0 this player is the supervisor,1732 { Difficulty levels of the players, if it's 0 this player is the supervisor, 1733 1733 -1 for unused slots } 1734 1734 RO: array [0 .. nPl - 1] of ^TPlayerContext; … … 1744 1744 RND: Integer; 1745 1745 Difficulty: array [0 .. nPl - 1] of Integer; 1746 { difficulty levels of the players, if it's 0 this player is the supervisor,1746 { Difficulty levels of the players, if it's 0 this player is the supervisor, 1747 1747 -1 for unused slots } 1748 1748 Controlled: Integer; … … 1757 1757 1758 1758 const 1759 { predefined unit models: }1759 { Predefined unit models: } 1760 1760 nSpecialModel = 9; 1761 1761 SpecialModel: array [0 .. nSpecialModel - 1] of TModel = ((Status: 0; … … 1858 1858 mi.Domain := M.Domain; 1859 1859 if M.Kind = mkEnemyDeveloped then 1860 mi.Kind := mkSelfDeveloped // important for IsSameModel()1860 mi.Kind := mkSelfDeveloped // Important for IsSameModel() 1861 1861 else 1862 1862 mi.Kind := M.Kind; … … 1911 1911 Y := Loc div lx; 1912 1912 X := Loc - Y * lx; 1913 if TerrType = fGrass then { formula for productive grassland }1913 if TerrType = fGrass then { Formula for productive grassland } 1914 1914 if Odd((lymax + X - Y shr 1) shr 1 + X + (Y + 1) shr 1) then 1915 1915 Result := 1 1916 1916 else 1917 1917 Result := 0 1918 else { formula for special resources }1918 else { Formula for special resources } 1919 1919 begin 1920 1920 A := 4 * X - Y + 9980;
Note:
See TracChangeset
for help on using the changeset viewer.