From 62e08f00c8ba38a5dea7cd5cdfc6a18e49c1a71a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 10 Feb 2001 10:40:12 +0000 Subject: [PATCH] reduzierte warnings unter visual C --- src/common/attributes/attributes-6.dsp | 8 +++ src/common/attributes/attributes.c | 7 ++- src/common/gamecode/creport.c | 62 ++++++++++----------- src/common/gamecode/economy.c | 5 +- src/common/gamecode/laws.c | 23 +++++++- src/common/gamecode/laws.h | 3 +- src/common/gamecode/randenc.c | 7 ++- src/common/gamecode/report.c | 75 +++++++++++++------------- src/common/kernel/alchemy.c | 7 +-- src/common/kernel/battle.c | 7 +-- src/common/kernel/border.c | 10 ++-- src/common/kernel/eressea.c | 23 +------- src/common/kernel/eressea.h | 3 +- src/common/util/event.h | 10 ++-- src/common/util/umlaut.c | 8 +-- src/common/util/util-6.dsp | 6 ++- 16 files changed, 144 insertions(+), 120 deletions(-) diff --git a/src/common/attributes/attributes-6.dsp b/src/common/attributes/attributes-6.dsp index a188867aa..18bfd5223 100644 --- a/src/common/attributes/attributes-6.dsp +++ b/src/common/attributes/attributes-6.dsp @@ -117,6 +117,10 @@ SOURCE=.\reduceproduction.h # End Source File # Begin Source File +SOURCE=.\roadsoverride.h +# End Source File +# Begin Source File + SOURCE=.\targetregion.h # End Source File # End Group @@ -158,6 +162,10 @@ SOURCE=.\reduceproduction.c # End Source File # Begin Source File +SOURCE=.\roadsoverride.c +# End Source File +# Begin Source File + SOURCE=.\targetregion.c # End Source File # End Target diff --git a/src/common/attributes/attributes.c b/src/common/attributes/attributes.c index 6d830a6a2..2888a6c45 100644 --- a/src/common/attributes/attributes.c +++ b/src/common/attributes/attributes.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: attributes.c,v 1.5 2001/02/04 08:42:36 enno Exp $ + * $Id: attributes.c,v 1.6 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -24,6 +24,7 @@ #include "follow.h" #include "iceberg.h" #include "hate.h" +#include "overrideroads.h" /* util includes */ #include @@ -32,13 +33,11 @@ * library initialization */ -extern attrib_type at_roads_override; - void init_attributes(void) { at_register(&at_orcification); - at_register(&at_roads_override); + at_register(&at_overrideroads); /* at_iceberg */ init_iceberg(); /* at_key */ diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 95c52bc7e..5fff17ec1 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: creport.c,v 1.5 2001/02/05 16:11:57 enno Exp $ + * $Id: creport.c,v 1.6 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -20,46 +20,46 @@ */ #include -#include "eressea.h" +#include #include "creport.h" -#include -#include -#include -#include "movement.h" -#include "item.h" -#include "faction.h" -#include "alchemy.h" -#include "magic.h" -#include "race.h" -#include "building.h" -#include "economy.h" -#include "goodies.h" -#include "region.h" -#include "unit.h" -#include "skill.h" -#include "message.h" -#include "border.h" -#include "teleport.h" -#include "ship.h" -#include "karma.h" -#ifdef GROUPS -#include "group.h" -#endif - - /* modules include */ #include /* attributes include */ #include +/* gamecode includes */ +#include "laws.h" +#include "economy.h" + +/* kernel includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* util includes */ +#include + +/* libc includes */ #include #include -#ifdef WIN32 -#else -#include -#endif #include #include #include diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 714f74b3e..2707bc7eb 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: economy.c,v 1.3 2001/02/03 13:45:29 enno Exp $ + * $Id: economy.c,v 1.4 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -46,6 +46,9 @@ #include "reports.h" #include "karma.h" +/* gamecode includes */ +#include "laws.h" + /* util includes */ #include #include diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index e61c96d33..17e0c785b 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: laws.c,v 1.8 2001/02/09 15:17:30 corwin Exp $ + * $Id: laws.c,v 1.9 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -2980,3 +2980,24 @@ processorders (void) write_skillfix(); #endif } + +int +count_migrants (const faction * f) +{ +#ifndef NDEBUG + unit *u = f->units; + int n = 0; + while (u) { + assert(u->faction == f); + if (u->race != f->race && u->race != RC_ILLUSION && u->race != RC_SPELL + && !nonplayer(u) && !(is_cursed(u->attribs, C_SLAVE, 0))) + { + n += u->number; + } + u = u->nextF; + } + if (f->num_migrants != n) + puts("FEHLER: Anzahl Migranten falsch"); +#endif + return f->num_migrants; +} diff --git a/src/common/gamecode/laws.h b/src/common/gamecode/laws.h index f1cbb9785..ed3bb9c4a 100644 --- a/src/common/gamecode/laws.h +++ b/src/common/gamecode/laws.h @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: laws.h,v 1.2 2001/01/26 16:19:39 enno Exp $ + * $Id: laws.h,v 1.3 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -42,5 +42,6 @@ extern void sinkships(void); extern void * resolve_ship(void * data); void processorders(void); +extern int count_migrants (const struct faction * f); #endif diff --git a/src/common/gamecode/randenc.c b/src/common/gamecode/randenc.c index 9d6c16214..812083013 100644 --- a/src/common/gamecode/randenc.c +++ b/src/common/gamecode/randenc.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: randenc.c,v 1.6 2001/02/03 13:45:30 enno Exp $ + * $Id: randenc.c,v 1.7 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -1305,7 +1305,10 @@ randomevents(void) if(is_cursed(r->attribs, C_HOLYGROUND, 0)) continue; /* Chance 0.1% * chaosfactor */ - if (unburied && r->land && rand() % 10000 < (100 + 100 * chaosfactor(r))) { + if (r->land && unburied > r->land->peasants / 20 && rand() % 10000 < (100 + 100 * chaosfactor(r))) { + /* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen. + * Lieber sammeln lassen, bis sie mindestens 5% der Bevölkerung sind, und + * dann erst auferstehen. */ int undead = unburied / (rand() % 2 + 1); race_t rc; int i; diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 723c3df95..9ed1e0355 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: report.c,v 1.11 2001/02/05 16:11:57 enno Exp $ + * $Id: report.c,v 1.12 2001/02/10 10:40:10 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -23,42 +23,47 @@ #define INDENT 0 #include -#include "eressea.h" -#include "reports.h" - -#include "item.h" -#include "alchemy.h" -#include "faction.h" -#include "region.h" -#include "unit.h" -#include "skill.h" -#include "movement.h" -#include "message.h" -#include "ship.h" -#include "building.h" -#include "economy.h" -#include "build.h" -#include "creation.h" -#include "save.h" -#include "build.h" -#include "magic.h" -#include "race.h" -#include "monster.h" -#include "plane.h" -#include "pool.h" -#include "teleport.h" -#include "border.h" -#include "objtypes.h" -#include "goodies.h" -#include "karma.h" -#include "render.h" -#ifdef GROUPS -#include "group.h" -#endif +#include +/* modules includes */ #include +/* attributes includes */ +#include + +/* gamecode includes */ +#include "creation.h" +#include "economy.h" +#include "monster.h" +#include "laws.h" + +/* kernel includes */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + /* util includes */ +#include #include /* libc includes */ @@ -861,8 +866,6 @@ see_border(border * b, faction * f, region * r) return cs; } -extern attrib_type at_roads_override; - static void describe(FILE * F, region * r, int partial, faction * f) { @@ -1025,7 +1028,7 @@ describe(FILE * F, region * r, int partial, faction * f) } if (!is_cursed(r->attribs, C_REGCONF, 0)) { - attrib *a_do = a_find(r->attribs, &at_roads_override); + attrib *a_do = a_find(r->attribs, &at_overrideroads); if(a_do) { scat(" "); scat((char *)a_do->data.v); diff --git a/src/common/kernel/alchemy.c b/src/common/kernel/alchemy.c index 33536ba50..615224e04 100644 --- a/src/common/kernel/alchemy.c +++ b/src/common/kernel/alchemy.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: alchemy.c,v 1.4 2001/02/09 13:53:51 corwin Exp $ + * $Id: alchemy.c,v 1.5 2001/02/10 10:40:11 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -178,8 +178,9 @@ a_readeffect(attrib *a, FILE *f) ptype = oldpotiontype[data.sa[0]]; power = data.sa[1]; } else { - fscanf(f, "%s %d", buf, &power); - ptype = pt_find(buf); + char zText[32]; + fscanf(f, "%s %d", zText, &power); + ptype = pt_find(zText); } if (ptype==NULL || power==0) return 0; edata->type = ptype; diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index de0be2ecd..2545cf7db 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: battle.c,v 1.8 2001/02/09 15:17:31 corwin Exp $ + * $Id: battle.c,v 1.9 2001/02/10 10:40:11 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -2449,8 +2449,9 @@ print_fighters(battle * b, cvector * fighters) int row = get_unitrow(df); if (row != lastrow) { - sprintf(buf, "... in der %d. Kampflinie:", row); - battlerecord(b, buf); + char zText[32]; + sprintf(zText, "... in der %d. Kampflinie:", row); + battlerecord(b, zText); lastrow = row; } battle_punit(du, b); diff --git a/src/common/kernel/border.c b/src/common/kernel/border.c index 138f88317..a90aa7d8a 100644 --- a/src/common/kernel/border.c +++ b/src/common/kernel/border.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: border.c,v 1.3 2001/01/28 08:01:51 enno Exp $ + * $Id: border.c,v 1.4 2001/02/10 10:40:11 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -89,18 +89,20 @@ read_borders(FILE * f) for (;;) { int fx, fy, tx, ty; unsigned int bid = 0; + char zText[32]; border * b; region * from, * to; border_type * type; - fscanf(f, "%s", buf); - if (!strcmp(buf, "end")) break; + + fscanf(f, "%s", zText); + if (!strcmp(zText, "end")) break; if (global.data_versionnext) - for (u = r->units; u; u = u->next) - if (u->faction == f && u->race != f->race - && u->race != RC_ILLUSION && u->race != RC_SPELL - && !nonplayer(u)) - if(!(is_cursed(u->attribs, C_SLAVE, 0))) - n += u->number; - if (f->num_migrants != n) - puts("FEHLER: Anzahl Migranten falsch"); -#endif - return f->num_migrants; -} - int count_all(const faction * f) { diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index e51e170ef..8aaf3489b 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: eressea.h,v 1.12 2001/02/05 16:11:58 enno Exp $ + * $Id: eressea.h,v 1.13 2001/02/10 10:40:11 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -995,7 +995,6 @@ char *shipname(const ship * sh); struct building *largestbuilding(const struct region * r, boolean img); -int count_migrants(const struct faction * f); int count_all(const struct faction * f); int teure_talente(struct unit * u); int count_maxmigrants(const struct faction * f); diff --git a/src/common/util/event.h b/src/common/util/event.h index aa80d7c4d..5eee55d91 100644 --- a/src/common/util/event.h +++ b/src/common/util/event.h @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: event.h,v 1.2 2001/01/26 16:19:41 enno Exp $ + * $Id: event.h,v 1.3 2001/02/10 10:40:12 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -21,12 +21,12 @@ struct attrib; struct trigger; typedef union { - void * v; - int i; - char c; + void *v; + int i; + char c; short s; short sa[2]; - char ca[4]; + char ca[4]; } variant; typedef struct trigger_type { diff --git a/src/common/util/umlaut.c b/src/common/util/umlaut.c index d981761f7..c186b5212 100644 --- a/src/common/util/umlaut.c +++ b/src/common/util/umlaut.c @@ -1,6 +1,6 @@ /* vi: set ts=2: * - * $Id: umlaut.c,v 1.2 2001/01/26 16:19:41 enno Exp $ + * $Id: umlaut.c,v 1.3 2001/02/10 10:40:12 enno Exp $ * Eressea PB(E)M host Copyright (C) 1998-2000 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -30,7 +30,7 @@ void addtoken(tnode * root, const char* str, void * id) { - static char buf[1024]; + static char zText[1024]; static struct replace { char c; const char * str; @@ -66,8 +66,8 @@ addtoken(tnode * root, const char* str, void * id) addtoken(tk, str+1, id); while (replace[i].str) { if (*str==replace[i].c) { - strcat(strcpy(buf, replace[i].str), str+1); - addtoken(root, buf, id); + strcat(strcpy(zText, replace[i].str), str+1); + addtoken(root, zText, id); break; } ++i; diff --git a/src/common/util/util-6.dsp b/src/common/util/util-6.dsp index 6b5e2c985..0d851140d 100644 --- a/src/common/util/util-6.dsp +++ b/src/common/util/util-6.dsp @@ -112,7 +112,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Profile" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /Za /W4 /GX- /Z7 /O2 /I "../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /Za /W4 /Z7 /O2 /I "../.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE RSC /l 0x407 # ADD RSC /l 0x407 BSC32=bscmake.exe @@ -236,6 +236,10 @@ SOURCE=.\resolve.c # End Source File # Begin Source File +SOURCE=.\translation.c +# End Source File +# Begin Source File + SOURCE=.\umlaut.c # End Source File # Begin Source File