/*
 * res_pop.c
 *
 */

#include <math.h>
#include "misc.h"
#include "var.h"
#include "sect.h"
#include "nat.h"
#include "item.h"
#include "news.h"
#include "file.h"
#include "xy.h"
#include "optlist.h"

int
max_pop(research, sp)
	float	research;
	struct sctstr  *sp;
{
	int	maxpop = 999;

	if (opt_RES_POP) {
		maxpop = (((50.0+4.0*research)/(200.0+3.0*research))*600.0) + 400;
		if (maxpop > 999)
			maxpop = 999;
	}
#ifdef BIG_CITY
	if (sp && dchr[sp->sct_type].d_pkg == UPKG)
		maxpop = (int)(maxpop * ((9.0 * sp->sct_effic) / 100 + 1));
#endif /* BIG_CITY */
	if (sp && sp->sct_type == SCT_MOUNT)
		maxpop /= 10;

	return maxpop;
}
