summaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorjuhdanad <juhdanad@gmail.com>2016-11-28 09:43:33 +0100
committerZeno- <kde.psych@gmail.com>2016-11-28 18:43:33 +1000
commit2fe3bf5a18eb9aa9f38654b3c0a0729c42408cd6 (patch)
treeafccb5b126b0ca34694ad9e8052a85f6f1a44b7f /src/script/common/c_content.cpp
parentbb06d377a163b2d168c9d327ad38b871132fa8ea (diff)
downloadminetest-2fe3bf5a18eb9aa9f38654b3c0a0729c42408cd6.tar.gz
minetest-2fe3bf5a18eb9aa9f38654b3c0a0729c42408cd6.tar.bz2
minetest-2fe3bf5a18eb9aa9f38654b3c0a0729c42408cd6.zip
Limit light_source in the engine (#4814)
Since light_source>15 causes crash, it must be limited.
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index f20a65903..541744895 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -526,6 +526,12 @@ ContentFeatures read_content_features(lua_State *L, int index)
// Amount of light the node emits
f.light_source = getintfield_default(L, index,
"light_source", f.light_source);
+ if (f.light_source > LIGHT_MAX) {
+ warningstream << "Node " << f.name.c_str()
+ << " had greater light_source than " << LIGHT_MAX
+ << ", it was reduced." << std::endl;
+ f.light_source = LIGHT_MAX;
+ }
f.damage_per_second = getintfield_default(L, index,
"damage_per_second", f.damage_per_second);