Merge pull request #159 from badgerman/develop

remove the change_locales code
This commit is contained in:
Enno Rehling 2015-04-04 09:21:42 +02:00
commit bd3c9f1fcb
1 changed files with 43 additions and 54 deletions

View File

@ -26,18 +26,6 @@ function callbacks(rules, name, ...)
end
end
local function change_locales(localechange)
for loc, flist in pairs(localechange) do
for index, name in pairs(flist) do
f = get_faction(atoi36(name))
if f ~= nil and f.locale ~= loc then
print("LOCALECHANGE ", f, f.locale, loc)
f.locale = loc
end
end
end
end
local function dbupdate()
update_scores()
dbname = config.dbname or 'eressea.db'
@ -127,64 +115,65 @@ local function write_scores()
end
function process(rules, orders)
local confirmed_multis = { }
local suspected_multis = { }
local confirmed_multis = { }
local suspected_multis = { }
if open_game(get_turn())~=0 then
eressea.log.error("could not read game")
return -1
end
if open_game(get_turn())~=0 then
eressea.log.error("could not read game")
return -1
end
callbacks(rules, 'init')
init_summary()
callbacks(rules, 'init')
init_summary()
-- run the turn:
if read_orders(orders) ~= 0 then
print("could not read " .. orders)
return -1
end
-- run the turn:
if read_orders(orders) ~= 0 then
print("could not read " .. orders)
return -1
end
plan_monsters()
plan_monsters()
if nmr_check(config.maxnmrs or 80)~=0 then
return -1
end
if nmr_check(config.maxnmrs or 80)~=0 then
return -1
end
process_orders()
callbacks(rules, 'update')
process_orders()
callbacks(rules, 'update')
local localechange = { de = { 'ii' } }
change_locales(localechange)
write_files(config.locales)
write_files(config.locales)
file = '' .. get_turn() .. '.dat'
if eressea.write_game(file)~=0 then
eressea.log.error("could not write game")
return -1
end
return 0
file = '' .. get_turn() .. '.dat'
if eressea.write_game(file)~=0 then
eressea.log.error("could not write game")
return -1
end
return 0
end
function run_turn(rules)
local turn = get_turn()
if turn<0 then
turn = read_turn()
set_turn(turn)
end
local turn = get_turn()
if turn<0 then
turn = read_turn()
set_turn(turn)
end
orderfile = orderfile or config.basepath .. '/orders.' .. turn
eressea.log.debug("executing turn " .. get_turn() .. " with " .. orderfile .. " with rules=" .. config.rules)
local result = process(rules, orderfile)
if result==0 then
dbupdate()
end
return result
orderfile = orderfile or config.basepath .. '/orders.' .. turn
eressea.log.debug("executing turn " .. get_turn() .. " with " .. orderfile .. " with rules=" .. config.rules)
local result = process(rules, orderfile)
if result==0 then
dbupdate()
end
return result
end
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
if not f then
return false
end
io.close(f)
return true
end
if file_exists('execute.lock') then