Make the default script write out one list of emails per locale (in

emails.<locale>
This commit is contained in:
Enno Rehling 2004-02-07 13:47:11 +00:00
parent 4440c421f1
commit f9a7ecb796
1 changed files with 24 additions and 1 deletions

View File

@ -1,3 +1,23 @@
function write_emails()
local locales = { "de", "en" }
local files = {}
local key
for key in locales do
local locale = locales[key]
files[locale] = io.open(basepath .. "/emails." .. locale, "w")
end
local faction
for faction in factions() do
print(faction.id .. " - " .. faction.locale)
files[faction.locale]:write(faction.email .. "\n")
end
for key in files do
files[key]:close()
end
end
function process(orders) function process(orders)
file = "" .. get_turn() file = "" .. get_turn()
if read_game(file)~=0 then if read_game(file)~=0 then
@ -12,17 +32,20 @@ function process(orders)
add_equipment("stone", 30); add_equipment("stone", 30);
add_equipment("money", 2000 + get_turn() * 10); add_equipment("money", 2000 + get_turn() * 10);
-- run the turn:
read_orders(orders) read_orders(orders)
process_orders() process_orders()
write_passwords() write_passwords()
write_reports() write_reports()
write_emails()
file = "" .. get_turn() file = "" .. get_turn()
if write_game(file)~=0 then if write_game(file)~=0 then
print("could not write game") print("could not write game")
return -1 return -1
end end
end end