einbau der bugfixes aus dem aktuellen beta-branch in die dev-version

This commit is contained in:
Enno Rehling 2001-03-04 18:41:27 +00:00
parent 460d62c3cf
commit 435e98f50c
16 changed files with 242 additions and 175 deletions

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: creport.c,v 1.11 2001/02/25 19:31:38 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)
@ -67,7 +66,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define C_REPORT_VERSION 55 #define C_REPORT_VERSION 56
#define NEWBLOCKS (C_REPORT_VERSION>=35) #define NEWBLOCKS (C_REPORT_VERSION>=35)
#define ENCODE_SPECIAL 1 #define ENCODE_SPECIAL 1
@ -113,6 +112,13 @@ print_curses(FILE * F, void * obj, typ_t typ, attrib *a, int self)
} }
fprintf(F, "\"%s\"\n", buf); fprintf(F, "\"%s\"\n", buf);
} }
} else if (a->type==&at_effect && self) {
effect_data * data = (effect_data *)a->data.v;
if (!header) {
header = 1;
fputs("EFFECTS\n", F);
}
fprintf(F, "\"%d %s\"\n", data->value, locale_string(NULL, resourcename(data->type->itype->rtype, 0)));
} }
a = a->next; a = a->next;
} }
@ -470,10 +476,6 @@ cr_output_unit(FILE * F, region * r,
else if (i<0) else if (i<0)
fprintf(F, "%d;alias\n", -i); fprintf(F, "%d;alias\n", -i);
i = get_money(u); i = get_money(u);
#ifdef OLD_SILBER
if (i)
fprintf(F, "%d;Silber\n", i);
#endif
if (u->status) if (u->status)
fprintf(F, "%d;Kampfstatus\n", u->status); fprintf(F, "%d;Kampfstatus\n", u->status);
i = u_geteffstealth(u); i = u_geteffstealth(u);
@ -539,16 +541,6 @@ cr_output_unit(FILE * F, region * r,
} }
} }
} }
#ifdef OLD_SILBER
/* silver information for other units */
else {
int i = get_money(u);
if (i / u->number >= 5000)
fprintf(F, "%d;Silber\n", 5000 * u->number);
else if (i / u->number >= 500)
fprintf(F, "%d;Silber\n", 500 * u->number);
}
#endif
/* items */ /* items */
pr = 0; pr = 0;
if (f == u->faction || u->faction->race==RC_ILLUSION) { if (f == u->faction || u->faction->race==RC_ILLUSION) {

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: economy.c,v 1.8 2001/02/25 19:31:38 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)
@ -1982,7 +1981,7 @@ expandselling(region * r, request * sellorders)
} }
} }
hafenowner = gebaeude_vorhanden(r, &bt_harbour); hafenowner = owner_buildingtyp(r, &bt_harbour);
if (maxb != (building *) NULL && maxowner != (unit *) NULL) { if (maxb != (building *) NULL && maxowner != (unit *) NULL) {
maxeffsize = buildingeffsize(maxb, false); maxeffsize = buildingeffsize(maxb, false);
@ -2000,7 +1999,7 @@ expandselling(region * r, request * sellorders)
* multiplier speichert r->demand für die debug message ab. */ * multiplier speichert r->demand für die debug message ab. */
max_products = rpeasants(r) / TRADE_FRACTION; max_products = rpeasants(r) / TRADE_FRACTION;
if (rterrain(r) == T_DESERT && gebaeude_vorhanden(r, &bt_caravan)) { if (rterrain(r) == T_DESERT && buildingtype_exists(r, &bt_caravan)) {
max_products = rpeasants(r) * 2 / TRADE_FRACTION; max_products = rpeasants(r) * 2 / TRADE_FRACTION;
} }
/* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro /* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro
@ -2130,7 +2129,7 @@ sell(region * r, unit * u, request ** sellorders, const char * cmd)
s = getstrtoken(); s = getstrtoken();
if (findparam(s) == P_ANY) { if (findparam(s) == P_ANY) {
n = (rpeasants(r) - rpeasants(r) / RECRUITFRACTION) / TRADE_FRACTION; n = (rpeasants(r) - rpeasants(r) / RECRUITFRACTION) / TRADE_FRACTION;
if (rterrain(r) == T_DESERT && gebaeude_vorhanden(r, &bt_caravan)) if (rterrain(r) == T_DESERT && buildingtype_exists(r, &bt_caravan))
n *= 2; n *= 2;
} else } else
n = atoi(s); n = atoi(s);

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: laws.c,v 1.32 2001/02/28 22:14:56 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)
@ -235,7 +234,10 @@ get_food(region *r)
{ {
unit *u; unit *u;
/* 1. Versorgung von eigenen Einheiten */ /* 1. Versorgung von eigenen Einheiten. Das vorhandene Silber
* wird zunächst so auf die Einheiten aufgeteilt, dass idealerweise
* jede Einheit genug Silber für ihren Unterhalt hat. */
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
int need = lifestyle(u); int need = lifestyle(u);
@ -247,7 +249,7 @@ get_food(region *r)
unit *v; unit *v;
for (v = r->units; need && v; v = v->next) for (v = r->units; need && v; v = v->next)
if (v->faction == u->faction && !is_monstrous(u)) { if (v->faction == u->faction && !is_monstrous(v)) {
int give = get_money(v) - lifestyle(v); int give = get_money(v) - lifestyle(v);
give = max(0, give); give = max(0, give);
give = min(need, give); give = min(need, give);
@ -260,11 +262,10 @@ get_food(region *r)
} }
} }
/* 2. Versorgung durch Fremde: */ /* 2. Versorgung durch Fremde. Das Silber alliierter Einheiten wird
* entsprechend verteilt. */
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
int need = lifestyle(u); int need = lifestyle(u);
/* Negative Silberbeträge kommen vor (Bug), deshalb geht
* need -= u->money nicht. */
need -= max(0, get_money(u)); need -= max(0, get_money(u));
@ -273,7 +274,7 @@ get_food(region *r)
for (v = r->units; need && v; v = v->next) for (v = r->units; need && v; v = v->next)
if (v->faction != u->faction && allied(v, u->faction, HELP_MONEY) if (v->faction != u->faction && allied(v, u->faction, HELP_MONEY)
&& !is_monstrous(u)) { && !is_monstrous(v)) {
int give = lifestyle(v); int give = lifestyle(v);
give = max(0, get_money(v) - give); give = max(0, get_money(v) - give);
give = min(need, give); give = min(need, give);
@ -747,7 +748,7 @@ demographics(void)
if (r->land) for (dmd=r->land->demands;dmd;dmd=dmd->next) { if (r->land) for (dmd=r->land->demands;dmd;dmd=dmd->next) {
if (dmd->value>0 && dmd->value < MAXDEMAND) { if (dmd->value>0 && dmd->value < MAXDEMAND) {
int rise = DMRISE; int rise = DMRISE;
if (gebaeude_vorhanden(r, &bt_harbour)) rise = DMRISEHAFEN; if (buildingtype_exists(r, &bt_harbour)) rise = DMRISEHAFEN;
if (rand() % 100 < rise) dmd->value++; if (rand() % 100 < rise) dmd->value++;
} }
} }
@ -756,7 +757,7 @@ demographics(void)
for (n = 0; n != MAXLUXURIES; n++) { for (n = 0; n != MAXLUXURIES; n++) {
int d = rdemand(r, n); int d = rdemand(r, n);
if (d > 0 && d < MAXDEMAND) { if (d > 0 && d < MAXDEMAND) {
if (gebaeude_vorhanden(r, &bt_harbour)) { if (buildingtype_exists(r, &bt_harbour)) {
if (rand() % 100 < DMRISEHAFEN) { if (rand() % 100 < DMRISEHAFEN) {
d++; d++;
} }
@ -2901,6 +2902,27 @@ defaultorders (void)
void write_skillfix(void); void write_skillfix(void);
#endif #endif
/* ************************************************************ */
/* GANZ WICHTIG! ALLE GEÄNDERTEN SPRÜCHE NEU ANZEIGEN */
/* GANZ WICHTIG! FÜGT AUCH NEUE ZAUBER IN DIE LISTE DER BEKANNTEN EIN */
/* ************************************************************ */
static void
update_spells(void)
{
region *r;
for(r=regions; r; r=r->next) {
unit *u;
for(u=r->units;u;u=u->next) {
sc_mage *m = get_mage(u);
if (u->faction->no != MONSTER_FACTION && m != NULL) {
if (m->magietyp == M_GRAU) continue;
updatespelllist(u);
}
}
}
}
void void
processorders (void) processorders (void)
{ {
@ -3065,6 +3087,9 @@ processorders (void)
#ifdef SKILLFIX_SAVE #ifdef SKILLFIX_SAVE
write_skillfix(); write_skillfix();
#endif #endif
/* immer ausführen, wenn neue Sprüche dazugekommen sind, oder sich
* Beschreibungen geändert haben */
update_spells();
} }
int int

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: report.c,v 1.19 2001/02/28 22:14:56 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)
@ -1206,7 +1205,7 @@ statistics(FILE * F, region * r, faction * f)
p / RECRUITFRACTION); p / RECRUITFRACTION);
rps(F, buf); rps(F, buf);
if (gebaeude_vorhanden(r, &bt_caravan)) { if (buildingtype_exists(r, &bt_caravan)) {
sprintf(buf, "Luxusgüter zum angegebenen Preis: %d", sprintf(buf, "Luxusgüter zum angegebenen Preis: %d",
(p * 2) / TRADE_FRACTION); (p * 2) / TRADE_FRACTION);
} else { } else {

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: battle.c,v 1.19 2001/02/24 12:50:47 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)
@ -368,7 +367,7 @@ select_corpse(battle * b, fighter * af)
for_each(df, b->fighters) { for_each(df, b->fighters) {
/* Geflohene haben auch 0 hp, dürfen hier aber nicht ausgewählt /* Geflohene haben auch 0 hp, dürfen hier aber nicht ausgewählt
* werden! */ * werden! */
int dead = df->unit->number - (df->alive + df->run_number); int dead = df->unit->number - (df->alive + df->run.number);
if (nonplayer(df->unit)) continue; if (nonplayer(df->unit)) continue;
if (af && !helping(af->side, df->side)) if (af && !helping(af->side, df->side))
@ -533,7 +532,7 @@ reportcasualties(battle * b, fighter * fig)
for (bf = b->factions;bf;bf=bf->next) { for (bf = b->factions;bf;bf=bf->next) {
faction * f = bf->faction; faction * f = bf->faction;
struct message * m = new_message(f, "casualties%u:unit%r:runto%i:run%i:alive%i:fallen", struct message * m = new_message(f, "casualties%u:unit%r:runto%i:run%i:alive%i:fallen",
fig->unit, fig->run_to, fig->run_number, fig->alive, fig->unit->number - fig->alive - fig->run_number); fig->unit, fig->run.region, fig->run.number, fig->alive, fig->unit->number - fig->alive - fig->run.number);
brecord(f, fig->unit->region, m); brecord(f, fig->unit->region, m);
} }
} }
@ -825,19 +824,19 @@ remove_troop(troop dt)
if (!df->alive) { if (!df->alive) {
switch (du->race) { switch (du->race) {
case RC_FIREDRAGON: case RC_FIREDRAGON:
change_item(du, I_DRACHENBLUT, du->number-df->run_number); change_item(du, I_DRACHENBLUT, du->number-df->run.number);
break; break;
case RC_DRAGON: case RC_DRAGON:
change_item(du, I_DRACHENBLUT, (du->number-df->run_number) * 4); change_item(du, I_DRACHENBLUT, (du->number-df->run.number) * 4);
change_item(du, I_DRAGONHEAD, du->number-df->run_number); change_item(du, I_DRAGONHEAD, du->number-df->run.number);
break; break;
case RC_WYRM: case RC_WYRM:
change_item(du, I_DRACHENBLUT, (du->number-df->run_number) * 10); change_item(du, I_DRACHENBLUT, (du->number-df->run.number) * 10);
change_item(du, I_DRAGONHEAD, du->number-df->run_number); change_item(du, I_DRAGONHEAD, du->number-df->run.number);
break; break;
case RC_SEASERPENT: case RC_SEASERPENT:
change_item(du, I_DRACHENBLUT, (du->number-df->run_number) * 6); change_item(du, I_DRACHENBLUT, (du->number-df->run.number) * 6);
change_item(du, I_SEASERPENTHEAD, du->number-df->run_number); change_item(du, I_SEASERPENTHEAD, du->number-df->run.number);
break; break;
} }
@ -2050,78 +2049,46 @@ loot_items(fighter * corpse)
u->items = NULL; u->items = NULL;
while (itm) { while (itm) {
const item_type * itype = itm->type;
int i; int i;
int keep, give; if (itm->number) {
if (corpse->run_number) { for (i = 10; i != 0; i--) {
/* es gibt flüchtlinge */ int loot = itm->number / i;
if (itype->capacity>0 || fval(itype, ITF_ANIMAL)) { itm->number -= loot;
/* Regeländerung: Man muß das Tier nicht reiten können, /* Looten tun hier immer nur die Gegner. Das
* um es vom Schlachtfeld mitzunehmen, ist ja nur * ist als Ausgleich für die neue Loot-regel
* eine Region weit. * */ * (nur ganz tote Einheiten) fair.
keep = min(corpse->run_number, itm->number); * zusätzlich looten auch geflohene, aber
} else if (itm->type->weight <= 0) { * nach anderen Regeln.
/* if it doesn't weigh anything, it won't slow us down */ */
keep = min(corpse->run_number, itm->number); if (loot>0 && (itm->type->flags & (ITF_CURSED|ITF_NOTLOST)
} || rand()%100 >= 50 - corpse->side->battle->keeploot)) {
else keep = 0; fighter *fig = select_enemy(corpse, FIGHT_ROW, LAST_ROW).fighter;
give = itm->number-keep; if (fig) {
} item * l = fig->loot;
else { while (l && l->type!=itm->type) l=l->next;
keep = 0; if (!l) {
give = itm->number; l = calloc(sizeof(item), 1);
} l->next = fig->loot;
if (give) for (i = 10; i != 0; i--) { fig->loot = l;
int loot = give / i; l->type = itm->type;
give -= loot; }
/* Looten tun hier immer nur die Gegner. Das l->number += loot;
* ist als Ausgleich für die neue Loot-regel
* (nur ganz tote Einheiten) fair.
* zusätzlich looten auch geflohene, aber
* nach anderen Regeln.
*/
if (loot>0 && (itm->type->flags & (ITF_CURSED|ITF_NOTLOST)
|| rand()%100 >= 50 - corpse->side->battle->keeploot)) {
fighter *fig = select_enemy(corpse, FIGHT_ROW, LAST_ROW).fighter;
if (fig) {
item * l = fig->loot;
while (l && l->type!=itm->type) l=l->next;
if (!l) {
l = calloc(sizeof(item), 1);
l->next = fig->loot;
fig->loot = l;
l->type = itm->type;
} }
l->number += loot;
} }
} }
} }
if (keep) { itm = itm->next;
item * i = i_remove(&itm, itm);
i->number = keep;
i_add(&u->items, i);
} else {
i_free(i_remove(&itm, itm));
}
} }
} }
void static void
loot_fleeing(unit* u, unit* runner) { loot_fleeing(fighter* fig, unit* runner)
/* die einheit runner nimmt von der einheit u soviel sie kann {
* in die nächste region mit. hier geschieht allerdings nur /* TODO: Vernünftig fixen */
* der transfer, nicht die eigentliche flucht */ runner->items = NULL;
int money = get_money(u) * runner->number / (u->number + runner->number); assert(runner->items == NULL);
runner->items = fig->run.items;
money = min(money, runner->number * (PERSONCAPACITY(u) - race[u->race].weight) / SILVERWEIGHT); fig->run.items = NULL;
set_money(runner, money);
change_money(u, -money);
if (effskill(runner, SK_RIDING) > 0) {
int horses = min(get_item(u, I_HORSE), runner->number);
change_item(runner, I_HORSE, horses);
change_item(u, I_HORSE, -horses);
}
} }
static boolean static boolean
@ -2164,7 +2131,7 @@ aftermath(battle * b)
} }
dead = du->number - df->alive; dead = du->number - df->alive;
dead -= df->run_number; dead -= df->run.number;
#ifdef TROLLSAVE #ifdef TROLLSAVE
/* Trolle können regenerieren */ /* Trolle können regenerieren */
if (df->alive > 0 && dead && du->race == RC_TROLL) if (df->alive > 0 && dead && du->race == RC_TROLL)
@ -2230,7 +2197,7 @@ aftermath(battle * b)
for_each(df, s->fighters) { for_each(df, s->fighters) {
unit *du = df->unit; unit *du = df->unit;
int dead = du->number - df->alive - df->run_number; int dead = du->number - df->alive - df->run.number;
int sum_hp = 0; int sum_hp = 0;
int n; int n;
@ -2246,20 +2213,20 @@ aftermath(battle * b)
} }
s->dead += dead; s->dead += dead;
s->flee += df->run_number; s->flee += df->run.number;
if (df->alive == du->number) continue; /* nichts passiert */ if (df->alive == du->number) continue; /* nichts passiert */
reportcasualties(b, df); reportcasualties(b, df);
scale_number(du, df->alive + df->run_number); scale_number(du, df->alive + df->run.number);
du->hp = sum_hp + df->run_hp; du->hp = sum_hp + df->run.hp;
/* die weggerannten werden später subtrahiert! */ /* die weggerannten werden später subtrahiert! */
assert(du->number >= 0); assert(du->number >= 0);
/* Report the casualties */ /* Report the casualties */
if (df->run_hp) { if (df->run.hp) {
/* Sonderbehandlung für sich auflösende Einheiten wie Wölfe, /* Sonderbehandlung für sich auflösende Einheiten wie Wölfe,
* diese fliehen nicht in eine Nachbarregion sondern kehren * diese fliehen nicht in eine Nachbarregion sondern kehren
* nach dem Kampf zu ihrer Einheit zurück */ * nach dem Kampf zu ihrer Einheit zurück */
@ -2270,14 +2237,15 @@ aftermath(battle * b)
continue; continue;
} }
if (df->alive == 0) { if (df->alive == 0) {
scale_number(du, df->run_number); scale_number(du, df->run.number);
du->hp = df->run_hp; du->hp = df->run.hp;
/* Distribute Loot */ /* Distribute Loot */
if (!fval(df, FIG_NOLOOT)) { if (!fval(df,FIG_NOLOOT)){
loot_fleeing(df, du);
loot_items(df); loot_items(df);
} }
} else { } else {
unit *nu = createunit(du->region, du->faction, df->run_number, du->race); unit *nu = createunit(du->region, du->faction, df->run.number, du->race);
skill_t sk; skill_t sk;
for (sk = 0; sk != MAXSKILLS; ++sk) { for (sk = 0; sk != MAXSKILLS; ++sk) {
@ -2300,7 +2268,7 @@ aftermath(battle * b)
nu->irace = du->irace; nu->irace = du->irace;
/* Fliehenden nehmen mit, was sie tragen können*/ /* Fliehenden nehmen mit, was sie tragen können*/
loot_fleeing(du, nu); loot_fleeing(df, nu);
set_string(&nu->lastorder, du->lastorder); set_string(&nu->lastorder, du->lastorder);
scale_number(du, df->alive); scale_number(du, df->alive);
@ -2308,24 +2276,22 @@ aftermath(battle * b)
du = nu; du = nu;
} }
set_string(&du->thisorder, ""); set_string(&du->thisorder, "");
du->hp = df->run_hp; du->hp = df->run.hp;
setguard(du, GUARD_NONE); setguard(du, GUARD_NONE);
fset(du, FL_MOVED); fset(du, FL_MOVED);
leave(du->region, du); leave(du->region, du);
if (df->run_to) travel(r, du, df->run_to, 1); if (df->run.region) travel(r, du, df->run.region, 1);
} }
else if (df->alive==0) { else if (df->alive==0) { /* alle sind tot, niemand geflohen. Einheit auflösen */
setguard(du, GUARD_NONE); setguard(du, GUARD_NONE);
scale_number(du, 0); scale_number(du, 0);
/* Distribute Loot */ /* Distribute Loot */
if (!fval(df, FIG_NOLOOT)) { loot_items(df);
loot_items(df);
}
} }
if (!nonplayer_race(du->race)) { if (!nonplayer_race(du->race)) {
/* tote im kampf werden zu regionsuntoten: /* tote im kampf werden zu regionsuntoten:
* for each o them, a peasant will die as well */ * for each of them, a peasant will die as well */
is += dead; is += dead;
} }
} next(df); } next(df);
@ -3237,6 +3203,50 @@ join_allies(battle * b)
} }
} }
extern struct item_type * i_silver;
void
flee(const troop dt)
{
fighter * fig = dt.fighter;
unit * u = fig->unit;
int carry = PERSONCAPACITY(u) - race[u->race].weight;
int money;
item ** ip = &u->items;
while (*ip) {
item * itm = *ip;
const item_type * itype = itm->type;
int keep = 0;
if (itype->capacity>0 || fval(itype, ITF_ANIMAL)) {
/* Regeländerung: Man muß das Tier nicht reiten können,
* um es vom Schlachtfeld mitzunehmen, ist ja nur
* eine Region weit. * */
keep = min(1, itm->number);
carry += itype->capacity; /* TODO: ist da das weight des tiers mit drin? */
} else if (itm->type->weight <= 0) {
/* if it doesn't weigh anything, it won't slow us down */
keep = itm->number;
}
if (itm->number==keep && keep>0) {
i_add(&fig->run.items, i_remove(ip, itm));
}
if (*ip==itm) ip = &itm->next;
}
/* we will take money with us */
money = get_money(u);
if (money > carry) money = carry;
i_change(&u->items, i_silver, -money);
i_change(&fig->run.items, i_silver, +money);
fig->run.hp += fig->person[dt.index].hp;
++fig->run.number;
remove_troop(dt);
}
void void
do_battle(void) do_battle(void)
{ {
@ -3257,7 +3267,7 @@ do_battle(void)
} }
#endif #endif
/* list_foreach geht nicht, wegen flee() */ /* list_foreach geht nicht, wegen flucht */
for (u = r->units; u != NULL; u = u->next) { for (u = r->units; u != NULL; u = u->next) {
if (fval(u, FL_LONGACTION)) continue; if (fval(u, FL_LONGACTION)) continue;
if (u->number > 0) { if (u->number > 0) {
@ -3474,8 +3484,8 @@ do_battle(void)
if (is_undead(u) || u->race == RC_SHADOWKNIGHT) continue; if (is_undead(u) || u->race == RC_SHADOWKNIGHT) continue;
if (u->ship) continue; if (u->ship) continue;
dt.fighter = fig; dt.fighter = fig;
if (!fig->run_to) fig->run_to = fleeregion(u); if (!fig->run.region) fig->run.region = fleeregion(u);
r = fig->run_to; r = fig->run.region;
if (!r) if (!r)
continue; continue;
dt.index = fig->alive - fig->removed; dt.index = fig->alive - fig->removed;
@ -3501,9 +3511,7 @@ do_battle(void)
} }
if (chance(min(fleechance(u)+ispaniced, 0.90))) { if (chance(min(fleechance(u)+ispaniced, 0.90))) {
++runners; ++runners;
fig->run_hp += fig->person[dt.index].hp; flee(dt);
++fig->run_number;
remove_troop(dt);
if (b->small) { if (b->small) {
sprintf(smallbuf, "%s/%d gelingt es, vom Schlachtfeld zu entkommen.", sprintf(smallbuf, "%s/%d gelingt es, vom Schlachtfeld zu entkommen.",
unitname(fig->unit), dt.index); unitname(fig->unit), dt.index);

View File

@ -169,9 +169,12 @@ typedef struct fighter {
struct weapon * secondary; /* defensive weapon */ struct weapon * secondary; /* defensive weapon */
} * person; } * person;
int flags; int flags;
int run_number; /* number of people who have flown */ struct {
int run_hp; /* accumulated hp of fleeing people */ int number; /* number of people who have flown */
struct region *run_to; /* destination of fleeing people */ int hp; /* accumulated hp of fleeing people */
struct region *region; /* destination of fleeing people */
struct item * items; /* items they take */
} run;
int action_counter; /* number of active actions the struct unit did in the fight */ int action_counter; /* number of active actions the struct unit did in the fight */
#ifdef SHOW_KILLS #ifdef SHOW_KILLS
int kills; int kills;
@ -230,5 +233,6 @@ extern struct region * fleeregion(const struct unit * u);
extern boolean enemy (const struct side * a, const struct side * b); extern boolean enemy (const struct side * a, const struct side * b);
extern struct troop select_corpse(struct battle * b, struct fighter * af); extern struct troop select_corpse(struct battle * b, struct fighter * af);
extern fighter * make_fighter(struct battle * b, struct unit * u, boolean attack); extern fighter * make_fighter(struct battle * b, struct unit * u, boolean attack);
void flee(const troop dt);
#endif #endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: build.c,v 1.8 2001/02/18 10:06:09 enno Exp $ * $Id: build.c,v 1.9 2001/03/04 18:41:25 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)
@ -388,19 +388,19 @@ build_road(region * r, unit * u, int size, direction_t d)
if (rterrain(r) == T_SWAMP) if (rterrain(r) == T_SWAMP)
/* wenn kein Damm existiert */ /* wenn kein Damm existiert */
if (!gebaeude_vorhanden(r, &bt_dam)) { if (!buildingtype_exists(r, &bt_dam)) {
cmistake(u, findorder(u, u->thisorder), 132, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 132, MSG_PRODUCE);
return; return;
} }
if (rterrain(r) == T_DESERT) if (rterrain(r) == T_DESERT)
/* wenn keine Karawanserei existiert */ /* wenn keine Karawanserei existiert */
if (!gebaeude_vorhanden(r, &bt_caravan)) { if (!buildingtype_exists(r, &bt_caravan)) {
cmistake(u, findorder(u, u->thisorder), 133, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 133, MSG_PRODUCE);
return; return;
} }
if (rterrain(r) == T_GLACIER) if (rterrain(r) == T_GLACIER)
/* wenn kein Tunnel existiert */ /* wenn kein Tunnel existiert */
if (!gebaeude_vorhanden(r, &bt_tunnel)) { if (!buildingtype_exists(r, &bt_tunnel)) {
cmistake(u, findorder(u, u->thisorder), 131, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 131, MSG_PRODUCE);
return; return;
} }
@ -689,7 +689,7 @@ build_building(unit * u, const building_type * btype, int want)
if (!b && u->building && u->building->type==btype) b = u->building; if (!b && u->building && u->building->type==btype) b = u->building;
if (b) btype = b->type; if (b) btype = b->type;
if (fval(btype, BTF_UNIQUE) && gebaeude_vorhanden(r, btype) != (unit *) NULL) { if (fval(btype, BTF_UNIQUE) && buildingtype_exists(r, btype)) {
/* only one of these per region */ /* only one of these per region */
cmistake(u, findorder(u, u->thisorder), 93, MSG_PRODUCE); cmistake(u, findorder(u, u->thisorder), 93, MSG_PRODUCE);
return; return;

View File

@ -1153,6 +1153,9 @@ sp_reeling_arrows(fighter * fi, int level, int force, spell * sp)
int int
sp_denyattack(fighter * fi, int level, int power, spell * sp) sp_denyattack(fighter * fi, int level, int power, spell * sp)
{ {
/* Magier weicht dem Kampf aus. Wenn er sich bewegen kann, zieht er in
* eine Nachbarregion, wobei ein NACH berücksichtigt wird. Ansonsten
* bleibt er stehen und nimmt nicht weiter am Kampf teil. */
side *sf = fi->side; side *sf = fi->side;
battle *b = fi->side->battle; battle *b = fi->side->battle;
unit *mage = fi->unit; unit *mage = fi->unit;
@ -1173,26 +1176,26 @@ sp_denyattack(fighter * fi, int level, int power, spell * sp)
if (igetkeyword(mage->thisorder) == K_MOVE if (igetkeyword(mage->thisorder) == K_MOVE
|| igetkeyword(mage->thisorder) == K_ROUTE) || igetkeyword(mage->thisorder) == K_ROUTE)
{ {
fi->run_to = movewhere(r, mage); fi->run.region = movewhere(r, mage);
if (!fi->run_to) { if (!fi->run.region) {
cmistake(mage, findorder(mage, mage->thisorder), 71, MSG_MOVE); cmistake(mage, findorder(mage, mage->thisorder), 71, MSG_MOVE);
fi->run_to = fleeregion(mage); fi->run.region = fleeregion(mage);
} }
} else { } else {
fi->run_to = fleeregion(mage); fi->run.region = fleeregion(mage);
} }
travel(r, mage, fi->run_to, 1); travel(r, mage, fi->run.region, 1);
/* wir tun so, als wäre die Person geflohen */ /* wir tun so, als wäre die Person geflohen */
fi->run_hp = mage->hp; /* Magier sind immer Einzelpersonen */
fi->run_number = mage->number;
fi->alive = 0;
fset(fi, FIG_NOLOOT); fset(fi, FIG_NOLOOT);
fi->run.hp = mage->hp;
fi->run.number = mage->number;
fi->alive = 0;
sf->size[SUM_ROW] -= mage->number; sf->size[SUM_ROW] -= mage->number;
sf->size[mage->status + FIGHT_ROW] -= mage->number; sf->size[mage->status + FIGHT_ROW] -= mage->number;
scat("Das Kampfgetümmel erstirbt und der Magier kann unbehelligt " scat("Das Kampfgetümmel erstirbt und er kann unbehelligt "
"seines Wege ziehen."); "seines Weges ziehen.");
battlerecord(b, buf); battlerecord(b, buf);
return level; return level;
} }
@ -1529,11 +1532,11 @@ sp_undeadhero(fighter * fi, int level, int force, spell * sp)
if (nonplayer(du)) if (nonplayer(du))
continue; continue;
if (df->alive + df->run_number < du->number) { if (df->alive + df->run.number < du->number) {
j = 0; j = 0;
/* Wieviele Untote können wir aus dieser Einheit wecken? */ /* Wieviele Untote können wir aus dieser Einheit wecken? */
for (n = df->alive + df->run_number; n <= du->number; n++) { for (n = df->alive + df->run.number; n <= du->number; n++) {
if (!k) break; if (!k) break;
if (chance(c)) { if (chance(c)) {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: item.c,v 1.13 2001/02/18 08:37:57 enno Exp $ * $Id: item.c,v 1.14 2001/03/04 18:41:25 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)
@ -1348,8 +1348,8 @@ init_olditems(void)
if (!strcmp(translation[ci][0], itemdata[i].name[0])) { if (!strcmp(translation[ci][0], itemdata[i].name[0])) {
name[0] = translation[ci][1]; name[0] = translation[ci][1];
name[1] = translation[ci][2]; name[1] = translation[ci][2];
appearance[0] = translation[ci][2]; appearance[0] = translation[ci][3];
appearance[1] = translation[ci][3]; appearance[1] = translation[ci][4];
} }
} }
} }
@ -1978,7 +1978,6 @@ init_resources(void)
} }
int int
get_money(const unit * u) get_money(const unit * u)
{ {
const item * i = u->items; const item * i = u->items;
@ -1987,7 +1986,8 @@ get_money(const unit * u)
return i->number; return i->number;
} }
int set_money(unit * u, int v) int
set_money(unit * u, int v)
{ {
item ** ip = &u->items; item ** ip = &u->items;
while (*ip && (*ip)->type!=i_silver) ip = &(*ip)->next; while (*ip && (*ip)->type!=i_silver) ip = &(*ip)->next;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: movement.c,v 1.14 2001/02/19 16:45:23 katze Exp $ * $Id: movement.c,v 1.15 2001/03/04 18:41:25 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)
@ -1240,7 +1240,7 @@ ship_ready(region * r, unit * u)
} }
unit * unit *
gebaeude_vorhanden(const region * r, const building_type * bt) owner_buildingtyp(const region * r, const building_type * bt)
{ {
building *b; building *b;
unit *owner; unit *owner;
@ -1257,6 +1257,38 @@ gebaeude_vorhanden(const region * r, const building_type * bt)
return NULL; return NULL;
} }
boolean
buildingtype_exists(const region * r, const building_type * bt)
{
building *b;
for (b = rbuildings(r); b; b = b->next) {
if (b->type == bt) {
if (b->size >= bt->maxsize) {
return true;
}
}
}
return false;
}
boolean
check_working_buildingtype(const region * r, const building_type * bt)
{
building *b;
for (b = rbuildings(r); b; b = b->next) {
if (b->type == bt) {
if (b->size >= bt->maxsize && fval(b, BLD_WORKING)) {
return true;
}
}
}
return false;
}
/* Prüft, ob Ablegen von einer Küste in eine der erlaubten Richtungen erfolgt. */ /* Prüft, ob Ablegen von einer Küste in eine der erlaubten Richtungen erfolgt. */
boolean boolean
@ -1273,7 +1305,7 @@ check_takeoff(ship *sh, region *from, region *to)
coastl = (direction_t)((coast+MAXDIRECTIONS-1) % MAXDIRECTIONS); coastl = (direction_t)((coast+MAXDIRECTIONS-1) % MAXDIRECTIONS);
if(dir != coast && dir != coastl && dir != coastr if(dir != coast && dir != coastl && dir != coastr
&& gebaeude_vorhanden(from, &bt_harbour) == NULL) && check_working_buildingtype(from, &bt_harbour) == false)
{ {
return false; return false;
} }
@ -1282,10 +1314,11 @@ check_takeoff(ship *sh, region *from, region *to)
return true; return true;
} }
boolean ship_allowed(const struct ship_type * type, region * r) boolean
ship_allowed(const struct ship_type * type, region * r)
{ {
int c = 0; int c = 0;
if (gebaeude_vorhanden(r, &bt_harbour)) return true; if (check_working_buildingtype(r, &bt_harbour)) return true;
for (c=0;type->coast[c]!=NOTERRAIN;++c) { for (c=0;type->coast[c]!=NOTERRAIN;++c) {
if (type->coast[c]==rterrain(r)) return true; if (type->coast[c]==rterrain(r)) return true;
} }
@ -1549,7 +1582,7 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan
/* Hafengebühren ? */ /* Hafengebühren ? */
hafenmeister = gebaeude_vorhanden(current_point, &bt_harbour); hafenmeister = owner_buildingtyp(current_point, &bt_harbour);
if (sh && hafenmeister != NULL) { if (sh && hafenmeister != NULL) {
item * itm; item * itm;
assert(trans==NULL); assert(trans==NULL);
@ -2000,7 +2033,6 @@ movement(void)
move(r, u, true); move(r, u, true);
set_string(&u->thisorder, ""); set_string(&u->thisorder, "");
up = &r->units; up = &r->units;
/* if (u==*up) up = &u->next; Blödsinn */
} }
break; break;
default: default:

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: movement.h,v 1.3 2001/02/18 10:06:09 enno Exp $ * $Id: movement.h,v 1.4 2001/03/04 18:41:25 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)
@ -62,5 +62,6 @@ extern attrib_type at_piracy_direction;
void follow(void); void follow(void);
struct building_type; struct building_type;
struct unit *gebaeude_vorhanden(const struct region * r, const struct building_type * bt); boolean buildingtype_exists(const struct region * r, const struct building_type * bt);
struct unit* owner_buildingtyp(const struct region * r, const struct building_type * bt);
#endif #endif

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: save.c,v 1.23 2001/02/25 19:31:39 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)
@ -462,7 +461,7 @@ readfaction(void)
f->lastorders = turn; f->lastorders = turn;
} else } else
printf(" WARNUNG: Befehle für die ungültige Partei Nr. %s;", fid); log_warning(("Befehle für die ungültige Partei %s\n", fid));
return f; return f;
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: spell.c,v 1.12 2001/02/18 10:06:09 enno Exp $ * $Id: spell.c,v 1.13 2001/03/04 18:41:25 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)
@ -3070,7 +3070,7 @@ sp_unholypower(castorder *co)
for (i = 0; i < pa->length && n > 0; i++) { for (i = 0; i < pa->length && n > 0; i++) {
race_t target_race; race_t target_race;
unit *u = pa->param[n]->data.u; unit *u = pa->param[i]->data.u;
switch(u->race) { switch(u->race) {
case RC_SKELETON: case RC_SKELETON:

View File

@ -1,6 +1,5 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: korrektur.c,v 1.29 2001/02/25 19:31:39 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)
@ -1056,7 +1055,6 @@ show_newspells(void)
} }
} }
} }
updatespelllist(u);
} }
} }
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: main.c,v 1.18 2001/02/18 10:06:10 enno Exp $ * $Id: main.c,v 1.19 2001/03/04 18:41:27 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)
@ -88,6 +88,7 @@ extern boolean nomer;
extern boolean nomsg; extern boolean nomsg;
extern boolean nobattle; extern boolean nobattle;
extern boolean nobattledebug; extern boolean nobattledebug;
static boolean printpotions;
#ifdef FUZZY_BASE36 #ifdef FUZZY_BASE36
extern int fuzzy_hits; extern int fuzzy_hits;
@ -102,7 +103,6 @@ struct settings global = {
extern void render_init(void); extern void render_init(void);
#if 0
static void static void
print_potions(FILE * F) print_potions(FILE * F)
{ {
@ -116,7 +116,6 @@ print_potions(FILE * F)
} }
} }
} }
#endif
static char * orders = NULL; static char * orders = NULL;
static int nowrite = 0; static int nowrite = 0;
@ -148,8 +147,11 @@ game_init(void)
abort(); abort();
} }
#endif #endif
/* print_potions(stdout); if (printpotions) {
exit(0); */ FILE * F = fopen("recipes.txt", "w");
print_potions(F);
fclose(F);
}
} }
void void
@ -436,6 +438,7 @@ usage(const char * prog, const char * arg)
"-r resdir : gibt das resourceverzeichnis an\n" "-r resdir : gibt das resourceverzeichnis an\n"
"-t turn : read this datafile, not the most current one\n" "-t turn : read this datafile, not the most current one\n"
"-o reportdir : gibt das reportverzeichnis an\n" "-o reportdir : gibt das reportverzeichnis an\n"
"-l logfile : specify an alternative logfile\n"
"--nomsg : keine Messages (RAM sparen)\n" "--nomsg : keine Messages (RAM sparen)\n"
"--nobattle : keine Kämpfe\n" "--nobattle : keine Kämpfe\n"
"--nodebug : keine Logfiles für Kämpfe\n" "--nodebug : keine Logfiles für Kämpfe\n"
@ -475,6 +478,9 @@ read_args(int argc, char **argv)
case 'o': case 'o':
g_reportdir = argv[++i]; g_reportdir = argv[++i];
break; break;
case 'D': /* DEBUG */
printpotions = true;
break;
case 'd': case 'd':
g_datadir = argv[++i]; g_datadir = argv[++i];
break; break;

View File

@ -28,7 +28,7 @@ forest_trail;de;der Wald von %s
swamp_trail;de;der Sumpf von %s swamp_trail;de;der Sumpf von %s
desert_trail;de;die Wüste von %s desert_trail;de;die Wüste von %s
highland_trail;de;das Hochland von %s highland_trail;de;das Hochland von %s
mountain_trail;de;die Berge von %s mountain_trail;de;das Bergland von %s
glacier_trail;de;der Gletscher von %s glacier_trail;de;der Gletscher von %s
firewall_trail;de;eine %s firewall_trail;de;eine %s
grassland_trail;de;die Steppe von %s grassland_trail;de;die Steppe von %s
@ -357,3 +357,4 @@ p14s;de;Heiltr
# Spezialitems # Spezialitems
lmsreward;de;Gürtel der Heldentaten lmsreward;de;Gürtel der Heldentaten
lmsrewards;de;Gürtel der Heldentaten