Skip to content

Commit 56b9377

Browse files
committedAug 10, 2013
Dont crash if facedir > 23
1 parent 0d60bc5 commit 56b9377

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎src/mapblock_mesh.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data)
711711

712712
// Get rotation for things like chests
713713
u8 facedir = mn.getFaceDir(ndef);
714-
assert(facedir <= 23);
714+
if (facedir > 23)
715+
facedir = 0;
715716
static const u16 dir_to_tile[24 * 16] =
716717
{
717718
// 0 +X +Y +Z -Z -Y -X -> value=tile,rotation
@@ -734,17 +735,17 @@ TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data)
734735
0,0, 0,2 , 5,3 , 3,1 , 0,0, 2,3 , 4,3 , 1,0 ,
735736
0,0, 0,1 , 2,3 , 5,1 , 0,0, 4,3 , 3,3 , 1,1 ,
736737
0,0, 0,0 , 4,3 , 2,1 , 0,0, 3,3 , 5,3 , 1,2 ,
737-
738+
738739
0,0, 1,1 , 2,1 , 4,3 , 0,0, 5,1 , 3,1 , 0,1 , // rotate around x- 16 - 19
739740
0,0, 1,2 , 4,1 , 3,3 , 0,0, 2,1 , 5,1 , 0,0 ,
740741
0,0, 1,3 , 3,1 , 5,3 , 0,0, 4,1 , 2,1 , 0,3 ,
741742
0,0, 1,0 , 5,1 , 2,3 , 0,0, 3,1 , 4,1 , 0,2 ,
742-
743+
743744
0,0, 3,2 , 1,2 , 4,2 , 0,0, 5,2 , 0,2 , 2,2 , // rotate around y- 20 - 23
744745
0,0, 5,2 , 1,3 , 3,2 , 0,0, 2,2 , 0,1 , 4,2 ,
745746
0,0, 2,2 , 1,0 , 5,2 , 0,0, 4,2 , 0,0 , 3,2 ,
746747
0,0, 4,2 , 1,1 , 2,2 , 0,0, 3,2 , 0,3 , 5,2
747-
748+
748749
};
749750
u16 tile_index=facedir*16 + dir_i;
750751
TileSpec spec = getNodeTileN(mn, p, dir_to_tile[tile_index], data);

0 commit comments

Comments
 (0)
Please sign in to comment.