Skip to content

Commit

Permalink
rename and,or,nor ->all,any,none in luafilters
Browse files Browse the repository at this point in the history
these come closer to their actual meaning and also are not lua keywords
which might come in hand later, in particular we can now replace the
f_and, f_or,f_terrain, with f.all, f.any, f.terrain if we want.
  • Loading branch information
gfgtdf committed Oct 20, 2018
1 parent 45a0946 commit 42920cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
14 changes: 3 additions & 11 deletions data/multiplayer/scenarios/test_lua_mapgen.lua
Expand Up @@ -11,23 +11,15 @@ local function f_terrain(terrain)
end

local function f_and(...)
return { "and", ... }
end

local function f_nand(...)
return { "nand", ... }
return { "all", ... }
end

local function f_not(...)
return { "nand", ... }
return { "none", ... }
end

local function f_or(...)
return { "or", ... }
end

local function f_nor(...)
return { "nor", ... }
return { "any", ... }
end

local function f_adjacent(f, ad, count)
Expand Down
8 changes: 4 additions & 4 deletions src/scripting/lua_terrainfilter.cpp
Expand Up @@ -638,10 +638,10 @@ enum filter_keys { F_AND, F_OR, F_NAND, F_NOR, F_X, F_Y, F_FIND_IN, F_ADJACENT,
//todoc++14: std::unordered_map doesn'tsupport herterogrnous lookup.
//todo consider renaming and -> all ,or ->any, nor -> none, nand -> notall
static const std::unordered_map<std::string, filter_keys> keys {
{ "and", F_AND },
{ "or", F_OR },
{ "nand", F_NAND },
{ "or", F_NOR },
{ "all", F_AND },
{ "any", F_OR },
{ "not_all", F_NAND },
{ "none", F_NOR },
{ "x", F_X },
{ "y", F_Y },
{ "find_in", F_FIND_IN },
Expand Down

0 comments on commit 42920cb

Please sign in to comment.