File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,31 @@ export bool Crystals(int x) {
6666
6767export 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+ */
6994export 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 ;
You can’t perform that action at this time.
0 commit comments