diff --git a/src/laws.c b/src/laws.c index 92f10f52a..0eefa8be4 100755 --- a/src/laws.c +++ b/src/laws.c @@ -259,7 +259,8 @@ static void calculate_emigration(region * r) } /** Bauern vermehren sich */ -int fast_peasant_luck_effect(int peasants, int luck, int maxp) { +#ifndef SLOWLUCK +int peasant_luck_effect(int peasants, int luck, int maxp) { int births=0; double mean = _min(luck, peasants) * PEASANTLUCK * PEASANTGROWTH / (float) 10000 * ((peasants/(float)maxp < .9)?1:PEASANTFORCE); @@ -271,6 +272,7 @@ int fast_peasant_luck_effect(int peasants, int luck, int maxp) { return (int)births; } +#else int peasant_luck_effect(int peasants, int luck, int maxp) { int n, births=0; for (n = peasants; n && luck; --n) { @@ -293,6 +295,7 @@ int peasant_luck_effect(int peasants, int luck, int maxp) { } return births; } +#endif static void peasants(region * r) { diff --git a/src/laws.h b/src/laws.h index 4efe28b37..27232982b 100755 --- a/src/laws.h +++ b/src/laws.h @@ -107,9 +107,6 @@ extern "C" { int armedmen(const struct unit *u, bool siege_weapons); void force_leave(struct region *r); - int peasant_luck_effect(int peasants, int luck, int maxp); - int fast_peasant_luck_effect(int peasants, int luck, int maxp); - #ifdef __cplusplus } diff --git a/src/laws.test.c b/src/laws.test.c index 1f4251be1..117e1fb3c 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -692,35 +692,6 @@ static void test_reserve_self(CuTest *tc) { test_cleanup(); } -static void test_peasant_luck(CuTest *tc) { - int p, l, max, n=0, wrong=0, total=0; - for (p=1; p<10000; p = (int)(_max(p*1.2+1, p+50))) { - for (l=1; l<2000; l=(int)(_max(l*1.5+1, l+10))) { - for (max=p/5; max<7*p; max=(int)(max*2+1)) { - double births = 0, births2=0, bsum1, bsum2; - double birthsm = l * PEASANTLUCK * PEASANTGROWTH / (float) 10000 * ((p/(float)max < .9)?1:PEASANTFORCE); - for (n=0;n<10;++n) { - births = peasant_luck_effect(p, l, max); - births2 = fast_peasant_luck_effect(p,l,max); - bsum1 += births; - bsum2 += births2; - printf("%f\t%f\t%f\t%d\t%d\t%d\t1#\n", birthsm, births2, births, p,l,max); - } - bsum1 /= 50; - bsum2 /= 50; - if ((bsum1-bsum2>.5 || bsum2-bsum1>.5) && (bsum1/bsum2>1.1 || bsum2/bsum1>1.1)){ - ++wrong; - } - ++total; - } - } - printf("#\n"); - } - printf("%d / %d\n", wrong, total); - -} - - CuSuite *get_laws_suite(void) { CuSuite *suite = CuSuiteNew(); @@ -751,7 +722,6 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_force_leave_buildings); SUITE_ADD_TEST(suite, test_force_leave_ships); SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean); - SUITE_ADD_TEST(suite, test_peasant_luck); return suite; }