diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 1c8ff4cb8..28ac2e203 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -565,7 +565,7 @@ bool valid_race(const struct faction *f, const struct race *rc) else { const char *str = get_param(f->race->parameters, "other_race"); if (str) - return (bool)(rc_find(str) == rc); + return rc_find(str) == rc; return false; } } diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c index 43956df59..1b1a0236b 100644 --- a/src/kernel/faction.test.c +++ b/src/kernel/faction.test.c @@ -202,7 +202,7 @@ static void test_max_migrants(CuTest *tc) { f = test_create_faction(rc); u = test_create_unit(f, test_create_region(0, 0, 0)); CuAssertIntEquals(tc, 0, count_maxmigrants(f)); - set_param(&rc->parameters, "migrants.formula", "1"); + rc->flags |= RCF_MIGRANTS; CuAssertIntEquals(tc, 0, count_maxmigrants(f)); scale_number(u, 250); CuAssertIntEquals(tc, 13, count_maxmigrants(f)); diff --git a/src/kernel/race.c b/src/kernel/race.c index 123d64022..7f6fe15c2 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -296,7 +296,7 @@ int rc_armor_bonus(const race *rc) { int rc_migrants_formula(const race *rc) { - return rc->parameters ? get_param_int(rc->parameters, "migrants.formula", MIGRANTS_NONE) : MIGRANTS_NONE; + return (rc->flags&RCF_MIGRANTS) ? MIGRANTS_LOG10 : MIGRANTS_NONE; } const char* rc_name(const race * rc, name_t n, char *name, size_t size) { diff --git a/src/kernel/race.h b/src/kernel/race.h index 7c4600ae5..67eea00f4 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -223,6 +223,7 @@ extern "C" { #define RCF_STONEGOLEM (1<<27) /* race gets stonegolem properties */ #define RCF_IRONGOLEM (1<<28) /* race gets irongolem properties */ #define RCF_ATTACK_MOVED (1<<29) /* may attack if it has moved */ +#define RCF_MIGRANTS (1<<30) /* may have migrant units (human bonus) */ /* Economic flags */ #define ECF_KEEP_ITEM (1<<1) /* gibt Gegenst�nde weg */ diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index 9b1f5532c..a0172313a 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -1737,6 +1737,11 @@ static int parse_races(xmlDocPtr doc) if (strcmp((const char *)propName, "recruit_multi")==0) { rc->recruit_multi = atof((const char *)propValue); } + else if (strcmp((const char *)propName, "migrants.formula") == 0) { + if (propValue[0] == '1') { + rc->flags |= RCF_MIGRANTS; + } + } else { set_param(&rc->parameters, (const char *)propName, (const char *)propValue); }