#ifndef lint
static char *RCSid = "$Header: /usr/brule/guest/empire/empire/emprcs/lib/common/land.c,v 2.1 1995/09/24 22:27:23 empire Exp $";
#endif

/*
 * populace.c
 *
 * return workforce available
 *
 * Dave Pare, 1986
 */

#include "misc.h"
#include "var.h"
#include "sect.h"
#include "nat.h"
#include "var.h"
#include "file.h"
#include "path.h"
#include "xy.h"
#include "land.h"
#include "nsc.h"

has_units(x,y,cn)
coord	x,y;
natid	cn;
{
	register int n;
	struct	lndstr land;
	
	for (n=0; ef_read(EF_LAND, n, (s_char *)&land); n++) {
		if(land.lnd_x != x || land.lnd_y != y)
			continue;
		if (land.lnd_own == cn)
			return 1;
	}

	return 0;
}

has_units_with_mob(x,y,cn)
coord	x,y;
natid	cn;
{
	struct	nstr_item ni;
	struct	lndstr land;
	
	snxtitem_xy(&ni,EF_LAND,x,y);
	while(nxtitem(&ni,(s_char *)&land)) {
		if (land.lnd_own != cn)
			continue;
		if (land.lnd_mobil > 0)
			return 1;
	}

	return 0;
}
