forked from github/server
select_corpse gibt keinen index mehr zurück, spielt ja keine Rolle.
This commit is contained in:
parent
6820841790
commit
3e3e79d6e5
|
@ -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;
|
||||
}
|
||||
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",
|
||||
fig->unit, NULL, fig->run.number, fig->alive, dead);
|
||||
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",
|
||||
fig->unit, fig->run.region, fig->run.number, fig->alive, dead);
|
||||
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);
|
||||
msg_release(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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
&& (chance(c)))
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue