Skip to content

Commit 76048cc

Browse files
authored
Add doxygen documentation to maxsupport
1 parent 1db310f commit 76048cc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

gb/gblib.cppm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,31 @@ export bool Crystals(int x) {
6666

6767
export std::vector<Victory> create_victory_list(EntityManager&);
6868

69+
/**
70+
* @brief Calculate the maximum population a sector can support for a given
71+
* race.
72+
*
73+
* Determines the carrying capacity of a sector based on multiple factors
74+
* including the race's preference for the sector type, sector productivity
75+
* (efficiency and fertility), race-planet compatibility, and environmental
76+
* toxicity.
77+
*
78+
* @param r The race that owns or would own the sector
79+
* @param s The sector being evaluated
80+
* @param c Compatibility factor (0.0-100.0) representing how well the race
81+
* adapts to the planet's overall conditions
82+
* @param toxic Toxicity level (0-100) of the planet - higher values reduce
83+
* capacity
84+
*
85+
* @return Maximum population the sector can support. Returns 0 if the race
86+
* cannot inhabit this sector type (likes value is 0).
87+
*
88+
* @note The calculation incorporates:
89+
* - Race preference: r.likes[sector_type] must be non-zero
90+
* - Sector productivity: (efficiency + 1) * fertility
91+
* - Compatibility: Scaled by race's adaptation to planet conditions
92+
* - Toxicity penalty: Reduces capacity as (100 - toxic)%
93+
*/
6994
export constexpr auto maxsupport(const Race& r, const Sector& s, const double c,
7095
const int toxic) {
7196
if (r.likes[s.get_condition()] == 0) return 0L;

0 commit comments

Comments
 (0)