1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-08-13 16:53:49 -04:00

Large increase in performance

This commit is contained in:
Craig Robbins 2014-12-22 01:37:45 +10:00
parent 03beb597c2
commit 8621e6de5d
2 changed files with 10 additions and 9 deletions

View File

@ -143,14 +143,13 @@ struct MapNode
{ {
*this = n; *this = n;
} }
MapNode(content_t content=CONTENT_AIR, u8 a_param1=0, u8 a_param2=0) MapNode(content_t content = CONTENT_AIR, u8 a_param1=0, u8 a_param2=0)
{ : param0(content),
param0 = content; param1(a_param1),
param1 = a_param1; param2(a_param2)
param2 = a_param2; { }
}
// Create directly from a nodename // Create directly from a nodename
// If name is unknown, sets CONTENT_IGNORE // If name is unknown, sets CONTENT_IGNORE
MapNode(INodeDefManager *ndef, const std::string &name, MapNode(INodeDefManager *ndef, const std::string &name,

View File

@ -180,7 +180,9 @@ void VoxelManipulator::addArea(const VoxelArea &area)
dstream<<std::endl;*/ dstream<<std::endl;*/
// Allocate and clear new data // Allocate and clear new data
MapNode *new_data = new MapNode[new_size]; // FIXME: UGLY KLUDGE because MapNode default constructor is FUBAR; it
// initialises data that is going to be overwritten anyway
MapNode *new_data = (MapNode*)new char[new_size * sizeof (*new_data)];
assert(new_data); assert(new_data);
u8 *new_flags = new u8[new_size]; u8 *new_flags = new u8[new_size];
assert(new_flags); assert(new_flags);