Get rid of src/lib/common/land.c
There are several files with land unit subroutines. This one is in an awkward place: it depends on stuff from ../subs, which contributes to libcommon.a's ugly dependencies. Move its contents to logical places (use internal linkage where possible), and remove it.
This commit is contained in:
parent
312e6d4c5b
commit
3d2518a724
5 changed files with 79 additions and 122 deletions
|
@ -42,6 +42,7 @@
|
|||
#include "plane.h"
|
||||
#include "ship.h"
|
||||
|
||||
static int has_units_with_mob(coord, coord, natid);
|
||||
static void cede_hdr(void);
|
||||
static int cede_sect(struct nstr_sect *, natid);
|
||||
static int cede_ship(struct nstr_item *, natid);
|
||||
|
@ -169,6 +170,23 @@ cede_sect(struct nstr_sect *ns, natid to)
|
|||
return RET_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
has_units_with_mob(coord x, coord y, natid cn)
|
||||
{
|
||||
struct nstr_item ni;
|
||||
struct lndstr land;
|
||||
|
||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||
while (nxtitem(&ni, &land)) {
|
||||
if (land.lnd_own != cn)
|
||||
continue;
|
||||
if (land.lnd_mobil > 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
cede_hdr(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue