Prevent infinite loop...
...when attempting to insert via wesnoth.game_events.on_save a tagname which is already handled by the C++ engine into the saved scenario wml data. The tag is ignored and an error message omitted to the console and chat window. (fix for bug #17979)
This commit is contained in:
parent
433b760507
commit
fc169a5916
1 changed files with 13 additions and 1 deletions
|
@ -3395,7 +3395,19 @@ void LuaKernel::save_game(config &cfg)
|
|||
{
|
||||
config::all_children_iterator i = v.ordered_begin();
|
||||
if (i == v.ordered_end()) break;
|
||||
if (is_handled_file_tag(i->key)) continue;
|
||||
if (is_handled_file_tag(i->key))
|
||||
{
|
||||
/*
|
||||
* It seems the only tags appearing in the config v variable here
|
||||
* are the core-lua-handled (currently [item] and [objectives])
|
||||
* and the extra UMC ones.
|
||||
*/
|
||||
const std::string m = "Tag is already used: [" + i->key + "]";
|
||||
chat_message("Lua error", m);
|
||||
ERR_LUA << m << '\n';
|
||||
v.erase(i);
|
||||
continue;
|
||||
}
|
||||
cfg.splice_children(v, i->key);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue