diff --git a/src/common/kernel/alchemy.h b/src/common/kernel/alchemy.h index 84543ff62..870c9d424 100644 --- a/src/common/kernel/alchemy.h +++ b/src/common/kernel/alchemy.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: alchemy.h,v 1.2 2001/01/26 16:19:39 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) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index f9cbc8491..3b0c3017f 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.13 2001/02/14 08:35:12 katze Exp $ + * $Id: battle.c,v 1.14 2001/02/14 09:17:56 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) @@ -22,11 +22,8 @@ typedef enum combatmagic { - DO_PRECOMBATSPELL, - DO_POSTCOMBATSPELL - } combatmagic_t; @@ -461,6 +458,11 @@ get_unitrow(const fighter * af) int front = 0; size_t bsize; +#ifdef FAST_GETUNITROW + if (!b->nonblockers && b->alive==af->row.alive) { + return af->row.cached; + } +#endif bsize = cv_size(&b->sides); if (csizerow.alive = b->alive; + af->row.cached = result; +#endif return result; } @@ -797,6 +803,8 @@ rmtroop(troop dt) side *ds = df->side; --df->alive; + --df->side->alive; + --df->side->battle->alive; assert(dt.index >= 0 && dt.index < df->unit->number); assert(df->alive < df->unit->number); df->person[dt.index] = df->person[df->alive - df->removed]; @@ -2162,16 +2170,23 @@ aftermath(battle * b) #ifdef TROLLSAVE /* Trolle können regenerieren */ if (df->alive > 0 && dead && du->race == RC_TROLL) - for (i = 0; i != dead; ++i) - if (chance(TROLL_REGENERATION)) + for (i = 0; i != dead; ++i) { + if (chance(TROLL_REGENERATION)) { ++df->alive; + ++df->side->alive; + ++df->side->battle->alive; + } + } trollsave[df->side->index] += dead - du->number + df->alive; #endif /* Regeneration durch PR_MERCY */ if (dead && pr_mercy) for (i = 0; i != dead; ++i) - if (rand()%100 < pr_mercy) + if (rand()%100 < pr_mercy) { ++df->alive; + ++df->side->alive; + ++df->side->battle->alive; + } /* Tote, die wiederbelebt werde können */ if (!nonplayer(df->unit)) { @@ -2212,7 +2227,6 @@ aftermath(battle * b) if (s->bf->lastturn+(b->has_tactics_turn?1:0)>1) { relevant = true; } - s->alive = 0; s->flee = 0; s->dead = 0; @@ -2235,7 +2249,6 @@ aftermath(battle * b) s->dead += dead; s->flee += df->run_number; - s->alive += df->alive; if (df->alive == du->number) continue; /* nichts passiert */ @@ -2707,6 +2720,8 @@ make_fighter(battle * b, unit * u, boolean attack) fig->status = u->status; fig->side = s1; fig->alive = u->number; + fig->side->alive += u->number; + fig->side->battle->alive += u->number; fig->catmsg = -1; /* Freigeben nicht vergessen! */ @@ -2838,6 +2853,9 @@ make_fighter(battle * b, unit * u, boolean attack) s1->size[SUM_ROW] += u->number; if (race[u->race].battle_flags & BF_NOBLOCK) { s1->nonblockers[fig->status + FIGHT_ROW] += u->number; +#ifdef FAST_GETUNITROW + b->nonblockers = true; +#endif } if (race[fig->unit->race].flags & RCF_HORSE) { @@ -3094,14 +3112,6 @@ battle_report(battle * b) bfaction *bf; buf[0] = 0; - for_each(s, b->sides) { - fighter *f; - - s->alive = 0; - for_each(f, s->fighters) { - s->alive += f->alive; - } next(f); - } next(s); for_each(s, b->sides) { for_each(s2, b->sides) { diff --git a/src/common/kernel/battle.h b/src/common/kernel/battle.h index cea2436f5..e2722a707 100644 --- a/src/common/kernel/battle.h +++ b/src/common/kernel/battle.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: battle.h,v 1.3 2001/02/14 01:38:50 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) @@ -15,11 +14,18 @@ #ifndef BATTLE_H #define BATTLE_H +/** new code defines **/ +#define FAST_GETUNITROW +#define FASTENEMY + +/** more defines **/ #define FS_ENEMY 1 #define FS_HELP 2 -#define NUMROWS 5 /* Eressea hat 4 Verteidigungslinien. 1 ist - * * * vorn */ +/***** Verteidigungslinien. + * Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enthält Summen + */ +#define NUMROWS 5 #define SUM_ROW 0 #define FIGHT_ROW 1 #define BEHIND_ROW 2 @@ -50,8 +56,12 @@ typedef struct battle { boolean has_tactics_turn; int keeploot; boolean reelarrow; - int dh; + int dh; + int alive; boolean small; +#ifdef FAST_GETUNITROW + boolean nonblockers; +#endif } battle; typedef struct tactics { @@ -66,7 +76,6 @@ typedef struct side { struct faction *faction; /* Die Partei, die hier kämpft */ struct bfaction * bf; /* Die Partei, die hier kämpft */ const struct group * group; -#define FASTENEMY #ifdef FASTENEMY # define E_ENEMY 1 # define E_ATTACKING 2 @@ -168,6 +177,12 @@ typedef struct fighter { int run_hp; /* accumulated hp of fleeing people */ struct region *run_to; /* destination of fleeing people */ int action_counter; /* number of active actions the struct unit did in the fight */ +#ifdef FAST_GETUNITROW + struct { + int alive; + int cached; + } row; +#endif } fighter; typedef struct troop { diff --git a/src/common/kernel/build.h b/src/common/kernel/build.h index 971c508dd..f07d322d9 100644 --- a/src/common/kernel/build.h +++ b/src/common/kernel/build.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: build.h,v 1.2 2001/01/26 16:19:39 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) diff --git a/src/common/kernel/building.h b/src/common/kernel/building.h index ddce1dd2c..264fc0344 100644 --- a/src/common/kernel/building.h +++ b/src/common/kernel/building.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: building.h,v 1.2 2001/01/26 16:19:39 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) diff --git a/src/common/kernel/curse.h b/src/common/kernel/curse.h index 8bb159799..5b3026d07 100644 --- a/src/common/kernel/curse.h +++ b/src/common/kernel/curse.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: curse.h,v 1.4 2001/02/03 13:45:32 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) diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index b3edbb344..5674ac62c 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: eressea.h,v 1.17 2001/02/12 22:39:56 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) diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index 0ae1fa55b..ca72a773b 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: faction.h,v 1.2 2001/01/26 16:19:39 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) diff --git a/src/common/kernel/group.h b/src/common/kernel/group.h index d28fdd1fe..71666e53d 100644 --- a/src/common/kernel/group.h +++ b/src/common/kernel/group.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: group.h,v 1.2 2001/01/26 16:19:39 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) diff --git a/src/common/kernel/item.h b/src/common/kernel/item.h index 3cfe25405..25bc1730c 100644 --- a/src/common/kernel/item.h +++ b/src/common/kernel/item.h @@ -1,6 +1,5 @@ /* vi: set ts=2: * - * $Id: item.h,v 1.5 2001/02/14 07:44:57 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) diff --git a/src/common/kernel/kernel-6.dsp b/src/common/kernel/kernel-6.dsp index 4998fa2be..435a49cab 100644 --- a/src/common/kernel/kernel-6.dsp +++ b/src/common/kernel/kernel-6.dsp @@ -155,18 +155,10 @@ SOURCE=.\building.h # End Source File # Begin Source File -SOURCE=.\creation.h -# End Source File -# Begin Source File - SOURCE=.\curse.h # End Source File # Begin Source File -SOURCE=.\economy.h -# End Source File -# Begin Source File - SOURCE=.\eressea.h # End Source File # Begin Source File diff --git a/src/eressea-6.opt b/src/eressea-6.opt index 87d1647fe..23793762c 100644 Binary files a/src/eressea-6.opt and b/src/eressea-6.opt differ diff --git a/src/eressea/eressea-6.dsp b/src/eressea/eressea-6.dsp index f12c0501b..b304072f7 100644 --- a/src/eressea/eressea-6.dsp +++ b/src/eressea/eressea-6.dsp @@ -44,7 +44,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Za /W4 /GX /Z7 /O2 /I ".." /I "../common" /I "../common/util" /I "../common/kernel" /I "../common/gamecode" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "NDEBUG" /D "CONVERT_TRIGGER" /YX /FD /c +# ADD CPP /nologo /Za /W4 /GX /Z7 /O2 /I ".." /I "../common" /I "../common/util" /I "../common/kernel" /I "../common/gamecode" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "NDEBUG" /D "CONVERT_TRIGGER" /FR /YX /FD /c # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe