added more checks for dialog names

This commit is contained in:
Sokomine 2024-03-09 19:32:29 +01:00
parent 7905d9937f
commit 70e1d4144c

View File

@ -171,6 +171,12 @@ yl_speak_up.edit_mode_apply_changes = function(pname, fields)
if(dialog.n_dialogs[fields.d_name]) then
err_msg = "Sorry. There is already a dialog with a dialog id of "..
tostring(fields.d_name).."."
elseif(yl_speak_up.is_special_dialog(fields.d_name)) then
err_msg = "Sorry. That is a special dialog ID. You cannot use it as "..
"a manually set name."
elseif(string.sub(fields.d_name, 1, 2) == "d_") then
err_msg = "Sorry. Names starting with \"d_\" are not allowed. They "..
"may later be needed for new dialogs."
end
-- TODO: check if the name is allowed (only normal chars, numbers and underscore)
if(err_msg) then