Skip to content

Commit

Permalink
Move replace_if_failed function to correct location
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 19, 2021
1 parent d666cc1 commit 14fbc4c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion data/lua/core.lua
Expand Up @@ -638,7 +638,6 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then

--[========[Map module]========]

wesnoth.map.replace_if_failed = wesnoth.map.get().replace_if_failed
function wesnoth.map.split_terrain_code(code)
return table.unpack(code:split('^', {remove_empty = false}))
end
Expand Down
1 change: 1 addition & 0 deletions src/scripting/game_lua_kernel.cpp
Expand Up @@ -4150,6 +4150,7 @@ game_lua_kernel::game_lua_kernel(game_state & gs, play_controller & pc, reports
// Filters
{"find_locations", &dispatch<&game_lua_kernel::intf_get_locations>},
{"match_location", &dispatch<&game_lua_kernel::intf_match_location>},
{"replace_if_failed", intf_replace_if_failed},
{ nullptr, nullptr }
};
luaL_setfuncs(L, map_callbacks, 0);
Expand Down
4 changes: 1 addition & 3 deletions src/scripting/lua_terrainmap.cpp
Expand Up @@ -464,7 +464,7 @@ int intf_terrain_mask(lua_State *L)
return 0;
}

static int intf_replace_if_failed(lua_State* L)
int intf_replace_if_failed(lua_State* L)
{
auto mode = terrain_type_data::BOTH;
if(!lua_isnoneornil(L, 2)) {
Expand Down Expand Up @@ -517,8 +517,6 @@ namespace lua_terrainmap {
// terrainmap methods
lua_pushcfunction(L, intf_on_board);
lua_setfield(L, -2, "on_board");
lua_pushcfunction(L, intf_replace_if_failed);
lua_setfield(L, -2, "replace_if_failed");
if(use_tf) {
lua_pushcfunction(L, intf_mg_get_locations);
lua_setfield(L, -2, "get_locations");
Expand Down
2 changes: 2 additions & 0 deletions src/scripting/lua_terrainmap.hpp
Expand Up @@ -57,6 +57,8 @@ void lua_terrainmap_setmetatable(lua_State *L);
int intf_terrainmap_create(lua_State *L);
int intf_terrainmap_get(lua_State *L);

int intf_replace_if_failed(lua_State* L);

namespace lua_terrainmap {
std::string register_metatables(lua_State *L, bool use_tf);
}

0 comments on commit 14fbc4c

Please sign in to comment.