Last active
November 24, 2016 19:02
-
-
Save ennorehling/8b5581d46d7944acef8cbe79f4e64bea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ./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