select_corpse gibt keinen index mehr zurück, spielt ja keine Rolle.

This commit is contained in:
Enno Rehling 2004-05-29 18:57:18 +00:00
parent 6820841790
commit 3e3e79d6e5
3 changed files with 32 additions and 41 deletions

View File

@ -391,7 +391,7 @@ allysf(const side * s, const faction * f)
return allysfm(s, f, HELP_FIGHT);
}
troop
fighter *
select_corpse(battle * b, fighter * af)
/* Wählt eine Leiche aus, der af hilft. casualties ist die Anzahl der
* Toten auf allen Seiten (im Array). Wenn af == NULL, wird die
@ -399,8 +399,6 @@ select_corpse(battle * b, fighter * af)
*
* Untote werden nicht ausgewählt (casualties, not dead) */
{
troop dt =
{0, 0};
int di, maxcasualties = 0;
fighter *df;
side *side;
@ -421,14 +419,13 @@ select_corpse(battle * b, fighter * af)
if (af && !helping(af->side, df->side))
continue;
if (di < dead) {
dt.fighter = df;
dt.index = df->unit->number - di;
return df;
break;
}
di -= dead;
}
cv_next(df);
return dt;
return NULL;
}
boolean
@ -571,28 +568,23 @@ sort_fighterrow(fighter ** elem1, fighter ** elem2)
static void
reportcasualties(battle * b, fighter * fig, int dead)
{
bfaction * bf;
if (fig->alive == fig->unit->number)
return;
struct message * m;
if (fig->alive == fig->unit->number) return;
#ifndef NO_RUNNING
if (fig->run.region == NULL) {
fig->run.region = fleeregion(fig->unit);
if (fig->run.region == NULL) fig->run.region = b->region;
}
#endif
fbattlerecord(b, fig->unit->faction, " ");
for (bf = b->factions;bf;bf=bf->next) {
faction * f = bf->faction;
#ifdef NO_RUNNING
struct message * m = msg_message("casualties", "unit runto run alive fallen",
m = msg_message("casualties", "unit runto run alive fallen",
fig->unit, NULL, fig->run.number, fig->alive, dead);
#else
struct message * m = msg_message("casualties", "unit runto run alive fallen",
m = msg_message("casualties", "unit runto run alive fallen",
fig->unit, fig->run.region, fig->run.number, fig->alive, dead);
#endif
message_faction(b, f, m);
message_all(b, m);
msg_release(m);
}
}
@ -1370,7 +1362,7 @@ select_enemy(battle * b, fighter * af, int minrow, int maxrow)
fighter * df = *fi;
int dr;
ui = statusrow(df);
ui = statusrow(df->status);
if (unitrow[ui]<0) {
unitrow[ui] = get_unitrow(df);
}

View File

@ -221,7 +221,7 @@ extern "C" {
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 struct fighter * select_corpse(struct battle * b, struct fighter * af);
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);

View File

@ -1538,27 +1538,26 @@ sp_reanimate(fighter * fi, int level, double power, spell * sp)
healable = count_healable(b, fi);
healable = (int)min(k, healable);
while (healable--) {
troop t = select_corpse(b, fi);
if (t.fighter
&& t.fighter->side->casualties > 0
&& old_race(t.fighter->unit->race) != RC_DAEMON
fighter * tf = select_corpse(b, fi);
if (tf!=NULL && tf->side->casualties > 0
&& old_race(tf->unit->race) != RC_DAEMON
&& (chance(c)))
{
assert(t.fighter->alive < t.fighter->unit->number);
assert(tf->alive < tf->unit->number);
/* t.fighter->person[].hp beginnt mit t.index = 0 zu zählen,
* t.fighter->alive ist jedoch die Anzahl lebender in der Einheit,
* also sind die hp von t.fighter->alive
* t.fighter->hitpoints[t.fighter->alive-1] und der erste Tote
* oder weggelaufene ist t.fighter->hitpoints[t.fighter->alive] */
t.fighter->person[t.fighter->alive].hp = 2;
++t.fighter->alive;
++t.fighter->side->size[SUM_ROW];
++t.fighter->side->size[t.fighter->unit->status + 1];
++t.fighter->side->healed;
--t.fighter->side->casualties;
assert(t.fighter->side->casualties>=0);
--t.fighter->side->dead;
assert(t.fighter->side->dead>=0);
* oder weggelaufene ist t.fighter->hitpoints[tf->alive] */
tf->person[tf->alive].hp = 2;
++tf->alive;
++tf->side->size[SUM_ROW];
++tf->side->size[tf->unit->status + 1];
++tf->side->healed;
--tf->side->casualties;
assert(tf->side->casualties>=0);
--tf->side->dead;
assert(tf->side->dead>=0);
++j;
}
}