forked from github/server
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:
parent
4d173cf7e2
commit
68d96014b1
|
@ -372,8 +372,8 @@ static int do_recruiting(recruitment * recruits, int available)
|
||||||
use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT,
|
use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT,
|
||||||
rc->recruitcost * number);
|
rc->recruitcost * number);
|
||||||
}
|
}
|
||||||
if (u->number == 0 && !fval(u, UFL_ISNEW)) {
|
if (u->number == 0 && fval(u, UFL_DEAD)) {
|
||||||
/* unit is empty, and not a TEMP => it is dead, and cannot recruit */
|
/* unit is empty, dead, and cannot recruit */
|
||||||
number = 0;
|
number = 0;
|
||||||
}
|
}
|
||||||
if (number > 0) {
|
if (number > 0) {
|
||||||
|
|
|
@ -2661,6 +2661,7 @@ static void aftermath(battle * b)
|
||||||
int dead = dead_fighters(df);
|
int dead = dead_fighters(df);
|
||||||
int sum_hp = 0;
|
int sum_hp = 0;
|
||||||
int n;
|
int n;
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
for (n = 0; n != df->alive; ++n) {
|
for (n = 0; n != df->alive; ++n) {
|
||||||
if (df->person[n].hp > 0) {
|
if (df->person[n].hp > 0) {
|
||||||
|
@ -2669,10 +2670,15 @@ static void aftermath(battle * b)
|
||||||
}
|
}
|
||||||
snumber += du->number;
|
snumber += du->number;
|
||||||
if (relevant) {
|
if (relevant) {
|
||||||
int flags = UFL_LONGACTION | UFL_NOTMOVING;
|
flags = UFL_LONGACTION | UFL_NOTMOVING;
|
||||||
if (du->status == ST_FLEE) {
|
if (du->status == ST_FLEE) {
|
||||||
flags -= UFL_NOTMOVING;
|
flags -= UFL_NOTMOVING;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (df->alive == 0) {
|
||||||
|
flags |= UFL_DEAD;
|
||||||
|
}
|
||||||
|
if (flags) {
|
||||||
fset(du, flags);
|
fset(du, flags);
|
||||||
}
|
}
|
||||||
if (sum_hp + df->run.hp < du->hp) {
|
if (sum_hp + df->run.hp < du->hp) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
||||||
struct item;
|
struct item;
|
||||||
struct sc_mage;
|
struct sc_mage;
|
||||||
|
|
||||||
#define UFL_DEBUG (1<<0)
|
#define UFL_DEAD (1<<0)
|
||||||
#define UFL_ISNEW (1<<1) /* 2 */
|
#define UFL_ISNEW (1<<1) /* 2 */
|
||||||
#define UFL_LONGACTION (1<<2) /* 4 */
|
#define UFL_LONGACTION (1<<2) /* 4 */
|
||||||
#define UFL_OWNER (1<<3) /* 8 */
|
#define UFL_OWNER (1<<3) /* 8 */
|
||||||
|
|
Loading…
Reference in New Issue