Skip to content

Commit

Permalink
add wesnoth.current.user_can_invoke_commands
Browse files Browse the repository at this point in the history
this attribute return whether we are in a context where the user coudl issue new commands.

This is mainly intended to be used to check whethere we can use [do_command] in the currently situation (for exampel if one wants to use [do_command] in a unsycned menu item)
  • Loading branch information
gfgtdf committed Sep 20, 2017
1 parent 2bd6454 commit 7c71bab
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/scripting/game_lua_kernel.cpp
Expand Up @@ -1356,6 +1356,7 @@ int game_lua_kernel::impl_current_get(lua_State *L)
return_int_attrib("side", play_controller_.current_side());
return_int_attrib("turn", play_controller_.turn());
return_string_attrib("synced_state", synced_state());
return_bool_attrib("user_can_invoke_commands", !play_controller_.is_lingering() && play_controller_.gamestate().init_side_done() && !events::commands_disabled && gamedata().phase() == game_data::PLAY);

if (strcmp(m, "event_context") == 0)
{
Expand Down

2 comments on commit 7c71bab

@jyrkive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a long line. Can you split the expression across multiple lines?

@gfgtdf
Copy link
Contributor Author

@gfgtdf gfgtdf commented on 7c71bab Sep 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are c macros involved and i'm unsure whicher i'd need to use // here. and since i didn't test this commit, i wanted to minimize the chance of breaking things.

Please sign in to comment.