Changeset 24
- Timestamp:
- Jan 8, 2017, 5:53:41 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AI
- Property svn:ignore
-
old new 2 2 AIProject.lps 3 3 StdAI.dll.dll 4 StdAI.dll
-
- Property svn:ignore
-
trunk/AI/AIProject.lpi
r23 r24 29 29 <PathDelim Value="\"/> 30 30 <Target> 31 <Filename Value="StdAI .dll"/>31 <Filename Value="StdAI"/> 32 32 </Target> 33 33 <SearchPaths> … … 39 39 <SyntaxMode Value="Delphi"/> 40 40 <CStyleOperator Value="False"/> 41 <IncludeAssertionCode Value="True"/>42 41 <AllowLabel Value="False"/> 43 42 <CPPInline Value="False"/> … … 45 44 </Parsing> 46 45 <CodeGeneration> 47 <Checks> 48 <IOChecks Value="True"/> 49 <RangeChecks Value="True"/> 50 <OverflowChecks Value="True"/> 51 <StackChecks Value="True"/> 52 </Checks> 53 <VerifyObjMethodCallValidity Value="True"/> 46 <Optimizations> 47 <OptimizationLevel Value="3"/> 48 </Optimizations> 54 49 </CodeGeneration> 55 50 <Linking> 51 <Debugging> 52 <GenerateDebugInfo Value="False"/> 53 </Debugging> 56 54 <Options> 57 55 <Win32> … … 115 113 <PathDelim Value="\"/> 116 114 <Target> 117 <Filename Value="StdAI .dll"/>115 <Filename Value="StdAI"/> 118 116 </Target> 119 117 <SearchPaths> -
trunk/AI/Protocol.pas
r23 r24 1 {$INCLUDE switches.inc}1 {$INCLUDE Switches.inc} 2 2 {$HINTS OFF} 3 3 unit Protocol; … … 52 52 53 53 // difficulty settings 54 MaxDiff = 3; { maximum difficulty level }55 StorageSize: array [1 .. MaxDiff] of integer = (30, 40, 50 );56 TechFormula_M: array [1 .. MaxDiff] of single = (2.0, 2.3, 2.6 );57 TechFormula_D: array [1 .. MaxDiff] of single = (102.0, 80.0, 64.0 );58 BuildCostMod: array [1 .. MaxDiff] of integer = (9, 12, 15 ); // in 1/1254 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/12 59 59 60 60 // test flags … … 83 83 sSetDebugMap = $0010; 84 84 sGetDebugMap = $0020; 85 sChangeSuperView = $0030;85 { sChangeSuperView=$0030; } sRefreshDebugMap = $0040; 86 86 sGetChart = $0100; // + type shl 4 87 87 sGetTechCost = $0180; 88 sGetAIInfo = $01C0; 88 89 sGetAICredits = $01D0; 89 90 sGetVersion = $01E0; … … 198 199 cHelpOnly = $0700; 199 200 cStartHelp = $0710; 201 cStartCredits = $0720; 200 202 201 203 cNewGame = $0800; … … 235 237 cShowSupportAllianceAgainst = $3830; 236 238 cShowPeaceViolation = $3880; 237 cShowGame = $3F00; 238 c ShowSuperView = $3F80;239 cShowGame = $3F00; { cShowSuperView=$3F80; } 240 cRefreshDebugMap = $3F90; 239 241 240 242 // diplomacy commands equal to server, see below … … 252 254 scDipOffer = $4B4E; 253 255 scDipBreak = $4BF0; 254 255 // advisor commands256 aInitModule = $0000;257 aReleaseModule = $0100;258 aNewGame = $0800;259 aBreakGame = $0900;260 aGiveStrategyAdvice = $4000;261 aGiveCityAdvice = $4100;262 256 263 257 { server return codes: flags } … … 430 424 trNoContact = -1; 431 425 trNone = 0; 432 trCeaseFire = 1;433 426 trPeace = 2; 434 427 trFriendlyContact = 3; … … 580 573 gDemocracy = 6; 581 574 gFuture = 7; 582 583 // colony ship584 nShipPart = 3;585 spComp = 0;586 spPow = 1;587 spHab = 2;588 ShipNeed: array [0 .. nShipPart - 1] of integer = (6, 4, 2);589 575 590 576 // ship change reasons … … 738 724 futMaterialTechnology = 92; 739 725 futArtificialIntelligence = 93; 726 727 FutureTech = [futComputingTechnology, futNanoTechnology, 728 futMaterialTechnology, futArtificialIntelligence]; 740 729 741 730 adMilitary = $800; // Military Research … … 1025 1014 (NewImp: imMilAcademy; OldImp: imBarracks)); 1026 1015 1016 // colony ship 1017 nShipPart = 3; 1018 spComp = 0; 1019 spPow = 1; 1020 spHab = 2; 1021 ShipNeed: 1022 array [0 .. nShipPart - 1] of integer = (6, 4, 2); 1023 ShipImpIndex: 1024 array [0 .. nShipPart - 1] of integer = (imShipComp, imShipPow, imShipHab); 1025 1027 1026 GovPreq: 1028 1027 array [1 .. nGov - 1] of integer = { government prerequisites } … … 1222 1221 mkDiplomat = mkCommando; 1223 1222 gLybertarianism = gFuture; 1223 trCeaseFire = 1; 1224 1224 adIntelligenArms = adSmartWeapons; 1225 1225 adIntelligentArms = adSmartWeapons; … … 1241 1241 : integer; stdcall; 1242 1242 TClientCall = procedure(Command, Player: integer; var Data); stdcall; 1243 TGiveAdviceCall = procedure(Text: PChar;1244 Nation, CityID, Loc: integer); stdcall;1245 1243 1246 1244 TUn = packed record … … 1418 1416 TJobProgressData = array [0 .. nJob - 1] of record Required, Done, 1419 1417 NextTurnPlus: integer; 1420 end; 1421 TBattleForecast = record pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement, 1422 EndHealthDef, EndHealthAtt: integer; 1423 end; 1424 TBattleForecastEx = record pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement, 1425 EndHealthDef, EndHealthAtt: integer; // must be same as in TBattleForecast 1426 AStr, DStr, ABaseDamage, DBaseDamage: integer; 1427 end; 1428 TShowMove = record Owner, Health, mix, emix, Flags, FromLoc, dx, dy, EndHealth, 1429 EndHealthDef, Fuel, Exp, Load: integer; 1430 end; 1431 TShowShipChange = record Reason, Ship1Owner, Ship2Owner: integer; 1432 Ship1Change, Ship2Change: array [0 .. nShipPart - 1] of integer; 1433 end; 1434 TOffer = record nDeliver, nCost: integer; 1435 Price: 1436 array [0 .. 11] of Cardinal; 1437 end; 1438 TChart = array [0 .. INFIN] of integer; 1439 TEditTileData = record Loc, NewTile: integer 1440 end; 1441 TCreateUnitData = record Loc, p, mix: integer; 1442 end; 1443 1444 TTileList = array [0 .. INFIN] of Cardinal; 1445 TTileObservedLastList = array [0 .. INFIN] of SmallInt; 1446 TOwnerList = array [0 .. INFIN] of ShortInt; 1447 TByteList = array [0 .. INFIN] of Byte; 1448 TCityList = array [0 .. INFIN] of TCity; 1449 TUnList = array [0 .. INFIN] of TUn; 1450 TModelList = array [0 .. INFIN] of TModel; 1451 TEnemyUnList = array [0 .. INFIN] of TUnitInfo; 1452 TEnemyCityList = array [0 .. INFIN] of TCityInfo; 1453 TEnemyModelList = array [0 .. INFIN] of TModelInfo; 1454 TBattleList = array [0 .. INFIN] of TBattle; 1455 1456 TPlayerContext = record Data: pointer; 1457 Map: 1458 ^TTileList; 1459 { the playground, a list of tiles with index = location, see tile flags } 1460 MapObservedLast: 1461 ^TTileObservedLastList; 1462 // turn in which the tile was observed last, index = location 1463 Territory: 1464 ^TOwnerList; // nation to which's territory a tile belongs, -1 indicates none 1465 Un: 1466 ^TUnList; { units } 1467 City: 1468 ^TCityList; { cities } 1469 Model: 1470 ^TModelList; { unit models } 1471 EnemyUn: 1472 ^TEnemyUnList; // known units of enemy players 1473 EnemyCity: 1474 ^TEnemyCityList; // known cities of enemy players 1475 EnemyModel: 1476 ^TEnemyModelList; // known unit models of enemy players 1477 EnemyReport: 1478 array [0 .. nPl - 1] of ^TEnemyReport; 1479 1480 TestFlags, // options turned on in the "Manipulation" menu 1481 Turn, // current turn 1482 Alive, { bitset of IDs of players still alive, flag 1 shl p for player p } 1483 Happened, // flags indicate what happened within the last turnaround 1484 AnarchyStart, // start turn of anarchy, <0 if not in anarchy 1485 Credibility, // own credibility 1486 MaxCredibility, // maximum credibility still to achieve 1487 nUn, { number of units } 1488 nCity, { number of cities } 1489 nModel, { number of developed unit models } 1490 nEnemyUn, nEnemyCity, nEnemyModel, Government, { gAnarchy..gDemocracy } 1491 Money, TaxRate, LuxRate, Research, 1492 { collected research points for currently researched tech } 1493 ResearchTech: integer; // currently researched tech 1494 DevModel: 1495 TModel; { unit model currently under development } 1496 Tech: 1497 array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt; { tech status indicator } 1498 Attitude: 1499 array [0 .. nPl - 1] of integer; // attitude to other nations 1500 Treaty: 1501 array [0 .. nPl - 1] of integer; // treaty with other nations 1502 EvaStart: 1503 array [0 .. nPl - 1] of integer; // peace treaty: start of evacuation period 1504 Tribute: 1505 array [0 .. nPl - 1] of integer; // no longer in use 1506 TributePaid: 1507 array [0 .. nPl - 1] of integer; // no longer in use 1508 Wonder: 1509 array [0 .. 27] of TWonderInfo; 1510 Ship: 1511 array [0 .. nPl - 1] of TShipInfo; 1512 NatBuilt: 1513 array [28 .. (nImp + 3) div 4 * 4 - 1] of ShortInt; 1514 nBattleHistory: 1515 integer; 1516 BattleHistory: 1517 ^TBattleList; // complete list of all my battles in the whole game 1518 BorderHelper: 1519 ^TByteList; 1520 LastCancelTreaty: 1521 array [0 .. nPl - 1] of integer; // turn of last treaty cancel 1522 OracleIncome: 1523 integer; 1524 Filler: 1525 array [0 .. 883] of Byte; 1526 end; 1527 1528 TInitModuleData = record Server: TServerCall; 1529 DataVersion, DataSize, Flags: integer; 1530 end; 1531 TInitAdvisorData = record Server: TServerCall; 1532 GiveAdvice: 1533 TGiveAdviceCall; 1534 end; 1535 TNewGameData = record lx, ly, LandMass, MaxTurn: integer; 1536 Difficulty: 1537 array [0 .. nPl - 1] of integer; 1538 { difficulty levels of the players, if it's 0 this player is the supervisor, 1539 -1 for unused slots } 1540 RO: 1541 array [0 .. nPl - 1] of ^TPlayerContext; 1542 end; 1543 TNewGameExData = record lx, ly, LandMass, MaxTurn, RND: integer; 1544 Difficulty: 1545 array [0 .. nPl - 1] of integer; 1546 { difficulty levels of the players, if it's 0 this player is the supervisor, 1547 -1 for unused slots } 1548 Controlled: 1549 integer; 1550 end; 1551 TShowNegoData = record pSender, pTarget, Action: integer; 1552 Offer: 1553 TOffer; 1554 end; 1418 end; 1419 TBattleForecast = record 1420 pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement, 1421 EndHealthDef, EndHealthAtt: integer; 1422 end; 1423 TBattleForecastEx = record 1424 pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement, 1425 EndHealthDef, EndHealthAtt: integer; // must be same as in TBattleForecast 1426 AStr, DStr, ABaseDamage, DBaseDamage: integer; 1427 end; 1428 TShowMove = record 1429 Owner, Health, mix, emix, Flags, FromLoc, dx, dy, EndHealth, 1430 EndHealthDef, Fuel, Exp, Load: integer; 1431 end; 1432 TShowShipChange = record 1433 Reason, Ship1Owner, Ship2Owner: integer; 1434 Ship1Change, Ship2Change: array [0 .. nShipPart - 1] of integer; 1435 end; 1436 TOffer = record nDeliver, nCost: integer; 1437 Price: array [0 .. 11] of Cardinal; 1438 end; 1439 TChart = array [0 .. INFIN] of integer; 1440 TEditTileData = record 1441 Loc, NewTile: integer 1442 end; 1443 TCreateUnitData = record 1444 Loc, p, mix: integer; 1445 end; 1446 1447 TTileList = array [0 .. INFIN] of Cardinal; 1448 TTileObservedLastList = array [0 .. INFIN] of SmallInt; 1449 TOwnerList = array [0 .. INFIN] of ShortInt; 1450 TByteList = array [0 .. INFIN] of Byte; 1451 TIntList = array [0 .. INFIN] of integer; 1452 TCityList = array [0 .. INFIN] of TCity; 1453 TUnList = array [0 .. INFIN] of TUn; 1454 TModelList = array [0 .. INFIN] of TModel; 1455 TEnemyUnList = array [0 .. INFIN] of TUnitInfo; 1456 TEnemyCityList = array [0 .. INFIN] of TCityInfo; 1457 TEnemyModelList = array [0 .. INFIN] of TModelInfo; 1458 TBattleList = array [0 .. INFIN] of TBattle; 1459 1460 TPlayerContext = record 1461 Data: pointer; 1462 Map: ^TTileList; 1463 { the playground, a list of tiles with index = location, see tile flags } 1464 MapObservedLast: ^TTileObservedLastList; 1465 // turn in which the tile was observed last, index = location 1466 Territory: ^TOwnerList; // nation to which's territory a tile belongs, -1 indicates none 1467 Un: ^TUnList; { units } 1468 City: ^TCityList; { cities } 1469 Model: ^TModelList; { unit models } 1470 EnemyUn: ^TEnemyUnList; // known units of enemy players 1471 EnemyCity: ^TEnemyCityList; // known cities of enemy players 1472 EnemyModel: ^TEnemyModelList; // known unit models of enemy players 1473 EnemyReport: array [0 .. nPl - 1] of ^TEnemyReport; 1474 1475 TestFlags, // options turned on in the "Manipulation" menu 1476 Turn, // current turn 1477 Alive, { bitset of IDs of players still alive, flag 1 shl p for player p } 1478 Happened, // flags indicate what happened within the last turnaround 1479 AnarchyStart, // start turn of anarchy, <0 if not in anarchy 1480 Credibility, // own credibility 1481 MaxCredibility, // maximum credibility still to achieve 1482 nUn, { number of units } 1483 nCity, { number of cities } 1484 nModel, { number of developed unit models } 1485 nEnemyUn, nEnemyCity, nEnemyModel, Government, { gAnarchy..gDemocracy } 1486 Money, TaxRate, LuxRate, Research, 1487 { collected research points for currently researched tech } 1488 ResearchTech: integer; // currently researched tech 1489 DevModel: TModel; { unit model currently under development } 1490 Tech: array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt; { tech status indicator } 1491 Attitude: array [0 .. nPl - 1] of integer; // attitude to other nations 1492 Treaty: array [0 .. nPl - 1] of integer; // treaty with other nations 1493 EvaStart: array [0 .. nPl - 1] of integer; // peace treaty: start of evacuation period 1494 Tribute: array [0 .. nPl - 1] of integer; // no longer in use 1495 TributePaid: array [0 .. nPl - 1] of integer; // no longer in use 1496 Wonder: array [0 .. 27] of TWonderInfo; 1497 Ship: array [0 .. nPl - 1] of TShipInfo; 1498 NatBuilt: array [28 .. (nImp + 3) div 4 * 4 - 1] of ShortInt; 1499 nBattleHistory: integer; 1500 BattleHistory: ^TBattleList; // complete list of all my battles in the whole game 1501 BorderHelper: ^TByteList; 1502 LastCancelTreaty: array [0 .. nPl - 1] of integer; // turn of last treaty cancel 1503 OracleIncome: integer; 1504 DefaultDebugMap: ^TIntList; 1505 Filler: array [0 .. 879] of Byte; 1506 end; 1507 1508 TInitModuleData = record 1509 Server: TServerCall; 1510 DataVersion, DataSize, Flags: integer; 1511 end; 1512 1513 TNewGameData = record 1514 lx, ly, LandMass, MaxTurn: integer; 1515 Difficulty: array [0 .. nPl - 1] of integer; 1516 { difficulty levels of the players, if it's 0 this player is the supervisor, 1517 -1 for unused slots } 1518 RO: array [0 .. nPl - 1] of ^TPlayerContext; 1519 AssemblyPath: array [0 .. 255] of char; 1520 SuperVisorRO: array [0 .. nPl - 1] of ^TPlayerContext; 1521 end; 1522 1523 TNewGameExData = record 1524 lx, ly, LandMass, MaxTurn, RND: integer; 1525 Difficulty: array [0 .. nPl - 1] of integer; 1526 { difficulty levels of the players, if it's 0 this player is the supervisor, 1527 -1 for unused slots } 1528 Controlled: integer; 1529 end; 1530 1531 TShowNegoData = record 1532 pSender, pTarget, Action: integer; 1533 Offer: TOffer; 1534 end; 1555 1535 1556 1536 const … … 1645 1625 mi.Owner := p; 1646 1626 mi.mix := mix; 1627 mi.ID := m.ID; 1647 1628 mi.Domain := m.Domain; 1648 1629 if m.Kind = mkEnemyDeveloped then … … 1736 1717 end; 1737 1718 1719 procedure InitUnit; 1738 1720 begin 1739 assert(sizeof(TPlayerContext) = 2048); 1740 assert(sizeof(TModel) - 2 * sizeof(LongInt) - 4 * sizeof(word) 1741 = sIntSetDevModel and $F * 4); 1721 { TODO 1722 Assert(sizeof(TPlayerContext) = 2048); 1723 Assert(sizeof(TModel) - 2 * sizeof(LongInt) - 4 * sizeof(word) 1724 = sIntSetDevModel and $F * 4); 1725 } 1726 end; 1727 1728 initialization 1729 1730 InitUnit; 1742 1731 1743 1732 end. -
trunk/AI/Switches.inc
r23 r24 10 10 {$TYPEINFO OFF} 11 11 {$DEBUGINFO ON} 12 //{$LOCALSYMBOLS ON}12 {$LOCALSYMBOLS ON} 13 13 14 //{$E-,S-,Z1}14 {$E-,S-,Z1} 15 15 16 16 {$IFDEF FPC} // freepascal -
trunk/GameServer.pas
r20 r24 61 61 TBrainInfo = record 62 62 FileName, DLLName, Name, Credits: string; { filename and full name } 63 hm ,{ module handle }63 hm: TLibHandle; { module handle } 64 64 Flags, ServerVersion, DataVersion, DataSize: integer; 65 65 Client: TClientCall; { client function address }
Note:
See TracChangeset
for help on using the changeset viewer.