Adding an event handler via the positional call style now defaults to a repeating event

This is a somewhat controversial change!

PROS:
- This makes wesnoth.game_events.add a drop-in replacement for the on_event function
- If you're registering events in preload, most of them WILL be repeating events

CONS:
- This makes the default depend on the call style; in positional style, it defaults to repeating, and in named-argument style, it defaults to non-repeating
- This makes the default different from the WML default of non-repeating events
This commit is contained in:
Celtic Minstrel 2021-04-10 21:30:32 -04:00 committed by Celtic Minstrel
parent 3435c56f69
commit d03116f829

View File

@ -3746,7 +3746,7 @@ int game_lua_kernel::intf_add_event(lua_State *L)
man.add_event_handler_from_wml(cfg.get_parsed_config(), *this);
}
} else if(lua_isstring(L, 1)) {
bool is_menu_item = luaW_toboolean(L, 3), repeat = false;
bool is_menu_item = luaW_toboolean(L, 3), repeat = true;
std::string name = read_event_name(L, 1), id;
if(is_menu_item) {
id = name;