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);
|
return allysfm(s, f, HELP_FIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
troop
|
fighter *
|
||||||
select_corpse(battle * b, fighter * af)
|
select_corpse(battle * b, fighter * af)
|
||||||
/* Wählt eine Leiche aus, der af hilft. casualties ist die Anzahl der
|
/* Wählt eine Leiche aus, der af hilft. casualties ist die Anzahl der
|
||||||
* Toten auf allen Seiten (im Array). Wenn af == NULL, wird die
|
* 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) */
|
* Untote werden nicht ausgewählt (casualties, not dead) */
|
||||||
{
|
{
|
||||||
troop dt =
|
|
||||||
{0, 0};
|
|
||||||
int di, maxcasualties = 0;
|
int di, maxcasualties = 0;
|
||||||
fighter *df;
|
fighter *df;
|
||||||
side *side;
|
side *side;
|
||||||
|
@ -421,14 +419,13 @@ select_corpse(battle * b, fighter * af)
|
||||||
if (af && !helping(af->side, df->side))
|
if (af && !helping(af->side, df->side))
|
||||||
continue;
|
continue;
|
||||||
if (di < dead) {
|
if (di < dead) {
|
||||||
dt.fighter = df;
|
return df;
|
||||||
dt.index = df->unit->number - di;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
di -= dead;
|
di -= dead;
|
||||||
}
|
}
|
||||||
cv_next(df);
|
cv_next(df);
|
||||||
return dt;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
@ -571,28 +568,23 @@ sort_fighterrow(fighter ** elem1, fighter ** elem2)
|
||||||
static void
|
static void
|
||||||
reportcasualties(battle * b, fighter * fig, int dead)
|
reportcasualties(battle * b, fighter * fig, int dead)
|
||||||
{
|
{
|
||||||
bfaction * bf;
|
struct message * m;
|
||||||
if (fig->alive == fig->unit->number)
|
if (fig->alive == fig->unit->number) return;
|
||||||
return;
|
|
||||||
#ifndef NO_RUNNING
|
#ifndef NO_RUNNING
|
||||||
if (fig->run.region == NULL) {
|
if (fig->run.region == NULL) {
|
||||||
fig->run.region = fleeregion(fig->unit);
|
fig->run.region = fleeregion(fig->unit);
|
||||||
if (fig->run.region == NULL) fig->run.region = b->region;
|
if (fig->run.region == NULL) fig->run.region = b->region;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
fbattlerecord(b, fig->unit->faction, " ");
|
|
||||||
for (bf = b->factions;bf;bf=bf->next) {
|
|
||||||
faction * f = bf->faction;
|
|
||||||
#ifdef NO_RUNNING
|
#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);
|
fig->unit, NULL, fig->run.number, fig->alive, dead);
|
||||||
#else
|
#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);
|
fig->unit, fig->run.region, fig->run.number, fig->alive, dead);
|
||||||
#endif
|
#endif
|
||||||
message_faction(b, f, m);
|
message_all(b, m);
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1370,7 +1362,7 @@ select_enemy(battle * b, fighter * af, int minrow, int maxrow)
|
||||||
fighter * df = *fi;
|
fighter * df = *fi;
|
||||||
int dr;
|
int dr;
|
||||||
|
|
||||||
ui = statusrow(df);
|
ui = statusrow(df->status);
|
||||||
if (unitrow[ui]<0) {
|
if (unitrow[ui]<0) {
|
||||||
unitrow[ui] = get_unitrow(df);
|
unitrow[ui] = get_unitrow(df);
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ extern "C" {
|
||||||
extern boolean helping(struct side * as, struct side * ds);
|
extern boolean helping(struct side * as, struct side * ds);
|
||||||
extern void rmfighter(fighter *df, int i);
|
extern void rmfighter(fighter *df, int i);
|
||||||
extern struct region * fleeregion(const struct unit * u);
|
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 fighter * make_fighter(struct battle * b, struct unit * u, side * s, boolean attack);
|
||||||
extern int statusrow(int status);
|
extern int statusrow(int status);
|
||||||
extern void drain_exp(struct unit *u, int d);
|
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 = count_healable(b, fi);
|
||||||
healable = (int)min(k, healable);
|
healable = (int)min(k, healable);
|
||||||
while (healable--) {
|
while (healable--) {
|
||||||
troop t = select_corpse(b, fi);
|
fighter * tf = select_corpse(b, fi);
|
||||||
if (t.fighter
|
if (tf!=NULL && tf->side->casualties > 0
|
||||||
&& t.fighter->side->casualties > 0
|
&& old_race(tf->unit->race) != RC_DAEMON
|
||||||
&& old_race(t.fighter->unit->race) != RC_DAEMON
|
&& (chance(c)))
|
||||||
&& (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->person[].hp beginnt mit t.index = 0 zu zählen,
|
||||||
* t.fighter->alive ist jedoch die Anzahl lebender in der Einheit,
|
* t.fighter->alive ist jedoch die Anzahl lebender in der Einheit,
|
||||||
* also sind die hp von t.fighter->alive
|
* also sind die hp von t.fighter->alive
|
||||||
* t.fighter->hitpoints[t.fighter->alive-1] und der erste Tote
|
* t.fighter->hitpoints[t.fighter->alive-1] und der erste Tote
|
||||||
* oder weggelaufene ist t.fighter->hitpoints[t.fighter->alive] */
|
* oder weggelaufene ist t.fighter->hitpoints[tf->alive] */
|
||||||
t.fighter->person[t.fighter->alive].hp = 2;
|
tf->person[tf->alive].hp = 2;
|
||||||
++t.fighter->alive;
|
++tf->alive;
|
||||||
++t.fighter->side->size[SUM_ROW];
|
++tf->side->size[SUM_ROW];
|
||||||
++t.fighter->side->size[t.fighter->unit->status + 1];
|
++tf->side->size[tf->unit->status + 1];
|
||||||
++t.fighter->side->healed;
|
++tf->side->healed;
|
||||||
--t.fighter->side->casualties;
|
--tf->side->casualties;
|
||||||
assert(t.fighter->side->casualties>=0);
|
assert(tf->side->casualties>=0);
|
||||||
--t.fighter->side->dead;
|
--tf->side->dead;
|
||||||
assert(t.fighter->side->dead>=0);
|
assert(tf->side->dead>=0);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue