aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2018-06-20 22:36:08 +0200
committerSmallJoker <mk939@ymail.com>2018-06-26 15:38:42 +0200
commitdb42542e271a00efd017b192f3a63e04f5b3dbf4 (patch)
tree98e8a8381121415f86527252663628b1245f34ec /src/script/lua_api
parent7bdf5eae05f63a98a13e520f98e68b9e7d9d544b (diff)
downloadminetest-db42542e271a00efd017b192f3a63e04f5b3dbf4.tar.gz
minetest-db42542e271a00efd017b192f3a63e04f5b3dbf4.tar.bz2
minetest-db42542e271a00efd017b192f3a63e04f5b3dbf4.zip
Rename CSM flavours to restrictions
& Satisfy LINT
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_client.cpp16
-rw-r--r--src/script/lua_api/l_env.cpp3
2 files changed, 15 insertions, 4 deletions
diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp
index 8e802d2a2..f70e65f0f 100644
--- a/src/script/lua_api/l_client.cpp
+++ b/src/script/lua_api/l_client.cpp
@@ -94,8 +94,12 @@ int ModApiClient::l_send_chat_message(lua_State *L)
return 0;
// If server disabled this API, discard
- if (getClient(L)->checkCSMFlavourLimit(CSMFlavourLimit::CSM_FL_CHAT_MESSAGES))
+
+ // clang-format off
+ if (getClient(L)->checkCSMRestrictionFlag(
+ CSMRestrictionFlags::CSM_RF_CHAT_MESSAGES))
return 0;
+ // clang-format on
std::string message = luaL_checkstring(L, 1);
getClient(L)->sendChatMessage(utf8_to_wide(message));
@@ -290,8 +294,11 @@ int ModApiClient::l_get_item_def(lua_State *L)
IItemDefManager *idef = gdef->idef();
assert(idef);
- if (getClient(L)->checkCSMFlavourLimit(CSMFlavourLimit::CSM_FL_READ_ITEMDEFS))
+ // clang-format off
+ if (getClient(L)->checkCSMRestrictionFlag(
+ CSMRestrictionFlags::CSM_RF_READ_ITEMDEFS))
return 0;
+ // clang-format on
if (!lua_isstring(L, 1))
return 0;
@@ -318,8 +325,11 @@ int ModApiClient::l_get_node_def(lua_State *L)
if (!lua_isstring(L, 1))
return 0;
- if (getClient(L)->checkCSMFlavourLimit(CSMFlavourLimit::CSM_FL_READ_NODEDEFS))
+ // clang-format off
+ if (getClient(L)->checkCSMRestrictionFlag(
+ CSMRestrictionFlags::CSM_RF_READ_NODEDEFS))
return 0;
+ // clang-format on
const std::string &name = lua_tostring(L, 1);
const ContentFeatures &cf = ndef->get(ndef->getId(name));
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 2eb7f3395..246732a17 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -770,7 +770,8 @@ int ModApiEnvMod::l_find_node_near(lua_State *L)
#ifndef SERVER
// Client API limitations
if (getClient(L) &&
- getClient(L)->checkCSMFlavourLimit(CSMFlavourLimit::CSM_FL_LOOKUP_NODES)) {
+ getClient(L)->checkCSMRestrictionFlag(
+ CSMRestrictionFlags::CSM_RF_LOOKUP_NODES)) {
radius = std::max<int>(radius, getClient(L)->getCSMNodeRangeLimit());
}
#endif