Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Enno Rehling 2015-08-03 19:17:25 +02:00
commit c19bed02fe
7 changed files with 28 additions and 40 deletions

View File

@ -33,10 +33,17 @@
<xi:include href="config://default/adamantium.xml"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="30"/>
<item name="stone" amount="30"/>
<item name="money" amount="4200"/>
<item name="log" amount="50"/>
<item name="stone" amount="50"/>
<item name="iron" amount="50"/>
<item name="laen" amount="10"/>
<item name="sword" amount="1"/>
<item name="mallorn" amount="10"/>
<item name="skillpotion" amount="5"/>
<item name="p2" amount="5"/>
<item name="money" amount="20000"/>
<skill name="perception" level="30"/>
<skill name="melee" level="1"/>
</set>
<set name="new_faction">
<item name="adamantium" amount="1"/>
@ -53,7 +60,6 @@
<!-- Game specific settings -->
<order name="pay" disable="yes"/>
<order name="besiege" disable="yes"/>
<skill name="alchemy" enable="true"/>
<skill name="crossbow" enable="true"/>
@ -94,11 +100,7 @@
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="1"/>
<param name="init_spells" value="0"/>
<param name="world.era" value="2"/>
<param name="seed.population.min" value="8"/>
<param name="seed.population.max" value="8"/>
<param name="rules.reserve.twophase" value="1"/>
<param name="rules.owners.force_leave" value="0"/>
<param name="rules.give.max_men" value="-1"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.limit.faction" value="2500"/>

View File

@ -32,7 +32,6 @@
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>

View File

@ -32,7 +32,6 @@
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>

View File

@ -1,12 +1,5 @@
#!/bin/bash
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BUILD="build-$MACHINE-$CC-Debug"
function usage() {
cat <<HEREDOC
usage: $0 [-t <turn>] [-g <game>] [-f <file>] command [args]
@ -89,7 +82,7 @@ rm -rf reports
mkdir -p reports
SUPP="$SOURCE/share/ubuntu-12_04.supp"
SERVER="$SOURCE/$BUILD/eressea/eressea"
SERVER="$SOURCE/Debug/eressea/eressea"
VALGRIND=$(which valgrind)
if [ ! -z $VALGRIND ]; then
SERVER="$VALGRIND --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"

View File

@ -9,7 +9,9 @@ local function read_players()
local str = input:read("*line")
if str==nil then break end
local email, race, lang = str:match("([^ ]*) ([^ ]*) ([^ ]*)")
table.insert(players, { race = race, lang = lang, email = email })
if string.char(string.byte(email, 1))~='#' then
table.insert(players, { race = race, lang = lang, email = email })
end
end
return players
end
@ -17,21 +19,12 @@ end
local function seed(r, email, race, lang)
local f = faction.create(email, race, lang)
local u = unit.create(f, r)
u:set_skill("perception", 30)
u:add_item("money", 20000)
items = {
log = 50,
stone = 50,
iron = 50,
laen = 10,
mallorn = 10,
skillpotion = 5
}
for it, num in pairs(items) do
u:add_item(it, num)
end
equip_unit(u, "new_faction")
equip_unit(u, "first_unit")
equip_unit(u, "first_" .. race, 7) -- disable old callbacks
unit.create(f, r, 5):set_skill("mining", 30)
unit.create(f, r, 5):set_skill("quarrying", 30)
f:set_origin(r)
return f
end
@ -50,12 +43,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))

View File

@ -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 r.terrain~="ocean" and not r.units() then
s = score(r)
if s >= limit then
if not r.plane and r.terrain~="ocean" and not r.units() then
if score(r, "peasant") >= peasants and score(r, "tree") >= trees then
table.insert(sel, r)
end
end

View File

@ -434,7 +434,9 @@ static int tolua_equipunit(lua_State * L)
{
unit *u = (unit *)tolua_tousertype(L, 1, 0);
const char *eqname = tolua_tostring(L, 2, 0);
equip_unit(u, get_equipment(eqname));
int mask = (int)tolua_tonumber(L, 3, EQUIP_ALL);
assert(mask > 0);
equip_unit_mask(u, get_equipment(eqname), mask);
return 0;
}