Skip to content

Commit

Permalink
sdfsdf
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Oct 21, 2018
1 parent eee9214 commit 0830d77
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/map/map.cpp
Expand Up @@ -209,7 +209,8 @@ std::string gamemap::write() const

void gamemap::overlay(const gamemap& m, map_location loc, const std::vector<overlay_rule>& rules, bool m_is_odd, bool ignore_special_locations)
{
overlay_impl(tiles_, starting_positions_, m.tiles_, m.starting_positions_, [this](auto&&... arg) { set_terrain(std::forward<decltype(arg)>(arg)...); }, loc, rules, m_is_odd, ignore_special_locations);
//the following line doesn't compile on all compiler without the 'this->'
overlay_impl(tiles_, starting_positions_, m.tiles_, m.starting_positions_, [this](auto&&... arg) { this->set_terrain(std::forward<decltype(arg)>(arg)...); }, loc, rules, m_is_odd, ignore_special_locations);
}

void gamemap::overlay_impl(
Expand Down
4 changes: 2 additions & 2 deletions src/map/map.hpp
Expand Up @@ -112,9 +112,9 @@ class gamemap
static void overlay_impl(
// const but changed via set_terrain
const t_translation::ter_map& m1,
starting_positions& m1_st,
t_translation::starting_positions& m1_st,
const t_translation::ter_map& m2,
const starting_positions& m2_st,
const t_translation::starting_positions& m2_st,
std::function<void (const map_location&, const t_translation::terrain_code&, terrain_type_data::merge_mode, bool)> set_terrain,
map_location loc,
const std::vector<overlay_rule>& rules,
Expand Down
12 changes: 5 additions & 7 deletions src/scripting/lua_terrainmap.cpp
Expand Up @@ -348,7 +348,7 @@ static std::vector<gamemap::overlay_rule> read_rules_vector(lua_State *L, int in
{
lua_rawgeti(L, index, i);
if(!lua_istable(L, -1)) {
return luaL_argerror(L, index, "rules must be a table of tables");
luaL_argerror(L, index, "rules must be a table of tables");
}
rules.push_back(gamemap::overlay_rule());
auto& rule = rules.back();
Expand Down Expand Up @@ -398,11 +398,11 @@ static std::vector<gamemap::overlay_rule> read_rules_vector(lua_State *L, int in
* - ignore_special_locations: boolean
* - rules: table of tables
*/
static int intf_mg_terrain_mask(lua_State *L)
int mapgen_gamemap::intf_mg_terrain_mask(lua_State *L)
{
mapgen_gamemap& tm1 = luaW_checkterrainmap(L, 1);
map_location loc = luaW_checklocation(L, 2);
mapgen_gamemap& tm1 = luaW_checkterrainmap(L, 3);
mapgen_gamemap& tm2 = luaW_checkterrainmap(L, 3);

bool is_odd = false;
bool ignore_special_locations = false;
Expand All @@ -416,13 +416,11 @@ static int intf_mg_terrain_mask(lua_State *L)
if(!lua_istable(L, -1)) {
return luaL_argerror(L, 4, "rules must be a table");
}
rules = read_rules_vector(L, -1)
rules = read_rules_vector(L, -1);
lua_pop(L, 1);
}
}

board().map_->overlay(mask_map, loc, rules, is_odd, ignore_special_locations);

gamemap::overlay_impl(
tm1.tiles_,
tm1.starting_positions_,
Expand Down Expand Up @@ -463,7 +461,7 @@ namespace lua_terrainmap {
lua_setfield(L, -2, "get_locations");
lua_pushcfunction(L, intf_mg_get_tiles_radius);
lua_setfield(L, -2, "get_tiles_radius");
lua_pushcfunction(L, intf_mg_terrain_mask);
lua_pushcfunction(L, &mapgen_gamemap::intf_mg_terrain_mask);
lua_setfield(L, -2, "terrain_mask");

cmd_out << "Adding terrainmamap2 metatable...\n";
Expand Down
2 changes: 1 addition & 1 deletion src/scripting/lua_terrainmap.hpp
Expand Up @@ -88,7 +88,7 @@ class mapgen_gamemap
}
}
}
friend int intf_terrain_mask(lua_State *L);
static int intf_mg_terrain_mask(lua_State *L);
private:
t_translation::ter_map tiles_;
starting_positions starting_positions_;
Expand Down

4 comments on commit 0830d77

@gfgtdf
Copy link
Contributor Author

@gfgtdf gfgtdf commented on 0830d77 Oct 21, 2018

Choose a reason for hiding this comment

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

this commit was a rebase mistake, it fixes the build for various typos/mistakes in 'add terrain_mask function to lua gamemap object.' ans way supposed to me merged into that one.

@GregoryLundberg
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, so the commit message should have been "fdsfds".

@gfgtdf
Copy link
Contributor Author

@gfgtdf gfgtdf commented on 0830d77 Oct 21, 2018

Choose a reason for hiding this comment

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

? no, It's as i said in my post. I didnt see git aborted my rebase with 'Could not execute editor' so i pushed it assuming it did rebase.

@CelticMinstrel
Copy link
Member

Choose a reason for hiding this comment

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

For reference, a link to the commit gfgtdf mentioned: cfd81d3

Please sign in to comment.