forked from github/server
cleanup battle.h header
removed some unreferenced functions from battle.h, made them static in battle.c
This commit is contained in:
parent
0497cbbdde
commit
69821b2a32
40
src/battle.c
40
src/battle.c
|
@ -431,7 +431,7 @@ static int get_row(const side * s, int row, const side * vs)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_unitrow(const fighter * af, const side * vs)
|
static int get_unitrow(const fighter * af, const side * vs)
|
||||||
{
|
{
|
||||||
int row = statusrow(af->status);
|
int row = statusrow(af->status);
|
||||||
if (vs == NULL) {
|
if (vs == NULL) {
|
||||||
|
@ -3661,6 +3661,24 @@ static void free_fighter(fighter * fig)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void battle_free(battle * b) {
|
||||||
|
side *s;
|
||||||
|
|
||||||
|
assert(b);
|
||||||
|
|
||||||
|
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||||
|
fighter *fnext = s->fighters;
|
||||||
|
while (fnext) {
|
||||||
|
fighter *fig = fnext;
|
||||||
|
fnext = fig->next;
|
||||||
|
free_fighter(fig);
|
||||||
|
free(fig);
|
||||||
|
}
|
||||||
|
free_side(s);
|
||||||
|
}
|
||||||
|
free(b);
|
||||||
|
}
|
||||||
|
|
||||||
void free_battle(battle * b)
|
void free_battle(battle * b)
|
||||||
{
|
{
|
||||||
int max_fac_no = 0;
|
int max_fac_no = 0;
|
||||||
|
@ -3740,7 +3758,7 @@ static int battle_report(battle * b)
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
||||||
if (komma) {
|
if (komma) {
|
||||||
bytes = strlcpy(bufp, ", ", size);
|
strlcpy(bufp, ", ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
@ -4295,21 +4313,3 @@ void do_battle(region * r)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void battle_free(battle * b) {
|
|
||||||
side *s;
|
|
||||||
|
|
||||||
assert(b);
|
|
||||||
|
|
||||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
|
||||||
fighter *fnext = s->fighters;
|
|
||||||
while (fnext) {
|
|
||||||
fighter *fig = fnext;
|
|
||||||
fnext = fig->next;
|
|
||||||
free_fighter(fig);
|
|
||||||
free(fig);
|
|
||||||
}
|
|
||||||
free_side(s);
|
|
||||||
}
|
|
||||||
free(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -225,8 +225,6 @@ extern "C" {
|
||||||
extern const troop no_troop;
|
extern const troop no_troop;
|
||||||
|
|
||||||
/* BEGIN battle interface */
|
/* BEGIN battle interface */
|
||||||
void battle_init(battle * b);
|
|
||||||
void battle_free(battle * b);
|
|
||||||
side * find_side(battle * b, const struct faction * f, const struct group * g, unsigned int flags, const struct faction * stealthfaction);
|
side * find_side(battle * b, const struct faction * f, const struct group * g, unsigned int flags, const struct faction * stealthfaction);
|
||||||
side * get_side(battle * b, const struct unit * u);
|
side * get_side(battle * b, const struct unit * u);
|
||||||
fighter * get_fighter(battle * b, const struct unit * u);
|
fighter * get_fighter(battle * b, const struct unit * u);
|
||||||
|
@ -251,11 +249,10 @@ extern "C" {
|
||||||
extern int hits(troop at, troop dt, weapon * awp);
|
extern int hits(troop at, troop dt, weapon * awp);
|
||||||
extern void damage_building(struct battle *b, struct building *bldg,
|
extern void damage_building(struct battle *b, struct building *bldg,
|
||||||
int damage_abs);
|
int damage_abs);
|
||||||
extern struct quicklist *fighters(struct battle *b, const struct side *vs,
|
struct quicklist *fighters(struct battle *b, const struct side *vs,
|
||||||
int minrow, int maxrow, int mask);
|
int minrow, int maxrow, int mask);
|
||||||
extern int count_allies(const struct side *as, int minrow, int maxrow,
|
int count_allies(const struct side *as, int minrow, int maxrow,
|
||||||
int select, int allytype);
|
int select, int allytype);
|
||||||
extern int get_unitrow(const struct fighter *af, const struct side *vs);
|
|
||||||
extern bool helping(const struct side *as, const struct side *ds);
|
extern bool helping(const struct side *as, const struct side *ds);
|
||||||
extern void rmfighter(fighter * df, int i);
|
extern void rmfighter(fighter * df, int i);
|
||||||
extern struct fighter *select_corpse(struct battle *b, struct fighter *af);
|
extern struct fighter *select_corpse(struct battle *b, struct fighter *af);
|
||||||
|
|
Loading…
Reference in New Issue