aboutsummaryrefslogtreecommitdiff
path: root/src/treegen.cpp
diff options
context:
space:
mode:
authorVincent Glize <vincentglize@hotmail.fr>2017-07-04 22:18:28 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2017-07-04 23:18:28 +0200
commit61a3de42fd9c7c24c06ba8522e4240d4f5e3a04f (patch)
tree69147a5ff45964fd973bf3ee1f74821196a37157 /src/treegen.cpp
parent66c4108581902a34e2e42a4551c8c1157a881681 (diff)
downloadminetest-61a3de42fd9c7c24c06ba8522e4240d4f5e3a04f.tar.gz
minetest-61a3de42fd9c7c24c06ba8522e4240d4f5e3a04f.tar.bz2
minetest-61a3de42fd9c7c24c06ba8522e4240d4f5e3a04f.zip
Treegen: Fix s16 overflow warning (#6082)
Diffstat (limited to 'src/treegen.cpp')
-rw-r--r--src/treegen.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/treegen.cpp b/src/treegen.cpp
index a397bdbd6..574cc034d 100644
--- a/src/treegen.cpp
+++ b/src/treegen.cpp
@@ -802,12 +802,9 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed)
}
// Centre top nodes
- u32 i = leaves_a.index(v3s16(0, 1, 0));
- leaves_d[i] = 1;
- i = leaves_a.index(v3s16(0, 2, 0));
- leaves_d[i] = 1;
- i = leaves_a.index(v3s16(0, 3, 0));
- leaves_d[i] = 2;
+ leaves_d[leaves_a.index(v3s16(0, 1, 0))] = 1;
+ leaves_d[leaves_a.index(v3s16(0, 2, 0))] = 1;
+ leaves_d[leaves_a.index(v3s16(0, 3, 0))] = 2;
// Lower branches
s16 my = -6;
@@ -820,7 +817,7 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed)
for (s16 zz = zi; zz <= zi + 1; zz++) {
u32 i = leaves_a.index(v3s16(xi, yy, zz));
u32 ia = leaves_a.index(v3s16(xi, yy + 1, zz));
- for (s16 xx = xi; xx <= xi + 1; xx++) {
+ for (s32 xx = xi; xx <= xi + 1; xx++) {
leaves_d[i] = 1;
if (leaves_d[ia] == 0)
leaves_d[ia] = 2;