change how migrant quota is configured for a race, eliminate the related rule caching

This commit is contained in:
Enno Rehling 2015-11-22 15:53:50 +01:00
parent 5f457f77b4
commit f7698d92a9
4 changed files with 12 additions and 17 deletions

View File

@ -52,7 +52,6 @@
"world.era": 3, "world.era": 3,
"seed.population.min": 8, "seed.population.min": 8,
"seed.population.max": 8, "seed.population.max": 8,
"rules.migrants.max": 0,
"rules.reserve.twophase": true, "rules.reserve.twophase": true,
"rules.owners.force_leave": false, "rules.owners.force_leave": false,
"rules.monsters.attack_chance": 0.1, "rules.monsters.attack_chance": 0.1,

View File

@ -51,7 +51,6 @@
"study.speedup": 2, "study.speedup": 2,
"study.from_use": 0.4, "study.from_use": 0.4,
"world.era": 3, "world.era": 3,
"rules.migrants.max": 0,
"rules.reserve.twophase": true, "rules.reserve.twophase": true,
"rules.owners.force_leave": false, "rules.owners.force_leave": false,
"rules.transfermen": false, "rules.transfermen": false,

View File

@ -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"> <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"/> <ai splitsize="10000" moverandom="yes" learn="yes"/>
<function name="itemdrop" value="defaultdrops"/> <function name="itemdrop" value="defaultdrops"/>
<param name="migrants.formula" value="1"/>
<skill name="trade" modifier="1"/> <skill name="trade" modifier="1"/>
<skill name="herbalism" modifier="-1"/> <skill name="herbalism" modifier="-1"/>
<skill name="shipcraft" modifier="1"/> <skill name="shipcraft" modifier="1"/>

View File

@ -756,24 +756,20 @@ int count_migrants(const faction * f)
return count_faction(f, COUNT_MIGRANTS); return count_faction(f, COUNT_MIGRANTS);
} }
#define MIGRANTS_NONE 0
#define MIGRANTS_LOG10 1
int count_maxmigrants(const faction * f) int count_maxmigrants(const faction * f)
{ {
static int migrants = -1; int formula = get_param_int(f->race->parameters, "migrants.formula", 0);
if (migrants < 0) { if (formula == MIGRANTS_LOG10) {
migrants = config_get_int("rules.migrants.max", INT_MAX); int nsize = count_all(f);
} if (nsize > 0) {
if (migrants == INT_MAX) { int x = (int)(log10(nsize / 50.0) * 20);
int x = 0; if (x < 0) x = 0;
if (f->race == get_race(RC_HUMAN)) { return x;
int nsize = count_all(f);
if (nsize > 0) {
x = (int)(log10(nsize / 50.0) * 20);
if (x < 0)
x = 0;
}
} }
return x;
} }
return migrants; return 0;
} }