From 51fc6680dd0161f5ffa46dbc8377263e902a07fc Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 28 Jul 2015 10:51:14 +0200 Subject: [PATCH] require trees for new player regions --- scripts/newplayer.lua | 5 +++-- scripts/populate.lua | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/newplayer.lua b/scripts/newplayer.lua index 9ac546d83..7e49c49e0 100644 --- a/scripts/newplayer.lua +++ b/scripts/newplayer.lua @@ -42,12 +42,13 @@ local function dump_selection(sel) end players = read_players() -local limit = 30000 +local peasants = 20000 +local trees = 1000 local turn = get_turn() local sel if #players > 0 then eressea.read_game(("%d.dat"):format(turn)) - sel = p.select(regions(), limit) + sel = p.select(regions(), peasants, trees) if #sel > 0 then local best = dump_selection(sel) print("finest region, " .. best.score .. " points: " .. tostring(best.r)) diff --git a/scripts/populate.lua b/scripts/populate.lua index 9ab1b5bcb..fd01f2af1 100644 --- a/scripts/populate.lua +++ b/scripts/populate.lua @@ -13,12 +13,11 @@ local function score(r, res) return peas end -local function select(regions, limit) +local function select(regions, peasants, trees) local sel = {} for r in regions do if not r.plane and r.terrain~="ocean" and not r.units() then - s = score(r) - if s >= limit then + if score(r, "peasant") >= peasants and score(r, "tree") >= trees then table.insert(sel, r) end end