prepare gameserver implementation

This commit is contained in:
Geoffray Levasseur committed 2026-10-27 16:22:49 +01:00
1 parent 20d64eebf9
commit 192898fb62
2 files changed
+576 -3

No files matched your search

+48
View File
@@ -89,6 +89,7 @@ extern int lx;
extern int ly;
extern int mapSize; // = lx * ly
extern int rnd; // world map randseed
extern int landMass; // 0 = predefined map, >0 = random map generation target
extern std::int32_t delphiRandSeed;
int delphiRandom(int max); // Delphi/Borland-compatible LCG, result in [0, max)
@@ -105,6 +106,7 @@ extern std::array<int, nPl> discovered; // number of tiles discovered
extern std::array<int, nPl> researched;
extern std::array<int, nPl> lastValidStat;
extern std::array<int, nPl> nTech; // number of known techs
extern std::array<int, nPl + 1> territoryCount; // index nPl means "no owner"
extern int gAlive; // players alive; bitset of 1 shl p
extern int gWatching;
extern int gAI;
@@ -173,6 +175,16 @@ void checkSpecialModels(int p, int pre);
// GWonder[wonder].EffectiveOwner must already be set before calling this.
void checkExpiration(int wonder);
// Marks an advance as seen (known exists, not yet researched) - used by
// the Great Library wonder effect.
void seeTech(int p, int ad);
// Applies the full effects of player p completing research of advance ad
// (tech counters, key-tech disclosure, special models, wonder expiration).
void discoverTech(int p, int ad);
// Promotes RW[p].DevModel (set by a completed sResetModel) into the
// player's real model list.
void enableDevModel(int p);
// --- Map Revealing ---
// cix>=0: known city index of player p (internal use only).
@@ -221,6 +233,10 @@ void removeUnitUpdateMap(int p, int uix);
void removeDomainUnits(int d, int p, int loc);
void foundCity(int p, int foundLoc);
// Removes dead (Loc < 0) entries from a player's Un/City/EnemyCity lists,
// fixing up cross-references (Un::Master/Home) to the indices that move.
void compactLists(int p);
// Database.pas's own formula function (originally in Protocol.pas), used
// only by actualSpecialTile() to recompute hidden special-resource bits
// after a terrain change (ClearTerrain/AfforestTerrain/TransTerrain jobs).
@@ -230,6 +246,16 @@ std::uint32_t actualSpecialTile(int loc);
// Applies a completed terrain improvement job's effect to the map.
void completeJob(int p, int loc, int job);
// --- Map Editor ---
// Converts a tile to ocean if it has no grass-or-better neighbor, to shore
// otherwise; returns true if the terrain type actually changed.
bool checkShore(int loc);
// Applies map-editor sanity rules (dead lands/canal/irrigation/mine
// clearing, automatic special resources, automatic shore tiles) and writes
// the result to realMap.
void editTile(int loc, std::uint32_t newTile);
// --- Territory Calculation ---
// OriginLoc: only changes in CountryRadius around this location possible,
@@ -242,12 +268,27 @@ void logCheckBorders(int p, int cix, int playerLosingCity = -1);
// recalculate fPeace flags for the whole map
void recalcPeaceMap(int p);
// recalculate fInEnemyZoC flags for the whole map
void recalcMapZoC(int p);
// --- Diplomacy ---
void introduceEnemy(int p1, int p2);
int techCost(int p);
void giveCivilReport(int p, int pAbout);
void giveMilReport(int p, int pAbout);
// Copies pAbout's civil/military report as known by pSender into pTarget's
// enemy-report of pAbout, if newer. Returns true if anything changed.
bool copyCivilReport(int pSender, int pTarget, int pAbout);
bool copyMilReport(int pSender, int pTarget, int pAbout);
// Grants pTarget a copy of pSender's model mix, unless an equivalent model
// (per IsSameModel) is already known.
void copyModel(int pSender, int pTarget, int mix);
// Copies every tile pSender has observed more recently than pTarget has.
void copyMap(int pSender, int pTarget);
// Executes a spy unit's mission against pCity's city cix; returns a
// mission-specific result bitset (only meaningful for smStealForeignReports).
std::uint32_t doSpyMission(int p, int pCity, int cix, int mission);
void showPrice(int pSender, int pTarget, std::uint32_t price);
bool payPrice(int pSender, int pTarget, std::uint32_t price, bool execute);
// Side effect: sets peaceEnded to the bitset of players with whom a peace
@@ -272,5 +313,12 @@ void findContinents();
void predefinedStartPositions(int human);
void releaseGame();
// --- City ---
// Removes a city (SaveUnits: true transfers supported units to the
// nearest remaining city instead of destroying them).
void destroyCity(int p, int cix, bool saveUnits);
void changeCityOwner(int pOld, int cixOld, int pNew);
} // namespace Database
} // namespace Cevo