Changeset 10 for trunk/Protocol.pas


Ignore:
Timestamp:
Jan 7, 2017, 2:33:20 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Created CevoComponents ackage for installable custom components.
  • Fixed: Compile time range check error.
  • Added: Heaptrace check and fixed some memory leaks.
  • Fixed: MaskD function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Protocol.pas

    r6 r10  
    14161416  TJobProgressData = array [0 .. nJob - 1] of record Required, Done,
    14171417    NextTurnPlus: integer;
    1418 end;
    1419 TBattleForecast = record pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement,
    1420   EndHealthDef, EndHealthAtt: integer;
    1421 end;
    1422 TBattleForecastEx = record pAtt, mixAtt, HealthAtt, ExpAtt, FlagsAtt, Movement,
    1423   EndHealthDef, EndHealthAtt: integer; // must be same as in TBattleForecast
    1424 AStr, DStr, ABaseDamage, DBaseDamage: integer;
    1425 end;
    1426 TShowMove = record Owner, Health, mix, emix, Flags, FromLoc, dx, dy, EndHealth,
    1427   EndHealthDef, Fuel, Exp, Load: integer;
    1428 end;
    1429 TShowShipChange = record Reason, Ship1Owner, Ship2Owner: integer;
    1430 Ship1Change, Ship2Change: array [0 .. nShipPart - 1] of integer;
    1431 end;
    1432 TOffer = record nDeliver, nCost: integer;
    1433 Price:
    1434 array [0 .. 11] of Cardinal;
    1435 end;
    1436 TChart = array [0 .. INFIN] of integer;
    1437 TEditTileData = record Loc, NewTile: integer
    1438 end;
    1439 TCreateUnitData = record Loc, p, mix: integer;
    1440 end;
    1441 
    1442 TTileList = array [0 .. INFIN] of Cardinal;
    1443 TTileObservedLastList = array [0 .. INFIN] of SmallInt;
    1444 TOwnerList = array [0 .. INFIN] of ShortInt;
    1445 TByteList = array [0 .. INFIN] of Byte;
    1446 TIntList = array [0 .. INFIN] of integer;
    1447 TCityList = array [0 .. INFIN] of TCity;
    1448 TUnList = array [0 .. INFIN] of TUn;
    1449 TModelList = array [0 .. INFIN] of TModel;
    1450 TEnemyUnList = array [0 .. INFIN] of TUnitInfo;
    1451 TEnemyCityList = array [0 .. INFIN] of TCityInfo;
    1452 TEnemyModelList = array [0 .. INFIN] of TModelInfo;
    1453 TBattleList = array [0 .. INFIN] of TBattle;
    1454 
    1455 TPlayerContext = record Data: pointer;
    1456 Map:
    1457 ^TTileList;
    1458 { the playground, a list of tiles with index = location, see tile flags }
    1459 MapObservedLast:
    1460 ^TTileObservedLastList;
    1461 // turn in which the tile was observed last, index = location
    1462 Territory:
    1463 ^TOwnerList; // nation to which's territory a tile belongs, -1 indicates none
    1464 Un:
    1465 ^TUnList; { units }
    1466 City:
    1467 ^TCityList; { cities }
    1468 Model:
    1469 ^TModelList; { unit models }
    1470 EnemyUn:
    1471 ^TEnemyUnList; // known units of enemy players
    1472 EnemyCity:
    1473 ^TEnemyCityList; // known cities of enemy players
    1474 EnemyModel:
    1475 ^TEnemyModelList; // known unit models of enemy players
    1476 EnemyReport:
    1477 array [0 .. nPl - 1] of ^TEnemyReport;
    1478 
    1479 TestFlags, // options turned on in the "Manipulation" menu
    1480 Turn, // current turn
    1481 Alive, { bitset of IDs of players still alive, flag 1 shl p for player p }
    1482 Happened, // flags indicate what happened within the last turnaround
    1483 AnarchyStart, // start turn of anarchy, <0 if not in anarchy
    1484 Credibility, // own credibility
    1485 MaxCredibility, // maximum credibility still to achieve
    1486 nUn, { number of units }
    1487 nCity, { number of cities }
    1488 nModel, { number of developed unit models }
    1489 nEnemyUn, nEnemyCity, nEnemyModel, Government, { gAnarchy..gDemocracy }
    1490 Money, TaxRate, LuxRate, Research,
    1491 { collected research points for currently researched tech }
    1492 ResearchTech: integer; // currently researched tech
    1493 DevModel:
    1494 TModel; { unit model currently under development }
    1495 Tech:
    1496 array [0 .. (nAdv + 3) div 4 * 4 - 1] of ShortInt; { tech status indicator }
    1497 Attitude:
    1498 array [0 .. nPl - 1] of integer; // attitude to other nations
    1499 Treaty:
    1500 array [0 .. nPl - 1] of integer; // treaty with other nations
    1501 EvaStart:
    1502 array [0 .. nPl - 1] of integer; // peace treaty: start of evacuation period
    1503 Tribute:
    1504 array [0 .. nPl - 1] of integer; // no longer in use
    1505 TributePaid:
    1506 array [0 .. nPl - 1] of integer; // no longer in use
    1507 Wonder:
    1508 array [0 .. 27] of TWonderInfo;
    1509 Ship:
    1510 array [0 .. nPl - 1] of TShipInfo;
    1511 NatBuilt:
    1512 array [28 .. (nImp + 3) div 4 * 4 - 1] of ShortInt;
    1513 nBattleHistory:
    1514 integer;
    1515 BattleHistory:
    1516 ^TBattleList; // complete list of all my battles in the whole game
    1517 BorderHelper:
    1518 ^TByteList;
    1519 LastCancelTreaty:
    1520 array [0 .. nPl - 1] of integer; // turn of last treaty cancel
    1521 OracleIncome:
    1522 integer;
    1523 DefaultDebugMap:
    1524 ^TIntList;
    1525 Filler:
    1526 array [0 .. 879] of Byte;
    1527 end;
    1528 
    1529 TInitModuleData = record Server: TServerCall;
    1530 DataVersion, DataSize, Flags: integer;
    1531 end;
    1532 TNewGameData = record lx, ly, LandMass, MaxTurn: integer;
    1533 Difficulty:
    1534 array [0 .. nPl - 1] of integer;
    1535 { difficulty levels of the players, if it's 0 this player is the supervisor,
    1536   -1 for unused slots }
    1537 RO:
    1538 array [0 .. nPl - 1] of ^TPlayerContext;
    1539 AssemblyPath:
    1540 array [0 .. 255] of char;
    1541 SuperVisorRO:
    1542 array [0 .. nPl - 1] of ^TPlayerContext;
    1543 end;
    1544 TNewGameExData = record lx, ly, LandMass, MaxTurn, RND: integer;
    1545 Difficulty:
    1546 array [0 .. nPl - 1] of integer;
    1547 { difficulty levels of the players, if it's 0 this player is the supervisor,
    1548   -1 for unused slots }
    1549 Controlled:
    1550 integer;
    1551 end;
    1552 TShowNegoData = record pSender, pTarget, Action: integer;
    1553 Offer:
    1554 TOffer;
    1555 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;
    15561535
    15571536const
     
    17391718
    17401719begin
    1741   assert(sizeof(TPlayerContext) = 2048);
    1742   assert(sizeof(TModel) - 2 * sizeof(LongInt) - 4 * sizeof(word)
    1743     = sIntSetDevModel and $F * 4);
     1720  // TODO assert(sizeof(TPlayerContext) = 2048);
     1721  // TODO assert(sizeof(TModel) - 2 * sizeof(LongInt) - 4 * sizeof(word)
     1722  //  = sIntSetDevModel and $F * 4);
    17441723
    17451724end.
Note: See TracChangeset for help on using the changeset viewer.