2008-04-25 16:31:38 +02:00
|
|
|
-- -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
function test_locales()
|
2008-05-23 11:52:43 +02:00
|
|
|
local skills = { "", "herb", "kraut", "Kräute", "Kraeut", "k", "kra", "MAGIE" }
|
|
|
|
for k,v in pairs(skills) do
|
|
|
|
str = test.loc_skill("de", v)
|
|
|
|
io.stdout:write(v, "\t", tostring(str), " ", tostring(get_string("de", "skill::" .. tostring(str))), "\n")
|
|
|
|
end
|
|
|
|
return 0
|
2008-04-25 16:31:38 +02:00
|
|
|
end
|
|
|
|
|
2008-05-22 16:40:21 +02:00
|
|
|
function loadscript(name)
|
|
|
|
local script = scriptpath .. "/" .. name
|
|
|
|
print("- loading " .. script)
|
|
|
|
if pcall(dofile, script)==0 then
|
|
|
|
print("Could not load " .. script)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function run_scripts()
|
|
|
|
scripts = {
|
|
|
|
"spells.lua",
|
|
|
|
"extensions.lua",
|
|
|
|
"familiars.lua",
|
|
|
|
}
|
|
|
|
for index, value in pairs(scripts) do
|
|
|
|
loadscript(value)
|
|
|
|
end
|
|
|
|
end
|
2008-05-18 16:38:12 +02:00
|
|
|
--test_locales()
|
2008-04-26 16:55:22 +02:00
|
|
|
|
2008-05-22 16:40:21 +02:00
|
|
|
function run_turn()
|
2008-05-23 11:52:43 +02:00
|
|
|
plan_monsters()
|
|
|
|
process_orders()
|
|
|
|
spawn_dragons()
|
|
|
|
spawn_undead()
|
|
|
|
spawn_braineaters(0.25)
|
|
|
|
autoseed(basepath .. "/newfactions", false)
|
2008-05-22 16:40:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function test_free()
|
2008-05-23 11:52:43 +02:00
|
|
|
read_game("571.dat", "binary")
|
|
|
|
read_orders("orders.571")
|
|
|
|
run_turn()
|
|
|
|
free_game()
|
|
|
|
read_game("570.dat", "binary")
|
|
|
|
read_orders("orders.570")
|
|
|
|
run_turn()
|
|
|
|
free_game()
|
2008-05-22 16:40:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
loadscript("default.lua")
|
|
|
|
run_scripts()
|
|
|
|
-- go
|
2008-04-26 16:55:22 +02:00
|
|
|
local now = os.clock()
|
2008-05-22 16:40:21 +02:00
|
|
|
-- test_free()
|
2008-05-23 11:52:43 +02:00
|
|
|
read_game("50", "text")
|
|
|
|
write_game("50.dat", "binary")
|
|
|
|
write_game("50.txt.1", "text")
|
2008-05-22 16:40:21 +02:00
|
|
|
free_game()
|
2008-05-23 11:52:43 +02:00
|
|
|
read_game("50", "test")
|
|
|
|
write_game("50.txt.2", "text")
|
2008-05-22 16:40:21 +02:00
|
|
|
free_game()
|
2008-04-26 16:55:22 +02:00
|
|
|
local elapsed = os.clock() - now
|
|
|
|
print(elapsed)
|
2008-04-27 11:52:03 +02:00
|
|
|
-- text: 50.574
|
|
|
|
-- bin0: 19.547
|
|
|
|
-- bin1: 18.953
|
2008-05-23 11:52:43 +02:00
|
|
|
-- io.stdin:read("*line")
|