From 91e6e375c2e2b8f3d77be63f99716bea72139516 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 24 Mar 2003 22:42:41 +0000 Subject: [PATCH] =?UTF-8?q?Bugfix=20D=C3=A4monenhunger,=20Projektfiles=20f?= =?UTF-8?q?=C3=BCr=20Visual=20Studio=20.NET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/attributes/attributes.vcproj | 9 +- src/common/gamecode/gamecode.vcproj | 9 +- src/common/gamecode/laws.c | 61 ++++++++- src/common/gamecode/randenc.c | 64 +-------- src/common/items/items.vcproj | 22 +++- src/common/kernel/eressea.c | 20 +-- src/common/kernel/eressea.h | 3 +- src/common/kernel/kernel.vcproj | 13 +- src/common/modules/modules.vcproj | 12 +- src/common/races/races.vcproj | 10 +- src/common/spells/spells.vcproj | 8 +- src/common/triggers/triggers.vcproj | 10 +- src/common/util/util.vcproj | 5 +- src/eressea.sln | 166 ++++++++++-------------- src/eressea/eressea.vcproj | 61 +-------- src/mapper/mapper.vcproj | 8 +- 16 files changed, 206 insertions(+), 275 deletions(-) diff --git a/src/common/attributes/attributes.vcproj b/src/common/attributes/attributes.vcproj index ad65b2157..16c9efac2 100644 --- a/src/common/attributes/attributes.vcproj +++ b/src/common/attributes/attributes.vcproj @@ -21,11 +21,12 @@ Name="VCCLCompilerTool" Optimization="0" ImproveFloatingPointConsistency="TRUE" - AdditionalIncludeDirectories="../util,../kernel,../..,.." + AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" - RuntimeLibrary="5" + BasicRuntimeChecks="0" + RuntimeLibrary="4" DisableLanguageExtensions="TRUE" - UsePrecompiledHeader="2" + UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderFile=".\Debug/attributes.pch" AssemblerListingLocation=".\Debug/" @@ -66,7 +67,7 @@ Name="VCCLCompilerTool" InlineFunctionExpansion="1" ImproveFloatingPointConsistency="TRUE" - AdditionalIncludeDirectories="../util,../kernel,../..,.." + AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" RuntimeLibrary="4" diff --git a/src/common/gamecode/gamecode.vcproj b/src/common/gamecode/gamecode.vcproj index 7fb617490..6237df6b8 100644 --- a/src/common/gamecode/gamecode.vcproj +++ b/src/common/gamecode/gamecode.vcproj @@ -67,7 +67,7 @@ Name="VCCLCompilerTool" InlineFunctionExpansion="1" ImproveFloatingPointConsistency="TRUE" - AdditionalIncludeDirectories="../util,../kernel,../..,.." + AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS" StringPooling="TRUE" RuntimeLibrary="4" @@ -114,10 +114,11 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" - RuntimeLibrary="5" + PreprocessorDefinitions="_WINDOWS,WIN32" + BasicRuntimeChecks="0" + RuntimeLibrary="4" DisableLanguageExtensions="TRUE" - UsePrecompiledHeader="2" + UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderFile=".\Debug/gamecode.pch" AssemblerListingLocation=".\Debug/" diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 7d106118c..49f9c0c63 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -186,9 +186,8 @@ get_food(region *r) if (need > 0) { unit *v; - for (v = r->units; need && v; v = v->next) - if (v->faction != u->faction && alliedunit(v, u->faction, HELP_MONEY) - && !is_monstrous(v)) { + for (v = r->units; need && v; v = v->next) { + if (v->faction != u->faction && alliedunit(v, u->faction, HELP_MONEY) && !is_monstrous(v)) { int give = lifestyle(v); give = max(0, get_money(v) - give); give = min(need, give); @@ -200,14 +199,66 @@ get_food(region *r) add_spende(v->faction, u->faction, give, r); } } + } /* Die Einheit hat nicht genug Geld zusammengekratzt und * nimmt Schaden: */ - - if (need) hunger(u, need); + if (need) { + int lspp = lifestyle(u)/u->number; + if (lspp > 0) { + int number = (need+lspp-1)/lspp; + if (hunger(number, u)) fset(u, FL_HUNGER); + } + } } } + for (r = regions; r; r = r->next) { + int peasantfood = rpeasants(r)*10; + int bauernblut = 0; + boolean bfind = false; + for (u = r->units; u; u = u->next) { + if (u->race == new_race[RC_DAEMON]) { + /* Alles Bauernblut der Region zählen. + * warnung: bauernblut einer partei hilft im moment der anderen + * so selten wie das benutzt wird, ist das erstmal wursht, + * aber ein TODO fürs BUGS File. + * Es ist auch deshalb fast egal, weil es ja im Grunde nicht dem Dämon, + * sondern der Region zu gute kommt - und da ist der anwender schnuppe + */ + if (!bfind) { + unit * ud = u; + while (ud) { + attrib * a = a_find(ud->attribs, &at_bauernblut); + if (a) bauernblut += a->data.i; + do { ud=ud->next; } while (ud && ud->race!=new_race[RC_DAEMON]); + } + bfind = true; + } + if (r->planep == NULL || !fval(r->planep, PFL_NOFEED)) { + int demons = u->number; + if (bauernblut>=demons) { + bauernblut -= demons; + demons = 0; + } else if (bauernblut) { + demons-=bauernblut; + } + if (peasantfood>=demons) { + peasantfood -= demons; + demons = 0; + } else { + demons -= peasantfood; + peasantfood = 0; + } + if (demons > 0) { + hunger(demons, u); /* nicht gefütterte dämonen hungern */ + } + } + } + } + rsetpeasants(r, peasantfood/10); + } + /* 3. Von den überlebenden das Geld abziehen: */ for (u = r->units; u; u = u->next) { int need = min(get_money(u), lifestyle(u)); diff --git a/src/common/gamecode/randenc.c b/src/common/gamecode/randenc.c index b37e3db48..8253e815d 100644 --- a/src/common/gamecode/randenc.c +++ b/src/common/gamecode/randenc.c @@ -1135,66 +1135,12 @@ randomevents(void) } #endif - /* Talente von Dämonen verschieben sich und Dämonen fressen Bauern */ + /* Talente von Dämonen verschieben sich */ for (r = regions; r; r = r->next) { - int peasantfood = rpeasants(r)*10; - int bauernblut = 0; - boolean bfind = false; for (u = r->units; u; u = u->next) { if (u->race == new_race[RC_DAEMON]) { - /* Alles Bauernblut der Region zählen. - * warnung: bauernblut einer partei hilft im moment der anderen - * so selten wie das benutzt wird, ist das erstmal wursht, - * aber ein TODO fürs BUGS File. - * Es ist auch deshalb fast egal, weil es ja im Grunde nicht dem Dämon, - * sondern der Region zu gute kommt - und da ist der anwender schnuppe - */ - skill * sv; - if (!bfind) { - unit * ud = u; - while (ud) { - attrib * a = a_find(ud->attribs, &at_bauernblut); - if (a) bauernblut += a->data.i; - do { ud=ud->next; } while (ud && ud->race!=new_race[RC_DAEMON]); - } - bfind = true; - } - if (r->planep == NULL || !fval(r->planep, PFL_NOFEED)) { - int demons = u->number; - if (bauernblut>=demons) { - bauernblut -= demons; - demons = 0; - } else if (bauernblut) { - demons-=bauernblut; - } - if (peasantfood>=demons) { - peasantfood -= demons; - demons = 0; - } else { - demons -= peasantfood; - peasantfood = 0; - } - if (demons > 0) { -#ifdef DAEMON_HUNGER - hunger(u, demons); /* nicht gefütterte dämonen hungern */ -#else - c = 0; - for (n = 0; n != demons; n++) { - if (rand() % 100 < 10) { - c++; - } - } - if (c) { - scale_number(u, u->number - c); - sprintf(buf, "%d Dämonen von %s sind hungrig in " - "ihre Sphäre zurückgekehrt.", c, unitname(u)); - addmessage(0, u->faction, buf, MSG_EVENT, ML_IMPORTANT); - } -#endif - } - } - sv = u->skills; + skill * sv = u->skills; while (sv!=u->skills+u->skill_size) { if (sv->level>0 && rand() % 100 < 25) { int weeks = 1+rand()%3; @@ -1203,12 +1149,16 @@ randomevents(void) } else { while (weeks--) learn_skill(u, sv->id, 1.0); } + if (sv->old>sv->level) { + log_printf("%s dropped from %u to %u:%u in %s\n", + unitname(u), sv->old, sv->level, + sv->weeks, skillname(sv->id, NULL)); + } } ++sv; } } } - rsetpeasants(r, peasantfood/10); } for (r = regions; r; r = r->next) { diff --git a/src/common/items/items.vcproj b/src/common/items/items.vcproj index 985c346e2..e61001082 100644 --- a/src/common/items/items.vcproj +++ b/src/common/items/items.vcproj @@ -34,8 +34,7 @@ ProgramDataBaseFileName=".\Release/" WarningLevel="4" SuppressStartupBanner="TRUE" - DebugInformationFormat="1" - CompileAs="0"/> + DebugInformationFormat="1"/> + + + + @@ -134,12 +140,18 @@ + + + + diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 709b9bf14..ae328b90e 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2594,24 +2594,20 @@ lifestyle(const unit * u) return need; } -void -hunger(unit * u, int need) +boolean +hunger(int number, unit * u) { region * r = u->region; int dead = 0, hpsub = 0; int hp = u->hp / u->number; - int lspp = lifestyle(u)/u->number; - if(lspp <= 0) return; - - while(need > 0) { + while (number--) { int dam = old_race(u->race)==RC_HALFLING?15+rand()%14:(13+rand()%12); - if(dam >= hp) { + if (dam >= hp) { ++dead; } else { hpsub += dam; } - need -= lspp; } if (dead) { @@ -2622,8 +2618,8 @@ hunger(unit * u, int need) scale_number(u, u->number - dead); deathcounts(r, dead); - } - if(hpsub > 0) { + } + if (hpsub > 0) { /* Jetzt die Schäden der nicht gestorbenen abziehen. */ u->hp -= hpsub; /* Meldung nur, wenn noch keine für Tote generiert. */ @@ -2633,9 +2629,7 @@ hunger(unit * u, int need) "malnourish%u:unit%r:region", u, r)); } } - if(dead || hpsub) { - fset(u, FL_HUNGER); - } + return (dead || hpsub); } void diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index dda40b01d..901bf4bc8 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -98,7 +98,6 @@ struct xml_stack; #define NEW_DRIVE /* Neuer Algorithmus Transportiere/Fahre */ #define PARTIAL_STUDY /* Wenn nicht genug Silber vorhanden, wird ein Talent anteilig gelernt */ #define HUNGER_REDUCES_SKILL /* Hunger reduziert den Talentwert auf die Hälfte */ -#define DAEMON_HUNGER /* Dämonen hungern, statt mit 10% in ihre sphäre zurückzukehren */ #define NEW_RECEIPIES /* Vereinfachte, besser verteilte Kräuterzutaten für Tränke */ #define NEW_TAVERN #define GOBLINKILL @@ -1170,7 +1169,7 @@ typedef struct local_names { } local_names; extern int maxworkingpeasants(const struct region * r); -extern void hunger(struct unit * u, int moneyneeded); +extern boolean hunger(int number, struct unit * u); extern int lifestyle(const struct unit*); extern int besieged(const struct unit * u); diff --git a/src/common/kernel/kernel.vcproj b/src/common/kernel/kernel.vcproj index 3265e8e4c..2d5402e19 100644 --- a/src/common/kernel/kernel.vcproj +++ b/src/common/kernel/kernel.vcproj @@ -68,10 +68,11 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../util,../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" - RuntimeLibrary="5" + PreprocessorDefinitions="_WINDOWS,WIN32" + BasicRuntimeChecks="0" + RuntimeLibrary="4" DisableLanguageExtensions="TRUE" - UsePrecompiledHeader="2" + UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderFile=".\Debug/kernel.pch" AssemblerListingLocation=".\Debug/" @@ -263,9 +264,6 @@ - - @@ -372,9 +370,6 @@ - - diff --git a/src/common/modules/modules.vcproj b/src/common/modules/modules.vcproj index 7d1be44b1..46d2e618d 100644 --- a/src/common/modules/modules.vcproj +++ b/src/common/modules/modules.vcproj @@ -22,17 +22,18 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" - RuntimeLibrary="5" + PreprocessorDefinitions="_WINDOWS,WIN32" + BasicRuntimeChecks="0" + RuntimeLibrary="4" DisableLanguageExtensions="TRUE" - UsePrecompiledHeader="2" + UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderFile=".\Debug/modules.pch" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" WarningLevel="4" - SuppressStartupBanner="TRUE" + SuppressStartupBanner="FALSE" DebugInformationFormat="1" CompileAs="0"/> + DebugInformationFormat="1"/> + DebugInformationFormat="1"/> + DebugInformationFormat="1"/> + DebugInformationFormat="1"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mapper/mapper.vcproj b/src/mapper/mapper.vcproj index 6f1efa567..46684c5c0 100644 --- a/src/mapper/mapper.vcproj +++ b/src/mapper/mapper.vcproj @@ -22,6 +22,7 @@ Name="VCCLCompilerTool" InlineFunctionExpansion="1" ImproveFloatingPointConsistency="TRUE" + AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE" StringPooling="TRUE" RuntimeLibrary="4" @@ -77,10 +78,11 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." - PreprocessorDefinitions="_CONSOLE,WIN32,_DEBUG" - RuntimeLibrary="5" + PreprocessorDefinitions="_CONSOLE,WIN32" + BasicRuntimeChecks="0" + RuntimeLibrary="4" DisableLanguageExtensions="TRUE" - UsePrecompiledHeader="2" + UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderFile=".\Debug/mapper.pch" AssemblerListingLocation=".\Debug/"