From fc7e4493f12f1e807d8a33692b1f326132f7b304 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 12 Feb 2005 21:25:03 +0000 Subject: [PATCH] =?UTF-8?q?http://eressea.upb.de/mantis/view.php=3Fid=3D38?= =?UTF-8?q?5=20In=20der=20Regel=20sollte=20create=5Funit()=20benutzt=20wer?= =?UTF-8?q?den,=20um=20Einheiten=20zu=20erzeugen,=20weil=20dann=20Parteita?= =?UTF-8?q?rnung,=20Rasse,=20etc.=20von=20der=20erzeugenden=20Einheit=20?= =?UTF-8?q?=C3=BCbernommen=20werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/economy.c | 2 +- src/common/kernel/battle.c | 1 - src/common/kernel/combatspells.c | 11 +++----- src/common/kernel/eressea.c | 8 ++---- src/common/kernel/eressea.h | 2 +- src/common/kernel/spell.c | 44 +++++++------------------------- src/common/races/zombies.c | 5 ++-- 7 files changed, 19 insertions(+), 54 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 4faf3f15a..bc0013960 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -248,7 +248,7 @@ expandrecruit(region * r, request * recruitorders) u->hp = u->n * unit_max_hp(u); unew = u; } else { - unew = createunit(r, u->faction, u->n, u->race); + unew = create_unit(r, u->faction, u->n, u->race, 0, NULL, u); } if (unew->race == new_race[RC_URUK]) { diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index ff96764a2..1187f2bb5 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -3817,7 +3817,6 @@ do_battle(void) */ switch (u->status) { case ST_FLEE: - run = true; break; default: if ((fig->person[dt.index].flags & FL_HIT) == 0) continue; diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index 967590ff8..e095358e9 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -762,7 +762,7 @@ sp_shadowcall(fighter * fi, int level, double power, spell * sp) break; } - u = createunit(r, mage->faction, force, rc); + u = create_unit(r, mage->faction, force, rc, 0, NULL, mage); u->status = ST_FIGHT; set_string(&u->name, racename(mage->faction->locale, u, u->race)); @@ -770,9 +770,6 @@ sp_shadowcall(fighter * fi, int level, double power, spell * sp) set_level(u, SK_AUSDAUER, (int)(power/2)); u->hp = u->number * unit_max_hp(u); - if (fval(mage, UFL_PARTEITARNUNG)) - fset(u, UFL_PARTEITARNUNG); - a = a_new(&at_unitdissolve); a->data.ca[0] = 0; a->data.ca[1] = 100; @@ -793,7 +790,7 @@ sp_wolfhowl(fighter * fi, int level, double power, spell * sp) unit *mage = fi->unit; attrib *a; int force = (int)(get_force(power, 3)/2); - unit *u = createunit(r, mage->faction, force, new_race[RC_WOLF]); + unit *u = create_unit(r, mage->faction, force, new_race[RC_WOLF], 0, NULL, mage); unused(sp); u->status = ST_FIGHT; @@ -830,7 +827,7 @@ sp_shadowknights(fighter * fi, int level, double power, spell * sp) unused(sp); - u = createunit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT]); + u = create_unit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT], 0, NULL, mage); u->status = ST_FIGHT; set_string(&u->name, "Schattenritter"); @@ -1730,7 +1727,7 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp) } if (j > 0) { - unit * u = createunit(r, mage->faction, 0, new_race[RC_UNDEAD]); + unit * u = create_unit(r, mage->faction, 0, new_race[RC_UNDEAD], 0, NULL, mage); /* new units gets some stats from old unit */ set_string(&u->name, du->name); diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 5cc6bfba6..000979612 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2543,16 +2543,12 @@ init_used_faction_ids(void) } -unit * -make_undead_unit(region * r, faction * f, int n, const struct race * rc) +void +make_undead_unit(unit * u) { - unit *u; - - u = createunit(r, f, n, rc); set_order(&u->lastorder, NULL); name_unit(u); fset(u, UFL_ISNEW); - return u; } void diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index b44c344dd..74df5cfb8 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -920,7 +920,7 @@ extern int findoption(const char *s, const struct locale * lang); extern char buf[BUFSIZE + 1]; /* special units */ -struct unit *make_undead_unit(struct region * r, struct faction * f, int n, const struct race * rc); +void make_undead_unit(struct unit *); extern struct region *regions; extern struct faction *factions; diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index 7d2da34fe..aadbd7a33 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -614,7 +614,7 @@ sp_summon_familiar(castorder *co) target_region = rconnect(r,d); } - familiar = createunit(target_region, mage->faction, 1, rc); + familiar = create_unit(target_region, mage->faction, 1, rc, 0, NULL, mage); if (target_region==mage->region) { familiar->building = mage->building; familiar->ship = mage->ship; @@ -3225,11 +3225,7 @@ sp_unholypower(castorder *co) /* Verletzungsanteil der transferierten Personen berechnen */ wounds = wounds*n/u->number; - un = createunit(co->rt, u->faction, 0, target_race); - if (co->rt==u->region) { - un->building = u->building; - un->ship = u->ship; - } + un = create_unit(co->rt, u->faction, 0, target_race, 0, NULL, u); transfermen(u, un, n); un->hp = unit_max_hp(un)*n - wounds; ADDMSG(&co->rt->msgs, msg_message("unholypower_limitedeffect", @@ -3502,13 +3498,7 @@ sp_summonshadow(castorder *co) unit *u; int val; - u = createunit(r, mage->faction, (int)(force*force), new_race[RC_SHADOW]); - if (r==mage->region) { - u->building = mage->building; - u->ship = mage->ship; - } - if (fval(mage, UFL_PARTEITARNUNG)) - fset(u, UFL_PARTEITARNUNG); + u = create_unit(r, mage->faction, (int)(force*force), new_race[RC_SHADOW], 0, NULL, mage); /* Bekommen Tarnung = (Magie+Tarnung)/2 und Wahrnehmung 1. */ val = get_level(mage, SK_MAGIC) + get_level(mage, SK_STEALTH); @@ -3549,13 +3539,7 @@ sp_summonshadowlords(castorder *co) int cast_level = co->level; double force = co->force; - u = createunit(r, mage->faction, (int)(force*force), new_race[RC_SHADOWLORD]); - if (r==mage->region) { - u->building = mage->building; - u->ship = mage->ship; - } - if (fval(mage, UFL_PARTEITARNUNG)) - fset(u, UFL_PARTEITARNUNG); + u = create_unit(r, mage->faction, (int)(force*force), new_race[RC_SHADOWLORD], 0, NULL, mage); /* Bekommen Tarnung = Magie und Wahrnehmung 5. */ set_level(u, SK_STEALTH, get_level(mage, SK_MAGIC)); @@ -3786,13 +3770,8 @@ sp_summonundead(castorder *co) race = new_race[RC_GHOUL]; } - u = make_undead_unit(r, mage->faction, undead, race); - if (r==mage->region) { - u->building = mage->building; - u->ship = mage->ship; - } - if (fval(mage, UFL_PARTEITARNUNG)) - fset(u, UFL_PARTEITARNUNG); + u = create_unit(r, mage->faction, undead, race, 0, NULL, mage); + make_undead_unit(u); sprintf(buf, "%s erweckt %d Untote aus ihren Gräbern.", unitname(mage), undead); @@ -5432,14 +5411,9 @@ sp_clonecopy(castorder *co) return 0; } - clone = createunit(target_region, mage->faction, 1, new_race[RC_CLONE]); - if (target_region==mage->region) { - clone->building = mage->building; - clone->ship = mage->ship; - } + sprintf(buf, "Klon von %s", unitname(mage)); + clone = create_unit(target_region, mage->faction, 1, new_race[RC_CLONE], 0, buf, mage); clone->status = ST_FLEE; - sprintf(buf, "Klon von %s", unitname(mage)); - set_string(&clone->name, buf); fset(clone, UFL_LOCKED); create_newclone(mage, clone); @@ -5485,7 +5459,7 @@ sp_dreamreading(castorder *co) return 0; } - u2=createunit(u->region,mage->faction, RS_FARVISION, new_race[RC_SPELL]); + u2 = createunit(u->region,mage->faction, RS_FARVISION, new_race[RC_SPELL]); set_number(u2, 1); set_string(&u2->name, "sp_dreamreading"); u2->age = 2; /* Nur für diese Runde. */ diff --git a/src/common/races/zombies.c b/src/common/races/zombies.c index 6ff602e06..a58d3f5f7 100644 --- a/src/common/races/zombies.c +++ b/src/common/races/zombies.c @@ -73,10 +73,9 @@ age_undead(unit *u) for (m = u->number; m; m--) if (rand() % 100 < UNDEAD_BREAKUP_FRACTION) n++; - u2 = make_undead_unit(r, findfaction(MONSTER_FACTION), 0, new_race[RC_UNDEAD]); + u2 = create_unit(r, findfaction(MONSTER_FACTION), 0, new_race[RC_UNDEAD], 0, NULL, u); + make_undead_unit(u2); transfermen(u, u2, u->number - n); - u2->building = u->building; - u2->ship = u->ship; } }