city processing

This commit is contained in:
Geoffray Levasseur committed 2026-10-27 11:57:29 +01:00
1 parent b9cfa2393f
commit 18bf340dee
5 files changed
+2524 -14

No files matched your search

+43 -6
View File
@@ -43,12 +43,14 @@
// calling convention.
//
// NOT ported here (left as a follow-up, pure data with no ABI-shape impact):
// the large gameplay rule tables Imp[], Terrain[], Upgrade[], Feature[],
// AdvPreq[], GovPreq, AgePreq, JobPreq, SpecialModel[], ShipNeed/ShipImpIndex,
// SettlerFood/CorrLevel/SupportFree, ImpReplacement, AutoFeature,
// WeightPreq7/10. An AI module compiled against a slightly different copy of
// those tables still speaks the same wire protocol; it just has stale rule
// knowledge, which is a correctness/strength concern, not an ABI one.
// Terrain[], Upgrade[], Feature[], AdvPreq[], JobPreq, SpecialModel[],
// ImpReplacement, AutoFeature, WeightPreq7/10. An AI module compiled against
// a slightly different copy of those tables still speaks the same wire
// protocol; it just has stale rule knowledge, which is a correctness/
// strength concern, not an ABI one. (Imp[]/GovPreq/AgePreq/SettlerFood/
// CorrLevel/SupportFree/ShipNeed/ShipImpIndex WERE added later, once a
// consumer needed them - this comment previously listed them as unported,
// now corrected.)
//
// Field order/types mirror the Pascal records exactly; `{$PACKRECORDS C}`
// (Free Pascal's C-compatible alignment) matches plain C++ struct layout on
@@ -1649,6 +1651,41 @@ constexpr int GovPreq[nGov] = { preNA, preNone, adMonarchy, adTheRepublic, adThe
constexpr int AgePreq[4] = { preNA, adScience, adMassProduction, adTransstellarColonization };
constexpr int SettlerFood[nGov] = { 1, 1, 1, 2, 1, 2, 2, 2 };
constexpr int CorrLevel[nGov] = { 3, 3, 1, 2, 1, 0, 0, 0 };
constexpr int SupportFree[nGov] = { 2, 2, 1, 0, 2, 1, 0, 0 };
constexpr int nSpecialModel = 9;
// Pre-defined unit models every player has from the start (Settlers,
// Engineers, Militia, Town Guard, Special Commando, Freight, Longboat,
// Slaves, Glider) - field order matches struct TModel exactly (aggregate
// init, no designated initializers since this targets C++17). Trailing
// `{}`/short Cap[] initializers zero-fill the rest, same as the Pascal
// array literals' explicit zero lists.
constexpr TModel SpecialModel[nSpecialModel] = {
// Settlers
{ 0, 0, 0, 0, 0, 0, mkSettler, dGround, 0, 10, 150, 40, 0, 0, 0, 0, 0, 0, 0, {} },
// Engineers
{ 0, 0, 0, 0, 0, 0, mkSettler, dGround, 0, 20, 300, 40, 0, 0, 0, 0, 0, 0, 0, {} },
// Militia
{ 0, 0, 0, 0, 0, 0, mkSelfDeveloped, dGround, 6, 6, 150, 10, 0, 0, 0, 0, 0, 0, 0, {} },
// Town Guard
{ 0, 0, 0, 0, 0, 0, mkSpecial_TownGuard, dGround, 4, 6, 150, 20, 0, 0, 0, 0, 0, 0, 0, {} },
// Special Commando
{ 0, 0, 0, 0, 0, 0, mkDiplomat, dGround, 12, 12, 250, 20, 0, 0, 0, 0, 0, 0, 0, {} },
// Freight
{ 0, 0, 0, 0, 0, 0, mkCaravan, dGround, 0, 6, 150, 60, 0, 0, 0, 0, 0, 0, 0, {} },
// Longboat (Cap[3] = 2)
{ 0, 0, 0, 0, 0, 0, mkSpecial_Boat, dSea, 0, 3, 250, 20, 0, 1, 0, 0, 0, 0, 0, { 0, 0, 0, 2 } },
// Slaves
{ 0, 0, 0, 0, 0, 0, mkSlaves, dGround, 0, 15, 150, 40, 0, 0, 0, 0, 0, 0, 0, {} },
// Glider (Cap[17] = 1)
{ 0, 0, 0, 0, 0, 0, mkSpecial_Glider, dAir, 6, 6, 450, 30, 0, 0, 0, 0, 0, 0, 0,
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } },
};
constexpr int SpecialModelPreq[nSpecialModel] = { preNone, adExplosives, preNone, preNone, adIntelligence,
adTrade, adMapMaking, preBuilder, preLeo };
struct TerrainInfo {
int MoveCost;