forked from github/server
Kaempfe beschleunigt (evtl). wird mit FASTENEMY define aktiviert. zahlen morgen im lauf des tages.
This commit is contained in:
parent
513d232211
commit
e76ddede60
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: battle.c,v 1.11 2001/02/11 08:55:30 enno Exp $
|
* $Id: battle.c,v 1.12 2001/02/14 01:38:50 enno Exp $
|
||||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||||
|
@ -295,15 +295,30 @@ fbattlerecord(faction * f, region * r, const char *s)
|
||||||
boolean
|
boolean
|
||||||
enemy(const side * as, const side * ds)
|
enemy(const side * as, const side * ds)
|
||||||
{
|
{
|
||||||
|
#ifdef FASTENEMY
|
||||||
|
switch(as->enemy[ds->index]) {
|
||||||
|
case E_ENEMY:
|
||||||
|
case E_ENEMY|E_ATTACKING:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
const struct enemy * e = as->enemies[ds->index % 16];
|
const struct enemy * e = as->enemies[ds->index % 16];
|
||||||
while (e && e->side!=ds) e=e->nexthash;
|
while (e && e->side!=ds) e=e->nexthash;
|
||||||
if (e) return true;
|
if (e) return true;
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_enemy(side * as, side * ds, boolean attacking)
|
set_enemy(side * as, side * ds, boolean attacking)
|
||||||
{
|
{
|
||||||
|
#ifdef FASTENEMY
|
||||||
|
ds->enemy[as->index] |= E_ENEMY;
|
||||||
|
as->enemy[ds->index] |= E_ENEMY;
|
||||||
|
if (attacking) as->enemy[ds->index] |= E_ATTACKING;
|
||||||
|
#else
|
||||||
struct enemy * e = as->enemies[ds->index % 16];
|
struct enemy * e = as->enemies[ds->index % 16];
|
||||||
while (e && e->side!=ds) e=e->nexthash;
|
while (e && e->side!=ds) e=e->nexthash;
|
||||||
if (e==NULL) {
|
if (e==NULL) {
|
||||||
|
@ -319,6 +334,7 @@ set_enemy(side * as, side * ds, boolean attacking)
|
||||||
ds->enemies[as->index % 16] = e;
|
ds->enemies[as->index % 16] = e;
|
||||||
}
|
}
|
||||||
else e->attacking |= attacking;
|
else e->attacking |= attacking;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int alliance(const ally * sf, const faction * f, int mode);
|
extern int alliance(const ally * sf, const faction * f, int mode);
|
||||||
|
@ -2522,7 +2538,9 @@ print_stats(battle * b)
|
||||||
|
|
||||||
for (bf=b->factions;bf;bf=bf->next) {
|
for (bf=b->factions;bf;bf=bf->next) {
|
||||||
faction * f = bf->faction;
|
faction * f = bf->faction;
|
||||||
|
#ifndef FASTENEMY
|
||||||
struct enemy * e;
|
struct enemy * e;
|
||||||
|
#endif
|
||||||
fbattlerecord(f, b->region, " ");
|
fbattlerecord(f, b->region, " ");
|
||||||
sprintf(buf, "Heer %d: %s", side->index,
|
sprintf(buf, "Heer %d: %s", side->index,
|
||||||
seematrix(f, side)
|
seematrix(f, side)
|
||||||
|
@ -2546,6 +2564,20 @@ print_stats(battle * b)
|
||||||
fbattlerecord(f, b->region, buf);
|
fbattlerecord(f, b->region, buf);
|
||||||
strcpy(buf, "Attacke gegen:");
|
strcpy(buf, "Attacke gegen:");
|
||||||
komma = false;
|
komma = false;
|
||||||
|
#ifdef FASTENEMY
|
||||||
|
for_each(s2, b->sides) {
|
||||||
|
if (side->enemy[s2->index] & E_ATTACKING) {
|
||||||
|
if (seematrix(f, s2) == true) {
|
||||||
|
sprintf(buf, "%s%s Heer %d(%s)", buf, komma++ ? "," : "",
|
||||||
|
s2->index, abkz(s2->bf->faction->name, 3));
|
||||||
|
} else {
|
||||||
|
sprintf(buf, "%s%s Heer %d(Unb)", buf, komma++ ? "," : "",
|
||||||
|
s2->index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next(s2);
|
||||||
|
#else
|
||||||
for (i=0;i!=16;i++)
|
for (i=0;i!=16;i++)
|
||||||
for (e=side->enemies[i]; e; e=e->nexthash) if (e->attacking) {
|
for (e=side->enemies[i]; e; e=e->nexthash) if (e->attacking) {
|
||||||
struct side * s2 = e->side;
|
struct side * s2 = e->side;
|
||||||
|
@ -2557,6 +2589,7 @@ print_stats(battle * b)
|
||||||
s2->index);
|
s2->index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
fbattlerecord(f, b->region, buf);
|
fbattlerecord(f, b->region, buf);
|
||||||
}
|
}
|
||||||
buf[77] = (char)0;
|
buf[77] = (char)0;
|
||||||
|
@ -2964,12 +2997,14 @@ make_battle(region * r)
|
||||||
static void
|
static void
|
||||||
free_side(side * si)
|
free_side(side * si)
|
||||||
{
|
{
|
||||||
|
#ifndef FASTENEMY
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i!=16;++i) while (si->enemies[i]) {
|
for (i=0;i!=16;++i) while (si->enemies[i]) {
|
||||||
struct enemy * e = si->enemies[i]->nexthash;
|
struct enemy * e = si->enemies[i]->nexthash;
|
||||||
free(si->enemies[i]);
|
free(si->enemies[i]);
|
||||||
si->enemies[i] = e;
|
si->enemies[i] = e;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
cv_kill(&si->fighters);
|
cv_kill(&si->fighters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: battle.h,v 1.2 2001/01/26 16:19:39 enno Exp $
|
* $Id: battle.h,v 1.3 2001/02/14 01:38:50 enno Exp $
|
||||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||||
|
@ -65,14 +65,19 @@ typedef struct side {
|
||||||
struct battle * battle;
|
struct battle * battle;
|
||||||
struct faction *faction; /* Die Partei, die hier kämpft */
|
struct faction *faction; /* Die Partei, die hier kämpft */
|
||||||
struct bfaction * bf; /* Die Partei, die hier kämpft */
|
struct bfaction * bf; /* Die Partei, die hier kämpft */
|
||||||
#ifdef GROUPS
|
|
||||||
const struct group * group;
|
const struct group * group;
|
||||||
#endif
|
#define FASTENEMY
|
||||||
|
#ifdef FASTENEMY
|
||||||
|
# define E_ENEMY 1
|
||||||
|
# define E_ATTACKING 2
|
||||||
|
int enemy[128];
|
||||||
|
#else
|
||||||
struct enemy {
|
struct enemy {
|
||||||
struct enemy * nexthash;
|
struct enemy * nexthash;
|
||||||
boolean attacking;
|
boolean attacking;
|
||||||
struct side * side;
|
struct side * side;
|
||||||
} * enemies[16];
|
} * enemies[16];
|
||||||
|
#endif
|
||||||
cvector fighters; /* vector der Einheiten dieser Fraktion */
|
cvector fighters; /* vector der Einheiten dieser Fraktion */
|
||||||
int index; /* Eintrag der Fraktion in b->matrix/b->enemies */
|
int index; /* Eintrag der Fraktion in b->matrix/b->enemies */
|
||||||
int size[NUMROWS]; /* Anzahl Personen in Reihe X. 0 = Summe */
|
int size[NUMROWS]; /* Anzahl Personen in Reihe X. 0 = Summe */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: message.c,v 1.6 2001/02/11 20:54:01 enno Exp $
|
* $Id: message.c,v 1.7 2001/02/14 01:38:50 enno Exp $
|
||||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||||
|
@ -195,6 +195,30 @@ mistake(const unit * u, const char *command, const char *comment, int mtype)
|
||||||
|
|
||||||
static messagetype * messagetypes;
|
static messagetype * messagetypes;
|
||||||
|
|
||||||
|
extern unsigned int new_hashstring(const char* s);
|
||||||
|
|
||||||
|
int
|
||||||
|
old_hashstring(const char* s)
|
||||||
|
{
|
||||||
|
int key = 0;
|
||||||
|
int i = strlen(s);
|
||||||
|
while (i) {
|
||||||
|
--i;
|
||||||
|
key = ((key >> 31) & 1) ^ (key << 1) ^ s[i];
|
||||||
|
}
|
||||||
|
return key & 0x7fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
debug_messagetypes(FILE * out)
|
||||||
|
{
|
||||||
|
messagetype * mt;
|
||||||
|
for (mt=messagetypes;mt;mt=mt->next) {
|
||||||
|
fprintf(out, "%ut%u\n", old_hashstring(mt->name), mt->hashkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
messagetype *
|
messagetype *
|
||||||
new_messagetype(const char * name, int level, const char * section)
|
new_messagetype(const char * name, int level, const char * section)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: goodies.c,v 1.6 2001/02/11 20:54:01 enno Exp $
|
* $Id: goodies.c,v 1.7 2001/02/14 01:38:50 enno Exp $
|
||||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||||
|
@ -66,7 +66,7 @@ hashstring(const char* s)
|
||||||
while (i>0) {
|
while (i>0) {
|
||||||
key = (s[--i] + key*37);
|
key = (s[--i] + key*37);
|
||||||
}
|
}
|
||||||
return key;
|
return key % 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
/* vi: set ts=2:
|
/* vi: set ts=2:
|
||||||
*
|
*
|
||||||
* $Id: main.c,v 1.15 2001/02/12 22:39:57 enno Exp $
|
* $Id: main.c,v 1.16 2001/02/14 01:38:51 enno Exp $
|
||||||
* Eressea PB(E)M host Copyright (C) 1998-2000
|
* Eressea PB(E)M host Copyright (C) 1998-2000
|
||||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||||
|
@ -119,6 +119,7 @@ print_potions(FILE * F)
|
||||||
|
|
||||||
static char * orders = NULL;
|
static char * orders = NULL;
|
||||||
static int nowrite = 0;
|
static int nowrite = 0;
|
||||||
|
extern void debug_messagetypes(FILE * out);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
game_init(void)
|
game_init(void)
|
||||||
|
@ -137,7 +138,15 @@ game_init(void)
|
||||||
init_museum();
|
init_museum();
|
||||||
init_arena();
|
init_arena();
|
||||||
init_xmas2000();
|
init_xmas2000();
|
||||||
|
#ifdef REMOVE_THIS
|
||||||
render_init();
|
render_init();
|
||||||
|
{
|
||||||
|
FILE * F = fopen("messagetypes.txt", "w");
|
||||||
|
debug_messagetypes(F);
|
||||||
|
fclose(F);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* print_potions(stdout);
|
/* print_potions(stdout);
|
||||||
exit(0); */
|
exit(0); */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue