diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index c056006e6..fa94ae0d0 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -523,62 +523,45 @@ calculate_emigration(region *r) } #endif -/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ +/** Bauern vermehren sich */ static void peasants(region * r) { - - int glueck; - - /* Das Geld, daß die Bauern erwirtschaftet haben unter expandwork, gibt - * den Bauern genug für 11 Bauern pro Ebene ohne Wald. Der Wald - * breitet sich nicht in Gebiete aus, die bebaut werden. */ - - int peasants, n, i, satiated, money; -#if PEASANTS_DO_NOT_STARVE == 0 - int dead; -#endif - attrib * a; - - /* Bauern vermehren sich */ + int glueck = 0; + int peasants = rpeasants(r); + int money = rmoney(r); + int maxp = production(r) * MAXPEASANTS_PER_AREA; + int n, satiated; + int dead = 0; + attrib * a = a_find(r->attribs, &at_peasantluck); /* Bis zu 1000 Bauern können Zwillinge bekommen oder 1000 Bauern * wollen nicht! */ - a = a_find(r->attribs, &at_peasantluck); - if (!a) { - glueck = 0; - } else { + if (a!=NULL) { glueck = a->data.i * 1000; } - peasants = rpeasants(r); - for (n = peasants; n; n--) { + int i; + if (glueck >= 0) { /* Sonst keine Vermehrung */ if (rand() % 10000 < PEASANTGROWTH) { - if ((float) peasants - / ((float) production(r) * MAXPEASANTS_PER_AREA) - < 0.9 || rand() % 100 < PEASANTFORCE) { - peasants++; + if (peasants/(float)maxp < 0.9 || rand() % 100 < PEASANTFORCE) { + ++peasants; } } - } else - glueck++; + --glueck; + } - if (glueck > 0) { /* Doppelvermehrung */ - for(i=0; i STARVATION_SURVIVAL) - dead++; + for (n = min((peasants - satiated), rpeasants(r)); n; n--) { + if (rand() % 100 > STARVATION_SURVIVAL) ++dead; + } - if(dead > 0) { + if (dead > 0) { message * msg = add_message(&r->msgs, msg_message("phunger", "dead", dead)); msg_release(msg); peasants -= dead; } -#endif rsetpeasants(r, peasants); } diff --git a/src/common/settings-eressea.h b/src/common/settings-eressea.h index 928a0dd88..be31c8949 100644 --- a/src/common/settings-eressea.h +++ b/src/common/settings-eressea.h @@ -25,7 +25,6 @@ #define RESOURCE_QUANTITY 0.5 #define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */ #define COMBAT_TURNS 5 -#define PEASANTS_DO_NOT_STARVE 0 #define NEW_MIGRATION 1 #define ASTRAL_HUNGER #define NEWATSROI 0 diff --git a/src/common/settings-tutorial.h b/src/common/settings-tutorial.h index 6a20f0aff..099b5cded 100644 --- a/src/common/settings-tutorial.h +++ b/src/common/settings-tutorial.h @@ -25,7 +25,6 @@ #define RESOURCE_QUANTITY 0.5 #define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */ #define COMBAT_TURNS 5 -#define PEASANTS_DO_NOT_STARVE 0 #define NEW_MIGRATION 1 #define ASTRAL_HUNGER #define NEWATSROI 0 diff --git a/src/common/settings-vinyambar-3.h b/src/common/settings-vinyambar-3.h index d1f93164d..854beabdc 100644 --- a/src/common/settings-vinyambar-3.h +++ b/src/common/settings-vinyambar-3.h @@ -26,7 +26,6 @@ #define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */ #define NEWATSROI 0 #define COMBAT_TURNS 5 -#define PEASANTS_DO_NOT_STARVE 0 #define NEW_MIGRATION 1 /* Vermehrungsrate Bauern in 1/10000. diff --git a/src/common/settings-wdw.h b/src/common/settings-wdw.h index b1bd1cb83..dadb586ed 100644 --- a/src/common/settings-wdw.h +++ b/src/common/settings-wdw.h @@ -25,7 +25,6 @@ #define RESOURCE_QUANTITY 0.5 #define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */ #define COMBAT_TURNS 5 -#define PEASANTS_DO_NOT_STARVE 0 #define NEW_MIGRATION 1 #define ASTRAL_HUNGER diff --git a/src/todo.txt b/src/todo.txt index 8ce172f4f..92f3db464 100644 --- a/src/todo.txt +++ b/src/todo.txt @@ -17,6 +17,7 @@ Code cleanup: - give monsters name with lua - kick init_oldherbs out (good for terrain) - allocators aus economy nach XML +- reporting units: http://eressea.upb.de/mantis/view.php?id=781 Larger Features: - eressea (b/g)zip reports?