Skip to content

Commit 8621e6d

Browse files
committedDec 24, 2014
Large increase in performance
1 parent 03beb59 commit 8621e6d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed
 

Diff for: ‎src/mapnode.h

+7-8
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,13 @@ struct MapNode
143143
{
144144
*this = n;
145145
}
146-
147-
MapNode(content_t content=CONTENT_AIR, u8 a_param1=0, u8 a_param2=0)
148-
{
149-
param0 = content;
150-
param1 = a_param1;
151-
param2 = a_param2;
152-
}
153-
146+
147+
MapNode(content_t content = CONTENT_AIR, u8 a_param1=0, u8 a_param2=0)
148+
: param0(content),
149+
param1(a_param1),
150+
param2(a_param2)
151+
{ }
152+
154153
// Create directly from a nodename
155154
// If name is unknown, sets CONTENT_IGNORE
156155
MapNode(INodeDefManager *ndef, const std::string &name,

Diff for: ‎src/voxel.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ void VoxelManipulator::addArea(const VoxelArea &area)
180180
dstream<<std::endl;*/
181181

182182
// Allocate and clear new data
183-
MapNode *new_data = new MapNode[new_size];
183+
// FIXME: UGLY KLUDGE because MapNode default constructor is FUBAR; it
184+
// initialises data that is going to be overwritten anyway
185+
MapNode *new_data = (MapNode*)new char[new_size * sizeof (*new_data)];
184186
assert(new_data);
185187
u8 *new_flags = new u8[new_size];
186188
assert(new_flags);

1 commit comments

Comments
 (1)

HybridDog commented on Dec 24, 2014

@HybridDog
Contributor

How large?

Please sign in to comment.