Skip to content

Instantly share code, notes, and snippets.

@ennorehling
Last active November 24, 2016 19:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ennorehling/8b5581d46d7944acef8cbe79f4e64bea to your computer and use it in GitHub Desktop.
-- ./eressea -v0 -t 1001 shipfix.lua
require 'config'
infos = {}
for line in io.lines("ships.txt") do
id = string.match(line, "^(%d+)%s*")
info = line:sub(id:len()+2)
infos[tonumber(id)] = info
end
eressea.read_game(get_turn() .. ".dat")
fixed = 0
for r in regions() do
for s in r.ships do
info = infos[s.id]
if info then
if s.info:len()<130 then
s.info = info
fixed = fixed + 1
else
print(s.info)
print(info)
end
end
end
end
print("fixed " .. fixed .. " ships.")
eressea.write_game(get_turn() .. ".new")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment