Skip to content
Snippets Groups Projects
Commit bf72164e authored by dg's avatar dg
Browse files

Creating a new character over an existing one now prompts a confirmation

git-svn-id: http://svn.net-core.org/repos/t-engine4@2147 51575b47-30f0-44d4-a5cc-537603b46e54
parent a28cee5c
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,14 @@ function _M:generateList()
Module:instanciate(mod, "player", true)
else
game:registerDialog(require('engine.dialogs.GetText').new("Enter your character's name", "Name", 2, 25, function(text)
Module:instanciate(mod, text, true)
local savename = text:gsub("[^a-zA-Z0-9_-.]", "_")
if fs.exists(("/%s/save/%s/game.teag"):format(mod.short_name, savename)) then
Dialog:yesnoPopup("Override character?", "There is already a character with this name, do you want to override it?", function(ret)
if not ret then Module:instanciate(mod, text, true) end
end, "No", "Yes")
else
Module:instanciate(mod, text, true)
end
end))
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment