a new method for finding out that a unit died in battle.

turns out, a unit can have 0 people without dying or being a TEMP (GIVE them all away, then RECRUIT more).
This commit is contained in:
Enno Rehling 2014-07-06 13:00:14 -07:00
parent 4d173cf7e2
commit 68d96014b1
3 changed files with 11 additions and 5 deletions

View File

@ -372,8 +372,8 @@ static int do_recruiting(recruitment * recruits, int available)
use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT,
rc->recruitcost * number);
}
if (u->number == 0 && !fval(u, UFL_ISNEW)) {
/* unit is empty, and not a TEMP => it is dead, and cannot recruit */
if (u->number == 0 && fval(u, UFL_DEAD)) {
/* unit is empty, dead, and cannot recruit */
number = 0;
}
if (number > 0) {

View File

@ -2661,6 +2661,7 @@ static void aftermath(battle * b)
int dead = dead_fighters(df);
int sum_hp = 0;
int n;
int flags = 0;
for (n = 0; n != df->alive; ++n) {
if (df->person[n].hp > 0) {
@ -2669,10 +2670,15 @@ static void aftermath(battle * b)
}
snumber += du->number;
if (relevant) {
int flags = UFL_LONGACTION | UFL_NOTMOVING;
flags = UFL_LONGACTION | UFL_NOTMOVING;
if (du->status == ST_FLEE) {
flags -= UFL_NOTMOVING;
}
}
if (df->alive == 0) {
flags |= UFL_DEAD;
}
if (flags) {
fset(du, flags);
}
if (sum_hp + df->run.hp < du->hp) {

View File

@ -30,7 +30,7 @@ extern "C" {
struct item;
struct sc_mage;
#define UFL_DEBUG (1<<0)
#define UFL_DEAD (1<<0)
#define UFL_ISNEW (1<<1) /* 2 */
#define UFL_LONGACTION (1<<2) /* 4 */
#define UFL_OWNER (1<<3) /* 8 */