From dd91b3d6fbc3a0b4b18b36b14864d703213dd622 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 20 Jun 2015 03:20:06 +0200 Subject: Generic CAO cleanups and renames for clarification * Use enum for GENERIC_CMD_* * Rename m_attachements to attachement_parent_ids (public member and clearer name) * Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO * USHRT_MAX + 1 buffer sizes to prevent overflows as @kahrl suggested * Remove unneccessary m_id from GenericCAO (shadowing protected superclass member for no reason) as @kahrl suggested --- src/mapblock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mapblock.cpp') diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 9eb64a76e..39cac0b60 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -465,11 +465,11 @@ s16 MapBlock::getGroundLevel(v2s16 p2d) // sure we can handle all content ids. But it's absolutely worth it as it's // a speedup of 4 for one of the major time consuming functions on storing // mapblocks. -static content_t getBlockNodeIdMapping_mapping[USHRT_MAX]; +static content_t getBlockNodeIdMapping_mapping[USHRT_MAX + 1]; static void getBlockNodeIdMapping(NameIdMapping *nimap, MapNode *nodes, INodeDefManager *nodedef) { - memset(getBlockNodeIdMapping_mapping, 0xFF, USHRT_MAX * sizeof(content_t)); + memset(getBlockNodeIdMapping_mapping, 0xFF, (USHRT_MAX + 1) * sizeof(content_t)); std::set unknown_contents; content_t id_counter = 0; -- cgit v1.2.3