Changeset 289 for trunk/AI/StdAI/Protocol.pas
- Timestamp:
- Feb 26, 2021, 11:55:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AI/StdAI/Protocol.pas
r124 r289 44 44 MaxMoneyPrice = $FFFF; 45 45 MaxShipPartPrice = 100; 46 BombardmentDestroysCity = false;46 BombardmentDestroysCity = False; 47 47 StartMoney = 0; 48 48 InitialCredibility = 95; … … 53 53 // difficulty settings 54 54 MaxDiff = 4; { maximum difficulty level } 55 StorageSize: array [1 .. MaxDiff] of integer = (30, 40, 50, 60);56 TechFormula_M: array [1 .. MaxDiff] of single = (2.0, 2.3, 2.6, 4.0);57 TechFormula_D: array [1 .. MaxDiff] of single = (102.0, 80.0, 64.0, 64.0);58 BuildCostMod: array [1 .. MaxDiff] of integer = (9, 12, 15, 18); // in 1/1255 StorageSize: array [1 .. MaxDiff] of Integer = (30, 40, 50, 60); 56 TechFormula_M: array [1 .. MaxDiff] of Single = (2.0, 2.3, 2.6, 4.0); 57 TechFormula_D: array [1 .. MaxDiff] of Single = (102.0, 80.0, 64.0, 64.0); 58 BuildCostMod: array [1 .. MaxDiff] of Integer = (9, 12, 15, 18); // in 1/12 59 59 60 60 // test flags … … 795 795 imShipHab = 69; 796 796 797 SettlerFood: array [0 .. nGov - 1] of integer = (1, 1, 1, 2, 1, 2, 2, 2);798 CorrLevel: array [0 .. nGov - 1] of integer = (3, 3, 1, 2, 1, 0, 0, 0);799 SupportFree: array [0 .. nGov - 1] of integer = (2, 2, 1, 0, 2, 1, 0, 0);797 SettlerFood: array [0 .. nGov - 1] of Integer = (1, 1, 1, 2, 1, 2, 2, 2); 798 CorrLevel: array [0 .. nGov - 1] of Integer = (3, 3, 1, 2, 1, 0, 0, 0); 799 SupportFree: array [0 .. nGov - 1] of Integer = (2, 2, 1, 0, 2, 1, 0, 0); 800 800 // in 1/2*city size 801 801 … … 808 808 preNA = -$FF; 809 809 810 JobPreq: array [0 .. nJob - 1] of integer = (preNone, preNone, adRailroad,810 JobPreq: array [0 .. nJob - 1] of Integer = (preNone, preNone, adRailroad, 811 811 preNone, preNone, adRefrigeration, preNone, preNone, adExplosives, 812 812 adExplosives, adConstruction, preNone, adMedicine, preNone, preNone); 813 813 814 AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of integer = { advance prerequisites }814 AdvPreq: array [0 .. nAdv - 1, 0 .. 2] of Integer = { advance prerequisites } 815 815 ((adFlight, adRobotics, preNone), // adAdvancedFlight 816 816 (adNavigation, adTactics, preNone), // adAmphibiousWarfare … … 1023 1023 spPow = 1; 1024 1024 spHab = 2; 1025 ShipNeed: array [0 .. nShipPart - 1] of integer = (6, 4, 2);1026 ShipImpIndex: array [0 .. nShipPart - 1] of integer = (imShipComp, imShipPow, imShipHab);1027 1028 GovPreq: array [1 .. nGov - 1] of integer = { government prerequisites }1025 ShipNeed: array [0 .. nShipPart - 1] of Integer = (6, 4, 2); 1026 ShipImpIndex: array [0 .. nShipPart - 1] of Integer = (imShipComp, imShipPow, imShipHab); 1027 1028 GovPreq: array [1 .. nGov - 1] of Integer = { government prerequisites } 1029 1029 (preNone, adMonarchy, adTheRepublic, adTheology, adCommunism, adDemocracy, 1030 1030 adInternet); 1031 1031 1032 AgePreq: array [1 .. 3] of integer = (adScience, adMassProduction,1032 AgePreq: array [1 .. 3] of Integer = (adScience, adMassProduction, 1033 1033 adTransstellarColonization); 1034 1034 … … 1044 1044 TransTerrain: Integer; 1045 1045 TransWork: Integer; 1046 FoodRes, ProdRes, TradeRes: array [0 .. 2] of Integer; 1046 FoodRes: array [0 .. 2] of Integer; 1047 ProdRes: array [0 .. 2] of Integer; 1048 TradeRes: array [0 .. 2] of Integer; 1047 1049 Filler: array [0 .. 12] of Integer; 1048 1050 end … … 1113 1115 // cost values accumulate if prerequisite is future tech / are maximized if not 1114 1116 nUpgrade = 15; 1115 upgrade: 1116 array [0 .. nDomains - 1, 0 .. nUpgrade - 1] of record 1117 upgrade: array [0 .. nDomains - 1, 0 .. nUpgrade - 1] of record 1117 1118 Preq: Integer; 1118 1119 Strength: Integer; … … 1201 1202 1202 1203 Feature: array [0 .. nFeature - 1] of { unit model features } 1203 record Domains, Preq, Weight, Cost: integer; 1204 end 1204 record 1205 Domains: Integer; 1206 Preq: Integer; 1207 Weight: Integer; 1208 Cost: Integer; 1209 end 1205 1210 = ((Domains: 7; Preq: preNone; Weight: 1; Cost: 1), { mcOffense } 1206 1211 (Domains: 7; Preq: preNone; Weight: 1; Cost: 1), { mcDefense } … … 1231 1236 (Domains: 7; Preq: adMassProduction; Weight: 0; Cost: 0)); { mcLine } 1232 1237 1233 WeightPreq7: array [0 .. nDomains - 1] of integer = (adHorsebackRiding, adSeafaring,1238 WeightPreq7: array [0 .. nDomains - 1] of Integer = (adHorsebackRiding, adSeafaring, 1234 1239 adAdvancedFlight); 1235 WeightPreq10: array [0 .. nDomains - 1] of integer = (adAutomobile, adSteel, preNA);1240 WeightPreq10: array [0 .. nDomains - 1] of Integer = (adAutomobile, adSteel, preNA); 1236 1241 1237 1242 INFIN = 999999; … … 1261 1266 1262 1267 type 1263 TServerCall = function (Command, Player, Subject: integer; var Data)1264 : integer; stdcall;1265 TClientCall = procedure (Command, Player: integer; var Data); stdcall;1268 TServerCall = function (Command, Player, Subject: Integer; var Data) 1269 : Integer; stdcall; 1270 TClientCall = procedure (Command, Player: Integer; var Data); stdcall; 1266 1271 1267 1272 TUn = packed record 1268 Loc ,{ location }1269 Status ,// free for AI use1273 Loc: LongInt; { location } 1274 Status: LongInt; // free for AI use 1270 1275 SavedStatus: LongInt; // for server internal use only 1271 ID: word; // unit number, never changes, unique within this nation1272 mix ,{ model index }1273 Home ,{ home city index, -1 if none }1274 Master ,{ index of transporting unit, -1 if none }1276 ID: Word; // unit number, never changes, unique within this nation 1277 mix: SmallInt; { model index } 1278 Home: SmallInt; { home city index, -1 if none } 1279 Master: SmallInt; { index of transporting unit, -1 if none } 1275 1280 Movement: SmallInt; { movement left for this turn } 1276 Health ,// = 100-Damage1281 Health: ShortInt; // = 100-Damage 1277 1282 Fuel: ShortInt; 1278 Job ,{ current terrain improvement job }1279 Exp ,{ micro experience, the level is Exp div ExpCost }1280 TroopLoad ,{ number of transported ground units }1283 Job: Byte; { current terrain improvement job } 1284 Exp: Byte; { micro experience, the level is Exp div ExpCost } 1285 TroopLoad: Byte; { number of transported ground units } 1281 1286 AirLoad: Byte; // number of transported air units 1282 1287 Flags: Cardinal; 1283 1288 end; 1284 1289 1290 { TCity } 1291 1285 1292 TCity = packed record 1286 Loc ,{ location }1287 Status ,// free for AI use1293 Loc: LongInt; { location } 1294 Status: LongInt; // free for AI use 1288 1295 SavedStatus: LongInt; // for server internal use only 1289 ID ,// founding player shl 12 + number, never changes, unique within the whole game1290 Size: word;1291 Project ,// current production project, see city project flags1292 Project0 ,// for server use only1293 Food ,// collected food in storage1294 Pollution ,// collected pollution in dump1295 Prod ,// for project collected production points1296 ID: Word; // founding player shl 12 + number, never changes, unique within the whole game 1297 Size: Word; 1298 Project: SmallInt; // current production project, see city project flags 1299 Project0: SmallInt; // for server use only 1300 Food: SmallInt; // collected food in storage 1301 Pollution: SmallInt; // collected pollution in dump 1302 Prod: SmallInt; // for project collected production points 1296 1303 Prod0: SmallInt; 1297 1304 // for project collected production points in the beginning of the turn 1298 Flags ,// what happened within the last turnaround1299 Tiles ,{ currently by city exploited tiles, bitset with index1305 Flags: Cardinal; // what happened within the last turnaround 1306 Tiles: Cardinal; { currently by city exploited tiles, bitset with index 1300 1307 (dy+3) shl 2+(dx+3) shr 1, (dx,dy) relative to central tile } 1301 1308 N1: Cardinal; // reserved for future use … … 1305 1312 1306 1313 TModel = packed record 1307 Status ,// free for AI use1314 Status: LongInt; // free for AI use 1308 1315 SavedStatus: LongInt; // for server internal use only 1309 ID, // developing player shl 12 + number, never changes, unique within the whole game 1310 IntroTurn, Built, // units built with this model 1311 Lost: word; // units of this model lost in combat 1312 Kind, Domain: Byte; 1313 Attack, Defense, Speed, Cost, MStrength: word; 1316 ID: Word; // developing player shl 12 + number, never changes, unique within the whole game 1317 IntroTurn: Word; 1318 Built: Word; // units built with this model 1319 Lost: Word; // units of this model lost in combat 1320 Kind: Byte; 1321 Domain: Byte; 1322 Attack: Word; 1323 Defense: Word; 1324 Speed: Word; 1325 Cost: Word; 1326 MStrength: Word; 1314 1327 // construction time multipliers, only valid if kind is mkSelfDeveloped or mkEnemyDeveloped 1315 MTrans, MCost, Weight, MaxWeight: Byte; 1328 MTrans: Byte; 1329 MCost: Byte; 1330 Weight: Byte; 1331 MaxWeight: Byte; 1316 1332 // weight and maximum weight (construction time) 1317 Upgrades ,// bitarray indicating all upgrades1333 Upgrades: Cardinal; // bitarray indicating all upgrades 1318 1334 Flags: Cardinal; 1319 1335 Cap: array [0 .. (nFeature + 3) div 4 * 4 - 1] of Byte; // special features … … 1322 1338 TUnitInfo = packed record 1323 1339 Loc: LongInt; 1324 mix ,// index of unit model for its owner1325 emix: word; // index in enemy model list1340 mix: Word; // index of unit model for its owner 1341 emix: Word; // index in enemy model list 1326 1342 Owner: Byte; 1327 Health ,// = 100-Damage1343 Health: ShortInt; // = 100-Damage 1328 1344 Fuel: ShortInt; 1329 Job ,// current terrain improvement job1330 Exp ,{ micro experience, the level is Exp div ExpCost }1345 Job: Byte; // current terrain improvement job 1346 Exp: Byte; { micro experience, the level is Exp div ExpCost } 1331 1347 Load: Byte; { number of transported units } 1332 Flags: word;1348 Flags: Word; 1333 1349 end; 1334 1350 1335 1351 TCityInfo = packed record 1336 Loc, Status, // free for AI use 1352 Loc: LongInt; 1353 Status: LongInt; // free for AI use 1337 1354 SavedStatus: LongInt; // for server internal use only 1338 Owner, // last known owner, even if not alive anymore! 1339 ID, // founding player <<12 + number, never changes, unique within the whole game 1340 Size, Flags: word; 1355 Owner: Word; // last known owner, even if not alive anymore! 1356 ID: Word; // founding player <<12 + number, never changes, unique within the whole game 1357 Size: Word; 1358 Flags: Word; 1341 1359 end; 1342 1360 1343 1361 TModelInfo = packed record 1344 Owner, // Player which owns the model 1345 mix, // index of unit model for its owner 1346 ID: word; // developing player shl 12 + number, never changes, unique within the whole game 1347 Kind, Domain: Byte; 1348 Attack, Defense, Speed, Cost: word; 1349 TTrans, // ground unit transport capability 1362 Owner: Word; // Player which owns the model 1363 mix: Word; // index of unit model for its owner 1364 ID: Word; // developing player shl 12 + number, never changes, unique within the whole game 1365 Kind: Byte; 1366 Domain: Byte; 1367 Attack: Word; 1368 Defense: Word; 1369 Speed: Word; 1370 Cost: Word; 1371 TTrans: Byte; // ground unit transport capability 1350 1372 ATrans_Fuel: Byte; // air unit transport capability resp. fuel 1351 Bombs: word; // additional attack with bombs1373 Bombs: Word; // additional attack with bombs 1352 1374 Cap: Cardinal; // special features, bitset with index Feature-mcFirstNonCap 1353 MaxUpgrade ,// maximum used upgrade1375 MaxUpgrade: Byte; // maximum used upgrade 1354 1376 Weight: Byte; 1355 Lost: word;1377 Lost: Word; 1356 1378 end; 1357 1379 1358 1380 TBattle = packed record 1359 Enemy, Flags: Byte; 1360 Turn, mix, mixEnemy: word; 1361 ToLoc, FromLoc: integer; 1381 Enemy: Byte; 1382 Flags: Byte; 1383 Turn: Word; 1384 mix: Word; 1385 mixEnemy: Word; 1386 ToLoc: Integer; 1387 FromLoc: Integer; 1362 1388 end; 1363 1389 1364 1390 TWonderInfo = record 1365 CityID ,// -2 if destroyed, -1 if never completed, >=0 ID of city1366 EffectiveOwner: integer1391 CityID: Integer; // -2 if destroyed, -1 if never completed, >=0 ID of city 1392 EffectiveOwner: Integer; 1367 1393 // owning player if effective, -1 if expired or not built 1368 end; 1369 1370 TShipInfo = record Parts: array [0 .. nShipPart - 1] of integer; 1394 end; 1395 1396 TShipInfo = record 1397 Parts: array [0 .. nShipPart - 1] of Integer; 1371 1398 end; 1372 1399 1373 1400 TEnemyReport = record 1374 TurnOfContact, TurnOfCivilReport, TurnOfMilReport, Attitude, 1375 Credibility: integer; // 0..100, last update: ToC 1376 Treaty: array [0 .. nPl - 1] of integer; 1401 TurnOfContact: Integer; 1402 TurnOfCivilReport: Integer; 1403 TurnOfMilReport: Integer; 1404 Attitude: Integer; 1405 Credibility: Integer; // 0..100, last update: ToC 1406 Treaty: array [0 .. nPl - 1] of Integer; 1377 1407 // diplomatic status with other nations, last update: ToCR 1378 Government, // gAnarchy..gDemocracy, last update: ToCR 1379 Money, // last update: ToCR 1380 ResearchTech, ResearchDone: integer; // last update: ToCR 1408 Government: Integer; // gAnarchy..gDemocracy, last update: ToCR 1409 Money: Integer; // last update: ToCR 1410 ResearchTech: Integer; // last update: ToCR 1411 ResearchDone: Integer; // last update: ToCR 1381 1412 Tech: array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt; 1382 1413 // tech status indicator, last update: ToCR 1383 nModelCounted: integer;1414 nModelCounted: Integer; 1384 1415 // number of models with info in UnCount, last update: ToMR 1385 UnCount: array [0 .. INFIN] of word;1416 UnCount: array [0 .. INFIN] of Word; 1386 1417 // number of available units for each model, last update: ToMR 1387 1418 end; 1388 1419 1389 1420 TMoveAdviceData = record 1390 ToLoc, nStep, MoreTurns, MaxHostile_MovementLeft: integer; 1391 dx, dy: array [0 .. 24] of integer; 1421 ToLoc: Integer; 1422 nStep: Integer; 1423 MoreTurns: Integer; 1424 MaxHostile_MovementLeft: Integer; 1425 dx: array [0 .. 24] of Integer; 1426 dy: array [0 .. 24] of Integer; 1392 1427 end; 1393 1428 1394 1429 TPlaneReturnData = record 1395 Loc, Fuel, Movement: integer; 1430 Loc: Integer; 1431 Fuel: Integer; 1432 Movement: Integer; 1396 1433 end; 1397 1434 1398 1435 TTileInfo = record 1399 Food, Prod, Trade, ExplCity: integer; 1436 Food: Integer; 1437 Prod: Integer; 1438 Trade: Integer; 1439 ExplCity: Integer; 1400 1440 end; 1401 1441 1402 1442 TCityReport = record 1403 HypoTiles, HypoTax, HypoLux, Working, Happy, FoodRep, 1404 ProdRep, Trade, PollRep, Corruption, Tax, Lux, Science, Support, Eaten, 1405 ProdCost, Storage, Deployed: integer; 1443 HypoTiles: Integer; 1444 HypoTax: Integer; 1445 HypoLux: Integer; 1446 Working: Integer; 1447 Happy: Integer; 1448 FoodRep: Integer; 1449 ProdRep: Integer; 1450 Trade: Integer; 1451 PollRep: Integer; 1452 Corruption: Integer; 1453 Tax: Integer; 1454 Lux: Integer; 1455 Science: Integer; 1456 Support: Integer; 1457 Eaten: Integer; 1458 ProdCost: Integer; 1459 Storage: Integer; 1460 Deployed: Integer; 1406 1461 end; 1407 1462 1408 1463 TCityReportNew = record 1409 HypoTiles ,1464 HypoTiles: Integer; 1410 1465 // tiles that should be considered as exploited (for the current adjustment, set this to -1 or to TCity.Tiles of the city) 1411 HypoTaxRate, HypoLuxuryRate, 1466 HypoTaxRate: Integer; 1467 HypoLuxuryRate: Integer; 1412 1468 // tax and luxury rate that should be assumed (for current rates, set this to -1 or to RO.TaxRate resp. RO.LuxRate) 1413 Morale, FoodSupport, MaterialSupport, 1469 Morale: Integer; 1470 FoodSupport: Integer; 1471 MaterialSupport: Integer; 1414 1472 // food and material taken for unit support 1415 ProjectCost, // material cost of current project 1416 Storage, // size of food storage 1417 Deployed, // number of units causing unrest (unrest=2*deployed) 1418 CollectedControl, CollectedFood, CollectedMaterial, CollectedTrade, 1473 ProjectCost: Integer; // material cost of current project 1474 Storage: Integer; // size of food storage 1475 Deployed: Integer; // number of units causing unrest (unrest=2*deployed) 1476 CollectedControl: Integer; 1477 CollectedFood: Integer; 1478 CollectedMaterial: Integer; 1479 CollectedTrade: Integer; 1419 1480 // raw control, food, material and trade as collected by the citizens 1420 Working, // number of exploited tiles including city tile 1421 FoodSurplus, Production, AddPollution, 1481 Working: Integer; // number of exploited tiles including city tile 1482 FoodSurplus: Integer; 1483 Production: Integer; 1484 AddPollution: Integer; 1422 1485 // food surplus, production gain and pollution after all effects 1423 Corruption, Tax, Science, Luxury, 1486 Corruption: Integer; 1487 Tax: Integer; 1488 Science: Integer; 1489 Luxury: Integer; 1424 1490 // corruption, tax, science and wealth after all effects 1425 HappinessBalance: integer;1491 HappinessBalance: Integer; 1426 1492 // = (Morale+Wealth+Control) - (Size+Unrest), value < 0 means disorder 1427 1493 end; 1428 1494 1429 1495 TCityTileAdviceData = record 1430 ResourceWeights, Tiles: Cardinal; 1496 ResourceWeights: Cardinal; 1497 Tiles: Cardinal; 1431 1498 CityReport: TCityReport; 1432 1499 end; 1433 1500 1434 1501 TGetCityData = record 1435 Owner: integer;1502 Owner: Integer; 1436 1503 c: TCity; 1437 1504 end; 1438 1505 1439 1506 TCityAreaInfo = record 1440 Available: array [0 .. 26] of integer;1507 Available: array [0 .. 26] of Integer; 1441 1508 end; 1442 1509 1443 1510 TUnitReport = record 1444 FoodSupport, ProdSupport, ReportFlags: integer; 1511 FoodSupport: Integer; 1512 ProdSupport: Integer; 1513 ReportFlags: Integer; 1445 1514 end; 1446 1515 1447 1516 TJobProgressData = array [0 .. nJob - 1] of record 1448 1517 Required, Done, 1449 NextTurnPlus: integer; 1450 end; 1518 NextTurnPlus: Integer; 1519 end; 1520 1451 1521 TBattleForecast = record 1452 pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement, 1453 EndHealthDef, EndHealthAtt: integer; 1454 end; 1522 pAtt: Integer; 1523 mixAtt: Integer; 1524 HealthAtt: Integer; 1525 ExpAtt: Integer; 1526 FlagsAtt: Integer; 1527 Movement: Integer; 1528 EndHealthDef: Integer; 1529 EndHealthAtt: Integer; 1530 end; 1531 1455 1532 TBattleForecastEx = record 1456 pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement, 1457 EndHealthDef, EndHealthAtt: integer; // must be same as in TBattleForecast 1458 AStr, DStr, ABaseDamage, DBaseDamage: integer; 1459 end; 1533 pAtt: Integer; 1534 mixAtt: Integer; 1535 HealthAtt: Integer; 1536 ExpAtt: Integer; 1537 FlagsAtt: Integer; 1538 Movement: Integer; 1539 EndHealthDef: Integer; 1540 EndHealthAtt: Integer; // must be same as in TBattleForecast 1541 AStr: Integer; 1542 DStr: Integer; 1543 ABaseDamage: Integer; 1544 DBaseDamage: Integer; 1545 end; 1546 1460 1547 TShowMove = record 1461 Owner, Health, mix, emix, Flags, FromLoc, dx, dy, EndHealth, 1462 EndHealthDef, Fuel, Exp, Load: integer; 1463 end; 1548 Owner: Integer; 1549 Health: Integer; 1550 mix: Integer; 1551 emix: Integer; 1552 Flags: Integer; 1553 FromLoc: Integer; 1554 dx: Integer; 1555 dy: Integer; 1556 EndHealth: Integer; 1557 EndHealthDef: Integer; 1558 Fuel: Integer; 1559 Exp: Integer; 1560 Load: Integer; 1561 end; 1562 1464 1563 TShowShipChange = record 1465 Reason, Ship1Owner, Ship2Owner: integer; 1466 Ship1Change, Ship2Change: array [0 .. nShipPart - 1] of integer; 1467 end; 1564 Reason: Integer; 1565 Ship1Owner: Integer; 1566 Ship2Owner: Integer; 1567 Ship1Change: array [0 .. nShipPart - 1] of Integer; 1568 Ship2Change: array [0 .. nShipPart - 1] of Integer; 1569 end; 1570 1468 1571 TOffer = record 1469 nDeliver, nCost: integer; 1572 nDeliver: Integer; 1573 nCost: Integer; 1470 1574 Price: array [0 .. 11] of Cardinal; 1471 1575 end; 1472 TChart = array [0 .. INFIN] of integer; 1576 1577 TChart = array [0 .. INFIN] of Integer; 1473 1578 TEditTileData = record 1474 Loc, NewTile: integer 1579 Loc: Integer; 1580 NewTile: Integer; 1475 1581 end; 1476 1582 TCreateUnitData = record 1477 Loc, p, mix: integer; 1583 Loc: Integer; 1584 p: Integer; 1585 mix: Integer; 1478 1586 end; 1479 1587 … … 1492 1600 1493 1601 TPlayerContext = record 1494 Data: pointer;1602 Data: Pointer; 1495 1603 Map: ^TTileList; 1496 1604 { the playground, a list of tiles with index = location, see tile flags } … … 1506 1614 EnemyReport: array [0 .. nPl - 1] of ^TEnemyReport; 1507 1615 1508 TestFlags, // options turned on in the "Manipulation" menu 1509 Turn, // current turn 1510 Alive, { bitset of IDs of players still alive, flag 1 shl p for player p } 1511 Happened, // flags indicate what happened within the last turnaround 1512 AnarchyStart, // start turn of anarchy, <0 if not in anarchy 1513 Credibility, // own credibility 1514 MaxCredibility, // maximum credibility still to achieve 1515 nUn, { number of units } 1516 nCity, { number of cities } 1517 nModel, { number of developed unit models } 1518 nEnemyUn, nEnemyCity, nEnemyModel, Government, { gAnarchy..gDemocracy } 1519 Money, TaxRate, LuxRate, Research, 1616 TestFlags: Integer; // options turned on in the "Manipulation" menu 1617 Turn: Integer; // current turn 1618 Alive: Integer; { bitset of IDs of players still alive, flag 1 shl p for player p } 1619 Happened: Integer; // flags indicate what happened within the last turnaround 1620 AnarchyStart: Integer; // start turn of anarchy, <0 if not in anarchy 1621 Credibility: Integer; // own credibility 1622 MaxCredibility: Integer; // maximum credibility still to achieve 1623 nUn: Integer; { number of units } 1624 nCity: Integer; { number of cities } 1625 nModel: Integer; { number of developed unit models } 1626 nEnemyUn: Integer; 1627 nEnemyCity: Integer; 1628 nEnemyModel: Integer; 1629 Government: Integer; { gAnarchy..gDemocracy } 1630 Money: Integer; 1631 TaxRate: Integer; 1632 LuxRate: Integer; 1633 Research: Integer; 1520 1634 { collected research points for currently researched tech } 1521 ResearchTech: integer; // currently researched tech1635 ResearchTech: Integer; // currently researched tech 1522 1636 DevModel: TModel; { unit model currently under development } 1523 1637 Tech: array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt; { tech status indicator } 1524 Attitude: array [0 .. nPl - 1] of integer; // attitude to other nations1525 Treaty: array [0 .. nPl - 1] of integer; // treaty with other nations1526 EvaStart: array [0 .. nPl - 1] of integer; // peace treaty: start of evacuation period1527 Tribute: array [0 .. nPl - 1] of integer; // no longer in use1528 TributePaid: array [0 .. nPl - 1] of integer; // no longer in use1638 Attitude: array [0 .. nPl - 1] of Integer; // attitude to other nations 1639 Treaty: array [0 .. nPl - 1] of Integer; // treaty with other nations 1640 EvaStart: array [0 .. nPl - 1] of Integer; // peace treaty: start of evacuation period 1641 Tribute: array [0 .. nPl - 1] of Integer; // no longer in use 1642 TributePaid: array [0 .. nPl - 1] of Integer; // no longer in use 1529 1643 Wonder: array [0 .. 27] of TWonderInfo; 1530 1644 Ship: array [0 .. nPl - 1] of TShipInfo; 1531 1645 NatBuilt: array [28 .. (nImp + 3) div 4 * 4 - 1] of ShortInt; 1532 nBattleHistory: integer;1646 nBattleHistory: Integer; 1533 1647 BattleHistory: ^TBattleList; // complete list of all my battles in the whole game 1534 1648 BorderHelper: ^TByteList; 1535 LastCancelTreaty: array [0 .. nPl - 1] of integer; // turn of last treaty cancel1536 OracleIncome: integer;1649 LastCancelTreaty: array [0 .. nPl - 1] of Integer; // turn of last treaty cancel 1650 OracleIncome: Integer; 1537 1651 DefaultDebugMap: ^TIntList; 1538 1652 Filler: array [0 .. 879] of Byte; … … 1541 1655 TInitModuleData = record 1542 1656 Server: TServerCall; 1543 DataVersion, DataSize, Flags: integer; 1657 DataVersion: Integer; 1658 DataSize: Integer; 1659 Flags: Integer; 1544 1660 end; 1545 1661 1546 1662 TNewGameData = record 1547 lx, ly, LandMass, MaxTurn: integer; 1548 Difficulty: array [0 .. nPl - 1] of integer; 1663 lx: Integer; 1664 ly: Integer; 1665 LandMass: Integer; 1666 MaxTurn: Integer; 1667 Difficulty: array [0 .. nPl - 1] of Integer; 1549 1668 { difficulty levels of the players, if it's 0 this player is the supervisor, 1550 1669 -1 for unused slots } 1551 1670 RO: array [0 .. nPl - 1] of ^TPlayerContext; 1552 AssemblyPath: array [0 .. 255] of char;1671 AssemblyPath: array [0 .. 255] of Char; 1553 1672 SuperVisorRO: array [0 .. nPl - 1] of ^TPlayerContext; 1554 1673 end; 1555 1674 1556 1675 TNewGameExData = record 1557 lx, ly, LandMass, MaxTurn, RND: integer; 1558 Difficulty: array [0 .. nPl - 1] of integer; 1676 lx: Integer; 1677 ly: Integer; 1678 LandMass: Integer; 1679 MaxTurn: Integer; 1680 RND: Integer; 1681 Difficulty: array [0 .. nPl - 1] of Integer; 1559 1682 { difficulty levels of the players, if it's 0 this player is the supervisor, 1560 1683 -1 for unused slots } 1561 Controlled: integer;1684 Controlled: Integer; 1562 1685 end; 1563 1686 1564 1687 TShowNegoData = record 1565 pSender, pTarget, Action: integer; 1688 pSender: Integer; 1689 pTarget: Integer; 1690 Action: Integer; 1566 1691 Offer: TOffer; 1567 1692 end; … … 1632 1757 { preLeo,preLighthouse, } preLeo); 1633 1758 1634 procedure MakeUnitInfo(p: integer; const u: TUn; var ui: TUnitInfo); 1635 procedure MakeModelInfo(p, mix: integer; const m: TModel; var mi: TModelInfo); 1636 function IsSameModel(const mi1, mi2: TModelInfo): boolean; 1637 function SpecialTile(Loc, TerrType, lx: integer): integer; 1759 var 1760 DelphiRandSeed: Integer; 1761 1762 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo); 1763 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo); 1764 function IsSameModel(const mi1, mi2: TModelInfo): Boolean; 1765 function SpecialTile(Loc, TerrType, lx: Integer): Integer; 1766 function DelphiRandom(const pi_Max: Integer): Integer; overload; 1767 function DelphiRandom: Extended; overload; 1768 procedure DelphiRandomize; 1638 1769 1639 1770 implementation 1640 1771 1641 procedure MakeUnitInfo(p: integer; const u: TUn; var ui: TUnitInfo);1772 procedure MakeUnitInfo(p: Integer; const u: TUn; var ui: TUnitInfo); 1642 1773 begin 1643 1774 ui.Owner := p; … … 1652 1783 end; 1653 1784 1654 procedure MakeModelInfo(p, mix: integer; const m: TModel; var mi: TModelInfo);1785 procedure MakeModelInfo(p, mix: Integer; const m: TModel; var mi: TModelInfo); 1655 1786 var 1656 i: integer;1787 i: Integer; 1657 1788 begin 1658 1789 mi.Owner := p; … … 1691 1822 end; 1692 1823 1693 function IsSameModel(const mi1, mi2: TModelInfo): boolean;1824 function IsSameModel(const mi1, mi2: TModelInfo): Boolean; 1694 1825 type 1695 1826 TModelInfo_Compare = array [0 .. 5] of Cardinal; … … 1704 1835 end; 1705 1836 1706 function SpecialTile(Loc, TerrType, lx: integer): integer;1837 function SpecialTile(Loc, TerrType, lx: Integer): Integer; 1707 1838 var 1708 x, y, qx, qy, a: integer;1839 x, y, qx, qy, a: Integer; 1709 1840 begin 1710 1841 if TerrType = fOcean then … … 1752 1883 procedure InitUnit; 1753 1884 begin 1754 { TODO 1755 Assert(sizeof(TPlayerContext) = 2048); 1756 Assert(sizeof(TModel) - 2 * sizeof(LongInt) - 4 * sizeof(word) 1885 Assert(SizeOf(TPlayerContext) = 1936 + 28 * SizeOf(Pointer)); 1886 Assert(SizeOf(TModel) - 2 * SizeOf(LongInt) - 4 * SizeOf(Word) 1757 1887 = sIntSetDevModel and $F * 4); 1758 }1759 1888 end; 1760 1889 1890 function DelphiRandom(const pi_Max: Integer): Integer; 1891 var 1892 Temp: LongInt; 1893 begin 1894 Temp := LongInt(Int64(134775813) * Int64(DelphiRandSeed) + 1); 1895 DelphiRandSeed := LongInt(Temp); 1896 Result := (UInt64(Cardinal(pi_Max)) * UInt64(Cardinal(Temp))) shr 32; 1897 end; 1898 1899 function DelphiRandom: Extended; overload; 1900 begin 1901 Result := DelphiRandom(High(LongInt)) / High(LongInt); 1902 end; 1903 1904 procedure DelphiRandomize; 1905 begin 1906 Randomize; 1907 DelphiRandSeed := RandSeed; 1908 end; 1909 1761 1910 initialization 1762 1911
Note:
See TracChangeset
for help on using the changeset viewer.