forked from github/server
* Bugfix Durchreiseregionen bei Start=Ziel
* Bugfix Sichtbarkeitsregel bei Borders * Neu definiert, was eine attribut-funktion zurückliefern soll, wenn sie failed. asserts, die checken das ich auch keine vergessen habe. damit ist die killunit::handle Geschichte erledigt. * Bugfix looting. Sowohl eigene als auch fremde Einheiten können looten. * Korrektur doppeltes shock-attribut. * Straßen, Diskrepanz im NR und CR beseitigt * remove_empty_factions macht kein free mehr.
This commit is contained in:
parent
f2f09674cf
commit
4fb2137edd
|
@ -30,39 +30,21 @@ verify_follow(attrib * a)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FOLLOW_PERSISTENT 0
|
|
||||||
|
|
||||||
#if FOLLOW_PERSISTENT
|
|
||||||
static void
|
|
||||||
write_follow(const attrib * a, FILE * F)
|
|
||||||
{
|
|
||||||
write_unit_reference((unit*)a->data.v, F);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define write_follow NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read_follow(attrib * a, FILE * F)
|
read_follow(attrib * a, FILE * F)
|
||||||
{
|
{
|
||||||
if (global.data_version < BASE36IDS_VERSION) {
|
if (global.data_version < BASE36IDS_VERSION) {
|
||||||
int i;
|
int i;
|
||||||
fscanf(F, "%d", &i);
|
fscanf(F, "%d", &i);
|
||||||
#if FOLLOW_PERSISTENT
|
|
||||||
ur_add((void*)i, (void**)&a->data.v, resolve_unit);
|
ur_add((void*)i, (void**)&a->data.v, resolve_unit);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#if FOLLOW_PERSISTENT
|
return read_unit_reference(NULL, F);
|
||||||
read_unit_reference((unit**)&a->data.v, F);
|
|
||||||
#else
|
|
||||||
read_unit_reference(NULL, F);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return FOLLOW_PERSISTENT;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_follow = {
|
attrib_type at_follow = {
|
||||||
"follow", NULL, NULL, verify_follow, write_follow, read_follow
|
"follow", NULL, NULL, verify_follow, NULL, read_follow
|
||||||
};
|
};
|
||||||
|
|
||||||
attrib *
|
attrib *
|
||||||
|
|
|
@ -68,7 +68,7 @@ a_readgive(attrib * a, FILE * F)
|
||||||
fscanf(F, "%d", &i);
|
fscanf(F, "%d", &i);
|
||||||
if (i==0) i_add(&gdata->items, i_new(it_find(zText), i));
|
if (i==0) i_add(&gdata->items, i_new(it_find(zText), i));
|
||||||
}
|
}
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -31,8 +31,7 @@ write_gm(const attrib * a, FILE * F)
|
||||||
static int
|
static int
|
||||||
read_gm(attrib * a, FILE * F)
|
read_gm(attrib * a, FILE * F)
|
||||||
{
|
{
|
||||||
read_plane_reference((plane**)&a->data.v, F);
|
return read_plane_reference((plane**)&a->data.v, F);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,9 @@ read_hate(attrib * a, FILE * F)
|
||||||
fscanf(F, "%d", &i);
|
fscanf(F, "%d", &i);
|
||||||
ur_add((void*)i, (void**)&a->data.v, resolve_unit);
|
ur_add((void*)i, (void**)&a->data.v, resolve_unit);
|
||||||
} else {
|
} else {
|
||||||
read_unit_reference((unit**)&a->data.v, F);
|
return read_unit_reference((unit**)&a->data.v, F);
|
||||||
}
|
}
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_hate = {
|
attrib_type at_hate = {
|
||||||
|
|
|
@ -34,7 +34,8 @@ static int
|
||||||
read_moved(attrib * a, FILE * F)
|
read_moved(attrib * a, FILE * F)
|
||||||
{
|
{
|
||||||
fscanf(F, "%d", &a->data.i);
|
fscanf(F, "%d", &a->data.i);
|
||||||
return a->data.i!=0;
|
if (a->data.i!=0) return AT_READ_OK;
|
||||||
|
else return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_moved = {
|
attrib_type at_moved = {
|
||||||
|
|
|
@ -36,8 +36,8 @@ read_of(struct attrib * a, FILE* F) /* return 1 on success, 0 if attrib needs re
|
||||||
int of;
|
int of;
|
||||||
fscanf(F, "%d", &of);
|
fscanf(F, "%d", &of);
|
||||||
a->data.v = findfaction(of);
|
a->data.v = findfaction(of);
|
||||||
if (a->data.v) return 1;
|
if (a->data.v) return AT_READ_OK;
|
||||||
return 0;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_otherfaction = {
|
attrib_type at_otherfaction = {
|
||||||
|
|
|
@ -71,7 +71,7 @@ a_readsynonym(attrib * a, FILE * F)
|
||||||
fscanf(F, "%s", lbuf);
|
fscanf(F, "%s", lbuf);
|
||||||
frs->synonyms[3] = strdup(lbuf);
|
frs->synonyms[3] = strdup(lbuf);
|
||||||
|
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_synonym = {
|
attrib_type at_synonym = {
|
||||||
|
|
|
@ -34,9 +34,9 @@ read_targetregion(attrib * a, FILE * F)
|
||||||
a_readdefault(a, F);
|
a_readdefault(a, F);
|
||||||
a->data.v = findregion(a->data.sa[0], a->data.sa[1]);
|
a->data.v = findregion(a->data.sa[0], a->data.sa[1]);
|
||||||
} else {
|
} else {
|
||||||
read_region_reference((region**)&a->data.v, F);
|
return read_region_reference((region**)&a->data.v, F);
|
||||||
}
|
}
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_targetregion = {
|
attrib_type at_targetregion = {
|
||||||
|
|
|
@ -35,7 +35,7 @@ a_readfunction(struct attrib *a, FILE *F)
|
||||||
char buf[64];
|
char buf[64];
|
||||||
fscanf(F, "%s ", buf);
|
fscanf(F, "%s ", buf);
|
||||||
a->data.f = get_function(buf);
|
a->data.f = get_function(buf);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_viewrange = {
|
attrib_type at_viewrange = {
|
||||||
|
|
|
@ -834,6 +834,53 @@ report_resource(char * buf, const char * name, const locale * loc, int amount, i
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cr_borders(const region * r, const faction * f, int seemode, FILE * F)
|
||||||
|
{
|
||||||
|
direction_t d;
|
||||||
|
int g = 0;
|
||||||
|
for (d = 0; d != MAXDIRECTIONS; d++)
|
||||||
|
{ /* Nachbarregionen, die gesehen werden, ermitteln */
|
||||||
|
const region * r2 = rconnect(r, d);
|
||||||
|
const border * b;
|
||||||
|
if (!r2) continue;
|
||||||
|
if (seemode==see_neighbour) {
|
||||||
|
seen_region * sr = find_seen(r2);
|
||||||
|
if (sr==NULL || sr->mode<=see_neighbour) continue;
|
||||||
|
}
|
||||||
|
b = get_borders(r, r2);
|
||||||
|
while (b) {
|
||||||
|
boolean cs = b->type->fvisible(b, f, r);
|
||||||
|
|
||||||
|
if (!cs) {
|
||||||
|
cs = b->type->rvisible(b, r);
|
||||||
|
if (!cs) {
|
||||||
|
unit * us = r->units;
|
||||||
|
while (us && !cs) {
|
||||||
|
if (us->faction==f) {
|
||||||
|
cs = b->type->uvisible(b, us);
|
||||||
|
if (cs) break;
|
||||||
|
}
|
||||||
|
us=us->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cs) {
|
||||||
|
fprintf(F, "GRENZE %d\n", ++g);
|
||||||
|
fprintf(F, "\"%s\";typ\n", b->type->name(b, r, f, GF_NONE));
|
||||||
|
fprintf(F, "%d;richtung\n", d);
|
||||||
|
if (!b->type->transparent(b, f)) fputs("1;opaque\n", F);
|
||||||
|
/* pfusch: */
|
||||||
|
if (b->type==&bt_road) {
|
||||||
|
int p = rroad(r, d)*100/terrain[rterrain(r)].roadreq;
|
||||||
|
fprintf(F, "%d;prozent\n", p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b = b->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* main function of the creport. creates the header and traverses all regions */
|
/* main function of the creport. creates the header and traverses all regions */
|
||||||
void
|
void
|
||||||
report_computer(FILE * F, faction * f, const seen_region * seen,
|
report_computer(FILE * F, faction * f, const seen_region * seen,
|
||||||
|
@ -989,12 +1036,11 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
|
||||||
fputs("\"travel\";visibility\n", F);
|
fputs("\"travel\";visibility\n", F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (seemode != see_neighbour)
|
if (seemode == see_neighbour) {
|
||||||
{
|
cr_borders(r, f, seemode, F);
|
||||||
|
} else {
|
||||||
#define RESOURCECOMPAT
|
#define RESOURCECOMPAT
|
||||||
char cbuf[8192], *pos = cbuf;
|
char cbuf[8192], *pos = cbuf;
|
||||||
int g = 0;
|
|
||||||
direction_t d;
|
|
||||||
#ifdef RESOURCECOMPAT
|
#ifdef RESOURCECOMPAT
|
||||||
if (r->display && strlen(r->display))
|
if (r->display && strlen(r->display))
|
||||||
fprintf(F, "\"%s\";Beschr\n", r->display);
|
fprintf(F, "\"%s\";Beschr\n", r->display);
|
||||||
|
@ -1120,42 +1166,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
|
||||||
}
|
}
|
||||||
if (pos!=cbuf) fputs(cbuf, F);
|
if (pos!=cbuf) fputs(cbuf, F);
|
||||||
}
|
}
|
||||||
for (d = 0; d != MAXDIRECTIONS; d++)
|
cr_borders(r, f, seemode, F);
|
||||||
{ /* Nachbarregionen, die gesehen werden, ermitteln */
|
|
||||||
region * r2 = rconnect(r, d);
|
|
||||||
border * b;
|
|
||||||
if (!r2) continue;
|
|
||||||
b = get_borders(r, r2);
|
|
||||||
while (b) {
|
|
||||||
boolean cs = b->type->fvisible(b, f, r);
|
|
||||||
|
|
||||||
if (!cs) {
|
|
||||||
cs = b->type->rvisible(b, r);
|
|
||||||
if (!cs) {
|
|
||||||
unit * us = r->units;
|
|
||||||
while (us && !cs) {
|
|
||||||
if (us->faction==f) {
|
|
||||||
cs = b->type->uvisible(b, us);
|
|
||||||
if (cs) break;
|
|
||||||
}
|
|
||||||
us=us->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cs) {
|
|
||||||
fprintf(F, "GRENZE %d\n", ++g);
|
|
||||||
fprintf(F, "\"%s\";typ\n", b->type->name(b, r, f, GF_NONE));
|
|
||||||
fprintf(F, "%d;richtung\n", d);
|
|
||||||
if (!b->type->transparent(b, f)) fputs("1;opaque\n", F);
|
|
||||||
/* pfusch: */
|
|
||||||
if (b->type==&bt_road) {
|
|
||||||
int p = rroad(r, d)*100/terrain[rterrain(r)].roadreq;
|
|
||||||
fprintf(F, "%d;prozent\n", p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
b = b->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (seemode==see_unit && r->planep && r->planep->id == 1 && !is_cursed(r->attribs, C_ASTRALBLOCK, 0))
|
if (seemode==see_unit && r->planep && r->planep->id == 1 && !is_cursed(r->attribs, C_ASTRALBLOCK, 0))
|
||||||
{
|
{
|
||||||
/* Sonderbehandlung Teleport-Ebene */
|
/* Sonderbehandlung Teleport-Ebene */
|
||||||
|
|
|
@ -888,7 +888,7 @@ f_regionid(const region * r, const faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
prices(FILE * F, region * r, faction * f)
|
prices(FILE * F, const region * r, const faction * f)
|
||||||
{
|
{
|
||||||
const luxury_type *sale=NULL;
|
const luxury_type *sale=NULL;
|
||||||
struct demand * dmd;
|
struct demand * dmd;
|
||||||
|
@ -928,13 +928,13 @@ extern const direction_t back[MAXDIRECTIONS];
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
see_border(border * b, faction * f, region * r)
|
see_border(const border * b, const faction * f, const region * r)
|
||||||
{
|
{
|
||||||
boolean cs = b->type->fvisible(b, f, r);
|
boolean cs = b->type->fvisible(b, f, r);
|
||||||
if (!cs) {
|
if (!cs) {
|
||||||
cs = b->type->rvisible(b, r);
|
cs = b->type->rvisible(b, r);
|
||||||
if (!cs) {
|
if (!cs) {
|
||||||
unit * us = r->units;
|
const unit * us = r->units;
|
||||||
while (us && !cs) {
|
while (us && !cs) {
|
||||||
if (us->faction==f) {
|
if (us->faction==f) {
|
||||||
cs = b->type->uvisible(b, us);
|
cs = b->type->uvisible(b, us);
|
||||||
|
@ -984,7 +984,7 @@ eval_trail(struct opstack ** stack, const void * userdata) /* (int, int) -> int
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
describe(FILE * F, region * r, int partial, faction * f)
|
describe(FILE * F, const region * r, int partial, faction * f)
|
||||||
{
|
{
|
||||||
char dbuf[512];
|
char dbuf[512];
|
||||||
int n;
|
int n;
|
||||||
|
@ -1321,9 +1321,9 @@ describe(FILE * F, region * r, int partial, faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
statistics(FILE * F, region * r, faction * f)
|
statistics(FILE * F, const region * r, const faction * f)
|
||||||
{
|
{
|
||||||
unit *u;
|
const unit *u;
|
||||||
int number, p;
|
int number, p;
|
||||||
item *itm, *items = NULL;
|
item *itm, *items = NULL;
|
||||||
p = rpeasants(r);
|
p = rpeasants(r);
|
||||||
|
@ -1379,7 +1379,7 @@ statistics(FILE * F, region * r, faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
durchreisende(FILE * F, region * r, faction * f)
|
durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
{
|
{
|
||||||
attrib *ru;
|
attrib *ru;
|
||||||
int wieviele;
|
int wieviele;
|
||||||
|
@ -1657,7 +1657,7 @@ allies(FILE * F, faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
guards(FILE * F, region * r, faction * see)
|
guards(FILE * F, const region * r, const faction * see)
|
||||||
{ /* die Partei see sieht dies; wegen
|
{ /* die Partei see sieht dies; wegen
|
||||||
* "unbekannte Partei", wenn man es selbst ist... */
|
* "unbekannte Partei", wenn man es selbst ist... */
|
||||||
|
|
||||||
|
@ -1812,7 +1812,7 @@ report(FILE *F, faction * f, const faction_list * addresses,
|
||||||
char ch;
|
char ch;
|
||||||
int dh;
|
int dh;
|
||||||
int anyunits;
|
int anyunits;
|
||||||
region *r;
|
const struct region *r;
|
||||||
building *b;
|
building *b;
|
||||||
ship *sh;
|
ship *sh;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -2536,47 +2536,48 @@ init_intervals()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static boolean
|
seen_region *
|
||||||
add_seen(region * r, unsigned char mode, boolean dis)
|
find_seen(const region * r)
|
||||||
{
|
{
|
||||||
seen_region * find;
|
|
||||||
|
|
||||||
int index = abs((r->x & 0xffff) + ((r->y) << 16)) % MAXSEEHASH;
|
int index = abs((r->x & 0xffff) + ((r->y) << 16)) % MAXSEEHASH;
|
||||||
for (find=seehash[index];find;find=find->nextHash) {
|
seen_region * find=seehash[index];
|
||||||
if (find->r==r) {
|
while (find) {
|
||||||
if (find->mode < mode) {
|
if (find->r==r) return find;
|
||||||
if (find->mode<=see_neighbour && find->next) {
|
find=find->nextHash;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
add_seen(const struct region * r, unsigned char mode, boolean dis)
|
||||||
|
{
|
||||||
|
seen_region * find = find_seen(r);
|
||||||
|
if (find) {
|
||||||
|
if (find->mode >= mode) return false;
|
||||||
|
if (find->mode>see_neighbour || find->next==NULL) return true;
|
||||||
|
/* take it out the list, so it can get processed again */
|
||||||
find->next->prev = find->prev;
|
find->next->prev = find->prev;
|
||||||
if (find->prev) find->prev->next = find->next;
|
if (find->prev) find->prev->next = find->next;
|
||||||
else seen = find->next;
|
else seen = find->next;
|
||||||
last->next = find;
|
} else {
|
||||||
find->prev = last;
|
int index = abs((r->x & 0xffff) + ((r->y) << 16)) % MAXSEEHASH;
|
||||||
|
if (!reuse) reuse = (seen_region*)calloc(1, sizeof(seen_region));
|
||||||
|
*append = find = reuse;
|
||||||
|
reuse = reuse->next;
|
||||||
|
find->nextHash = seehash[index];
|
||||||
|
seehash[index] = find;
|
||||||
|
find->r = r;
|
||||||
|
}
|
||||||
|
/* put it at the end of the list, where the unprocessed nodes are */
|
||||||
|
if (last) last->next = find;
|
||||||
find->next = NULL;
|
find->next = NULL;
|
||||||
|
find->prev = last;
|
||||||
last = find;
|
last = find;
|
||||||
append = &last->next;
|
append = &last->next;
|
||||||
}
|
|
||||||
find->mode = mode;
|
find->mode = mode;
|
||||||
find->disbelieves |= dis;
|
find->disbelieves |= dis;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!reuse) reuse = (seen_region*)calloc(1, sizeof(seen_region));
|
|
||||||
*append = reuse;
|
|
||||||
reuse = reuse->next;
|
|
||||||
(*append)->next = NULL;
|
|
||||||
(*append)->prev = last;
|
|
||||||
if (last) last->next = *append;
|
|
||||||
last = *append;
|
|
||||||
(*append)->nextHash = seehash[index];
|
|
||||||
seehash[index] = *append;
|
|
||||||
(*append)->r = r;
|
|
||||||
(*append)->mode = mode;
|
|
||||||
(*append)->disbelieves = dis;
|
|
||||||
append = &(*append)->next;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DBG_CACHE 1
|
#define DBG_CACHE 1
|
||||||
#if DBG_CACHE
|
#if DBG_CACHE
|
||||||
|
@ -2591,6 +2592,10 @@ view_default(region *r, faction *f)
|
||||||
region * r2 = rconnect(r, dir);
|
region * r2 = rconnect(r, dir);
|
||||||
if (r2) {
|
if (r2) {
|
||||||
border * b = get_borders(r, r2);
|
border * b = get_borders(r, r2);
|
||||||
|
while (b) {
|
||||||
|
if (!b->type->transparent(b, f)) break;
|
||||||
|
b = b->next;
|
||||||
|
}
|
||||||
if (!b) add_seen(r2, see_neighbour, false);
|
if (!b) add_seen(r2, see_neighbour, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ attack_firesword(const troop * at, int *casualties, int row)
|
||||||
int force = 1+rand()%10;
|
int force = 1+rand()%10;
|
||||||
|
|
||||||
if (row==FIGHT_ROW) {
|
if (row==FIGHT_ROW) {
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY,
|
enemies = count_enemies(fi->side->battle, fi->side, FS_ENEMY,
|
||||||
minrow, maxrow);
|
minrow, maxrow);
|
||||||
}
|
}
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
|
@ -178,7 +178,7 @@ attack_firesword(const troop * at, int *casualties, int row)
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dt = select_enemy(fi, minrow, maxrow);
|
dt = select_enemy(fi->side->battle, fi, minrow, maxrow);
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
--force;
|
--force;
|
||||||
killed += terminate(dt, *at, AT_SPELL, damage, 1);
|
killed += terminate(dt, *at, AT_SPELL, damage, 1);
|
||||||
|
@ -215,11 +215,11 @@ attack_catapult(const troop * at, int * casualties, int row)
|
||||||
}
|
}
|
||||||
minrow = FIGHT_ROW;
|
minrow = FIGHT_ROW;
|
||||||
maxrow = FIGHT_ROW;
|
maxrow = FIGHT_ROW;
|
||||||
n = min(10, count_enemies(af->side, FS_ENEMY, minrow, maxrow));
|
n = min(10, count_enemies(b, af->side, FS_ENEMY, minrow, maxrow));
|
||||||
|
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
/* Select defender */
|
/* Select defender */
|
||||||
dt = select_enemy(af, minrow, maxrow);
|
dt = select_enemy(b, af, minrow, maxrow);
|
||||||
if (!dt.fighter)
|
if (!dt.fighter)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ a_readeffect(attrib *a, FILE *f)
|
||||||
if (ptype==NULL || power==0) return 0;
|
if (ptype==NULL || power==0) return 0;
|
||||||
edata->type = ptype;
|
edata->type = ptype;
|
||||||
edata->value = power;
|
edata->value = power;
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_effect = {
|
attrib_type at_effect = {
|
||||||
|
|
|
@ -1241,10 +1241,9 @@ lovar(int n)
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
int
|
int
|
||||||
count_enemies(side * as, int mask, int minrow, int maxrow)
|
count_enemies(battle * b, side * as, int mask, int minrow, int maxrow)
|
||||||
/* new implementation of count_enemies ignores mask, since it was never used */
|
/* new implementation of count_enemies ignores mask, since it was never used */
|
||||||
{
|
{
|
||||||
battle *b = as->battle;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
void **si;
|
void **si;
|
||||||
|
|
||||||
|
@ -1252,7 +1251,7 @@ count_enemies(side * as, int mask, int minrow, int maxrow)
|
||||||
|
|
||||||
for (si = b->sides.begin; si != b->sides.end; ++si) {
|
for (si = b->sides.begin; si != b->sides.end; ++si) {
|
||||||
side *side = *si;
|
side *side = *si;
|
||||||
if (enemy(side, as))
|
if (as==NULL || enemy(side, as))
|
||||||
{
|
{
|
||||||
void **fi;
|
void **fi;
|
||||||
|
|
||||||
|
@ -1275,15 +1274,14 @@ count_enemies(side * as, int mask, int minrow, int maxrow)
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
troop
|
troop
|
||||||
select_enemy(fighter * af, int minrow, int maxrow)
|
select_enemy(battle * b, fighter * af, int minrow, int maxrow)
|
||||||
{
|
{
|
||||||
side *as = af->side;
|
side *as = af?af->side:NULL;
|
||||||
battle *b = as->battle;
|
|
||||||
troop dt = no_troop;
|
troop dt = no_troop;
|
||||||
void ** si;
|
void ** si;
|
||||||
int enemies;
|
int enemies;
|
||||||
|
|
||||||
if(af->unit->race->flags & RCF_FLY) {
|
if (af && af->unit->race->flags & RCF_FLY) {
|
||||||
/* flying races ignore min- and maxrow and can attack anyone fighting
|
/* flying races ignore min- and maxrow and can attack anyone fighting
|
||||||
* them */
|
* them */
|
||||||
minrow = FIGHT_ROW;
|
minrow = FIGHT_ROW;
|
||||||
|
@ -1291,7 +1289,7 @@ select_enemy(fighter * af, int minrow, int maxrow)
|
||||||
}
|
}
|
||||||
minrow = max(minrow, FIGHT_ROW);
|
minrow = max(minrow, FIGHT_ROW);
|
||||||
|
|
||||||
enemies = count_enemies(af->side, FS_ENEMY, minrow, maxrow);
|
enemies = count_enemies(b, as, FS_ENEMY, minrow, maxrow);
|
||||||
|
|
||||||
if (!enemies)
|
if (!enemies)
|
||||||
return dt; /* Niemand ist in der angegebenen Entfernung */
|
return dt; /* Niemand ist in der angegebenen Entfernung */
|
||||||
|
@ -1299,7 +1297,7 @@ select_enemy(fighter * af, int minrow, int maxrow)
|
||||||
for (si=b->sides.begin;!dt.fighter && si!=b->sides.end;++si) {
|
for (si=b->sides.begin;!dt.fighter && si!=b->sides.end;++si) {
|
||||||
side *ds = *si;
|
side *ds = *si;
|
||||||
void ** fi;
|
void ** fi;
|
||||||
if (!enemy(as, ds)) continue;
|
if (as!=NULL && !enemy(as, ds)) continue;
|
||||||
for (fi=ds->fighters.begin;fi!=ds->fighters.end;++fi) {
|
for (fi=ds->fighters.begin;fi!=ds->fighters.end;++fi) {
|
||||||
fighter * df = *fi;
|
fighter * df = *fi;
|
||||||
int dr = get_unitrow(df);
|
int dr = get_unitrow(df);
|
||||||
|
@ -1892,11 +1890,11 @@ attack(battle *b, troop ta, const att *a)
|
||||||
boolean missile = false;
|
boolean missile = false;
|
||||||
if (wp && fval(wp->type, WTF_MISSILE)) missile=true;
|
if (wp && fval(wp->type, WTF_MISSILE)) missile=true;
|
||||||
if (missile) {
|
if (missile) {
|
||||||
if (row<=BEHIND_ROW) td = select_enemy(af, missile_range[0], missile_range[1]);
|
if (row<=BEHIND_ROW) td = select_enemy(b, af, missile_range[0], missile_range[1]);
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (row<=FIGHT_ROW) td = select_enemy(af, melee_range[0], melee_range[1]);
|
if (row<=FIGHT_ROW) td = select_enemy(b, af, melee_range[0], melee_range[1]);
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
|
@ -1930,7 +1928,7 @@ attack(battle *b, troop ta, const att *a)
|
||||||
do_extra_spell(ta, a);
|
do_extra_spell(ta, a);
|
||||||
break;
|
break;
|
||||||
case AT_NATURAL:
|
case AT_NATURAL:
|
||||||
td = select_enemy(af, melee_range[0]-offset, melee_range[1]-offset);
|
td = select_enemy(b, af, melee_range[0]-offset, melee_range[1]-offset);
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||||
td.fighter->person[td.index].last_action = b->turn;
|
td.fighter->person[td.index].last_action = b->turn;
|
||||||
|
@ -1945,7 +1943,7 @@ attack(battle *b, troop ta, const att *a)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AT_DRAIN_ST:
|
case AT_DRAIN_ST:
|
||||||
td = select_enemy(af, melee_range[0]-offset, melee_range[1]-offset);
|
td = select_enemy(b, af, melee_range[0]-offset, melee_range[1]-offset);
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||||
td.fighter->person[td.index].last_action = b->turn;
|
td.fighter->person[td.index].last_action = b->turn;
|
||||||
|
@ -1968,7 +1966,7 @@ attack(battle *b, troop ta, const att *a)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AT_DRAIN_EXP:
|
case AT_DRAIN_EXP:
|
||||||
td = select_enemy(af, melee_range[0]-offset, melee_range[1]-offset);
|
td = select_enemy(b, af, melee_range[0]-offset, melee_range[1]-offset);
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||||
td.fighter->person[td.index].last_action = b->turn;
|
td.fighter->person[td.index].last_action = b->turn;
|
||||||
|
@ -1983,7 +1981,7 @@ attack(battle *b, troop ta, const att *a)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AT_DAZZLE:
|
case AT_DAZZLE:
|
||||||
td = select_enemy(af, melee_range[0]-offset, melee_range[1]-offset);
|
td = select_enemy(b, af, melee_range[0]-offset, melee_range[1]-offset);
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||||
td.fighter->person[td.index].last_action = b->turn;
|
td.fighter->person[td.index].last_action = b->turn;
|
||||||
|
@ -1998,7 +1996,7 @@ attack(battle *b, troop ta, const att *a)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AT_STRUCTURAL:
|
case AT_STRUCTURAL:
|
||||||
td = select_enemy(af, melee_range[0]-offset, melee_range[1]-offset);
|
td = select_enemy(b, af, melee_range[0]-offset, melee_range[1]-offset);
|
||||||
if (!td.fighter) return;
|
if (!td.fighter) return;
|
||||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
||||||
ta.fighter->person[ta.index].last_action = b->turn;
|
ta.fighter->person[ta.index].last_action = b->turn;
|
||||||
|
@ -2045,7 +2043,7 @@ do_attack(fighter * af)
|
||||||
while (ta.index--) {
|
while (ta.index--) {
|
||||||
/* Wir suchen eine beliebige Feind-Einheit aus. An der können
|
/* Wir suchen eine beliebige Feind-Einheit aus. An der können
|
||||||
* wir feststellen, ob noch jemand da ist. */
|
* wir feststellen, ob noch jemand da ist. */
|
||||||
int enemies = count_enemies(af->side, FS_ENEMY, FIGHT_ROW, LAST_ROW);
|
int enemies = count_enemies(b, af->side, FS_ENEMY, FIGHT_ROW, LAST_ROW);
|
||||||
if (!enemies) break;
|
if (!enemies) break;
|
||||||
|
|
||||||
for (apr=attacks_per_round(ta); apr > 0; apr--) {
|
for (apr=attacks_per_round(ta); apr > 0; apr--) {
|
||||||
|
@ -2144,6 +2142,7 @@ loot_items(fighter * corpse)
|
||||||
{
|
{
|
||||||
unit * u = corpse->unit;
|
unit * u = corpse->unit;
|
||||||
item * itm = u->items;
|
item * itm = u->items;
|
||||||
|
battle * b = corpse->side->battle;
|
||||||
u->items = NULL;
|
u->items = NULL;
|
||||||
|
|
||||||
while (itm) {
|
while (itm) {
|
||||||
|
@ -2160,7 +2159,7 @@ loot_items(fighter * corpse)
|
||||||
*/
|
*/
|
||||||
if (loot>0 && (itm->type->flags & (ITF_CURSED|ITF_NOTLOST)
|
if (loot>0 && (itm->type->flags & (ITF_CURSED|ITF_NOTLOST)
|
||||||
|| rand()%100 >= 50 - corpse->side->battle->keeploot)) {
|
|| rand()%100 >= 50 - corpse->side->battle->keeploot)) {
|
||||||
fighter *fig = select_enemy(corpse, FIGHT_ROW, LAST_ROW).fighter;
|
fighter *fig = select_enemy(b, corpse, FIGHT_ROW, LAST_ROW).fighter;
|
||||||
if (fig) {
|
if (fig) {
|
||||||
item * l = fig->loot;
|
item * l = fig->loot;
|
||||||
while (l && l->type!=itm->type) l=l->next;
|
while (l && l->type!=itm->type) l=l->next;
|
||||||
|
|
|
@ -209,8 +209,8 @@ extern void do_battle(void);
|
||||||
|
|
||||||
/* for combar spells and special attacks */
|
/* for combar spells and special attacks */
|
||||||
extern int damage_unit(struct unit *u, const char *dam, boolean armor, boolean magic);
|
extern int damage_unit(struct unit *u, const char *dam, boolean armor, boolean magic);
|
||||||
extern troop select_enemy(struct fighter * af, int minrow, int maxrow);
|
extern troop select_enemy(struct battle * b, struct fighter * af, int minrow, int maxrow);
|
||||||
extern int count_enemies(struct side * as, int mask, int minrow, int maxrow);
|
extern int count_enemies(struct battle * b, struct side * as, int mask, int minrow, int maxrow);
|
||||||
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
|
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
|
||||||
extern void battlemsg(battle * b, struct unit * u, const char * s);
|
extern void battlemsg(battle * b, struct unit * u, const char * s);
|
||||||
extern void battlerecord(battle * b, const char *s);
|
extern void battlerecord(battle * b, const char *s);
|
||||||
|
|
|
@ -530,12 +530,12 @@ read_building_reference(struct building ** b, FILE * F)
|
||||||
id = atoi36(zText);
|
id = atoi36(zText);
|
||||||
if (id==0) {
|
if (id==0) {
|
||||||
*b = NULL;
|
*b = NULL;
|
||||||
return 0;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*b = findbuilding(id);
|
*b = findbuilding(id);
|
||||||
if (*b==NULL) ur_add((void*)id, (void**)b, resolve_building);
|
if (*b==NULL) ur_add((void*)id, (void**)b, resolve_building);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ sp_kampfzauber(fighter * fi, int level, int power, spell * sp)
|
||||||
force = lovar(get_force(power,10));
|
force = lovar(get_force(power,10));
|
||||||
}
|
}
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY,
|
enemies = count_enemies(b, fi->side, FS_ENEMY,
|
||||||
minrow, maxrow);
|
minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
|
@ -145,7 +145,7 @@ sp_kampfzauber(fighter * fi, int level, int power, spell * sp)
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dt = select_enemy(fi, minrow, maxrow);
|
dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
--force;
|
--force;
|
||||||
killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
|
killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
|
||||||
|
@ -175,7 +175,7 @@ sp_versteinern(fighter * fi, int level, int power, spell * sp)
|
||||||
|
|
||||||
force = lovar(get_force(power,0));
|
force = lovar(get_force(power,0));
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY,
|
enemies = count_enemies(b, fi->side, FS_ENEMY,
|
||||||
minrow, maxrow);
|
minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
|
@ -186,7 +186,7 @@ sp_versteinern(fighter * fi, int level, int power, spell * sp)
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
troop dt = select_enemy(fi, minrow, maxrow);
|
troop dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
fighter * df = dt.fighter;
|
fighter * df = dt.fighter;
|
||||||
unit * du = df->unit;
|
unit * du = df->unit;
|
||||||
if (is_magic_resistant(mage, du, 0) == false) {
|
if (is_magic_resistant(mage, du, 0) == false) {
|
||||||
|
@ -234,7 +234,7 @@ sp_stun(fighter * fi, int level, int power, spell * sp)
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow, maxrow);
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
@ -245,7 +245,7 @@ sp_stun(fighter * fi, int level, int power, spell * sp)
|
||||||
|
|
||||||
stunned = 0;
|
stunned = 0;
|
||||||
do {
|
do {
|
||||||
troop dt = select_enemy(fi, minrow, maxrow);
|
troop dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
fighter * df = dt.fighter;
|
fighter * df = dt.fighter;
|
||||||
unit * du = df->unit;
|
unit * du = df->unit;
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ sp_combatrosthauch(fighter * fi, int level, int power, spell * sp)
|
||||||
|
|
||||||
force = lovar(power * 15);
|
force = lovar(power * 15);
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow, maxrow);
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
battlemsg(b, fi->unit, msgt[0]);
|
battlemsg(b, fi->unit, msgt[0]);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -376,7 +376,7 @@ sp_sleep(fighter * fi, int level, int power, spell * sp)
|
||||||
|
|
||||||
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
||||||
force = lovar(power * 25);
|
force = lovar(power * 25);
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow, maxrow);
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
|
||||||
|
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
|
@ -387,7 +387,7 @@ sp_sleep(fighter * fi, int level, int power, spell * sp)
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dt = select_enemy(fi, minrow, maxrow);
|
dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
du = dt.fighter->unit;
|
du = dt.fighter->unit;
|
||||||
if (is_magic_resistant(mage, du, 0) == false) {
|
if (is_magic_resistant(mage, du, 0) == false) {
|
||||||
|
@ -522,7 +522,7 @@ sp_mindblast(fighter * fi, int level, int power, spell * sp)
|
||||||
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
||||||
force = lovar(power * 25);
|
force = lovar(power * 25);
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow, maxrow);
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
@ -532,7 +532,7 @@ sp_mindblast(fighter * fi, int level, int power, spell * sp)
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dt = select_enemy(fi, minrow, maxrow);
|
dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
du = dt.fighter->unit;
|
du = dt.fighter->unit;
|
||||||
if (humanoidrace(du->race) && is_magic_resistant(mage, du, 0) == false) {
|
if (humanoidrace(du->race) && is_magic_resistant(mage, du, 0) == false) {
|
||||||
|
@ -606,7 +606,7 @@ sp_dragonodem(fighter * fi, int level, int power, spell * sp)
|
||||||
/* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
|
/* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
|
||||||
force = lovar(get_force(level,6));
|
force = lovar(get_force(level,6));
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow,
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow,
|
||||||
maxrow);
|
maxrow);
|
||||||
|
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
|
@ -621,7 +621,7 @@ sp_dragonodem(fighter * fi, int level, int power, spell * sp)
|
||||||
at.index = 0;
|
at.index = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dt = select_enemy(fi, minrow, maxrow);
|
dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
--force;
|
--force;
|
||||||
killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
|
killed += terminate(dt, at, AT_COMBATSPELL, damage, false);
|
||||||
|
@ -655,7 +655,7 @@ sp_drainodem(fighter * fi, int level, int power, spell * sp)
|
||||||
/* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
|
/* Jungdrache 3->54, Drache 6->216, Wyrm 12->864 Treffer */
|
||||||
force = lovar(get_force(level,6));
|
force = lovar(get_force(level,6));
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow,
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow,
|
||||||
maxrow);
|
maxrow);
|
||||||
|
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
|
@ -670,7 +670,7 @@ sp_drainodem(fighter * fi, int level, int power, spell * sp)
|
||||||
at.index = 0;
|
at.index = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
dt = select_enemy(fi, minrow, maxrow);
|
dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
if (hits(at, dt, NULL)) {
|
if (hits(at, dt, NULL)) {
|
||||||
drain_exp(dt.fighter->unit, 90);
|
drain_exp(dt.fighter->unit, 90);
|
||||||
|
@ -864,7 +864,7 @@ sp_chaosrow(fighter * fi, int level, int force, spell * sp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY, minrow, maxrow);
|
enemies = count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
@ -964,7 +964,7 @@ sp_flee(fighter * fi, int level, int power, spell * sp)
|
||||||
force = get_force(power,10);
|
force = get_force(power,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count_enemies(fi->side, FS_ENEMY, minrow, maxrow)) {
|
if (!count_enemies(b, fi->side, FS_ENEMY, minrow, maxrow)) {
|
||||||
scat(", aber es gab niemanden mehr, der beeinflusst werden konnte.");
|
scat(", aber es gab niemanden mehr, der beeinflusst werden konnte.");
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1140,7 +1140,7 @@ sp_frighten(fighter * fi, int level, int power, spell * sp)
|
||||||
force = get_force(power, 2);
|
force = get_force(power, 2);
|
||||||
|
|
||||||
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY,
|
enemies = count_enemies(b, fi->side, FS_ENEMY,
|
||||||
minrow, maxrow);
|
minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
|
@ -1151,7 +1151,7 @@ sp_frighten(fighter * fi, int level, int power, spell * sp)
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
troop dt = select_enemy(fi, minrow, maxrow);
|
troop dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
--enemies;
|
--enemies;
|
||||||
|
|
||||||
|
@ -1190,7 +1190,7 @@ sp_tiredsoldiers(fighter * fi, int level, int force, spell * sp)
|
||||||
force = force * force * 4;
|
force = force * force * 4;
|
||||||
|
|
||||||
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
|
||||||
if (!count_enemies(fi->side, FS_ENEMY, FIGHT_ROW,
|
if (!count_enemies(b, fi->side, FS_ENEMY, FIGHT_ROW,
|
||||||
BEHIND_ROW)) {
|
BEHIND_ROW)) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
battlerecord(b, buf);
|
battlerecord(b, buf);
|
||||||
|
@ -1198,7 +1198,7 @@ sp_tiredsoldiers(fighter * fi, int level, int force, spell * sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (force) {
|
while (force) {
|
||||||
troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW);
|
troop t = select_enemy(b, fi, FIGHT_ROW, BEHIND_ROW);
|
||||||
fighter *df = t.fighter;
|
fighter *df = t.fighter;
|
||||||
|
|
||||||
if (!df)
|
if (!df)
|
||||||
|
@ -1250,7 +1250,7 @@ sp_windshield(fighter * fi, int level, int power, spell * sp)
|
||||||
force = power;
|
force = power;
|
||||||
at_malus = 2;
|
at_malus = 2;
|
||||||
}
|
}
|
||||||
enemies = count_enemies(fi->side, FS_ENEMY,
|
enemies = count_enemies(b, fi->side, FS_ENEMY,
|
||||||
minrow, maxrow);
|
minrow, maxrow);
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
scat(", aber niemand war in Reichweite.");
|
scat(", aber niemand war in Reichweite.");
|
||||||
|
@ -1259,7 +1259,7 @@ sp_windshield(fighter * fi, int level, int power, spell * sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
troop dt = select_enemy(fi, minrow, maxrow);
|
troop dt = select_enemy(b, fi, minrow, maxrow);
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
--enemies;
|
--enemies;
|
||||||
|
|
||||||
|
|
|
@ -2366,9 +2366,12 @@ remove_empty_factions(void)
|
||||||
}
|
}
|
||||||
fprintf(sqlstream, "UPDATE subscriptions set status='DEAD' where "
|
fprintf(sqlstream, "UPDATE subscriptions set status='DEAD' where "
|
||||||
"faction='%s' and game=%d;", itoa36(f->no), GAME_ID);
|
"faction='%s' and game=%d;", itoa36(f->no), GAME_ID);
|
||||||
stripfaction(f);
|
|
||||||
*fp = f->next;
|
*fp = f->next;
|
||||||
free(f);
|
/* stripfaction(f);
|
||||||
|
* free(f);
|
||||||
|
* Wir können die nicht löschen, weil sie evtl. noch in attributen
|
||||||
|
* referenziert sind ! */
|
||||||
}
|
}
|
||||||
else fp = &(*fp)->next;
|
else fp = &(*fp)->next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -855,7 +855,6 @@ extern int max_unique_id;
|
||||||
#define FL_PARTEITARNUNG (1<<4) /* 16 */
|
#define FL_PARTEITARNUNG (1<<4) /* 16 */
|
||||||
#define FL_DISBELIEVES (1<<5) /* 32 */
|
#define FL_DISBELIEVES (1<<5) /* 32 */
|
||||||
#define FL_WARMTH (1<<6) /* 64 */
|
#define FL_WARMTH (1<<6) /* 64 */
|
||||||
#define FL_TRAVELTHRU (1<<7) /* 128 */
|
|
||||||
#define FL_MOVED (1<<8)
|
#define FL_MOVED (1<<8)
|
||||||
|
|
||||||
#define FL_FOLLOWING (1<<9)
|
#define FL_FOLLOWING (1<<9)
|
||||||
|
|
|
@ -99,9 +99,9 @@ read_group(attrib * a, FILE * f)
|
||||||
a->data.v = g = find_group(gid);
|
a->data.v = g = find_group(gid);
|
||||||
if (g!=0) {
|
if (g!=0) {
|
||||||
g->members++;
|
g->members++;
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
return 0;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -148,7 +148,7 @@ a_readicastle(attrib * a, FILE * f)
|
||||||
fscanf(f, "%d", &t);
|
fscanf(f, "%d", &t);
|
||||||
data->time = 0;
|
data->time = 0;
|
||||||
data->type = NULL;
|
data->type = NULL;
|
||||||
return 0; /* no longer supported */
|
return AT_READ_FAIL;
|
||||||
} else {
|
} else {
|
||||||
int bno;
|
int bno;
|
||||||
fscanf(f, "%s %d %d", buf, &bno, &data->time);
|
fscanf(f, "%s %d %d", buf, &bno, &data->time);
|
||||||
|
@ -158,7 +158,7 @@ a_readicastle(attrib * a, FILE * f)
|
||||||
ur_add((void*)bno, (void**)&data->building, resolve_building);
|
ur_add((void*)bno, (void**)&data->building, resolve_building);
|
||||||
}
|
}
|
||||||
data->type = bt_find(buf);
|
data->type = bt_find(buf);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ read_mage(attrib * a, FILE * F)
|
||||||
(*sp)->spellid = (spellid_t)i;
|
(*sp)->spellid = (spellid_t)i;
|
||||||
sp = &(*sp)->next;
|
sp = &(*sp)->next;
|
||||||
}
|
}
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2636,7 +2636,7 @@ read_familiar(attrib * a, FILE * F)
|
||||||
fscanf(F, "%s", buf);
|
fscanf(F, "%s", buf);
|
||||||
i = atoi36(buf);
|
i = atoi36(buf);
|
||||||
ur_add((void*)i, &a->data.v, resolve_familiar);
|
ur_add((void*)i, &a->data.v, resolve_familiar);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clones */
|
/* clones */
|
||||||
|
@ -2713,7 +2713,7 @@ read_clone(attrib * a, FILE * F)
|
||||||
fscanf(F, "%s", buf);
|
fscanf(F, "%s", buf);
|
||||||
i = atoi36(buf);
|
i = atoi36(buf);
|
||||||
ur_add((void*)i, &a->data.v, resolve_clone);
|
ur_add((void*)i, &a->data.v, resolve_clone);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mages */
|
/* mages */
|
||||||
|
@ -2739,7 +2739,7 @@ read_magician(attrib * a, FILE * F)
|
||||||
fscanf(F, "%s", buf);
|
fscanf(F, "%s", buf);
|
||||||
i = atoi36(buf);
|
i = atoi36(buf);
|
||||||
ur_add((void*)i, &a->data.v, resolve_mage);
|
ur_add((void*)i, &a->data.v, resolve_mage);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -110,7 +110,7 @@ a_traveldir_new_read(attrib *a, FILE *f)
|
||||||
t->no = no;
|
t->no = no;
|
||||||
t->dir = (direction_t)dir;
|
t->dir = (direction_t)dir;
|
||||||
t->age = age;
|
t->age = age;
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -391,12 +391,12 @@ do_maelstrom(region *r, unit *u)
|
||||||
damage_ship(u->ship, 0.01*damage);
|
damage_ship(u->ship, 0.01*damage);
|
||||||
|
|
||||||
if (u->ship->damage >= u->ship->size * DAMAGE_SCALE) {
|
if (u->ship->damage >= u->ship->size * DAMAGE_SCALE) {
|
||||||
add_message(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs, msg_message("entermaelstrom",
|
||||||
new_message(u->faction, "entermaelstrom%r:region%h:ship%i:damage%i:sink", r, u->ship, damage, 1));
|
"region ship damage sink", r, u->ship, damage, 1));
|
||||||
destroy_ship(u->ship, r);
|
destroy_ship(u->ship, r);
|
||||||
} else {
|
} else {
|
||||||
add_message(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs, msg_message("entermaelstrom",
|
||||||
new_message(u->faction, "entermaelstrom%r:region%h:ship%i:damage%i:sink", r, u->ship, damage, 0));
|
"region ship damage sink", r, u->ship, damage, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,6 @@ travelthru(unit * u, region * r)
|
||||||
attrib *ru = a_add(&r->attribs, a_new(&at_travelunit));
|
attrib *ru = a_add(&r->attribs, a_new(&at_travelunit));
|
||||||
|
|
||||||
ru->data.v = u;
|
ru->data.v = u;
|
||||||
fset(u, FL_TRAVELTHRU);
|
|
||||||
u->faction->first = 0;
|
u->faction->first = 0;
|
||||||
u->faction->last = 0;
|
u->faction->last = 0;
|
||||||
}
|
}
|
||||||
|
@ -419,8 +418,10 @@ move_ship(ship * sh, region * from, region * to, region ** route)
|
||||||
direction_t dir;
|
direction_t dir;
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
|
if (from!=to) {
|
||||||
translist(&from->ships, &to->ships, sh);
|
translist(&from->ships, &to->ships, sh);
|
||||||
sh->region = to;
|
sh->region = to;
|
||||||
|
}
|
||||||
|
|
||||||
while (u) {
|
while (u) {
|
||||||
unit *nu = u->next;
|
unit *nu = u->next;
|
||||||
|
@ -457,14 +458,12 @@ move_ship(ship * sh, region * from, region * to, region ** route)
|
||||||
travelthru(u, *ri++);
|
travelthru(u, *ri++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (from!=to) {
|
||||||
u->ship = NULL; /* damit move_unit() kein leave() macht */
|
u->ship = NULL; /* damit move_unit() kein leave() macht */
|
||||||
move_unit(u, to, ulist);
|
move_unit(u, to, ulist);
|
||||||
#if 0
|
|
||||||
/* das braucht man (fast) sicher nicht. (Enno) */
|
|
||||||
fset(u->faction, FL_DH);
|
|
||||||
#endif
|
|
||||||
ulist = &u->next;
|
ulist = &u->next;
|
||||||
u->ship = sh;
|
u->ship = sh;
|
||||||
|
}
|
||||||
if (route && eff_skill(u, SK_SAILING, from) >= 1) {
|
if (route && eff_skill(u, SK_SAILING, from) >= 1) {
|
||||||
produceexp(u, SK_SAILING, u->number);
|
produceexp(u, SK_SAILING, u->number);
|
||||||
}
|
}
|
||||||
|
@ -1550,7 +1549,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
|
||||||
} else {
|
} else {
|
||||||
sh->coast = NODIRECTION;
|
sh->coast = NODIRECTION;
|
||||||
}
|
}
|
||||||
fset(sh, FL_MOVED);
|
|
||||||
sprintf(buf, "Die %s ", shipname(sh));
|
sprintf(buf, "Die %s ", shipname(sh));
|
||||||
if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) )
|
if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) )
|
||||||
scat("fliegt");
|
scat("fliegt");
|
||||||
|
@ -1600,7 +1599,6 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
|
||||||
/* Verfolgungen melden */
|
/* Verfolgungen melden */
|
||||||
if (fval(u, FL_FOLLOWING)) caught_target(current_point, u);
|
if (fval(u, FL_FOLLOWING)) caught_target(current_point, u);
|
||||||
|
|
||||||
if (starting_point != current_point) {
|
|
||||||
tt[step] = NULL;
|
tt[step] = NULL;
|
||||||
sh = move_ship(sh, starting_point, current_point, tt);
|
sh = move_ship(sh, starting_point, current_point, tt);
|
||||||
|
|
||||||
|
@ -1660,7 +1658,6 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return route;
|
return route;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,14 +242,16 @@ write_plane_reference(const plane * u, FILE * F)
|
||||||
fprintf(F, "%d ", u?(u->id):0);
|
fprintf(F, "%d ", u?(u->id):0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
read_plane_reference(plane ** pp, FILE * F)
|
read_plane_reference(plane ** pp, FILE * F)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
fscanf(F, "%d", &i);
|
fscanf(F, "%d", &i);
|
||||||
if (i==0) *pp = NULL;
|
if (i==0) {
|
||||||
{
|
*pp = NULL;
|
||||||
|
return AT_READ_FAIL;
|
||||||
|
}
|
||||||
*pp = getplanebyid(i);
|
*pp = getplanebyid(i);
|
||||||
if (*pp==NULL) ur_add((void*)i, (void**)pp, resolve_plane);
|
if (*pp==NULL) ur_add((void*)i, (void**)pp, resolve_plane);
|
||||||
}
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,6 @@ extern int rel_to_abs(const struct plane *pl, const struct faction * f, int rel,
|
||||||
|
|
||||||
extern void * resolve_plane(void * data);
|
extern void * resolve_plane(void * data);
|
||||||
extern void write_plane_reference(const plane * p, FILE * F);
|
extern void write_plane_reference(const plane * p, FILE * F);
|
||||||
extern void read_plane_reference(plane ** pp, FILE * F);
|
extern int read_plane_reference(plane ** pp, FILE * F);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -553,7 +553,7 @@ write_race_reference(const race * rc, FILE * F)
|
||||||
fprintf(F, "%s ", rc?rc->_name[0]:"none");
|
fprintf(F, "%s ", rc?rc->_name[0]:"none");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
read_race_reference(const struct race ** rp, FILE * F)
|
read_race_reference(const struct race ** rp, FILE * F)
|
||||||
{
|
{
|
||||||
char zName[20];
|
char zName[20];
|
||||||
|
@ -564,16 +564,18 @@ read_race_reference(const struct race ** rp, FILE * F)
|
||||||
*rp = new_race[i];
|
*rp = new_race[i];
|
||||||
} else {
|
} else {
|
||||||
*rp = NULL;
|
*rp = NULL;
|
||||||
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fscanf(F, "%s", zName);
|
fscanf(F, "%s", zName);
|
||||||
if (strcmp(zName, "none")==0) {
|
if (strcmp(zName, "none")==0) {
|
||||||
*rp = NULL;
|
*rp = NULL;
|
||||||
} else {
|
return AT_READ_FAIL;
|
||||||
|
}
|
||||||
*rp = rc_find(zName);
|
*rp = rc_find(zName);
|
||||||
assert(*rp!=NULL);
|
assert(*rp!=NULL);
|
||||||
}
|
}
|
||||||
}
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <xml.h>
|
#include <xml.h>
|
||||||
|
|
|
@ -156,6 +156,6 @@ extern const char *race_prefixes[];
|
||||||
extern const struct race_syn race_synonyms[];
|
extern const struct race_syn race_synonyms[];
|
||||||
|
|
||||||
extern void write_race_reference(const struct race * rc, FILE * F);
|
extern void write_race_reference(const struct race * rc, FILE * F);
|
||||||
extern void read_race_reference(const struct race ** rp, FILE * F);
|
extern int read_race_reference(const struct race ** rp, FILE * F);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -181,7 +181,7 @@ a_readdirection(attrib *a, FILE *f)
|
||||||
d->desc = strdup(cstring(buf));
|
d->desc = strdup(cstring(buf));
|
||||||
fscanf(f, "%s ", buf);
|
fscanf(f, "%s ", buf);
|
||||||
d->keyword = strdup(cstring(buf));
|
d->keyword = strdup(cstring(buf));
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -224,7 +224,7 @@ a_readmoveblock(attrib *a, FILE *f)
|
||||||
|
|
||||||
fscanf(f, "%d", &i);
|
fscanf(f, "%d", &i);
|
||||||
m->dir = (direction_t)i;
|
m->dir = (direction_t)i;
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1020,16 +1020,18 @@ production(const region *r)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
read_region_reference(region ** r, FILE * F)
|
read_region_reference(region ** r, FILE * F)
|
||||||
{
|
{
|
||||||
int x[2];
|
int x[2];
|
||||||
fscanf(F, "%d %d", &x[0], &x[1]);
|
fscanf(F, "%d %d", &x[0], &x[1]);
|
||||||
if (x[0]==INT_MAX) *r = NULL;
|
if (x[0]==INT_MAX) {
|
||||||
else {
|
*r = NULL;
|
||||||
|
return AT_READ_FAIL;
|
||||||
|
}
|
||||||
*r = findregion(x[0], x[1]);
|
*r = findregion(x[0], x[1]);
|
||||||
if (*r==NULL) ur_add(memcpy(malloc(sizeof(x)), x, sizeof(x)), (void**)r, resolve_region);
|
if (*r==NULL) ur_add(memcpy(malloc(sizeof(x)), x, sizeof(x)), (void**)r, resolve_region);
|
||||||
}
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -216,7 +216,7 @@ extern const int delta_y[MAXDIRECTIONS];
|
||||||
extern const direction_t back[MAXDIRECTIONS];
|
extern const direction_t back[MAXDIRECTIONS];
|
||||||
|
|
||||||
extern int production(const struct region *r);
|
extern int production(const struct region *r);
|
||||||
extern void read_region_reference(struct region ** r, FILE * F);
|
extern int read_region_reference(struct region ** r, FILE * F);
|
||||||
extern void write_region_reference(const struct region * r, FILE * F);
|
extern void write_region_reference(const struct region * r, FILE * F);
|
||||||
|
|
||||||
#endif /* _REGION_H */
|
#endif /* _REGION_H */
|
||||||
|
|
|
@ -82,12 +82,14 @@ typedef struct seen_region {
|
||||||
struct seen_region * next;
|
struct seen_region * next;
|
||||||
struct seen_region * prev;
|
struct seen_region * prev;
|
||||||
struct seen_region * nextHash;
|
struct seen_region * nextHash;
|
||||||
struct region *r;
|
const struct region *r;
|
||||||
unsigned char mode;
|
unsigned char mode;
|
||||||
boolean disbelieves;
|
boolean disbelieves;
|
||||||
} seen_region;
|
} seen_region;
|
||||||
|
|
||||||
extern seen_region * seen;
|
extern struct seen_region * seen;
|
||||||
|
extern struct seen_region * find_seen(const struct region * r);
|
||||||
|
|
||||||
extern const char* resname(resource_t res, int i);
|
extern const char* resname(resource_t res, int i);
|
||||||
|
|
||||||
extern char **seasonnames;
|
extern char **seasonnames;
|
||||||
|
|
|
@ -89,7 +89,7 @@ int laen_read(attrib * a, FILE * F)
|
||||||
int laen;
|
int laen;
|
||||||
fscanf(F, "%d", &laen);
|
fscanf(F, "%d", &laen);
|
||||||
read_laen(current_region, laen);
|
read_laen(current_region, laen);
|
||||||
return 0;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -258,7 +258,6 @@ ri(FILE * F)
|
||||||
return i * vz;
|
return i * vz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ri36(FILE * F)
|
ri36(FILE * F)
|
||||||
{
|
{
|
||||||
|
@ -840,7 +839,7 @@ readgame(boolean backup)
|
||||||
|
|
||||||
n = ri(F);
|
n = ri(F);
|
||||||
if (maxregions<0) maxregions = n;
|
if (maxregions<0) maxregions = n;
|
||||||
printf(" - Einzulesende Regionen: %d/%d ", maxregions, n);
|
printf(" - Einzulesende Regionen: %d/%d\r", maxregions, n);
|
||||||
|
|
||||||
while (--n >= 0) {
|
while (--n >= 0) {
|
||||||
unit **up;
|
unit **up;
|
||||||
|
@ -862,8 +861,8 @@ readgame(boolean backup)
|
||||||
skip = true;
|
skip = true;
|
||||||
}
|
}
|
||||||
if ((n%1024)==0) { /* das spart extrem Zeit */
|
if ((n%1024)==0) { /* das spart extrem Zeit */
|
||||||
printf("* %d,%d \r", x, y);
|
|
||||||
printf(" - Einzulesende Regionen: %d/%d ", maxregions, n);
|
printf(" - Einzulesende Regionen: %d/%d ", maxregions, n);
|
||||||
|
printf("* %d,%d \r", x, y);
|
||||||
}
|
}
|
||||||
if (skip) {
|
if (skip) {
|
||||||
char * r;
|
char * r;
|
||||||
|
@ -966,6 +965,7 @@ readgame(boolean backup)
|
||||||
addlist2(up,u);
|
addlist2(up,u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("\n");
|
||||||
if (!dirtyload) {
|
if (!dirtyload) {
|
||||||
if (global.data_version >= BORDER_VERSION) read_borders(F);
|
if (global.data_version >= BORDER_VERSION) read_borders(F);
|
||||||
#ifdef USE_UGROUPS
|
#ifdef USE_UGROUPS
|
||||||
|
@ -1040,6 +1040,9 @@ readgame(boolean backup)
|
||||||
if(findfaction(0)) {
|
if(findfaction(0)) {
|
||||||
findfaction(0)->alive = 1;
|
findfaction(0)->alive = 1;
|
||||||
}
|
}
|
||||||
|
if (maxregions>=0) {
|
||||||
|
remove_empty_factions();
|
||||||
|
}
|
||||||
|
|
||||||
/* Regionen */
|
/* Regionen */
|
||||||
for (r=regions;r;r=r->next) {
|
for (r=regions;r;r=r->next) {
|
||||||
|
@ -1449,7 +1452,7 @@ curse_read(attrib * a, FILE * f) {
|
||||||
}
|
}
|
||||||
chash(c);
|
chash(c);
|
||||||
|
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
@ -1499,13 +1502,13 @@ read_faction_reference(faction ** f, FILE * F)
|
||||||
} else {
|
} else {
|
||||||
fscanf(F, "%d ", &id);
|
fscanf(F, "%d ", &id);
|
||||||
}
|
}
|
||||||
if (id==0) {
|
if (id<0) {
|
||||||
*f = NULL;
|
*f = NULL;
|
||||||
return 0;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
*f = findfaction(id);
|
*f = findfaction(id);
|
||||||
if (*f==NULL) ur_add((void*)id, (void**)f, resolve_faction);
|
if (*f==NULL) ur_add((void*)id, (void**)f, resolve_faction);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -2939,7 +2939,7 @@ cw_read(attrib * a, FILE * f)
|
||||||
fscanf(f, "%d ", &br->id);
|
fscanf(f, "%d ", &br->id);
|
||||||
ur_add((void *)br->id, (void**)&wc->wall, resolve_borderid);
|
ur_add((void *)br->id, (void**)&wc->wall, resolve_borderid);
|
||||||
ur_add((void *)br, (void**)&wc->buddy, resolve_buddy);
|
ur_add((void *)br, (void**)&wc->buddy, resolve_buddy);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_cursewall =
|
attrib_type at_cursewall =
|
||||||
|
|
|
@ -459,20 +459,23 @@ write_unit_reference(const unit * u, FILE * F)
|
||||||
fprintf(F, "%s ", u?itoa36(u->no):"0");
|
fprintf(F, "%s ", u?itoa36(u->no):"0");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
read_unit_reference(unit ** up, FILE * F)
|
read_unit_reference(unit ** up, FILE * F)
|
||||||
{
|
{
|
||||||
char zId[10];
|
char zId[10];
|
||||||
int i;
|
int i;
|
||||||
fscanf(F, "%s", zId);
|
fscanf(F, "%s", zId);
|
||||||
|
if (up==NULL) {
|
||||||
|
return AT_READ_FAIL;
|
||||||
|
}
|
||||||
i = atoi36(zId);
|
i = atoi36(zId);
|
||||||
if (up) {
|
if (i==0) {
|
||||||
if (i==0) *up = NULL;
|
*up = NULL;
|
||||||
else {
|
return AT_READ_FAIL;
|
||||||
|
}
|
||||||
*up = findunit(i);
|
*up = findunit(i);
|
||||||
if (*up==NULL) ur_add((void*)i, (void**)up, resolve_unit);
|
if (*up==NULL) ur_add((void*)i, (void**)up, resolve_unit);
|
||||||
}
|
return AT_READ_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_stealth = {
|
attrib_type at_stealth = {
|
||||||
|
|
|
@ -130,7 +130,7 @@ extern void destroy_unit(struct unit * u);
|
||||||
/* see resolve.h */
|
/* see resolve.h */
|
||||||
extern void * resolve_unit(void * data);
|
extern void * resolve_unit(void * data);
|
||||||
extern void write_unit_reference(const unit * u, FILE * F);
|
extern void write_unit_reference(const unit * u, FILE * F);
|
||||||
extern void read_unit_reference(unit ** up, FILE * F);
|
extern int read_unit_reference(unit ** up, FILE * F);
|
||||||
|
|
||||||
extern void leave(struct region * r, struct unit * u);
|
extern void leave(struct region * r, struct unit * u);
|
||||||
extern void leave_ship(unit * u);
|
extern void leave_ship(unit * u);
|
||||||
|
|
|
@ -267,9 +267,9 @@ read_hurting(attrib * a, FILE * F) {
|
||||||
a->data.v = (void*)findbuilding(i);
|
a->data.v = (void*)findbuilding(i);
|
||||||
if (a->data.v==NULL) {
|
if (a->data.v==NULL) {
|
||||||
log_error(("temple of pain is broken\n"));
|
log_error(("temple of pain is broken\n"));
|
||||||
return 0;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static attrib_type at_hurting = {
|
static attrib_type at_hurting = {
|
||||||
|
@ -446,7 +446,7 @@ caldera_read(trigger * t, FILE * F)
|
||||||
t->data.v = findbuilding(i);
|
t->data.v = findbuilding(i);
|
||||||
if (t->data.v==NULL) ur_add((void*)i, &t->data.v, resolve_building);
|
if (t->data.v==NULL) ur_add((void*)i, &t->data.v, resolve_building);
|
||||||
|
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct trigger_type tt_caldera = {
|
struct trigger_type tt_caldera = {
|
||||||
|
|
|
@ -57,7 +57,7 @@ read_permissions(attrib * a, FILE * F)
|
||||||
{
|
{
|
||||||
attrib ** p_a = (attrib**)&a->data.v;
|
attrib ** p_a = (attrib**)&a->data.v;
|
||||||
a_read(F, p_a);
|
a_read(F, p_a);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct attrib_type at_permissions = {
|
struct attrib_type at_permissions = {
|
||||||
|
@ -93,7 +93,7 @@ read_gmcreate(attrib * a, FILE * F)
|
||||||
fscanf(F, "%s", zText);
|
fscanf(F, "%s", zText);
|
||||||
*p_itype = it_find(zText);
|
*p_itype = it_find(zText);
|
||||||
assert(*p_itype);
|
assert(*p_itype);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* at_gmcreate specifies that the owner can create items of a particular type */
|
/* at_gmcreate specifies that the owner can create items of a particular type */
|
||||||
|
|
|
@ -98,7 +98,7 @@ a_readmuseumgivebackcookie(attrib *a, FILE *f)
|
||||||
{
|
{
|
||||||
museumgivebackcookie *gbc = (museumgivebackcookie *)a->data.v;
|
museumgivebackcookie *gbc = (museumgivebackcookie *)a->data.v;
|
||||||
fscanf(f, "%d %d", &gbc->warden_no, &gbc->cookie);
|
fscanf(f, "%d %d", &gbc->warden_no, &gbc->cookie);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_museumgivebackcookie = {
|
attrib_type at_museumgivebackcookie = {
|
||||||
|
@ -141,7 +141,7 @@ a_readmuseumgiveback(attrib *a, FILE *f)
|
||||||
museumgiveback *gb = (museumgiveback *)a->data.v;
|
museumgiveback *gb = (museumgiveback *)a->data.v;
|
||||||
fscanf(f, "%d", &gb->cookie);
|
fscanf(f, "%d", &gb->cookie);
|
||||||
read_items(f, &gb->items);
|
read_items(f, &gb->items);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_museumgiveback = {
|
attrib_type at_museumgiveback = {
|
||||||
|
|
|
@ -32,7 +32,6 @@ santa_comes_to_town(region * r, unit * santa, void (*action)(unit*))
|
||||||
const item_type * roi = it_find("roi");
|
const item_type * roi = it_find("roi");
|
||||||
assert(roi);
|
assert(roi);
|
||||||
|
|
||||||
fset(santa, FL_TRAVELTHRU);
|
|
||||||
for (f = factions;f;f=f->next) {
|
for (f = factions;f;f=f->next) {
|
||||||
unit * u;
|
unit * u;
|
||||||
unit * senior = f->units;
|
unit * senior = f->units;
|
||||||
|
|
|
@ -89,15 +89,7 @@ xmasgate_write(const trigger * t, FILE * F)
|
||||||
static int
|
static int
|
||||||
xmasgate_read(trigger * t, FILE * F)
|
xmasgate_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
char zText[128];
|
return read_building_reference((building**)&t->data.v, F);
|
||||||
int i;
|
|
||||||
|
|
||||||
fscanf(F, "%s", zText);
|
|
||||||
i = atoi36(zText);
|
|
||||||
t->data.v = findbuilding(i);
|
|
||||||
if (t->data.v==NULL) ur_add((void*)i, &t->data.v, resolve_building);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct trigger_type tt_xmasgate = {
|
struct trigger_type tt_xmasgate = {
|
||||||
|
|
|
@ -70,9 +70,10 @@ static int
|
||||||
alp_read(attrib * a, FILE * F)
|
alp_read(attrib * a, FILE * F)
|
||||||
{
|
{
|
||||||
alp_data * ad = (alp_data*)a->data.v;
|
alp_data * ad = (alp_data*)a->data.v;
|
||||||
read_unit_reference(&ad->mage, F);
|
int m = read_unit_reference(&ad->mage, F);
|
||||||
read_unit_reference(&ad->target, F);
|
int t = read_unit_reference(&ad->target, F);
|
||||||
return 1;
|
if (m!=AT_READ_OK || t!=AT_READ_OK) return AT_READ_FAIL;
|
||||||
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static attrib_type at_alp = {
|
static attrib_type at_alp = {
|
||||||
|
|
|
@ -83,10 +83,11 @@ changefaction_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
changefaction_data * td = (changefaction_data*)t->data.v;
|
changefaction_data * td = (changefaction_data*)t->data.v;
|
||||||
|
|
||||||
read_unit_reference(&td->unit, F);
|
int u = read_unit_reference(&td->unit, F);
|
||||||
read_faction_reference(&td->faction, F);
|
int f = read_faction_reference(&td->faction, F);
|
||||||
|
|
||||||
return 1;
|
if (u!=AT_READ_OK || f!=AT_READ_OK) return AT_READ_FAIL;
|
||||||
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_changefaction = {
|
trigger_type tt_changefaction = {
|
||||||
|
|
|
@ -84,10 +84,11 @@ static int
|
||||||
changerace_read(trigger * t, FILE * F)
|
changerace_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
changerace_data * td = (changerace_data*)t->data.v;
|
changerace_data * td = (changerace_data*)t->data.v;
|
||||||
read_unit_reference(&td->u, F);
|
int uc = read_unit_reference(&td->u, F);
|
||||||
read_race_reference(&td->race, F);
|
int rc = read_race_reference(&td->race, F);
|
||||||
read_race_reference(&td->irace, F);
|
int ic = read_race_reference(&td->irace, F);
|
||||||
return 1;
|
if (uc!=AT_READ_OK || rc!=AT_READ_OK || ic!=AT_READ_OK) return AT_READ_FAIL;
|
||||||
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_changerace = {
|
trigger_type tt_changerace = {
|
||||||
|
|
|
@ -62,8 +62,7 @@ clonedied_write(const trigger * t, FILE * F)
|
||||||
static int
|
static int
|
||||||
clonedied_read(trigger * t, FILE * F)
|
clonedied_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
read_unit_reference((unit**)&t->data.v, F);
|
return read_unit_reference((unit**)&t->data.v, F);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_clonedied = {
|
trigger_type tt_clonedied = {
|
||||||
|
|
|
@ -103,7 +103,7 @@ createcurse_read(trigger * t, FILE * F)
|
||||||
if (td->target==NULL) ur_add((void*)i, (void**)&td->target, resolve_unit);
|
if (td->target==NULL) ur_add((void*)i, (void**)&td->target, resolve_unit);
|
||||||
|
|
||||||
fscanf(F, "%d %d %d %d %d %d ", &td->id, &td->id2, &td->vigour, &td->duration, &td->effect, &td->men);
|
fscanf(F, "%d %d %d %d %d %d ", &td->id, &td->id2, &td->vigour, &td->duration, &td->effect, &td->men);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_createcurse = {
|
trigger_type tt_createcurse = {
|
||||||
|
|
|
@ -88,12 +88,14 @@ createunit_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
createunit_data * td = (createunit_data*)t->data.v;
|
createunit_data * td = (createunit_data*)t->data.v;
|
||||||
|
|
||||||
read_unit_reference(&td->u, F);
|
int uc = read_unit_reference(&td->u, F);
|
||||||
read_region_reference(&td->r, F);
|
int rc = read_region_reference(&td->r, F);
|
||||||
read_race_reference(&td->race, F);
|
int ic = read_race_reference(&td->race, F);
|
||||||
|
|
||||||
fscanf(F, "%d ", &td->number);
|
fscanf(F, "%d ", &td->number);
|
||||||
return 1;
|
|
||||||
|
if (uc!=AT_READ_OK || rc!=AT_READ_OK || ic!=AT_READ_OK) return AT_READ_FAIL;
|
||||||
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_createunit = {
|
trigger_type tt_createunit = {
|
||||||
|
|
|
@ -71,10 +71,11 @@ gate_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
gate_data * gd = (gate_data*)t->data.v;
|
gate_data * gd = (gate_data*)t->data.v;
|
||||||
|
|
||||||
read_building_reference(&gd->gate, F);
|
int bc = read_building_reference(&gd->gate, F);
|
||||||
read_region_reference(&gd->target, F);
|
int rc = read_region_reference(&gd->target, F);
|
||||||
|
|
||||||
return 1;
|
if (rc!=AT_READ_OK || bc!=AT_READ_OK) return AT_READ_FAIL;
|
||||||
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -91,7 +91,7 @@ giveitem_read(trigger * t, FILE * F)
|
||||||
td->itype = it_find(zText);
|
td->itype = it_find(zText);
|
||||||
assert(td->itype);
|
assert(td->itype);
|
||||||
|
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_giveitem = {
|
trigger_type tt_giveitem = {
|
||||||
|
|
|
@ -54,8 +54,7 @@ killunit_write(const trigger * t, FILE * F)
|
||||||
static int
|
static int
|
||||||
killunit_read(trigger * t, FILE * F)
|
killunit_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
read_unit_reference((unit**)&t->data.v, F);
|
return read_unit_reference((unit**)&t->data.v, F);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_killunit = {
|
trigger_type tt_killunit = {
|
||||||
|
|
|
@ -94,7 +94,7 @@ removecurse_read(trigger * t, FILE * F)
|
||||||
td->curse = cfindhash(i);
|
td->curse = cfindhash(i);
|
||||||
if (td->curse==NULL) ur_add((void*)i, (void**)&td->curse, resolve_curse);
|
if (td->curse==NULL) ur_add((void*)i, (void**)&td->curse, resolve_curse);
|
||||||
|
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_removecurse = {
|
trigger_type tt_removecurse = {
|
||||||
|
|
|
@ -49,14 +49,25 @@ static void
|
||||||
shock_write(const trigger * t, FILE * F)
|
shock_write(const trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
unit * u = (unit*)t->data.v;
|
unit * u = (unit*)t->data.v;
|
||||||
|
trigger * next = t->next;
|
||||||
|
while (next) {
|
||||||
|
/* make sure it is unique! */
|
||||||
|
if (next->type==t->type && next->data.v==t->data.v) break;
|
||||||
|
next=next->next;
|
||||||
|
}
|
||||||
|
if (next && u) {
|
||||||
|
log_error(("more than one shock-attribut for %s on a unit. FIXED.\n",
|
||||||
|
unitid(u)));
|
||||||
|
write_unit_reference(NULL, F);
|
||||||
|
} else {
|
||||||
write_unit_reference(u, F);
|
write_unit_reference(u, F);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
shock_read(trigger * t, FILE * F)
|
shock_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
read_unit_reference((unit**)&t->data.v, F);
|
return read_unit_reference((unit**)&t->data.v, F);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_shock = {
|
trigger_type tt_shock = {
|
||||||
|
|
|
@ -83,7 +83,8 @@ timeout_read(trigger * t, FILE * F)
|
||||||
tr = tr->next;
|
tr = tr->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (td->triggers!=NULL && td->timer>0);
|
if (td->triggers!=NULL && td->timer>0) return AT_READ_OK;
|
||||||
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_timeout = {
|
trigger_type tt_timeout = {
|
||||||
|
|
|
@ -49,9 +49,7 @@ unguard_write(const trigger * t, FILE * F)
|
||||||
static int
|
static int
|
||||||
unguard_read(trigger * t, FILE * F)
|
unguard_read(trigger * t, FILE * F)
|
||||||
{
|
{
|
||||||
read_building_reference((building**)&t->data.v, F);
|
return read_building_reference((building**)&t->data.v, F);
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct trigger_type tt_unguard = {
|
struct trigger_type tt_unguard = {
|
||||||
|
|
|
@ -93,7 +93,7 @@ unitmessage_read(trigger * t, FILE * F)
|
||||||
fscanf(F, "%s %d %d ", zText, &td->type, &td->level);
|
fscanf(F, "%s %d %d ", zText, &td->type, &td->level);
|
||||||
td->string = strdup(zText);
|
td->string = strdup(zText);
|
||||||
|
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_type tt_unitmessage = {
|
trigger_type tt_unitmessage = {
|
||||||
|
|
|
@ -174,7 +174,7 @@ a_readdefault(attrib * a, FILE * f)
|
||||||
{
|
{
|
||||||
assert(sizeof(int)==sizeof(a->data));
|
assert(sizeof(int)==sizeof(a->data));
|
||||||
fscanf(f, "%d", &a->data.i);
|
fscanf(f, "%d", &a->data.i);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -206,7 +206,7 @@ a_readstring(attrib * a, FILE * f)
|
||||||
char zText[4096];
|
char zText[4096];
|
||||||
read_quoted(f, zText, sizeof(zText));
|
read_quoted(f, zText, sizeof(zText));
|
||||||
a->data.v = strdup(zText);
|
a->data.v = strdup(zText);
|
||||||
return 1;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -258,10 +258,18 @@ a_read(FILE * f, attrib ** attribs)
|
||||||
}
|
}
|
||||||
if (at->read) {
|
if (at->read) {
|
||||||
attrib * na = a_new(at);
|
attrib * na = a_new(at);
|
||||||
if (at->read(na, f))
|
int i = at->read(na, f);
|
||||||
|
switch (i) {
|
||||||
|
case AT_READ_OK:
|
||||||
a_add(attribs, na);
|
a_add(attribs, na);
|
||||||
else
|
break;
|
||||||
|
case AT_READ_FAIL:
|
||||||
a_free(na);
|
a_free(na);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(!"invalid return value");
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(!"fehler: keine laderoutine für attribut");
|
assert(!"fehler: keine laderoutine für attribut");
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,4 +83,7 @@ extern void a_write(FILE * f, const attrib * attribs);
|
||||||
#define NO_WRITE NULL
|
#define NO_WRITE NULL
|
||||||
#define NO_READ NULL
|
#define NO_READ NULL
|
||||||
|
|
||||||
|
#define AT_READ_OK 4711
|
||||||
|
#define AT_READ_FAIL -4711
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,13 +25,16 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef HAVE_STRTOL
|
|
||||||
int
|
int
|
||||||
atoi36(const char * s)
|
atoi36(const char * s)
|
||||||
{
|
{
|
||||||
return (int)(strtol(s, NULL, 36));
|
char * p = NULL;
|
||||||
|
int i = (int)(strtol(s, &p, 36));
|
||||||
|
if (*p || i<0) return -1;
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
#if 0
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
int
|
int
|
||||||
atoi36(const char * s)
|
atoi36(const char * s)
|
||||||
|
@ -40,14 +43,15 @@ atoi36(const char * s)
|
||||||
assert(s);
|
assert(s);
|
||||||
if(!(*s)) return 0;
|
if(!(*s)) return 0;
|
||||||
|
|
||||||
while(!isalnum((int)*s)) ++s;
|
while(isspace((int)*s)) ++s;
|
||||||
while(isalnum((int)*s)) {
|
while(isalnum((int)*s)) {
|
||||||
if (isupper((int)*s)) i = i*36 + (*s)-'A' + 10;
|
if (isupper((int)*s)) i = i*36 + (*s)-'A' + 10;
|
||||||
else if (islower((int)*s)) i=i*36 + (*s)-'a' + 10;
|
else if (islower((int)*s)) i=i*36 + (*s)-'a' + 10;
|
||||||
else if (isdigit((int)*s)) i=i*36 + (*s)-'0';
|
else if (isdigit((int)*s)) i=i*36 + (*s)-'0';
|
||||||
|
else return -1;
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
if (i<0) return 0;
|
if (i<0 || !isspace(*s) && *s!='0') return -1;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,8 +47,20 @@ read_triggers(FILE * F, trigger ** tp)
|
||||||
ttype = tt_find(zText);
|
ttype = tt_find(zText);
|
||||||
assert(ttype || !"unknown trigger-type");
|
assert(ttype || !"unknown trigger-type");
|
||||||
*tp = t_new(ttype);
|
*tp = t_new(ttype);
|
||||||
if (ttype->read) ttype->read(*tp, F);
|
if (ttype->read) {
|
||||||
|
int i = ttype->read(*tp, F);
|
||||||
|
switch (i) {
|
||||||
|
case AT_READ_OK:
|
||||||
tp = &(*tp)->next;
|
tp = &(*tp)->next;
|
||||||
|
break;
|
||||||
|
case AT_READ_FAIL:
|
||||||
|
t_free(*tp);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(!"invalid return value");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +142,10 @@ read_handler(attrib * a, FILE * F)
|
||||||
fscanf(F, "%s ", zText);
|
fscanf(F, "%s ", zText);
|
||||||
hi->event = strdup(zText);
|
hi->event = strdup(zText);
|
||||||
read_triggers(F, &hi->triggers);
|
read_triggers(F, &hi->triggers);
|
||||||
return (hi->triggers!=NULL);
|
if (hi->triggers!=NULL) {
|
||||||
|
return AT_READ_OK;
|
||||||
|
}
|
||||||
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_eventhandler = {
|
attrib_type at_eventhandler = {
|
||||||
|
|
|
@ -108,6 +108,22 @@ LINK32=link.exe
|
||||||
# Name "eressea - Win32 Release"
|
# Name "eressea - Win32 Release"
|
||||||
# Name "eressea - Win32 Debug"
|
# Name "eressea - Win32 Debug"
|
||||||
# Name "eressea - Win32 Profile"
|
# Name "eressea - Win32 Profile"
|
||||||
|
# Begin Group "Text Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter ""
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\commit.txt
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\header.txt
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\todo.txt
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\korrektur.c
|
SOURCE=.\korrektur.c
|
||||||
|
|
|
@ -126,9 +126,8 @@ verify_owners(boolean bOnce)
|
||||||
#define do_once(magic, fun) \
|
#define do_once(magic, fun) \
|
||||||
{ \
|
{ \
|
||||||
attrib * a = find_key(global.attribs, atoi36(magic)); \
|
attrib * a = find_key(global.attribs, atoi36(magic)); \
|
||||||
if (a) { \
|
if (!a) { \
|
||||||
log_warning(("[do_once] a unique fix %d=\"%s\" was called a second time\n", atoi36(magic), magic)); \
|
log_warning(("[do_once] a unique fix %d=\"%s\" was applied.\n", atoi36(magic), magic)); \
|
||||||
} else { \
|
|
||||||
if (fun == 0) a_add(&global.attribs, make_key(atoi36(magic))); \
|
if (fun == 0) a_add(&global.attribs, make_key(atoi36(magic))); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -138,12 +137,13 @@ warn_items(void)
|
||||||
{
|
{
|
||||||
boolean found = 0;
|
boolean found = 0;
|
||||||
region * r;
|
region * r;
|
||||||
|
const item_type * it_money = it_find("money");
|
||||||
for (r=regions;r;r=r->next) {
|
for (r=regions;r;r=r->next) {
|
||||||
unit * u;
|
unit * u;
|
||||||
for (u=r->units;u;u=u->next) {
|
for (u=r->units;u;u=u->next) {
|
||||||
item * itm;
|
item * itm;
|
||||||
for (itm=u->items;itm;itm=itm->next) {
|
for (itm=u->items;itm;itm=itm->next) {
|
||||||
if (itm->number>1000000) {
|
if (itm->number>100000 && itm->type!=it_money) {
|
||||||
found = 1;
|
found = 1;
|
||||||
log_error(("Einheit %s hat %u %s\n",
|
log_error(("Einheit %s hat %u %s\n",
|
||||||
unitid(u), itm->number,
|
unitid(u), itm->number,
|
||||||
|
@ -187,7 +187,6 @@ santa_comes_to_town(void)
|
||||||
santa->irace = new_race[RC_DAEMON];
|
santa->irace = new_race[RC_DAEMON];
|
||||||
set_string(&santa->name, "Ein dicker Gnom mit einem Rentierschlitten");
|
set_string(&santa->name, "Ein dicker Gnom mit einem Rentierschlitten");
|
||||||
set_string(&santa->display, "hat: 6 Rentiere, Schlitten, Sack mit Geschenken, Kekse für Khorne");
|
set_string(&santa->display, "hat: 6 Rentiere, Schlitten, Sack mit Geschenken, Kekse für Khorne");
|
||||||
fset(santa, FL_TRAVELTHRU);
|
|
||||||
|
|
||||||
for (f=factions;f;f=f->next) {
|
for (f=factions;f;f=f->next) {
|
||||||
unit * u;
|
unit * u;
|
||||||
|
@ -1337,7 +1336,7 @@ fix_herbtypes(void)
|
||||||
static int
|
static int
|
||||||
fix_plainherbs(void)
|
fix_plainherbs(void)
|
||||||
{
|
{
|
||||||
region *r, *lastr;
|
region *r, *lastr = regions;
|
||||||
for (r=regions;r;r=r->next) {
|
for (r=regions;r;r=r->next) {
|
||||||
int i;
|
int i;
|
||||||
const char * name;
|
const char * name;
|
||||||
|
|
49
src/todo.txt
49
src/todo.txt
|
@ -1,44 +1,53 @@
|
||||||
|
Status:
|
||||||
|
*=default
|
||||||
|
!=critical, muss diese Runde gemacht werden.
|
||||||
|
+=fixed, muss überprüft werden
|
||||||
|
V=verified, ist getestet
|
||||||
|
-=war kein Bug
|
||||||
|
|
||||||
Announcen:
|
Announcen:
|
||||||
* Freigewordene Vinyambar-Parteien
|
! Schattendämonen, Gewicht
|
||||||
* Bugfix Kräuterverteilung
|
|
||||||
* Schattendämonen, Gewicht
|
|
||||||
|
|
||||||
Nächste Woche beachten:
|
Nächste Woche beachten:
|
||||||
* bei der auswertung auf die resourcenanzeige achten.
|
+ bei der auswertung auf die resourcenanzeige achten.
|
||||||
* Kräuterneuverteilung
|
+ Kräuterneuverteilung
|
||||||
* Bauern in Bofintedlat aussetzen, bitte
|
! Bauern in Bofintedlat aussetzen, bitte
|
||||||
|
|
||||||
Bugfixes/Debugging:
|
Bugfixes/Debugging:
|
||||||
|
! TARNE PARTEI NICHT immer noch defekt?
|
||||||
* Tragkraft von monstern unbegrenzt?
|
* Tragkraft von monstern unbegrenzt?
|
||||||
* Unterhaltungsmaximum kann nicht ausgeschoepft werden (H. Bruns)
|
* Unterhaltungsmaximum kann nicht ausgeschoepft werden (H. Bruns)
|
||||||
* Schiff nicht abgelegt (Marc Albrecht)
|
* Schiff nicht abgelegt (Marc Albrecht)
|
||||||
* Antimagiekristall (Stefan Schwarz)
|
+ Antimagiekristall (Stefan Schwarz)
|
||||||
* NR und CR Diskrepanz: Strassen
|
+ NR und CR Diskrepanz: Strassen
|
||||||
* shock-Attribut (u. wahrscheinlich andere) mehrfach im Datenfile
|
+ shock-Attribut (u. wahrscheinlich andere) mehrfach im Datenfile
|
||||||
* Kampf und Bergung (W. Edel)
|
v Kampf und Bergung (W. Edel)
|
||||||
* Lernkosten (W. Edel)
|
- Lernkosten (W. Edel)
|
||||||
* Schattendaemonen kann man mit RESERVIERE Gegenstaende abnehmen, aber sie
|
! Schattendaemonen kann man mit RESERVIERE Gegenstaende abnehmen, aber sie
|
||||||
koennen kein GIB. was ist richtig?
|
koennen kein GIB. was ist richtig?
|
||||||
* Monsterroutinen nochmal anschauen, Clustering von Wyrmen
|
* Monsterroutinen nochmal anschauen, Clustering von Wyrmen
|
||||||
* trigger anschauen. killunit::handle
|
v trigger anschauen. killunit::handle
|
||||||
* Durchreiseregionen werden nicht angezeigt
|
v Durchreiseregionen werden nicht angezeigt
|
||||||
* Gewicht von Schattendämonen
|
v Regionen nach Straßen werden nicht angezeigt
|
||||||
|
! Gewicht von Schattendämonen
|
||||||
|
v remove_empty_factions darf kein free machen, weil noch attribute
|
||||||
|
auf die partei zeigen. Attribute mit faction 0 wurden nie eingelesen.
|
||||||
|
* Parteien in Durchreise- und Leuchtturmregionen tauchen nicht als PARTEI Block auf
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Bauernblut-Effekt an der Einheit speichern, wie bei anderen Traenken auch
|
* Bauernblut-Effekt an der Einheit speichern, wie bei anderen Traenken auch
|
||||||
* Passworte fuer Vinyambar, cancelling von Parteien aus DB an Server
|
* cancelling von Parteien aus DB an Server weiterreichen
|
||||||
weiterreichen
|
|
||||||
* Automatisches Einsetzen im allgemeinen
|
* Automatisches Einsetzen im allgemeinen
|
||||||
* buildings.xml hat keinen support fuer gebaeude mit mehreren ausbaustufen
|
* buildings.xml hat keinen support fuer gebaeude mit mehreren ausbaustufen
|
||||||
(castle). nachtragen, und bt_castle aus dem source werfen
|
(castle). nachtragen, und bt_castle aus dem source werfen
|
||||||
* eigener messagetype für regions-/einheitenbotschaften (nicht string)
|
- eigener messagetype für regions-/einheitenbotschaften (nicht string)
|
||||||
|
|
||||||
Webseiten, Mailinglisten:
|
Webseiten, Mailinglisten:
|
||||||
* mehr logging, vinyambar-accounts
|
* mehr logging, vinyambar-accounts
|
||||||
* mailman gate_news konfiguration
|
* mailman gate_news konfiguration
|
||||||
* mailgate schickt postings von Arsenius nicht an die mailingliste.
|
* mailgate schickt postings von Arsenius nicht an die mailingliste.
|
||||||
* Option fuer Start in alten Regionen im Webformular
|
! Option fuer Start in alten Regionen im Webformular
|
||||||
* Regel mit mindestens 0 NMR aus der partieboerse (standin.py) nehmen.
|
V Regel mit mindestens 0 NMR aus der parteiboerse (standin.py) nehmen.
|
||||||
|
|
||||||
Designideen zur Diskussion:
|
Designideen zur Diskussion:
|
||||||
* neue Waffen
|
* neue Waffen
|
||||||
|
|
Loading…
Reference in New Issue