forked from github/server
change how migrant quota is configured for a race, eliminate the related rule caching
This commit is contained in:
parent
5f457f77b4
commit
f7698d92a9
|
@ -52,7 +52,6 @@
|
|||
"world.era": 3,
|
||||
"seed.population.min": 8,
|
||||
"seed.population.max": 8,
|
||||
"rules.migrants.max": 0,
|
||||
"rules.reserve.twophase": true,
|
||||
"rules.owners.force_leave": false,
|
||||
"rules.monsters.attack_chance": 0.1,
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
"study.speedup": 2,
|
||||
"study.from_use": 0.4,
|
||||
"world.era": 3,
|
||||
"rules.migrants.max": 0,
|
||||
"rules.reserve.twophase": true,
|
||||
"rules.owners.force_leave": false,
|
||||
"rules.transfermen": false,
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<race name="human" magres="0.000000" maxaura="1.000000" regaura="1.000000" recruitcost="75" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<param name="migrants.formula" value="1"/>
|
||||
<skill name="trade" modifier="1"/>
|
||||
<skill name="herbalism" modifier="-1"/>
|
||||
<skill name="shipcraft" modifier="1"/>
|
||||
|
|
|
@ -756,24 +756,20 @@ int count_migrants(const faction * f)
|
|||
return count_faction(f, COUNT_MIGRANTS);
|
||||
}
|
||||
|
||||
#define MIGRANTS_NONE 0
|
||||
#define MIGRANTS_LOG10 1
|
||||
|
||||
int count_maxmigrants(const faction * f)
|
||||
{
|
||||
static int migrants = -1;
|
||||
int formula = get_param_int(f->race->parameters, "migrants.formula", 0);
|
||||
|
||||
if (migrants < 0) {
|
||||
migrants = config_get_int("rules.migrants.max", INT_MAX);
|
||||
}
|
||||
if (migrants == INT_MAX) {
|
||||
int x = 0;
|
||||
if (f->race == get_race(RC_HUMAN)) {
|
||||
int nsize = count_all(f);
|
||||
if (nsize > 0) {
|
||||
x = (int)(log10(nsize / 50.0) * 20);
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
}
|
||||
if (formula == MIGRANTS_LOG10) {
|
||||
int nsize = count_all(f);
|
||||
if (nsize > 0) {
|
||||
int x = (int)(log10(nsize / 50.0) * 20);
|
||||
if (x < 0) x = 0;
|
||||
return x;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
return migrants;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue