forked from github/server
Merge branch 'master' of github.com:eressea/server
This commit is contained in:
commit
039f38cbdb
|
@ -3,6 +3,8 @@ local autoseed = {}
|
||||||
-- minimum required resources in the 7-hex neighborhood:
|
-- minimum required resources in the 7-hex neighborhood:
|
||||||
local peasants = 10000
|
local peasants = 10000
|
||||||
local trees = 800
|
local trees = 800
|
||||||
|
-- minimum resources in the region itself:
|
||||||
|
local min_peasants = 2000
|
||||||
-- number of starters per region:
|
-- number of starters per region:
|
||||||
local per_region = 2
|
local per_region = 2
|
||||||
|
|
||||||
|
@ -23,11 +25,13 @@ local function select_regions(regions, peasants, trees)
|
||||||
local sel = {}
|
local sel = {}
|
||||||
for r in regions do
|
for r in regions do
|
||||||
if not r.plane and r.terrain~="ocean" and not r.units() then
|
if not r.plane and r.terrain~="ocean" and not r.units() then
|
||||||
sp = score(r, "peasant")
|
if r:get_resource("peasant") >= min_peasants then
|
||||||
st = score(r, "tree")
|
sp = score(r, "peasant")
|
||||||
if sp >= peasants then
|
st = score(r, "tree")
|
||||||
if st >= trees then
|
if sp >= peasants then
|
||||||
table.insert(sel, r)
|
if st >= trees then
|
||||||
|
table.insert(sel, r)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,6 +98,15 @@ static void cunhash(curse * c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curse *cfindhash(int i)
|
||||||
|
{
|
||||||
|
curse *old;
|
||||||
|
|
||||||
|
for (old = cursehash[i % MAXENTITYHASH]; old; old = old->nexthash)
|
||||||
|
if (old->no == i)
|
||||||
|
return old;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/* at_curse */
|
/* at_curse */
|
||||||
void curse_init(attrib * a)
|
void curse_init(attrib * a)
|
||||||
|
|
|
@ -285,6 +285,7 @@ extern "C" {
|
||||||
void ct_register(const curse_type *);
|
void ct_register(const curse_type *);
|
||||||
void ct_checknames(void);
|
void ct_checknames(void);
|
||||||
|
|
||||||
|
curse *cfindhash(int i);
|
||||||
curse *findcurse(int curseid);
|
curse *findcurse(int curseid);
|
||||||
|
|
||||||
void curse_init(struct attrib *a);
|
void curse_init(struct attrib *a);
|
||||||
|
|
|
@ -1876,6 +1876,7 @@ int newunitid(void)
|
||||||
start_random_no = random_unit_no;
|
start_random_no = random_unit_no;
|
||||||
|
|
||||||
while (ufindhash(random_unit_no) || dfindhash(random_unit_no)
|
while (ufindhash(random_unit_no) || dfindhash(random_unit_no)
|
||||||
|
|| cfindhash(random_unit_no)
|
||||||
|| forbiddenid(random_unit_no)) {
|
|| forbiddenid(random_unit_no)) {
|
||||||
random_unit_no++;
|
random_unit_no++;
|
||||||
if (random_unit_no == MAX_UNIT_NR + 1) {
|
if (random_unit_no == MAX_UNIT_NR + 1) {
|
||||||
|
|
Loading…
Reference in New Issue