Moi Magnus
Emperor
- Joined
- Mar 1, 2015
- Messages
- 1,868
Reading trough the file, the computation is:
With BALANCE_HAPPINESS_THRESHOLD_PERCENTILE being 40 per default (from CP, maybe changed in CBO).
In your example, the table is [54, 54, 55, 55, 59, 59, 59, 61, 65]
40% of 9 (size of the table), rounded down = 3.
So we take the cell "number 3" of the table, so the 4th cell (since it start from 0)
Which is 55 (the second one).
Plus agriculture, its 56.
Code:
size_t nt = (viTechMedian.size() * GC.getBALANCE_HAPPINESS_THRESHOLD_PERCENTILE()) / 100;
if ((int)viTechMedian[nt] > m_iGlobalTechAvg)
m_iGlobalTechAvg = (int)viTechMedian[nt];
In your example, the table is [54, 54, 55, 55, 59, 59, 59, 61, 65]
40% of 9 (size of the table), rounded down = 3.
So we take the cell "number 3" of the table, so the 4th cell (since it start from 0)
Which is 55 (the second one).
Plus agriculture, its 56.