Skip to content

Commit

Permalink
Undeprecate wesnoth.highlight_hex()
Browse files Browse the repository at this point in the history
wesnoth.select_hex has problems with simply highlighting units without displaying
their movement range. If you set its third argument to false, the unit gets
selected, but no hex cursors appears around it. Using this allows us to simply
highlight a location with the hex cursor, independent of unit presence (select_hex
works funny if no unit is present).
  • Loading branch information
Vultraz committed Mar 13, 2016
1 parent 2ffa1ff commit 497aee8
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/scripting/game_lua_kernel.cpp
Expand Up @@ -1175,26 +1175,18 @@ int game_lua_kernel::intf_shroud_op(lua_State *L, bool place_shroud)
*/
int game_lua_kernel::intf_highlight_hex(lua_State *L)
{
ERR_LUA << "wesnoth.highlight_hex is deprecated, use wesnoth.select_hex" << std::endl;

if (!game_display_) {
return 0;
}

int x = luaL_checkinteger(L, 1) - 1;
int y = luaL_checkinteger(L, 2) - 1;
const map_location loc(x, y);
if(!map().on_board(loc)) return luaL_argerror(L, 1, "not on board");

game_display_->highlight_hex(loc);
game_display_->display_unit_hex(loc);

unit_map::const_unit_iterator i = board().units().find(loc);
if(i != board().units().end()) {
game_display_->highlight_reach(pathfind::paths(*i, false,
true, teams().front()));
/// @todo: teams().front() is not always the correct
/// choice for the viewing team.
}

return 0;
}

Expand Down

0 comments on commit 497aee8

Please sign in to comment.