Skip to content

Commit 61a3de4

Browse files
DumbeldorSmallJoker
authored andcommittedJul 4, 2017
Treegen: Fix s16 overflow warning (#6082)
1 parent 66c4108 commit 61a3de4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed
 

Diff for: ‎src/treegen.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -802,12 +802,9 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed)
802802
}
803803

804804
// Centre top nodes
805-
u32 i = leaves_a.index(v3s16(0, 1, 0));
806-
leaves_d[i] = 1;
807-
i = leaves_a.index(v3s16(0, 2, 0));
808-
leaves_d[i] = 1;
809-
i = leaves_a.index(v3s16(0, 3, 0));
810-
leaves_d[i] = 2;
805+
leaves_d[leaves_a.index(v3s16(0, 1, 0))] = 1;
806+
leaves_d[leaves_a.index(v3s16(0, 2, 0))] = 1;
807+
leaves_d[leaves_a.index(v3s16(0, 3, 0))] = 2;
811808

812809
// Lower branches
813810
s16 my = -6;
@@ -820,7 +817,7 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed)
820817
for (s16 zz = zi; zz <= zi + 1; zz++) {
821818
u32 i = leaves_a.index(v3s16(xi, yy, zz));
822819
u32 ia = leaves_a.index(v3s16(xi, yy + 1, zz));
823-
for (s16 xx = xi; xx <= xi + 1; xx++) {
820+
for (s32 xx = xi; xx <= xi + 1; xx++) {
824821
leaves_d[i] = 1;
825822
if (leaves_d[ia] == 0)
826823
leaves_d[ia] = 2;

0 commit comments

Comments
 (0)
Please sign in to comment.