Skip to content

Commit

Permalink
Fix some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 21, 2021
1 parent 8626689 commit 9e4a7b5
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
16 changes: 8 additions & 8 deletions src/scripting/lua_terrainfilter.cpp
Expand Up @@ -790,7 +790,7 @@ static lua_mapgen::filter* luaW_push_mgfilter(lua_State *L, T&&... params)
/**
* Create a filter.
*/
int intf_terainfilter_create(lua_State *L)
int intf_terrainfilter_create(lua_State *L)
{
try {
int res_index = 0;
Expand All @@ -816,7 +816,7 @@ int intf_terainfilter_create(lua_State *L)
* - Arg 2: string containing the name of the property.
* - Ret 1: something containing the attribute.
*/
static int impl_terainfilter_get(lua_State *L)
static int impl_terrainfilter_get(lua_State *L)
{
lua_mapgen::filter& f = luaW_check_mgfilter(L, 1);
UNUSED(f);
Expand All @@ -829,7 +829,7 @@ static int impl_terainfilter_get(lua_State *L)
* - Arg 2: string containing the name of the property.
* - Arg 3: something containing the attribute.
*/
static int impl_terainfilter_set(lua_State *L)
static int impl_terrainfilter_set(lua_State *L)
{
lua_mapgen::filter& f = luaW_check_mgfilter(L, 1);
UNUSED(f);
Expand All @@ -852,7 +852,7 @@ static int intf_clearcache(lua_State *L)
/**
* Destroys a map object before it is collected (__gc metamethod).
*/
static int impl_terainfilter_collect(lua_State *L)
static int impl_terrainfilter_collect(lua_State *L)
{
lua_mapgen::filter& f = luaW_check_mgfilter(L, 1);
f.~filter();
Expand All @@ -868,15 +868,15 @@ namespace lua_terrainfilter {
cmd_out << "Adding terrainmamap metatable...\n";

luaL_newmetatable(L, terrinfilterKey);
lua_pushcfunction(L, impl_terainfilter_collect);
lua_pushcfunction(L, impl_terrainfilter_collect);
lua_setfield(L, -2, "__gc");
lua_pushcfunction(L, impl_terainfilter_get);
lua_pushcfunction(L, impl_terrainfilter_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, impl_terainfilter_set);
lua_pushcfunction(L, impl_terrainfilter_set);
lua_setfield(L, -2, "__newindex");
lua_pushstring(L, "terrain_filter");
lua_setfield(L, -2, "__metatable");
// terainmap methods
// terrainmap methods
lua_pushcfunction(L, intf_clearcache);
lua_setfield(L, -2, "clear_cache");

Expand Down
2 changes: 1 addition & 1 deletion src/scripting/lua_terrainfilter.hpp
Expand Up @@ -63,7 +63,7 @@ lua_mapgen::filter& luaW_check_mgfilter(lua_State *L, int index);

void lua_mgfilter_setmetatable(lua_State *L);

int intf_terainfilter_create(lua_State *L);
int intf_terrainfilter_create(lua_State *L);

int intf_mg_get_locations(lua_State* L);
int intf_mg_get_tiles_radius(lua_State* L);
Expand Down
40 changes: 20 additions & 20 deletions src/scripting/lua_terrainmap.cpp
Expand Up @@ -30,7 +30,7 @@ static lg::log_domain log_scripting_lua("scripting/lua");
#define LOG_LUA LOG_STREAM(info, log_scripting_lua)
#define ERR_LUA LOG_STREAM(err, log_scripting_lua)

static const char terrinmapKey[] = "terrainmap";
static const char terrainmapKey[] = "terrainmap";
static const char maplocationKey[] = "special_locations";

using std::string_view;
Expand Down Expand Up @@ -92,8 +92,8 @@ int impl_slocs_get(lua_State* L)
//todo: calling map.special_locations[1] will return the underlying map
// object instead of the first starting position, because the lua
// special locations is actually a table with the map object at
// index 1. The probably easiest way to fix this inconsitency is
// to just disallow all integerindicies here.
// index 1. The probably easiest way to fix this inconsistency is
// to just disallow all integer indices here.
mapgen_gamemap& m = luaW_check_slocs(L, 1);
string_view id = luaL_checkstring(L, 2);
auto res = m.special_location(std::string(id));
Expand Down Expand Up @@ -193,7 +193,7 @@ map_location mapgen_gamemap::special_location(const std::string& id) const

bool luaW_isterrainmap(lua_State* L, int index)
{
return luaL_testudata(L, index, terrinmapKey) != nullptr;
return luaL_testudata(L, index, terrainmapKey) != nullptr;
}


Expand All @@ -216,7 +216,7 @@ mapgen_gamemap& luaW_checkterrainmap(lua_State *L, int index)

void lua_terrainmap_setmetatable(lua_State *L)
{
luaL_setmetatable(L, terrinmapKey);
luaL_setmetatable(L, terrainmapKey);
}

template<typename... T>
Expand All @@ -229,13 +229,13 @@ mapgen_gamemap* luaW_pushmap(lua_State *L, T&&... params)

/**
* Create a map.
* - Arg 1: string descripbing the map data.
* - Arg 1: string describing the map data.
* - or:
* - Arg 1: int, width
* - Arg 2: int, height
* - Arg 3: string, terrain
*/
int intf_terainmap_create(lua_State *L)
int intf_terrainmap_create(lua_State *L)
{
if(lua_isnumber(L, 1) && lua_isnumber(L, 2)) {
int w = lua_tonumber(L, 1);
Expand All @@ -254,7 +254,7 @@ int intf_terainmap_create(lua_State *L)
/**
* Destroys a map object before it is collected (__gc metamethod).
*/
static int impl_terainmap_collect(lua_State *L)
static int impl_terrainmap_collect(lua_State *L)
{
mapgen_gamemap *u = static_cast<mapgen_gamemap*>(lua_touserdata(L, 1));
u->mapgen_gamemap::~mapgen_gamemap();
Expand All @@ -267,7 +267,7 @@ static int impl_terainmap_collect(lua_State *L)
* - Arg 2: string containing the name of the property.
* - Ret 1: something containing the attribute.
*/
static int impl_terainmap_get(lua_State *L)
static int impl_terrainmap_get(lua_State *L)
{
mapgen_gamemap& tm = luaW_checkterrainmap(L, 1);
char const *m = luaL_checkstring(L, 2);
Expand All @@ -293,7 +293,7 @@ static int impl_terainmap_get(lua_State *L)
* - Arg 2: string containing the name of the property.
* - Arg 3: something containing the attribute.
*/
static int impl_terainmap_set(lua_State *L)
static int impl_terrainmap_set(lua_State *L)
{
mapgen_gamemap& tm = luaW_checkterrainmap(L, 1);
UNUSED(tm);
Expand Down Expand Up @@ -397,11 +397,11 @@ static std::vector<gamemap::overlay_rule> read_rules_vector(lua_State *L, int in
return rules;
}
/**
* Reaplces part of the map.
* Replaces part of the map.
* - Arg 1: map location.
* - Arg 2: map data string.
* - Arg 3: table for optional named arguments
* - is_odd: boolen, if Arg2 has the odd mapo format (as if it was cut from a odd map location)
* - is_odd: boolean, if Arg2 has the odd map format (as if it was cut from a odd map location)
* - ignore_special_locations: boolean
* - rules: table of tables
*/
Expand Down Expand Up @@ -448,18 +448,18 @@ namespace lua_terrainmap {
{
std::ostringstream cmd_out;

cmd_out << "Adding terrainmamap metatable...\n";
cmd_out << "Adding terrainmap metatable...\n";

luaL_newmetatable(L, terrinmapKey);
lua_pushcfunction(L, impl_terainmap_collect);
luaL_newmetatable(L, terrainmapKey);
lua_pushcfunction(L, impl_terrainmap_collect);
lua_setfield(L, -2, "__gc");
lua_pushcfunction(L, impl_terainmap_get);
lua_pushcfunction(L, impl_terrainmap_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, impl_terainmap_set);
lua_pushcfunction(L, impl_terrainmap_set);
lua_setfield(L, -2, "__newindex");
lua_pushstring(L, "terainmap");
lua_pushstring(L, "terrainmap");
lua_setfield(L, -2, "__metatable");
// terainmap methods
// terrainmap methods
lua_pushcfunction(L, intf_set_terrain);
lua_setfield(L, -2, "set_terrain");
lua_pushcfunction(L, intf_get_terrain);
Expand All @@ -471,7 +471,7 @@ namespace lua_terrainmap {
lua_pushcfunction(L, &mapgen_gamemap::intf_mg_terrain_mask);
lua_setfield(L, -2, "terrain_mask");

cmd_out << "Adding terrainmamap2 metatable...\n";
cmd_out << "Adding terrainmap2 metatable...\n";

luaL_newmetatable(L, maplocationKey);
lua_pushcfunction(L, impl_slocs_get);
Expand Down
4 changes: 2 additions & 2 deletions src/scripting/lua_terrainmap.hpp
Expand Up @@ -26,7 +26,7 @@ struct map_location;

// this clas is similar to the orginal gamemap class but they have no 'is' rlation:
// mapgen_gamemap, unlike gamemap offers 'raw' access to the data
// gamemap, unlike mapgen_gamemap uses terain type data.
// gamemap, unlike mapgen_gamemap uses terrain type data.
class mapgen_gamemap
{
public:
Expand Down Expand Up @@ -118,7 +118,7 @@ void lua_terrainmap_setmetatable(lua_State *L);

mapgen_gamemap* luaW_pushmap(lua_State *L, mapgen_gamemap&& u);

int intf_terainmap_create(lua_State *L);
int intf_terrainmap_create(lua_State *L);

namespace lua_terrainmap {
std::string register_metatables(lua_State *L);
Expand Down
4 changes: 2 additions & 2 deletions src/scripting/mapgen_lua_kernel.cpp
Expand Up @@ -222,8 +222,8 @@ mapgen_lua_kernel::mapgen_lua_kernel(const config* vars)
static luaL_Reg const callbacks[] {
{ "find_path", &intf_find_path },
{ "random", &intf_random },
{ "create_filter", &intf_terainfilter_create },
{ "create_map", &intf_terainmap_create },
{ "create_filter", &intf_terrainfilter_create },
{ "create_map", &intf_terrainmap_create },
{ "default_generate_height_map", &intf_default_generate_height_map },
{ "generate_default_map", &intf_default_generate },
{ "get_variable", &dispatch<&mapgen_lua_kernel::intf_get_variable> },
Expand Down

0 comments on commit 9e4a7b5

Please sign in to comment.