diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 745aa1a66..4f5dc1e7f 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -67,7 +66,7 @@ #include #include -#define C_REPORT_VERSION 55 +#define C_REPORT_VERSION 56 #define NEWBLOCKS (C_REPORT_VERSION>=35) #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); } + } 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; } @@ -470,10 +476,6 @@ cr_output_unit(FILE * F, region * r, else if (i<0) fprintf(F, "%d;alias\n", -i); i = get_money(u); -#ifdef OLD_SILBER - if (i) - fprintf(F, "%d;Silber\n", i); -#endif if (u->status) fprintf(F, "%d;Kampfstatus\n", u->status); 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 */ pr = 0; if (f == u->faction || u->faction->race==RC_ILLUSION) { diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index e4ba50256..181bd2785 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.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) { maxeffsize = buildingeffsize(maxb, false); @@ -2000,7 +1999,7 @@ expandselling(region * r, request * sellorders) * multiplier speichert r->demand für die debug message ab. */ 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; } /* 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(); if (findparam(s) == P_ANY) { 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; } else n = atoi(s); diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index d8bb7f7ad..f03d72bc7 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -235,7 +234,10 @@ get_food(region *r) { 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) { int need = lifestyle(u); @@ -247,7 +249,7 @@ get_food(region *r) unit *v; 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); give = max(0, 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) { int need = lifestyle(u); - /* Negative Silberbeträge kommen vor (Bug), deshalb geht - * need -= u->money nicht. */ need -= max(0, get_money(u)); @@ -273,7 +274,7 @@ get_food(region *r) for (v = r->units; need && v; v = v->next) if (v->faction != u->faction && allied(v, u->faction, HELP_MONEY) - && !is_monstrous(u)) { + && !is_monstrous(v)) { int give = lifestyle(v); give = max(0, get_money(v) - give); give = min(need, give); @@ -747,7 +748,7 @@ demographics(void) if (r->land) for (dmd=r->land->demands;dmd;dmd=dmd->next) { if (dmd->value>0 && dmd->value < MAXDEMAND) { 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++; } } @@ -756,7 +757,7 @@ demographics(void) for (n = 0; n != MAXLUXURIES; n++) { int d = rdemand(r, n); if (d > 0 && d < MAXDEMAND) { - if (gebaeude_vorhanden(r, &bt_harbour)) { + if (buildingtype_exists(r, &bt_harbour)) { if (rand() % 100 < DMRISEHAFEN) { d++; } @@ -2901,6 +2902,27 @@ defaultorders (void) void write_skillfix(void); #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 processorders (void) { @@ -3065,6 +3087,9 @@ processorders (void) #ifdef SKILLFIX_SAVE write_skillfix(); #endif + /* immer ausführen, wenn neue Sprüche dazugekommen sind, oder sich + * Beschreibungen geändert haben */ + update_spells(); } int diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index aad6bbc04..77cc04c00 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -1206,7 +1205,7 @@ statistics(FILE * F, region * r, faction * f) p / RECRUITFRACTION); rps(F, buf); - if (gebaeude_vorhanden(r, &bt_caravan)) { + if (buildingtype_exists(r, &bt_caravan)) { sprintf(buf, "Luxusgüter zum angegebenen Preis: %d", (p * 2) / TRADE_FRACTION); } else { diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 23fccaef8..1505be3ed 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.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) { /* Geflohene haben auch 0 hp, dürfen hier aber nicht ausgewählt * 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 (af && !helping(af->side, df->side)) @@ -533,7 +532,7 @@ reportcasualties(battle * b, fighter * fig) for (bf = b->factions;bf;bf=bf->next) { faction * f = bf->faction; 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); } } @@ -825,19 +824,19 @@ remove_troop(troop dt) if (!df->alive) { switch (du->race) { case RC_FIREDRAGON: - change_item(du, I_DRACHENBLUT, du->number-df->run_number); + change_item(du, I_DRACHENBLUT, du->number-df->run.number); break; case RC_DRAGON: - 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_DRACHENBLUT, (du->number-df->run.number) * 4); + change_item(du, I_DRAGONHEAD, du->number-df->run.number); break; case RC_WYRM: - 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_DRACHENBLUT, (du->number-df->run.number) * 10); + change_item(du, I_DRAGONHEAD, du->number-df->run.number); break; case RC_SEASERPENT: - 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_DRACHENBLUT, (du->number-df->run.number) * 6); + change_item(du, I_SEASERPENTHEAD, du->number-df->run.number); break; } @@ -2050,78 +2049,46 @@ loot_items(fighter * corpse) u->items = NULL; while (itm) { - const item_type * itype = itm->type; int i; - int keep, give; - if (corpse->run_number) { - /* es gibt flüchtlinge */ - 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(corpse->run_number, itm->number); - } else if (itm->type->weight <= 0) { - /* if it doesn't weigh anything, it won't slow us down */ - keep = min(corpse->run_number, itm->number); - } - else keep = 0; - give = itm->number-keep; - } - else { - keep = 0; - give = itm->number; - } - if (give) for (i = 10; i != 0; i--) { - int loot = give / i; - give -= loot; - /* Looten tun hier immer nur die Gegner. Das - * 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; + if (itm->number) { + for (i = 10; i != 0; i--) { + int loot = itm->number / i; + itm->number -= loot; + /* Looten tun hier immer nur die Gegner. Das + * 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; } - l->number += loot; } } } - if (keep) { - item * i = i_remove(&itm, itm); - i->number = keep; - i_add(&u->items, i); - } else { - i_free(i_remove(&itm, itm)); - } + itm = itm->next; } } -void -loot_fleeing(unit* u, unit* runner) { - /* die einheit runner nimmt von der einheit u soviel sie kann - * in die nächste region mit. hier geschieht allerdings nur - * der transfer, nicht die eigentliche flucht */ - int money = get_money(u) * runner->number / (u->number + runner->number); - - money = min(money, runner->number * (PERSONCAPACITY(u) - race[u->race].weight) / SILVERWEIGHT); - 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 void +loot_fleeing(fighter* fig, unit* runner) +{ + /* TODO: Vernünftig fixen */ + runner->items = NULL; + assert(runner->items == NULL); + runner->items = fig->run.items; + fig->run.items = NULL; } static boolean @@ -2164,7 +2131,7 @@ aftermath(battle * b) } dead = du->number - df->alive; - dead -= df->run_number; + dead -= df->run.number; #ifdef TROLLSAVE /* Trolle können regenerieren */ if (df->alive > 0 && dead && du->race == RC_TROLL) @@ -2230,7 +2197,7 @@ aftermath(battle * b) for_each(df, s->fighters) { 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 n; @@ -2246,20 +2213,20 @@ aftermath(battle * b) } s->dead += dead; - s->flee += df->run_number; + s->flee += df->run.number; if (df->alive == du->number) continue; /* nichts passiert */ reportcasualties(b, df); - scale_number(du, df->alive + df->run_number); - du->hp = sum_hp + df->run_hp; + scale_number(du, df->alive + df->run.number); + du->hp = sum_hp + df->run.hp; /* die weggerannten werden später subtrahiert! */ assert(du->number >= 0); /* Report the casualties */ - if (df->run_hp) { + if (df->run.hp) { /* Sonderbehandlung für sich auflösende Einheiten wie Wölfe, * diese fliehen nicht in eine Nachbarregion sondern kehren * nach dem Kampf zu ihrer Einheit zurück */ @@ -2270,14 +2237,15 @@ aftermath(battle * b) continue; } if (df->alive == 0) { - scale_number(du, df->run_number); - du->hp = df->run_hp; + scale_number(du, df->run.number); + du->hp = df->run.hp; /* Distribute Loot */ - if (!fval(df, FIG_NOLOOT)) { + if (!fval(df,FIG_NOLOOT)){ + loot_fleeing(df, du); loot_items(df); } } 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; for (sk = 0; sk != MAXSKILLS; ++sk) { @@ -2300,7 +2268,7 @@ aftermath(battle * b) nu->irace = du->irace; /* Fliehenden nehmen mit, was sie tragen können*/ - loot_fleeing(du, nu); + loot_fleeing(df, nu); set_string(&nu->lastorder, du->lastorder); scale_number(du, df->alive); @@ -2308,24 +2276,22 @@ aftermath(battle * b) du = nu; } set_string(&du->thisorder, ""); - du->hp = df->run_hp; + du->hp = df->run.hp; setguard(du, GUARD_NONE); fset(du, FL_MOVED); 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); scale_number(du, 0); /* Distribute Loot */ - if (!fval(df, FIG_NOLOOT)) { - loot_items(df); - } + loot_items(df); } if (!nonplayer_race(du->race)) { /* 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; } } 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 do_battle(void) { @@ -3257,7 +3267,7 @@ do_battle(void) } #endif - /* list_foreach geht nicht, wegen flee() */ + /* list_foreach geht nicht, wegen flucht */ for (u = r->units; u != NULL; u = u->next) { if (fval(u, FL_LONGACTION)) continue; if (u->number > 0) { @@ -3474,8 +3484,8 @@ do_battle(void) if (is_undead(u) || u->race == RC_SHADOWKNIGHT) continue; if (u->ship) continue; dt.fighter = fig; - if (!fig->run_to) fig->run_to = fleeregion(u); - r = fig->run_to; + if (!fig->run.region) fig->run.region = fleeregion(u); + r = fig->run.region; if (!r) continue; dt.index = fig->alive - fig->removed; @@ -3501,9 +3511,7 @@ do_battle(void) } if (chance(min(fleechance(u)+ispaniced, 0.90))) { ++runners; - fig->run_hp += fig->person[dt.index].hp; - ++fig->run_number; - remove_troop(dt); + flee(dt); if (b->small) { sprintf(smallbuf, "%s/%d gelingt es, vom Schlachtfeld zu entkommen.", unitname(fig->unit), dt.index); diff --git a/src/common/kernel/battle.h b/src/common/kernel/battle.h index 3328f6ff7..fb9848207 100644 --- a/src/common/kernel/battle.h +++ b/src/common/kernel/battle.h @@ -169,9 +169,12 @@ typedef struct fighter { struct weapon * secondary; /* defensive weapon */ } * person; int flags; - int run_number; /* number of people who have flown */ - int run_hp; /* accumulated hp of fleeing people */ - struct region *run_to; /* destination of fleeing people */ + struct { + int number; /* number of people who have flown */ + 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 */ #ifdef SHOW_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 struct troop select_corpse(struct battle * b, struct fighter * af); extern fighter * make_fighter(struct battle * b, struct unit * u, boolean attack); +void flee(const troop dt); #endif diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index 967237c24..a7479c879 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.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) /* 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); return; } if (rterrain(r) == T_DESERT) /* 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); return; } if (rterrain(r) == T_GLACIER) /* 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); 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) 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 */ cmistake(u, findorder(u, u->thisorder), 93, MSG_PRODUCE); return; diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index ac444681c..d6a3cd430 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -1153,6 +1153,9 @@ sp_reeling_arrows(fighter * fi, int level, int force, spell * sp) int 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; battle *b = fi->side->battle; unit *mage = fi->unit; @@ -1173,26 +1176,26 @@ sp_denyattack(fighter * fi, int level, int power, spell * sp) if (igetkeyword(mage->thisorder) == K_MOVE || igetkeyword(mage->thisorder) == K_ROUTE) { - fi->run_to = movewhere(r, mage); - if (!fi->run_to) { + fi->run.region = movewhere(r, mage); + if (!fi->run.region) { cmistake(mage, findorder(mage, mage->thisorder), 71, MSG_MOVE); - fi->run_to = fleeregion(mage); + fi->run.region = fleeregion(mage); } } 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 */ - fi->run_hp = mage->hp; /* Magier sind immer Einzelpersonen */ - fi->run_number = mage->number; - fi->alive = 0; 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[mage->status + FIGHT_ROW] -= mage->number; - scat("Das Kampfgetümmel erstirbt und der Magier kann unbehelligt " - "seines Wege ziehen."); + scat("Das Kampfgetümmel erstirbt und er kann unbehelligt " + "seines Weges ziehen."); battlerecord(b, buf); return level; } @@ -1529,11 +1532,11 @@ sp_undeadhero(fighter * fi, int level, int force, spell * sp) if (nonplayer(du)) continue; - if (df->alive + df->run_number < du->number) { + if (df->alive + df->run.number < du->number) { j = 0; /* 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 (chance(c)) { diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 57ea6dd79..56e2e2535 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.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])) { name[0] = translation[ci][1]; name[1] = translation[ci][2]; - appearance[0] = translation[ci][2]; - appearance[1] = translation[ci][3]; + appearance[0] = translation[ci][3]; + appearance[1] = translation[ci][4]; } } } @@ -1978,7 +1978,6 @@ init_resources(void) } int - get_money(const unit * u) { const item * i = u->items; @@ -1987,7 +1986,8 @@ get_money(const unit * u) return i->number; } -int set_money(unit * u, int v) +int +set_money(unit * u, int v) { item ** ip = &u->items; while (*ip && (*ip)->type!=i_silver) ip = &(*ip)->next; diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 7f7ef3528..becb9e174 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -1240,7 +1240,7 @@ ship_ready(region * r, unit * u) } unit * -gebaeude_vorhanden(const region * r, const building_type * bt) +owner_buildingtyp(const region * r, const building_type * bt) { building *b; unit *owner; @@ -1257,6 +1257,38 @@ gebaeude_vorhanden(const region * r, const building_type * bt) 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. */ boolean @@ -1273,7 +1305,7 @@ check_takeoff(ship *sh, region *from, region *to) coastl = (direction_t)((coast+MAXDIRECTIONS-1) % MAXDIRECTIONS); if(dir != coast && dir != coastl && dir != coastr - && gebaeude_vorhanden(from, &bt_harbour) == NULL) + && check_working_buildingtype(from, &bt_harbour) == false) { return false; } @@ -1282,10 +1314,11 @@ check_takeoff(ship *sh, region *from, region *to) 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; - 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) { 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 ? */ - hafenmeister = gebaeude_vorhanden(current_point, &bt_harbour); + hafenmeister = owner_buildingtyp(current_point, &bt_harbour); if (sh && hafenmeister != NULL) { item * itm; assert(trans==NULL); @@ -2000,7 +2033,6 @@ movement(void) move(r, u, true); set_string(&u->thisorder, ""); up = &r->units; - /* if (u==*up) up = &u->next; Blödsinn */ } break; default: diff --git a/src/common/kernel/movement.h b/src/common/kernel/movement.h index e19689d96..aa42f5d15 100644 --- a/src/common/kernel/movement.h +++ b/src/common/kernel/movement.h @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -62,5 +62,6 @@ extern attrib_type at_piracy_direction; void follow(void); 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 diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index d73baa64f..fde3a072a 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -462,7 +461,7 @@ readfaction(void) f->lastorders = turn; } 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; } diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index b20b9d96d..880ed5c13 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.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++) { race_t target_race; - unit *u = pa->param[n]->data.u; + unit *u = pa->param[i]->data.u; switch(u->race) { case RC_SKELETON: diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index b41e2021e..2bea9a290 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -1,6 +1,5 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -1056,7 +1055,6 @@ show_newspells(void) } } } - updatespelllist(u); } } } diff --git a/src/eressea/main.c b/src/eressea/main.c index d6f72937b..61deb172e 100644 --- a/src/eressea/main.c +++ b/src/eressea/main.c @@ -1,6 +1,6 @@ /* 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 * Christian Schlittchen (corwin@amber.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de) @@ -88,6 +88,7 @@ extern boolean nomer; extern boolean nomsg; extern boolean nobattle; extern boolean nobattledebug; +static boolean printpotions; #ifdef FUZZY_BASE36 extern int fuzzy_hits; @@ -102,7 +103,6 @@ struct settings global = { extern void render_init(void); -#if 0 static void print_potions(FILE * F) { @@ -116,7 +116,6 @@ print_potions(FILE * F) } } } -#endif static char * orders = NULL; static int nowrite = 0; @@ -148,8 +147,11 @@ game_init(void) abort(); } #endif -/* print_potions(stdout); - exit(0); */ + if (printpotions) { + FILE * F = fopen("recipes.txt", "w"); + print_potions(F); + fclose(F); + } } void @@ -436,6 +438,7 @@ usage(const char * prog, const char * arg) "-r resdir : gibt das resourceverzeichnis an\n" "-t turn : read this datafile, not the most current one\n" "-o reportdir : gibt das reportverzeichnis an\n" + "-l logfile : specify an alternative logfile\n" "--nomsg : keine Messages (RAM sparen)\n" "--nobattle : keine Kämpfe\n" "--nodebug : keine Logfiles für Kämpfe\n" @@ -475,6 +478,9 @@ read_args(int argc, char **argv) case 'o': g_reportdir = argv[++i]; break; + case 'D': /* DEBUG */ + printpotions = true; + break; case 'd': g_datadir = argv[++i]; break; diff --git a/src/res/de/strings.txt b/src/res/de/strings.txt index 68a70e65a..b68212b2c 100644 --- a/src/res/de/strings.txt +++ b/src/res/de/strings.txt @@ -28,7 +28,7 @@ forest_trail;de;der Wald von %s swamp_trail;de;der Sumpf von %s desert_trail;de;die Wüste 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 firewall_trail;de;eine %s grassland_trail;de;die Steppe von %s @@ -357,3 +357,4 @@ p14s;de;Heiltr # Spezialitems lmsreward;de;Gürtel der Heldentaten +lmsrewards;de;Gürtel der Heldentaten