From 567117932c28332393b61df6436e779e28070973 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 9 Feb 2004 21:12:46 +0000 Subject: [PATCH] =?UTF-8?q?Bugfix=20Wolfsgeheul=20und=20sonstige=20Spr?= =?UTF-8?q?=C3=BCche=20(Hamo's=20Tod)=20Behebung=20der=20restlichen=20doub?= =?UTF-8?q?le->int=20conversion=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/laws.c | 7 - src/common/gamecode/monster.c | 6 +- src/common/gamecode/study.c | 11 - src/common/kernel/battle.c | 61 +- src/common/kernel/battle.h | 2 +- src/common/kernel/combatspells.c | 6 +- src/common/kernel/eressea.c | 8 + src/common/kernel/eressea.h | 3 +- src/common/kernel/item.c | 3 +- src/common/kernel/magic.c | 2 +- src/common/kernel/magic.h | 22 +- src/common/kernel/save.c | 4 - src/common/kernel/spell.c | 351 +++++----- src/common/modules/modules.vcproj | 2 +- src/common/triggers/createcurse.c | 10 +- src/common/triggers/createcurse.h | 2 +- src/eressea/korrektur.c | 1004 ----------------------------- 17 files changed, 228 insertions(+), 1276 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 975e03cb1..fbf78906b 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3436,10 +3436,6 @@ defaultorders (void) list_next(r); } -#ifdef SKILLFIX_SAVE -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 */ @@ -3675,9 +3671,6 @@ processorders (void) puts(" - Attribute altern"); ageing(); -#ifdef SKILLFIX_SAVE - write_skillfix(); -#endif /* immer ausführen, wenn neue Sprüche dazugekommen sind, oder sich * Beschreibungen geändert haben */ update_spells(); diff --git a/src/common/gamecode/monster.c b/src/common/gamecode/monster.c index b7624ea1f..a91668fdf 100644 --- a/src/common/gamecode/monster.c +++ b/src/common/gamecode/monster.c @@ -654,7 +654,7 @@ eaten_by_monster(unit * u) n = lovar(n); n = min(rpeasants(u->region), n); - if(n > 0) { + if (n > 0) { deathcounts(u->region, n); rsetpeasants(u->region, rpeasants(u->region) - n); add_message(&u->region->msgs, new_message(NULL, @@ -982,11 +982,7 @@ plan_monsters(void) } else a_remove(&u->attribs, ta); } -#ifdef CONVERT_TRIGGER - ta = set_new_dragon_target(u, r, DRAGON_RANGE); -#else ta = a_find(u->attribs, &at_targetregion); -#endif if (ta!=NULL) { tr = (region *) ta->data.v; if (tr != r) is_moving = true; diff --git a/src/common/gamecode/study.c b/src/common/gamecode/study.c index 8721da8cc..8693ec2ad 100644 --- a/src/common/gamecode/study.c +++ b/src/common/gamecode/study.c @@ -434,10 +434,6 @@ teach(region * r, unit * u) } /* ------------------------------------------------------------- */ -#ifdef SKILLFIX_SAVE -extern void skillfix(struct unit *, skill_t, int, int, int); -#endif - void learn(void) { @@ -668,13 +664,6 @@ learn(void) if (is_cursed(r->attribs,C_BADLEARN,0)) { teach->value -= u->number * 10; } -#ifdef SKILLFIX_SAVE - if (teach && teach->value) { - int skill = get_skill(u, sk); - skillfix(u, sk, skill, - (int)(u->number * 30 * multi), teach->value); - } -#endif days = (int)((u->number * 30 + teach->value) * multi); if (fval(u, UFL_HUNGER)) days = days / 2; diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index a16d7c30e..3eb194aeb 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1297,15 +1297,6 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) return true; } -int -lovar(int n) -{ - assert(n > 0); - if (n == 1) return rand()%2; - n /= 2; - return (rand() % n + 1) + (rand() % n + 1); -} - /* ------------------------------------------------------------- */ int count_enemies(battle * b, side * as, int mask, int minrow, int maxrow) @@ -1446,7 +1437,7 @@ do_combatmagic(battle *b, combatmagic_t was) region *r = b->region; castorder *co; castorder *cll[MAX_SPELLRANK]; - int level, power; + int level; int spellrank; int sl; @@ -1464,6 +1455,7 @@ do_combatmagic(battle *b, combatmagic_t was) level = eff_skill(mage, SK_MAGIC, r); if (level > 0) { + double power; const struct locale * lang = mage->faction->locale; char cmd[128]; @@ -1520,10 +1512,10 @@ do_combatmagic(battle *b, combatmagic_t was) } for (spellrank = 0; spellrank < MAX_SPELLRANK; spellrank++) { for (co = cll[spellrank]; co; co = co->next) { - fig = (fighter*)co->magician; - sp = co->sp; - level = co->level; - power = co->force; + fighter * fig = (fighter*)co->magician; + spell * sp = co->sp; + int level = co->level; + double power = co->force; level = ((cspell_f)sp->sp_function)(fig, level, power, sp); if (level > 0) { @@ -1548,7 +1540,8 @@ do_combatspell(troop at, int row) unit *mage = fi->unit; battle *b = fi->side->battle; region *r = b->region; - int level, power; + int level; + double power; int fumblechance = 0; void **mg; int sl; @@ -2747,7 +2740,7 @@ weapon_weight(const weapon * w, boolean missile) } fighter * -make_fighter(battle * b, unit * u, boolean attack) +make_fighter(battle * b, unit * u, side * s1, boolean attack) { #define WMAX 16 weapon weapons[WMAX]; @@ -2758,7 +2751,7 @@ make_fighter(battle * b, unit * u, boolean attack) item * itm; fighter *fig = NULL; int i, t = eff_skill(u, SK_TACTICS, r); - side *s2, *s1 = NULL; + side *s2; int h; int berserk; int strongmen; @@ -2775,22 +2768,24 @@ make_fighter(battle * b, unit * u, boolean attack) if (fval(u->race, RCF_ILLUSIONARY) || idle(u->faction)) return NULL; - cv_foreach(s2, b->sides) { - if (s2->bf->faction == u->faction - && s2->stealth==stealth - && s2->stealthfaction == stealthfaction - ) { - if (s2->group==g) { - s1 = s2; - break; - } - } - } cv_next(s2); + if (s1==NULL) { + cv_foreach(s2, b->sides) { + if (s2->bf->faction == u->faction + && s2->stealth==stealth + && s2->stealthfaction == stealthfaction + ) { + if (s2->group==g) { + s1 = s2; + break; + } + } + } cv_next(s2); - /* aliances are moved out of make_fighter and will be handled later */ - if (!s1) s1 = make_side(b, u->faction, g, stealth, stealthfaction); - /* Zu diesem Zeitpunkt ist attacked noch 0, da die Einheit für noch - * keinen Kampf ausgewählt wurde (sonst würde ein fighter existieren) */ + /* aliances are moved out of make_fighter and will be handled later */ + if (!s1) s1 = make_side(b, u->faction, g, stealth, stealthfaction); + /* Zu diesem Zeitpunkt ist attacked noch 0, da die Einheit für noch + * keinen Kampf ausgewählt wurde (sonst würde ein fighter existieren) */ + } fig = calloc(1, sizeof(struct fighter)); cv_pushback(&s1->fighters, fig); @@ -3043,7 +3038,7 @@ join_battle(battle * b, unit * u, boolean attack) } } cv_next(fig); - if (!c) c = make_fighter(b, u, attack); + if (!c) c = make_fighter(b, u, NULL, attack); return c; } static const char * diff --git a/src/common/kernel/battle.h b/src/common/kernel/battle.h index 0043c1020..02b543f96 100644 --- a/src/common/kernel/battle.h +++ b/src/common/kernel/battle.h @@ -227,7 +227,7 @@ extern boolean helping(struct side * as, struct side * ds); extern void rmfighter(fighter *df, int i); extern struct region * fleeregion(const struct unit * u); 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, side * s, boolean attack); extern int statusrow(int status); extern void drain_exp(struct unit *u, int d); extern void rmtroop(troop dt); diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index 456555d45..523a31bf9 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -796,7 +796,7 @@ sp_shadowcall(fighter * fi, int level, int power, spell * sp) a->data.ca[1] = 100; a_add(&u->attribs, a); - make_fighter(b, u, true); + make_fighter(b, u, fi->side, fval(fi, FIG_ATTACKED)); sprintf(buf, "%s ruft %d %s zu Hilfe", unitname(mage), force, racename(default_locale, u, u->race)); battlerecord(b, buf); @@ -829,7 +829,7 @@ sp_wolfhowl(fighter * fi, int level, int power, spell * sp) a->data.ca[1] = 100; a_add(&u->attribs, a); - make_fighter(b, u, true); + make_fighter(b, u, fi->side, fval(fi, FIG_ATTACKED)); sprintf(buf, "%s ruft %d %s zu Hilfe", unitname(mage), force, racename(default_locale, u, u->race)); battlerecord(b, buf); @@ -863,7 +863,7 @@ sp_shadowknights(fighter * fi, int level, int power, spell * sp) a->data.ca[1] = 100; a_add(&u->attribs, a); - make_fighter(b, u, true); + make_fighter(b, u, fi->side, fval(fi, FIG_ATTACKED)); sprintf(buf, "%s beschwört Trugbilder herauf", unitname(mage)); battlerecord(b, buf); diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index c1ab09cd3..c0294d303 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2949,6 +2949,14 @@ produceexp(struct unit * u, skill_t sk, int n) return 0; } +int +lovar(double xpct_x2) +{ + int n = (int)(xpct_x2 * 500)+1; + if (n==0) return 0; + return (rand() % n + rand() % n)/1000; +} + boolean teure_talente (const struct unit * u) { diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 5b4b90ba4..1ee08a391 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -977,7 +977,8 @@ boolean cansee_durchgezogen(const struct faction * f, const struct region * r, c boolean seefaction(const struct faction * f, const struct region * r, const struct unit * u, int modifier); extern int effskill(const struct unit * u, skill_t sk); -int lovar(int n); +extern int lovar(double xpct_x2); + /* returns a value between [0..xpct_2], generated with two dice */ int distribute(int old, int new_value, int n); diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index 4fc6b3c6c..abf81d716 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -812,7 +812,8 @@ use_antimagiccrystal(region * r, unit * mage, int amount, strlist * cmdstrings) { int i; for (i=0;i!=amount;++i) { - int effect, force, duration = 2; + int effect, duration = 2; + double force; spell *sp = find_spellbyid(SPL_ANTIMAGICZONE); attrib ** ap = &r->attribs; unused(cmdstrings); diff --git a/src/common/kernel/magic.c b/src/common/kernel/magic.c index 791473f3f..7b1f6ad95 100644 --- a/src/common/kernel/magic.c +++ b/src/common/kernel/magic.c @@ -2361,7 +2361,7 @@ add_spellparameter(region *target_r, unit *u, const char *syntax, castorder * new_castorder(void *u, unit *u2, spell *sp, region *r, int lev, - int force, int range, char *cmd, spellparameter *p) + double force, int range, char *cmd, spellparameter *p) { castorder *corder; diff --git a/src/common/kernel/magic.h b/src/common/kernel/magic.h index 4e2794e9b..c7f61b21b 100644 --- a/src/common/kernel/magic.h +++ b/src/common/kernel/magic.h @@ -168,15 +168,15 @@ typedef struct spell { struct castorder { castorder *next; - void *magician; /* Magier (kann vom Typ struct unit oder fighter sein) */ - struct unit *familiar; /* Vertrauter, gesetzt, wenn der Spruch durch - den Vertrauten gezaubert wird */ - struct spell *sp; /* Spruch */ - int level; /* gewünschte Stufe oder Stufe des Magiers */ - float force; /* Stärke des Zaubers */ - struct region *rt; /* Zielregion des Spruchs */ - int distance; /* Entfernung zur Zielregion */ - char *order; /* Befehl */ + void *magician; /* Magier (kann vom Typ struct unit oder fighter sein) */ + struct unit *familiar; /* Vertrauter, gesetzt, wenn der Spruch durch + den Vertrauten gezaubert wird */ + struct spell *sp; /* Spruch */ + int level; /* gewünschte Stufe oder Stufe des Magiers */ + double force; /* Stärke des Zaubers */ + struct region *rt; /* Zielregion des Spruchs */ + int distance; /* Entfernung zur Zielregion */ + char *order; /* Befehl */ struct spellparameter *par; /* für weitere Parameter */ }; @@ -187,7 +187,7 @@ typedef void (*spell_f) (void*); /* normale zauber: */ typedef int (*nspell_f)(castorder*); /* kampfzauber: */ -typedef int (*cspell_f) (struct fighter*, int, int, struct spell * sp); +typedef int (*cspell_f) (struct fighter*, int, double, struct spell * sp); /* zauber-patzer: */ typedef void (*pspell_f) (castorder *); @@ -335,7 +335,7 @@ boolean fumble (struct region *r, struct unit *u, spell *spruch, int cast_level) /* */ castorder *new_castorder(void *u, struct unit *familiar, spell *sp, struct region *r, - int lev, int force, int distance, char *cmd, spellparameter *p); + int lev, double force, int distance, char *cmd, spellparameter *p); /* Zwischenspreicher für Zauberbefehle, notwendig für Prioritäten */ void add_castorder(castorder **cll, castorder *co); /* Hänge c-order co an die letze c-order von cll an */ diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index ad9a186c2..053344465 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -882,11 +882,7 @@ readgame(const char * filename, int backup) global.data_version = ri(F); assert(global.data_version>=MIN_VERSION || !"unsupported data format"); assert(global.data_version<=RELEASE_VERSION || !"unsupported data format"); -#ifdef CONVERT_TRIGGER - assert(global.data_version < NEWSOURCE_VERSION); -#else assert(global.data_version >= NEWSOURCE_VERSION); -#endif if(global.data_version >= SAVEXMLNAME_VERSION) { char basefile[1024]; const char *basearg = "(null)"; diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index f7acfa437..b44e6b2e1 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -161,35 +161,34 @@ do_shock(unit *u, const char *reason) /* Spruchanalyse - Ausgabe von curse->info und curse->name */ /* ------------------------------------------------------------- */ -static int -curse_chance(const struct curse * c, int force) +static double +curse_chance(const struct curse * c, double force) { - return 100 + (int)((force - c->vigour)*10); + return 1.0 + (force - c->vigour) * 0.1; } -void -magicanalyse_region(region *r, unit *mage, int force) +static void +magicanalyse_region(region *r, unit *mage, double force) { attrib *a; boolean found = false; const struct locale * lang = mage->faction->locale; for (a=r->attribs;a;a=a->next) { - curse * c; - int chance; + curse * c = (curse*)a->data.v; + double probability; int mon; - if (!fval(a->type, ATF_CURSE)) continue; - c = (curse*)a->data.v; + if (!fval(a->type, ATF_CURSE)) continue; /* ist der curse schwächer als der Analysezauber, so ergibt sich - * mehr als 100% chance und damit immer ein Erfolg. */ - chance = curse_chance(c, force); + * mehr als 100% probability und damit immer ein Erfolg. */ + probability = curse_chance(c, force); mon = c->duration + (rand()%10) - 5; - mon = max(1,mon); + mon = max(1, mon); found = true; - if(rand()%100 < chance){ /* Analyse geglückt */ + if (chance(probability)) { /* Analyse geglückt */ if(c->flag & CURSE_NOAGE) { add_message(&mage->faction->msgs, new_message(mage->faction, "analyse_region_noage%u:mage%r:region%s:spell", @@ -210,8 +209,8 @@ magicanalyse_region(region *r, unit *mage, int force) } } -void -magicanalyse_unit(unit *u, unit *mage, int force) +static void +magicanalyse_unit(unit *u, unit *mage, double force) { attrib *a; boolean found = false; @@ -219,18 +218,18 @@ magicanalyse_unit(unit *u, unit *mage, int force) for (a=u->attribs;a;a=a->next) { curse * c; - int chance; + double probability; int mon; if (!fval(a->type, ATF_CURSE)) continue; c = (curse*)a->data.v; /* ist der curse schwächer als der Analysezauber, so ergibt sich - * mehr als 100% chance und damit immer ein Erfolg. */ - chance = curse_chance(c, force); + * mehr als 100% probability und damit immer ein Erfolg. */ + probability = curse_chance(c, force); mon = c->duration + (rand()%10) - 5; mon = max(1,mon); - if(rand()%100 < chance){ /* Analyse geglückt */ + if (chance(probability)) { /* Analyse geglückt */ if(c->flag & CURSE_NOAGE){ add_message(&mage->faction->msgs, new_message(mage->faction, "analyse_unit_noage%u:mage%u:unit%s:spell", @@ -251,8 +250,8 @@ magicanalyse_unit(unit *u, unit *mage, int force) } } -void -magicanalyse_building(building *b, unit *mage, int force) +static void +magicanalyse_building(building *b, unit *mage, double force) { attrib *a; boolean found = false; @@ -260,18 +259,19 @@ magicanalyse_building(building *b, unit *mage, int force) for (a=b->attribs;a;a=a->next) { curse * c; - int chance; + double probability; int mon; - if (!fval(a->type, ATF_CURSE)) continue; + + if (!fval(a->type, ATF_CURSE)) continue; c = (curse*)a->data.v; /* ist der curse schwächer als der Analysezauber, so ergibt sich - * mehr als 100% chance und damit immer ein Erfolg. */ - chance = curse_chance(c, force); + * mehr als 100% probability und damit immer ein Erfolg. */ + probability = curse_chance(c, force); mon = c->duration + (rand()%10) - 5; mon = max(1,mon); - if(rand()%100 < chance){ /* Analyse geglückt */ + if (chance(probability)) { /* Analyse geglückt */ if(c->flag & CURSE_NOAGE){ add_message(&mage->faction->msgs, new_message(mage->faction, "analyse_building_age%u:mage%b:building%s:spell", @@ -293,8 +293,8 @@ magicanalyse_building(building *b, unit *mage, int force) } -void -magicanalyse_ship(ship *sh, unit *mage, int force) +static void +magicanalyse_ship(ship *sh, unit *mage, double force) { attrib *a; boolean found = false; @@ -302,18 +302,18 @@ magicanalyse_ship(ship *sh, unit *mage, int force) for (a=sh->attribs;a;a=a->next) { curse * c; - int chance; + double probability; int mon; if (!fval(a->type, ATF_CURSE)) continue; c = (curse*)a->data.v; /* ist der curse schwächer als der Analysezauber, so ergibt sich - * mehr als 100% chance und damit immer ein Erfolg. */ - chance = curse_chance(c, force); + * mehr als 100% probability und damit immer ein Erfolg. */ + probability = curse_chance(c, force); mon = c->duration + (rand()%10) - 5; mon = max(1,mon); - if(rand()%100 < chance){ /* Analyse geglückt */ + if (chance(probability)) { /* Analyse geglückt */ if(c->flag & CURSE_NOAGE){ add_message(&mage->faction->msgs, new_message(mage->faction, "analyse_ship_noage%u:mage%h:ship%s:spell", @@ -351,10 +351,9 @@ double destr_curse(curse* c, int cast_level, double force) { if (cast_level < c->vigour) { /* Zauber ist nicht stark genug */ - double chance; + double probability = 0.1 + (cast_level - c->vigour)*0.2; /* pro Stufe Unterschied -20% */ - chance = 0.1 + (cast_level - c->vigour)*0.2; - if (rand()%100 >= chance*100) { + if (chance(probability)) { force -= c->vigour; if (c->type->change_vigour){ c->type->change_vigour(c, -(cast_level+1/2)); @@ -2232,7 +2231,7 @@ sp_fog_of_confusion(castorder *co) regionlist *rl,*rl2; range = (power-11)/3-1; - duration = ((power-11)/3)*2+1; + duration = (int)((power-11)/1.5)+1; rl = all_in_range(r, (int)range); @@ -2341,21 +2340,18 @@ sp_stormwinds(castorder *co) faction *f; ship *sh; unit *u; - int n, force; int erfolg = 0; region *r = co->rt; unit *mage = (unit *)co->magician; double power = co->force; spellparameter *pa = co->par; - - force = power; + int n, force = (int)power; /* melden vorbereiten */ for(f = factions; f; f = f->next ) freset(f, FL_DH); for (n = 0; n < pa->length; n++) { - if (!force) - break; + if (force<=0) break; if(pa->param[n]->flag == TARGET_RESISTS || pa->param[n]->flag == TARGET_NOTFOUND) @@ -2552,35 +2548,32 @@ sp_forest_fire(castorder *co) { unit *u; region *nr; - int prozent, chance, vernichtet; -#if GROWING_TREES - int vernichtet_schoesslinge; -#endif direction_t i; region *r = co->rt; unit *mage = (unit *)co->magician; int cast_level = co->level; + double probability; + double percentage = (rand() % 8 + 1) * 0.1; /* 10 - 80% */ - prozent = (rand() % 71) + 10; /* 10 - 80% */ #if GROWING_TREES - vernichtet = rtrees(r,2) * prozent / 100; - vernichtet_schoesslinge = rtrees(r,1) * prozent / 100; + int vernichtet_schoesslinge = (int)(rtrees(r, 1) * percentage); + int destroyed = (int)(rtrees(r, 2) * percentage); #else - vernichtet = rtrees(r) * prozent / 100; + int destroyed = (int)(rtrees(r) * percentage); #endif - if(!vernichtet ) { + if (destroyed<1) { cmistake(mage, strdup(co->order), 198, MSG_MAGIC); return 0; } #if GROWING_TREES - rsettrees(r, 2, rtrees(r,2) - vernichtet); + rsettrees(r, 2, rtrees(r,2) - destroyed); rsettrees(r, 1, rtrees(r,1) - vernichtet_schoesslinge); #else - rsettrees(r, rtrees(r) - vernichtet); + rsettrees(r, rtrees(r) - destroyed); #endif - chance = vernichtet / 10; /* Chance, dass es sich ausbreitet */ + probability = destroyed * 0.001; /* Chance, dass es sich ausbreitet */ /* melden, 1x pro Partei */ for (u = r->units; u; u = u->next) freset(u->faction, FL_DH); @@ -2591,20 +2584,20 @@ sp_forest_fire(castorder *co) sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s " "den Flammen zum Opfer.", cansee(u->faction, r, mage, 0) ? unitname(mage) : "Jemand", - vernichtet, - vernichtet == 1 ? "Baum fiel" : "Bäume fielen"); + destroyed, + destroyed == 1 ? "Baum fiel" : "Bäume fielen"); addmessage(r, u->faction, buf, MSG_EVENT, ML_INFO); } } if(!fval(mage->faction, FL_DH)){ #if GROWING_TREES sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s " - "den Flammen zum Opfer.", unitname(mage), vernichtet+vernichtet_schoesslinge, - vernichtet+vernichtet_schoesslinge == 1 ? "Baum fiel" : "Bäume fielen"); + "den Flammen zum Opfer.", unitname(mage), destroyed+vernichtet_schoesslinge, + destroyed+vernichtet_schoesslinge == 1 ? "Baum fiel" : "Bäume fielen"); #else sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s " - "den Flammen zum Opfer.", unitname(mage), vernichtet, - vernichtet == 1 ? "Baum fiel" : "Bäume fielen"); + "den Flammen zum Opfer.", unitname(mage), destroyed, + destroyed == 1 ? "Baum fiel" : "Bäume fielen"); #endif addmessage(0, mage->faction, buf, MSG_MAGIC, ML_INFO); } @@ -2612,28 +2605,28 @@ sp_forest_fire(castorder *co) for(i = 0; i < MAXDIRECTIONS; i++ ) { nr = rconnect(r, i); assert(nr); - vernichtet = 0; + destroyed = 0; #if GROWING_TREES if(rtrees(nr,2) + rtrees(nr,1) >= 800) { - if((rand() % 100) < chance ) { - vernichtet = rtrees(nr,2) * prozent / 200; - vernichtet_schoesslinge = rtrees(nr,1) * prozent / 200; + if (chance(probability)) { + destroyed = (int)(rtrees(nr,2) * percentage/2); + vernichtet_schoesslinge = (int)(rtrees(nr,1) * percentage/2); } - } else if(rtrees(nr,2) + rtrees(nr,1) >= 600) { - if((rand() % 100) < chance / 2 ) { - vernichtet = rtrees(nr,2) * prozent / 400; - vernichtet_schoesslinge = rtrees(nr,1) * prozent / 400; + } else if (rtrees(nr,2) + rtrees(nr,1) >= 600) { + if (chance(probability/2)) { + destroyed = (int)(rtrees(nr,2) * percentage/4); + vernichtet_schoesslinge = (int)(rtrees(nr,1) * percentage/4); } } - if(vernichtet > 0 || vernichtet_schoesslinge > 0) { - rsettrees(nr, 2, rtrees(nr,2) - vernichtet); + if (destroyed > 0 || vernichtet_schoesslinge > 0) { + rsettrees(nr, 2, rtrees(nr,2) - destroyed); rsettrees(nr, 1, rtrees(nr,1) - vernichtet_schoesslinge); sprintf(buf, "Der Waldbrand in %s griff auch auf %s " "über und %d %s.", - regionid(r), regionid(nr), vernichtet+vernichtet_schoesslinge, - vernichtet+vernichtet_schoesslinge == 1 ? "Baum verbrannte" : "Bäume verbrannten"); + regionid(r), regionid(nr), destroyed+vernichtet_schoesslinge, + destroyed+vernichtet_schoesslinge == 1 ? "Baum verbrannte" : "Bäume verbrannten"); for (u = nr->units; u; u = u->next) freset(u->faction, FL_DH); for(u = nr->units; u; u = u->next ) { if(!fval(u->faction, FL_DH) ) { @@ -2646,18 +2639,18 @@ sp_forest_fire(castorder *co) } } #else - if(rtrees(nr) >= 800) { - if((rand() % 100) < chance ) vernichtet = rtrees(nr) * prozent / 200; - } else if(rtrees(nr) >= 600) { - if((rand() % 100) < chance / 2 ) vernichtet = rtrees(nr) * prozent / 400; + if (rtrees(nr) >= 800) { + if (chance(probability)) destroyed = (int)(rtrees(nr) * percentage/2); + } else if (rtrees(nr) >= 600) { + if(chance(probability/2)) destroyed = (int)(rtrees(nr) * percentage/4); } - if(vernichtet > 0 ) { - rsettrees(nr, rtrees(nr) - vernichtet); + if (destroyed > 0 ) { + rsettrees(nr, rtrees(nr) - destroyed); sprintf(buf, "Der Waldbrand in %s griff auch auf %s " "über und %d %s.", - regionid(r), regionid(nr), vernichtet, - vernichtet == 1 ? "Baum verbrannte" : "Bäume verbrannten"); + regionid(r), regionid(nr), destroyed, + destroyed == 1 ? "Baum verbrannte" : "Bäume verbrannten"); for (u = nr->units; u; u = u->next) freset(u->faction, FL_DH); for(u = nr->units; u; u = u->next ) { if(!fval(u->faction, FL_DH) ) { @@ -2698,10 +2691,10 @@ sp_fumblecurse(castorder *co) unit *target; int rx, sx; int duration; - int effect; unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; + int effect = (int)(force/2); curse * c; spellparameter *pa = co->par; @@ -2714,8 +2707,6 @@ sp_fumblecurse(castorder *co) sx = cast_level - effskill(target, SK_MAGIC); duration = max(sx, rx) + 1; - effect = force/2; - c = create_curse(mage, &target->attribs, ct_find("fumble"), force, duration, effect, 0); if (c == NULL) { @@ -2736,12 +2727,10 @@ patzer_fumblecurse(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int effect; + int effect = (int)(force/2); curse * c; int duration = (cast_level/2)+1; - effect = force/2; - c = create_curse(mage, &mage->attribs, ct_find("fumble"), force, duration, effect, 0); if (c!=NULL) { @@ -3079,12 +3068,12 @@ sp_firewall(castorder *co) if (b==NULL) { b = new_border(&bt_firewall, r, r2); fd = (wall_data*)b->data; - fd->force = (force+1)/2; + fd->force = (int)(force/2+0.5); fd->mage = mage; fd->active = false; } else { fd = (wall_data*)b->data; - fd->force = max(fd->force, (force+1)/2); + fd->force = (int)max(fd->force, force/2+0.5); } a = a_find(b->attribs, &at_countdown); @@ -3166,7 +3155,7 @@ sp_wisps(castorder *co) b = new_border(&bt_wisps, r, r2); fd = (wall_data*)b->data; - fd->force = (force+1)/2; + fd->force = (int)(force/2+0.5); fd->mage = mage; fd->active = false; @@ -3216,7 +3205,7 @@ sp_unholypower(castorder *co) int n; int wounds; - n = dice(co->force, 10); + n = dice((int)co->force, 10); for (i = 0; i < pa->length && n > 0; i++) { const race * target_race; @@ -3465,7 +3454,7 @@ sp_summonshadow(castorder *co) unit *u; int val; - u = createunit(r, mage->faction, force*force, new_race[RC_SHADOW]); + u = createunit(r, mage->faction, (int)(force*force), new_race[RC_SHADOW]); if (r==mage->region) { u->building = mage->building; u->ship = mage->ship; @@ -3512,7 +3501,7 @@ sp_summonshadowlords(castorder *co) int cast_level = co->level; double force = co->force; - u = createunit(r, mage->faction, force*force, new_race[RC_SHADOWLORD]); + u = createunit(r, mage->faction, (int)(force*force), new_race[RC_SHADOWLORD]); if (r==mage->region) { u->building = mage->building; u->ship = mage->ship; @@ -3673,14 +3662,14 @@ sp_bloodsacrifice(castorder *co) int cast_level = co->level; int aura; int skill = eff_skill(mage, SK_MAGIC, mage->region); - double hp = co->force*4; + int hp = (int)(co->force*8); - if (hp <= 0){ + if (hp <= 0) { report_failure(mage, co->order); return 0; } - aura = lovar(hp*2); + aura = lovar(hp); if (skill < 8) { aura /= 4; @@ -3729,7 +3718,7 @@ sp_summonundead(castorder *co) region *r = co->rt; unit *mage = (unit *)co->magician; int cast_level = co->level; - double force = co->force; + int force = (int)(co->force*10); const race * race = new_race[RC_SKELETON]; if (!r->land || deathcount(r) == 0) { @@ -3739,7 +3728,7 @@ sp_summonundead(castorder *co) return 0; } - undead = min(deathcount(r), 2 + lovar(force * 10)); + undead = min(deathcount(r), 2 + lovar(force)); if(cast_level <= 8) { race = new_race[RC_SKELETON]; @@ -3914,7 +3903,7 @@ sp_analysesong_obj(castorder *co) obj = pa->param[0]->typ; - switch(obj){ + switch(obj) { case SPP_REGION: magicanalyse_region(r, mage, force); break; @@ -4027,7 +4016,7 @@ sp_charmingsong(castorder *co) /* Magieresistensbonus für mehr als Stufe Personen */ if (target->number > force) { - resist_bonus += (target->number - force) * 10; + resist_bonus += (int)((target->number - force) * 10); } /* Magieresistensbonus für höhere Talentwerte */ for(i = 0; i < MAXSKILLS; i++){ @@ -4039,7 +4028,7 @@ sp_charmingsong(castorder *co) resist_bonus += tb * 15; } /* Magieresistenz */ - if (target_resists_magic(mage, target, TYP_UNIT, resist_bonus)){ + if (target_resists_magic(mage, target, TYP_UNIT, resist_bonus)) { report_failure(mage, co->order); sprintf(buf, "%s fühlt sich einen Moment lang benommen und desorientiert.", unitname(target)); @@ -4096,7 +4085,7 @@ sp_song_resistmagic(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int duration = force+1; + int duration = (int)force+1; create_curse(mage, &r->attribs, ct_find("goodmagicresistancezone"), force, duration, mr_bonus, 0); @@ -4127,7 +4116,7 @@ sp_song_susceptmagic(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int duration = force+1; + int duration = (int)force+1; create_curse(mage, &r->attribs, ct_find("badmagicresistancezone"), force, duration, mr_malus, 0); @@ -4227,7 +4216,7 @@ sp_raisepeasantmob(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int duration = force+1; + int duration = (int)force+1; anteil += rand()%4; @@ -4406,10 +4395,8 @@ sp_song_of_peace(castorder *co) int cast_level = co->level; double force = co->force; - if(force < 2) - duration = 0; - else - duration = lovar(force/2); + if (force < 2) duration = 0; + else duration = lovar(force/2); create_curse(mage,&r->attribs, ct_find("peacezone"), force, duration, 1,0); @@ -4450,7 +4437,7 @@ sp_generous(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int duration = force+1; + int duration = (int)force+1; if(is_cursed(r->attribs, C_DEPRESSION, 0)){ sprintf(buf, "%s in %s: Die Stimmung in %s ist so schlecht, das " @@ -4559,13 +4546,11 @@ sp_bigrecruit(castorder *co) } /* Für vergleichbare Erfolge bei unterschiedlichen Rassen die * Rekrutierungskosten mit einfliessen lassen. */ - n = (int)((force * force * 1000)/f->race->recruitcost); - /* Zufälliger Wert mit n/2 Maximum, mindestens aber force Anzahl */ - n = force+lovar(n); + n = (int)force + lovar((force * force * 1000)/f->race->recruitcost); /* natürlich nur maximal soviele Bauern, wie auch in der Region sind */ - n = min(rpeasants(r),n); + n = min(rpeasants(r), n); - if(n <= 0){ + if (n <= 0) { report_failure(mage, co->order); return 0; } @@ -4711,7 +4696,7 @@ sp_seduce(castorder *co) loot += rand() % 2; } if (loot > 0) { - loot = min(loot, force * 5); + loot = (int)min(loot, force * 5); scat(", "); icat(loot); scat(" "); @@ -4773,7 +4758,6 @@ sp_create_nimblefingerring(castorder *co) static int sp_calm_monster(castorder *co) { - int duration; curse * c; unit *target; region *r = co->rt; @@ -4783,8 +4767,6 @@ sp_calm_monster(castorder *co) double force = co->force; spell *sp = co->sp; - duration = force; - /* wenn kein Ziel gefunden, Zauber abbrechen */ if(pa->param[0]->flag == TARGET_NOTFOUND) return 0; @@ -4797,8 +4779,8 @@ sp_calm_monster(castorder *co) return 0; } - c = create_curse(mage, &target->attribs, ct_find("calmmonster"), force, duration, - (int)mage->faction, 0); + c = create_curse(mage, &target->attribs, ct_find("calmmonster"), force, + (int)force, (int)mage->faction, 0); if (c==NULL) { report_failure(mage, co->order); return 0; @@ -4899,7 +4881,7 @@ sp_raisepeasants(castorder *co) MSG_MAGIC, ML_MISTAKE); return 0; } - bauern = min(rpeasants(r),power*250); + bauern = (int)min(rpeasants(r), power*250); rsetpeasants(r, rpeasants(r) - bauern); u2 = create_unit(r,mage->faction, bauern, new_race[RC_PEASANT], 0,"Wilder Bauernmob",mage); @@ -4944,7 +4926,7 @@ sp_depression(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int duration = force+1; + int duration = (int)force+1; create_curse(mage,&r->attribs, ct_find("depression"), force, duration, 0, 0); @@ -5066,9 +5048,9 @@ sp_puttorest(castorder *co) { region *r = co->rt; unit *mage = (unit *)co->magician; - int laid_to_rest = 0; - laid_to_rest = dice(co->force * 2, 100); - laid_to_rest = max(laid_to_rest, deathcount(r)); + int dead = deathcount(r); + int laid_to_rest = dice((int)(co->force * 2), 100); + laid_to_rest = max(laid_to_rest, dead); deathcounts(r, -laid_to_rest); @@ -5191,7 +5173,7 @@ sp_illusionary_shapeshift(castorder *co) } { trigger * trestore = trigger_changerace(u, NULL, u->irace); - add_trigger(&u->attribs, "timer", trigger_timeout(power+2, trestore)); + add_trigger(&u->attribs, "timer", trigger_timeout((int)power+2, trestore)); } u->irace = rc; @@ -5328,7 +5310,7 @@ sp_baddreams(castorder *co) /* wirkt erst in der Folgerunde, soll mindestens eine Runde wirken, * also duration+2 */ - duration = max(1, power/2); /* Stufe 1 macht sonst mist */ + duration = (int)max(1, power/2); /* Stufe 1 macht sonst mist */ duration = 2 + rand()%duration; /* Nichts machen als ein entsprechendes Attribut in die Region legen. */ @@ -5367,7 +5349,7 @@ sp_gooddreams(castorder *co) /* wirkt erst in der Folgerunde, soll mindestens eine Runde wirken, * also duration+2 */ - duration = max(1, power/2); /* Stufe 1 macht sonst mist */ + duration = (int)max(1, power/2); /* Stufe 1 macht sonst mist */ duration = 2 + rand()%duration; c = create_curse(mage, &r->attribs, ct_find("gbdream"), power, duration, 1, 0); curse_setflag(c, CURSE_ISNEW); @@ -5482,8 +5464,8 @@ sp_sweetdreams(castorder *co) double power = co->force; spellparameter *pa = co->par; int men, n; - int duration = 1+(power/2); - int opfer = power*power; + int duration = (int)(power/2)+1; + int opfer = (int)(power*power); /* Schleife über alle angegebenen Einheiten */ for (n = 0; n < pa->length; n++) { @@ -5533,7 +5515,7 @@ sp_disturbingdreams(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double power = co->force; - int duration = 1 + (power/6); + int duration = 1 + (int)(power/6); curse * c = create_curse(mage, &r->attribs, ct_find("badlearn"), power, duration, 10, 0); curse_setflag(c, CURSE_ISNEW); @@ -5554,7 +5536,7 @@ sp_dream_of_confusion(castorder *co) int cast_level = co->level; double power = co->force; double range = (power-14)/2-1; - int duration = ((power-14)/2)*2+1; + int duration = (int)(power-14)+1; rl = all_in_range(r, (int)range); @@ -5665,7 +5647,7 @@ sp_itemcloak(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double power = co->force; - int duration = power+1; + int duration = (int)power+1; spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -5709,7 +5691,7 @@ sp_resist_magic_bonus(castorder *co) spellparameter *pa = co->par; /* Pro Stufe können bis zu 5 Personen verzaubert werden */ - opfer = power * 5; + opfer = (int)(power * 5); /* Schleife über alle angegebenen Einheiten */ for (n = 0; n < pa->length; n++) { @@ -5802,7 +5784,7 @@ sp_enterastral(castorder *co) return 0; } - remaining_cap = (power-3) * 1500; + remaining_cap = (int)((power-3) * 1500); /* für jede Einheit in der Kommandozeile */ for (n = 0; n < pa->length; n++) { @@ -5927,7 +5909,7 @@ sp_pullastral(castorder *co) return 0; } - remaining_cap = (power-3) * 1500; + remaining_cap = (int)((power-3) * 1500); /* für jede Einheit in der Kommandozeile */ for (n = 1; n < pa->length; n++) { @@ -6010,47 +5992,45 @@ sp_leaveastral(castorder *co) region *r = co->rt; unit *mage = (unit *)co->magician; int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; + double power = co->force; + spellparameter *pa = co->par; - switch(getplaneid(r)) { - case 1: - ro = r; - rt = pa->param[0]->data.r; - if(!rt) { - addmessage(r, mage->faction, "Dorthin führt kein Weg.", - MSG_MAGIC, ML_MISTAKE); - return 0; - } - rl = allinhab_in_range(r_astral_to_standard(r), TP_RADIUS); - rl2 = rl; - while(rl2) { - if(rl2->region == rt) break; - rl2 = rl2->next; - } - if(!rl2) { - addmessage(r, mage->faction, "Dorthin führt kein Weg.", - MSG_MAGIC, ML_MISTAKE); - free_regionlist(rl); - return 0; - } - free_regionlist(rl); - break; - default: - sprintf(buf, "Der Zauber funktioniert nur in der astralen Welt."); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); - return 0; - } + switch(getplaneid(r)) { + case 1: + ro = r; + rt = pa->param[0]->data.r; + if(!rt) { + addmessage(r, mage->faction, "Dorthin führt kein Weg.", + MSG_MAGIC, ML_MISTAKE); + return 0; + } + rl = allinhab_in_range(r_astral_to_standard(r), TP_RADIUS); + rl2 = rl; + while(rl2) { + if(rl2->region == rt) break; + rl2 = rl2->next; + } + if(!rl2) { + addmessage(r, mage->faction, "Dorthin führt kein Weg.", + MSG_MAGIC, ML_MISTAKE); + free_regionlist(rl); + return 0; + } + free_regionlist(rl); + break; + default: + sprintf(buf, "Der Zauber funktioniert nur in der astralen Welt."); + addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); + return 0; + } - if(!ro - || is_cursed(ro->attribs, C_ASTRALBLOCK, 0) - || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { - sprintf(buf, "Die Wege aus dieser astralen Region sind blockiert."); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); - return 0; - } - - remaining_cap = (power-3) * 1500; + if (ro==NULL || is_cursed(ro->attribs, C_ASTRALBLOCK, 0) || is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { + sprintf(buf, "Die Wege aus dieser astralen Region sind blockiert."); + addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); + return 0; + } + + remaining_cap = (int)((power-3) * 1500); /* für jede Einheit in der Kommandozeile */ for (n = 1; n < pa->length; n++) { @@ -6157,7 +6137,7 @@ sp_fetchastral(castorder *co) return 0; } - remaining_cap = (power-3) * 1500; + remaining_cap = (int)((power-3) * 1500); /* für jede Einheit in der Kommandozeile */ for (n = 0; n < pa->length; n++) { @@ -6379,7 +6359,7 @@ sp_disruptastral(castorder *co) unit *mage = (unit *)co->magician; int cast_level = co->level; double power = co->force; - int duration = (power/3)+1; + int duration = (int)(power/3)+1; switch(getplaneid(r)) { case 0: @@ -6399,7 +6379,7 @@ sp_disruptastral(castorder *co) return 0; } - rl = all_in_range(rt, power/5); + rl = all_in_range(rt, (int)(power/5)); for(rl2=rl; rl; rl=rl->next) { attrib *a, *a2; @@ -6848,13 +6828,13 @@ sp_create_antimagiccrystal(castorder *co) int sp_antimagiczone(castorder *co) { - int power; + double power; int effect; region *r = co->rt; unit *mage = (unit *)co->magician; int cast_level = co->level; double force = co->force; - int duration = force+1; + int duration = (int)force+1; /* Hält Sprüche bis zu einem summierten Gesamtlevel von power aus. * Jeder Zauber reduziert die 'Lebenskraft' (vigour) der Antimagiezone @@ -7111,7 +7091,6 @@ sp_destroy_curse(castorder *co) attrib **ap; int obj; curse * c; - int succ = 0; region *r = co->rt; unit *mage = (unit *)co->magician; int cast_level = co->level; @@ -7176,10 +7155,9 @@ sp_destroy_curse(castorder *co) } /* curse auflösen, wenn zauber stärker (force > vigour)*/ - succ = c->vigour - force; - c->vigour = max(0, succ); + c->vigour -= force; - if(succ <= 0) { + if (c->vigour <= 0.0) { remove_curse(ap, c); add_message(&mage->faction->msgs, new_message(mage->faction, @@ -7192,7 +7170,7 @@ sp_destroy_curse(castorder *co) mage, mage->region, strdup(co->order))); } } - if(ts != NULL) free(ts); + if (ts != NULL) free(ts); return cast_level; } @@ -7247,11 +7225,10 @@ sp_earn_silver(castorder *co) unit *mage = (unit *)co->magician; double force = co->force; region *r = co->rt; - int wanted, earned; + int wanted = (int)(force * 50); + int earned = min(rmoney(r), wanted); - wanted = force * 50; - earned = min(rmoney(r), wanted); - rsetmoney(r, rmoney(r) - earned); + rsetmoney(r, rmoney(r) - earned); change_money(mage, earned); /* TODO klären: ist das Silber damit schon reserviert? */ diff --git a/src/common/modules/modules.vcproj b/src/common/modules/modules.vcproj index ac0b7d0ce..19c596708 100644 --- a/src/common/modules/modules.vcproj +++ b/src/common/modules/modules.vcproj @@ -33,7 +33,7 @@ ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" WarningLevel="4" - SuppressStartupBanner="FALSE" + SuppressStartupBanner="TRUE" DebugInformationFormat="1" CompileAs="0"/> data.v; fprintf(F, "%s ", itoa36(td->mage->no)); fprintf(F, "%s ", itoa36(td->target->no)); - fprintf(F, "%s %d %d %d %d ", td->type->cname, td->vigour, td->duration, td->effect, td->men); + fprintf(F, "%s %lf %d %d %d ", td->type->cname, td->vigour, td->duration, td->effect, td->men); } static int @@ -103,11 +103,11 @@ createcurse_read(trigger * t, FILE * F) if (global.data_versionvigour, &td->duration, &td->effect, &td->men); + fscanf(F, "%d %d %lf %d %d %d ", &id1, &id2, &td->vigour, &td->duration, &td->effect, &td->men); assert(id2==0); td->type = ct_find(oldcursename(id1)); } else { - fscanf(F, "%s %d %d %d %d ", zText, &td->vigour, &td->duration, &td->effect, &td->men); + fscanf(F, "%s %lf %d %d %d ", zText, &td->vigour, &td->duration, &td->effect, &td->men); td->type = ct_find(zText); } return AT_READ_OK; @@ -124,7 +124,7 @@ trigger_type tt_createcurse = { trigger * trigger_createcurse(struct unit * mage, struct unit * target, - const curse_type * ct, int vigour, int duration, + const curse_type * ct, double vigour, int duration, int effect, int men) { trigger * t = t_new(&tt_createcurse); diff --git a/src/common/triggers/createcurse.h b/src/common/triggers/createcurse.h index 15ccafd91..518420672 100644 --- a/src/common/triggers/createcurse.h +++ b/src/common/triggers/createcurse.h @@ -28,7 +28,7 @@ struct unit; extern struct trigger_type tt_createcurse; -extern struct trigger * trigger_createcurse(struct unit * mage, struct unit * target, const struct curse_type * ct, int vigour, int duration, int effect, int men); +extern struct trigger * trigger_createcurse(struct unit * mage, struct unit * target, const struct curse_type * ct, double vigour, int duration, int effect, int men); #ifdef __cplusplus } diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 3eaa638b8..65ba9b113 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -87,27 +87,6 @@ extern void reorder_owners(struct region * r); -#if 0 -#define MAXALLIANCES 3 -static void -init_alliances(void) -{ - faction * f = factions; - alliance * aalliance[MAXALLIANCES]; - if (alliances==NULL) { - aalliance[0] = makealliance(atoi36("dark"), "Ritter der dunklen Sonne"); - aalliance[1] = makealliance(atoi36("deep"), "Monster aus der Tiefe"); - aalliance[2] = makealliance(atoi36("pope"), "Priester des Vatikan"); - } - while (f!=NULL) { - if (f->alliance==NULL && f->no!=MONSTER_FACTION) { - setalliance(f, aalliance[rand() % MAXALLIANCES]); - } - f=f->next; - } -} -#endif - static int curse_emptiness(void) { @@ -229,171 +208,6 @@ warn_items(void) return found; } -#ifdef XMAS1999 -#include "race.h" -#include "movement.h" - -static void -santa_comes_to_town(void) -{ - unit * santa = ufindhash(atoi36("xmas")); - unit * tans = ufindhash(atoi36("tans")); - faction * f; - region * r; - - if (!tans) r = findregion(0,0); - else r = tans->region; - if (!r) return; - - while (santa && santa->race!=RC_ILLUSION) { - uunhash(santa); - santa->no = newunitid(); - uhash(santa); - santa = ufindhash(atoi36("xmas")); - } - if (!santa) { - santa = createunit(r, findfaction(MONSTER_FACTION), 1, new_race[RC_ILLUSION]); - uunhash(santa); - santa->no = atoi36("xmas"); - uhash(santa); - } - santa->age = 2; - santa->irace = new_race[RC_DAEMON]; - 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"); - - for (f=factions;f;f=f->next) { - unit * u; - runit *ru; - region * r; - item_t i = (item_t) (rand() % 4 + I_KEKS); - unit * senior = f->units; - for (u = f->units; u; u=u->nextF) { - if (senior->age < u->age) senior = u; - } - if (!senior) continue; - r = senior->region; - sprintf(buf, "%s gibt %d %s an %s.", unitname(santa), 1, itemdata[i].name[0], unitname(senior)); - change_item(senior, i, 1); - addmessage(r, senior->faction, buf, MSG_COMMERCE, ML_INFO); - - sprintf(buf, "von %s: 'Ho ho ho. Frohe Weihnachten, und %s für %s.'", unitname(santa), itemdata[i].name[1], unitname(senior)); - addmessage(r, 0, buf, MSG_MESSAGE, ML_IMPORTANT); - - for (ru = r->durchgezogen; ru ; ru=ru->next) - if (ru->unit==santa) break; - if (!ru) { - ru = calloc(1, sizeof(runit)); - ru->next = r->durchgezogen; - ru->unit = santa; - r->durchgezogen = ru; - } - } -} -#endif - -#if 0 -static void -init_hp(void) -{ - region *r; - unit *u; - - for (r = regions; r; r = r->next) { - for (u = r->units; u; u = u->next) { - if (u->hp == -1) { - u->hp = unit_max_hp(u) * u->number; - } - } - } -} - -static void -convert(int x, int y, int *nx, int *ny) -{ - *ny = -y; - *nx = x + (y + ((y>=0)?1:0))/2; -} -#endif - -#if 0 -static void -loesche_coasts(void) -{ - region *r; - ship *sh; - - for(r=regions;r;r=r->next) { - for(sh=r->ships;sh;sh=sh->next) { - sh->coast = NODIRECTION; - } - } -} -#endif - -#if 0 -static void -create_underworld(void) - -{ - int x, y; - region *r; - attrib *a; - plane * hell = create_new_plane(-1, "Hölle", 100000, 100000, 100020, 100020, PFL_NONE); - - for(x=0;x<=20;x++) { - for(y=0;y<=20;y++) { - r = new_region(x+100000,y); - r->planep = hell; - if(x==0 || x == 20 || y == 0 || y == 20) { - rsetterrain(r, T_FIREWALL); - } else { - rsetterrain(r, T_HELL); - } - } - } - - /* Verbindungen schaffen */ - - a = create_special_direction(findregion(4,4),100005,5,-1, - "Ein dunkler Schlund fuehrt in die Tiefe der Erde", - "Schlund"); - - a = create_special_direction(findregion(100005,5),4,4,-1, - "Ein hell erleuchteter Tunnel fuehrt nach oben", - "Tunnel"); -} -#endif - -#if 0 -static void -bename_dracoide(void) -{ - region *r; - unit *u; - - for(r=regions;r;r=r->next) { - for(u=r->units;u;u=u->next) { - if(u->race == new_race[RC_DRACOID]) name_unit(u); - } - } -} -#endif - -static void -fix_migrants(void) { - region * r; - for (r=regions;r;r=r->next) { - unit * u; - for (u=r->units;u;u=u->next) { - if (u->race == new_race[RC_HUMAN]) u->irace = u->race; - if (u->irace!=u->race && (u->race->flags & RCF_SHAPESHIFT)==0) { - log_warning(("[fix_migrants] %s ist ein %s, als %s getarnt\n", unitname(u), LOC(default_locale, rc_name(u->race, 0)), LOC(default_locale, rc_name(u->irace, 0)))); - } - } - } -} - static boolean kor_teure_talente(unit *u) { @@ -434,144 +248,6 @@ no_teurefremde(boolean convert) } } -#if 0 -static void -give_arena_gates(void) -{ - faction * f; - for (f=factions;f;f=f->next) { - unit * u; - region * r; - unit * senior = f->units; - if (f->age>2) return; - for (u = f->units; u; u=u->nextF) { - if (senior->age < u->age) senior = u; - if (f->no==MONSTER_FACTION && get_item(u, I_ARENA_GATE)) return; - } - if (!senior) continue; - r = senior->region; - sprintf(buf, "Der Himmel über %s reißt auf und ein Licht aus den Wolken scheint auf %s. Ein Gesang wie von tausend Walküren ertönt, dazu Schlachtenlärm. Nach einer Weile endet die Vision, und %s hält ein %s in den Händen.", regionid(senior->region), unitname(senior), unitname(senior), itemdata[I_ARENA_GATE].name[0]); - change_item(senior, I_ARENA_GATE, 1); - addmessage(NULL, senior->faction, buf, MSG_MESSAGE, ML_IMPORTANT); - } -} - -static void -remove_impossible_dragontargets(void) -{ - region *r; - for (r=regions;r;r=r->next) { - unit *u; - for (u=r->units;u;u=u->next) { - attrib *a; - if(u->faction->no != MONSTER_FACTION) continue; - - a = a_find(u->attribs, &at_targetregion); - if (a!=NULL) { - boolean cango = false; - region * r2 = a->data.v; - if(r2!=NULL) { -#ifdef NEW_PATH - cango = path_exists(r, r2, DRAGON_RANGE, allowed_dragon); -#else - cango = path_exists(r, r2, FLY|DRAGON_LIMIT); -#endif - } - if(!cango) { - printf("Lösche Ziel von %s\n", unitname(u)); - a_remove(&u->attribs, a); - } - } - } - } -} - -static void -fix_score_option(void) -{ - faction * f; - for (f=factions;f;f=f->next) { - f->options &= ((1<options &= ~(1<options |= (1<next) { - for(u=r->units; u; u=u->next) { - int wounds = unit_max_hp(u)*u->number - u->hp; - u->hp = max(1, u->hp - wounds); - } - } -} -#endif - -#if 0 -static void -fix_beached(void) -{ - region * r; - for (r=regions;r;r=r->next) { - if (r->land && rterrain(r)!=T_PLAIN) { - ship * s; - building *b; - - for(b=r->buildings; b; b=b->next) { - if(b->typ == BT_HAFEN) break; - } - if(b == NULL) { - for (s=r->ships;s;s=s->next) { - if (s->coast!=NODIRECTION && s->type>SH_BOAT) - { - region * r2 = rconnect(r, s->coast); - assert(rterrain(r2)==T_OCEAN || fval(r2, RF_CHAOTIC)); - move_ship(s, r, r2, NULL); - } - } - } - } - } -} -#endif - -#if 0 -static void -fix_hungrydead(void) -{ - region *r; - unit *u; - - for (r=regions;r;r=r->next) { - for (u=r->units;u;u=u->next) { - if(u->hp == 0) u->hp = 1; - } - } -} - -static void -name_seaserpents(void) -{ - region *r; - unit *u; - - for (r=regions;r;r=r->next) { - for (u=r->units;u;u=u->next) { - if(u->race == new_race[RC_SEASERPENT] && strncmp(u->name, "Nummer ", 7)) { - set_string(&u->name, "Seeschlange"); - } - } - } -} -#endif - attrib_type at_roadfix = { "roadfix", DEFAULT_INIT, @@ -657,111 +333,6 @@ fix_foreign(void) } return 0; } -#if 0 -static void -fix_feuerwand_orks(void) -{ - unit *u; - - if((u=findunitg(atoi36("1j1L"), NULL))==NULL) { - printf("Korrektur: kann Orks nicht finden!\n"); - return; - } - - if(u->number < 1000) { - printf("Korrektur: Orks sind schon korrigiert!\n"); - return; - } - scale_number(u,170); - u->hp=2337; /* Buggy Anzahl Personen = Normale HP */ -} - -static void -fix_buildings(void) -{ - building *burg; - unit *u, *uf = NULL; - const requirement *req; - const construction *con; - FILE *statfile; - vset done; - int s1, s2; - char buf[256]; - int a,b,c,d; - int first; - - if((statfile=fopen("building.txt","r"))==NULL) { - log_warning(("fix_buildings: cannot open building.txt!\n")); - return; - } - - vset_init(&done); - s1=s2=-1; - - while(fgets(buf, 256, statfile)!=NULL) { - if(*buf=='#') - continue; - - a=b=c=d=0; - first=0; - - sscanf(buf,"%d;%d;%d;%d",&a,&b,&c,&d); - - if((u=findunitg(b,NULL))==NULL) { - printf("fix_buildings: Einheit %d nicht gefunden.\n",b); - continue; - } - - if((burg=findbuilding(a))==NULL) { - printf("fix_buildings: Burg %d nicht gefunden.\n", a); - if((burg=u->building)==NULL) { - printf("Einheit %d steht auch in keinem Gebäude. (gebe auf)\n",u->no); - continue; - } - if(burg->type->construction->maxsize > 0 && - burg->type->construction->reqsize > 0) - printf("Ersatz: Burg %d\n",burg->no); - else { - printf("Ersatzgebäude ist nicht vom betroffenen Typ.\n"); - continue; - } - } - - printf("Burg %d; Einheit %d; vorher %d; + %d\n",burg->no,u->no,c,d); - - s2=vset_add(&done, (void *)a); - if(s2>s1) { - printf("ERSTER !\n"); - first=1; - uf=u; - } - s1=s2; - - con=burg->type->construction; - - if(con->maxsize != -1 || con->reqsize == 1) continue; - - for(req=con->materials; req->number!=0; req++) { - int diff=burg->size-c; - - if(req->type==R_SILVER) - change_resource(uf, R_SILVER, diff*req->number-d*req->number/con->reqsize); - else { - if(first) - change_resource(uf, req->type, diff*req->number); - assert(uf!=NULL); - change_resource(uf, req->type, -d*req->number/con->reqsize); - } - } - if(first) - burg->size=c+d; - else - burg->size+=d; - } - vset_destroy(&done); - fclose(statfile); -} -#endif extern plane * arena; @@ -781,62 +352,6 @@ fix_age(void) } } -#if 0 -static boolean -balsambug(const region *r) -{ - direction_t dir; - - for (dir=0; dir 0) - return false; - } - return true; -} - -static void -fix_balsamfiasko(void) -{ - region *r, *rc; - direction_t dir; - int i; - - for (r=regions; r; r=r->next) freset(r, RF_DH); - - /* Zufällig verteilen */ - for (r=regions; r; r=r->next) { - if (r->x < -36 && r->y < -45 && landregion(rterrain(r))) { - if(rdemand(r,0) <= 0 && balsambug(r)) { - rsetdemand(r,0,(char)(1+rand()%5)); - rsetdemand(r,rand()%7,0); - fset(r, RF_DH); - } - } - } - - /* Smoothing */ - for(i=0; i<3; i++) { - for (r=regions; r; r=r->next) if(fval(r, RF_DH)) { - for (dir=0; dir < MAXDIRECTIONS; dir++) { - rc = rconnect(r, dir); - if(rc && fval(rc, RF_DH) && rand()%100 < 20) { - int p1, p2; - for (p1 = 0; p1 != MAXLUXURIES; p1++) - if (rdemand(r, p1) == 0) break; - for (p2 = 0; p2 != MAXLUXURIES; p2++) - if (rdemand(rc, p2) == 0) break; - - if(p1 != p2) { - rsetdemand(rc, p2, (char)(1+rand()%5)); - rsetdemand(rc, p1, 0); - } - } - } - } - } -} -#endif - #if 1 static int count_demand(const region *r) @@ -1036,46 +551,6 @@ fix_demand(void) } #endif -#if 0 -static void -read_laenrepair(boolean active) -{ - FILE * f = fopen("repair.laen", "rt"); - FILE * log = fopen("report.laen", "wt"); - if (!f || !log) return; - while (!feof(f)) { - int n, x, y; - region * r; - fscanf(f, "%d %d %d", &x, &y, &n); - r = findregion(x, y); - if (!r) fprintf(log, "%d,%d:\tnot found\n", x, y); - else if (fval(r, RF_CHAOTIC)) continue; - else { - int laen = rlaen(r); - if (n==-1 && laen>=0) { - fprintf(log, "%d,%d:\tillegal laen (%d)\n", x, y, laen); - if (active) rsetlaen(r, n); - } else if (laen==-1 && n!=-1) { - fprintf(log, "%d,%d:\tlaen was lost (%d)\n", x, y, n); - if (active) rsetlaen(r, n); - } - } - } - fclose(f); -} - -static void -write_laenrepair(void) { - FILE * f = fopen("repair.laen", "wt"); - region * r; - for (r=regions;r;r=r->next) if (!fval(r, RF_CHAOTIC)) { - int laen = rlaen(r); - fprintf(f, "%d %d %d\n", r->x, r->y, laen); - } - fclose(f); -} -#endif - #include "group.h" static void fix_allies(void) @@ -1143,55 +618,6 @@ fix_icastles(void) } } -#if 0 -static void -fix_ponnukis(void) - /* Es kann nur einen geben! */ -{ - unit * ponn = findunit(atoi36("ponn")); - if (ponn) { - region * mag = ponn->region; - unit * u; - for (u=mag->units;u;u=u->next) { - if (u!=ponn && u->faction==ponn->faction && u->race==ponn->race && !strcmp(ponn->name, u->name)) { - set_number(u, 0); - } - } - } -} -#endif - -#if 0 -static void -fix_traveldir(void) -{ - region *r; - attrib *a, *a2; - traveldir *t; - - for(r=regions; r; r=r->next) { - a = a_find(r->attribs, &at_traveldir); - while (a) { - a2 = a_add(&r->attribs, a_new(&at_traveldir_new)); - t = (traveldir *)(a2->data.v); - - t->no = a->data.sa[0]; - t->dir = a->data.ca[2]; - t->age = a->data.ca[3]; - - a = a->nexttype; - } - } - for(r=regions; r; r=r->next) { - a = a_find(r->attribs, &at_traveldir); - while(a) { - a_remove(&r->attribs, a); - a = a->nexttype; - } - } -} -#endif - typedef struct stats_t { struct stats_t * next; const struct item_type * type; @@ -1257,238 +683,6 @@ stats(void) } #if 0 -static void -fix_prices(void) -{ - region *r; - - puts(" - Korrigiere Handelsgüterpreise"); - - for(r=regions; r; r=r->next) if(r->land) { - int sales = 0, buys = 0; - const luxury_type *sale = NULL, *ltype; - struct demand *dmd; - for (dmd=r->land->demands;dmd;dmd=dmd->next) { - if(dmd->value == 0) { - sales++; - sale = dmd->type; - } else { - buys++; - } - } - if(sales == 0) { - int c = 0; - for(ltype=luxurytypes; ltype; ltype=ltype->next) c++; - c = rand()%c; - for(ltype=luxurytypes; c>0; c--) ltype=ltype->next; - r_setdemand(r, ltype, 0); - sale = ltype; - } - assert(sale); - if(buys == 0) { - for(ltype=luxurytypes; ltype; ltype=ltype->next) { - if(ltype != sale) r_setdemand(r, ltype, 1 + rand() % 5); - } - } - } -} - -static void -fix_options(void) -{ - faction *f; - - puts(" - Korrigiere Parteioptionen"); - - for(f=factions;f;f=f->next) { - f->options = f->options | Pow(O_REPORT); - f->options = f->options | Pow(O_ZUGVORLAGE); - } -} - -static void -init_region_age(void) -{ - region *r; - - puts(" - Initialisiere r->age"); - - /* Initialisieren mit dem Alter der ältesten Partei in 2 Feldern - * Umkreis */ - - for(r=regions; r; r=r->next) { - regionlist *rl = all_in_range(r,2); - regionlist *rl2; - unit *u; - int maxage = 0; - - for(rl2 = rl; rl2; rl2 = rl2->next) { - for(u=rl2->region->units; u; u=u->next) { - if(u->faction->age > maxage) maxage = u->faction->age; - } - } - r->age = (unsigned short)maxage; - } -} - -static void -fix_herbtypes(void) -{ - region * r; - for (r=regions;r!=NULL;r=r->next) if (r->land) { - const herb_type * htype = r->land->herbtype; - if (htype==NULL) { - if (terrain[r->terrain].herbs!=NULL) { - const item_type * itype; - int i=0; - while (terrain[r->terrain].herbs[i]!=NULL) ++i; - - itype = finditemtype(terrain[r->terrain].herbs[rand()%i], NULL); - r->land->herbtype = resource2herb(itype->rtype); - } - } else { - if (r->terrain==T_PLAIN) { - if (r_isforest(r)) { - int i = rand()%3+3; - const char * name = terrain[T_PLAIN].herbs[i]; - const item_type * itype = finditemtype(name, NULL); - r->land->herbtype = resource2herb(itype->rtype); - } - } else { - /* Das geht so nicht, wegen der Eisberg-Terrains */ - /* assert(htype->terrain==r->terrain); */ - } - } - } -} -#endif - -#ifdef SKILLFIX_SAVE -typedef struct skillfix_data { - unit * u; - skill_t skill; - int value; - int number; - int self; - int teach; -} skillfix_data; - -static void -init_skillfix(attrib * a) -{ - a->data.v = calloc(sizeof(skillfix_data), 1); -} - -static void -free_skillfix(attrib * a) -{ - free(a->data.v); -} - -attrib_type at_skillfix = { "skillfix", init_skillfix, free_skillfix }; - -void -skillfix(struct unit * u, skill_t skill, int from, int self, int teach) -{ - attrib * a = a_add(&u->attribs, a_new(&at_skillfix)); - skillfix_data * data = (skillfix_data*)a->data.v; - data->u = u; - data->skill = skill; - data->number = u->number; - data->value = from; - data->self = self; - data->teach = teach; -} - -void -write_skillfix(void) -{ - FILE * F = fopen("skills.fix", "w+"); - region * r; - fprintf(F, "S%d\n", turn); - for (r=regions;r;r=r->next) { - unit * u; - for (u=r->units;u;u=u->next) { - attrib * a = a_find(u->attribs, &at_skillfix); - while (a) { - skillfix_data * data = (skillfix_data*)a->data.v; - fprintf(F, "%s %d %d %d %d %d\n", - itoa36(data->u->no), - data->skill, - data->number, - data->value, - data->self, - data->teach); - a = a->nexttype; - } - } - } - fclose(F); -} -#endif - -#if 0 -static void -init_mwarden(void) -{ - unit *u = findunitg(atoi36("mwar"), NULL); - attrib *a; - - if(!u) return; - - a = a_add(&u->attribs, a_new(&at_warden)); - a->data.i = 0; -} -#endif - -#if 0 -#include -static void -lms_special(unit * u) -{ - if (u) i_change(&u->items, &it_lmsreward, 1); -} -#endif - -#if 0 -#define LIFEEXPECTANCY (27*40) -static void -undo_deadpeasants(void) -{ - region * r = regions; - while (r) { - int dead = rpeasants(r) / LIFEEXPECTANCY; - deathcounts(r, -dead); - r = r->next; - } -} - -static void -fix_undead3percent(void) -{ - region * r = regions; - while (r) { - int dead = deathcount(r); - deathcounts(r, -(dead/2)); - r = r->next; - } -} - -static void -fix_targetregion_resolve(void) -{ - region *r; - unit *u; - attrib *a; - - for(r=regions; r; r=r->next) { - for(u=r->units; u; u=u->next) { - a = a_find(u->attribs, &at_targetregion); - if(a) a->data.v = findregion(a->data.sa[0], a->data.sa[1]); - } - } -} - static void fix_herbs(void) { @@ -1559,7 +753,6 @@ fix_herbs(void) } #endif - #include #include #include @@ -1600,70 +793,6 @@ get_timeout(trigger * td, trigger * tfind) return t; } -#if 0 -static void -fix_timeouts(void) -{ - region * r; - for (r=regions;r;r=r->next) { - unit * u; - for (u=r->units;u;u=u->next) { - attrib * a = a_find(u->attribs, &at_eventhandler); - boolean toad = (u->race==RC_TOAD); - boolean keeper = (u->race==RC_IRONKEEPER); - while (a!=NULL) { - trigger * t; - handler_info * td = (handler_info *)a->data.v; - for (t=td->triggers;t;t=t->next) { - trigger ** tptr=&t->next; - while (*tptr) { - /* remove duplicates */ - if ((*tptr)->type==t->type) { - *tptr = (*tptr)->next; - } else tptr = &(*tptr)->next; - } - if (t->type == &tt_changerace || - t->type == &tt_changefaction || - t->type == &tt_createcurse || - t->type == &tt_createunit) - { - trigger * timer = get_timeout(td->triggers, t); - if (toad && t->type == &tt_changerace) { - toad = false; - } - if (timer==NULL) { - add_trigger(&u->attribs, "timer", trigger_timeout(1+(rand()%2), t)); - } - } - else if (t->type == &tt_killunit) { - if (u->race==RC_IRONKEEPER) { - trigger * timer = get_timeout(td->triggers, t); - keeper = false; - if (timer==NULL) { - add_trigger(&u->attribs, "timer", trigger_timeout(1+(rand()%2), t)); - } - } - } - } - a = a->nexttype; - } - if (keeper) { - int duration = 1+ (rand() % 2); - trigger * tkill = trigger_killunit(u); - add_trigger(&u->attribs, "timer", trigger_timeout(duration, tkill)); - } - if (toad) { - /* repair toad-only mage */ - int duration = 1+ (rand() % 2); - trigger * trestore = trigger_changerace(u, u->faction->race, u->faction->race); - if (rand()%10>2) t_add(&trestore, trigger_giveitem(u, olditemtype[I_TOADSLIME], 1)); - add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore)); - } - } - } -} -#endif - #include static int @@ -1751,33 +880,6 @@ update_gmquests(void) do_once("renm", fix_foreign()); } -#if 0 -static void -test_gmquest(void) -{ - const struct faction * f; - /* enno's world */ - f = gm_addquest("enno@eressea.upb.de", "GM Zone", 1, PFL_NOATTACK|PFL_NOALLIANCES|PFL_NOFEED|PFL_FRIENDLY); - log_printf("Neue Questenpartei %s\n", factionname(f)); - - f = gm_addquest("xandril@att.net", "Mardallas Welt", 40, 0); - log_printf("Neue Questenpartei %s\n", factionname(f)); - - f = gm_addquest("moritzsalinger@web.de", "Laen-Kaiser", 7, /*PFL_NORECRUITS |*/ PFL_NOMAGIC /*| PFL_NOBUILD*/); - log_printf("Neue Questenpartei %s\n", factionname(f)); - - f = gm_addquest("Denise.Muenstermann@home.gelsen-net.de", "Mochikas Queste", 7, PFL_NOMAGIC); - log_printf("Neue Questenpartei %s\n", factionname(f)); - - f = gm_addquest("feeron@aol.com", "Eternath", 11, 0); - log_printf("Neue Questenpartei %s\n", factionname(f)); - - f = gm_addquest("BigBear@nord-com.net", "Leonidas Vermächtnis", 15, PFL_NOMAGIC|PFL_NOSTEALTH); - log_printf("Neue Questenpartei %s\n", factionname(f)); - -} -#endif - #define TEST_LOCALES 0 #if TEST_LOCALES static void @@ -1795,83 +897,6 @@ setup_locales(void) #include #include -#if 0 -#error "this is broken, it duplicates triggers" -static void -fix_unitrefs(void) -{ - region * r=regions; - while (r) { - unit * u = r->units; - while (u) { - attrib * a; - - a = a_find(u->attribs, &at_familiar); - if (a) { - /* magier, hat einen familiar */ - unit * ufamiliar = get_familiar(u); - if (ufamiliar) { - attrib * ae; - /* killunit attribut am magier */ - ae = a_find(u->attribs, &at_eventhandler); - if (ae) { - trigger * tkillunit = NULL; - trigger ** tlist = get_triggers(u->attribs, "destroy"); - if (tlist!=NULL) { - tkillunit = *tlist; - while (tkillunit) { - if (strcmp(tkillunit->type->name, "killunit")==0) break; - tkillunit = tkillunit->next; - } - if (tkillunit && !tkillunit->data.v) { - log_warning(("killunit-trigger für Magier %s und Vertrauten %s restauriert.\n", - itoa36(u->no), itoa36(ufamiliar->no))); - tkillunit->data.v = ufamiliar; - } - else ae = NULL; - } - } - if (ae==NULL) { - /* Wenn der Magier stirbt, dann auch der Vertraute */ - add_trigger(&u->attribs, "destroy", trigger_killunit(ufamiliar)); - } - - /* killunit attribut am magier */ - ae = a_find(ufamiliar->attribs, &at_eventhandler); - if (ae) { - trigger * tshockunit = NULL; - trigger ** tlist = get_triggers(ufamiliar->attribs, "destroy"); - if (tlist!=NULL) { - tshockunit = *tlist; - while (tshockunit) { - if (strcmp(tshockunit->type->name, "shock")==0) break; - tshockunit = tshockunit->next; - } - if (tshockunit && !tshockunit->data.v) { - log_warning(("shockunit-trigger für Magier %s und Vertrauten %s restauriert.\n", - itoa36(u->no), itoa36(ufamiliar->no))); - tshockunit->data.v = u; - } - else ae = NULL; - } - } - if (ae==NULL) { - /* Wenn der Vertraute stirbt, schockt er den Magier */ - add_trigger(&ufamiliar->attribs, "destroy", trigger_shock(u)); - } - - } else { - log_error(("Magier %s hat ein at_familiar, aber keinen Vertrauten.\n", - itoa36(u->no))); - } - } - u = u->next; - } - r=r->next; - } -} -#endif - static void update_igjarjuk_quest(void) { @@ -1895,25 +920,6 @@ init_resourcefix(void) #endif -#if 0 -static void -fix_negpotion(void) -{ - region *r; - unit *u; - int i; - - for(r=regions; r; r=r->next) { - for(u=r->units; u; u=u->next) { - i = get_effect(u, oldpotiontype[P_FAST]); - if (i < 0){ - change_effect(u, oldpotiontype[P_FAST], -i); - } - } - } -} -#endif - #if GROWING_TREES int growing_trees(void) @@ -2171,10 +1177,6 @@ korrektur(void) update_gms(); verify_owners(false); /* fix_herbtypes(); */ -#ifdef CONVERT_TRIGGER - convert_triggers(); -#endif - /* fix_migrants(); */ /* In Vin3 können Parteien komplett übergeben werden. */ #ifdef ENHANCED_QUIT no_teurefremde(0); @@ -2249,10 +1251,4 @@ korrektur_end(void) void init_conversion(void) { -#if defined(CONVERT_TRIGGER) - at_register(&at_relation); - at_register(&at_relbackref); - at_register(&at_trigger); - at_register(&at_action); -#endif }