memset(outsideWallHeightMap, 0, sizeof(outsideWallHeightMap[0][0]) * CHUNK_SIZE_MULT * ITEM_CHUNK_SIZE_MULT);
quint8 outsideWallHeightMap[INSIDE_ITEM_CHUNK_SIZE_MULT][CHUNK_SIZE_MULT];
#define ITEM_MAP_SIZE 128
#define CHUNK_SIZE 8
#define CHUNK_SIZE_MULT (CHUNK_SIZE*CHUNK_SIZE)
#define INSIDE_ITEM_CHUNK_SIZE (INSIDE_ITEM_MAP_SIZE/CHUNK_SIZE)
#define INSIDE_ITEM_CHUNK_SIZE_MULT (INSIDE_ITEM_CHUNK_SIZE*INSIDE_ITEM_CHUNK_SIZE)
我不知道为什么这会彻底腐蚀我的记忆!我之前遇到过quint8的麻烦,我希望不是那个......
任何见解都会很棒!
答案 0 :(得分:3)
不应该是
memset(outsideWallHeightMap, 0, sizeof(outsideWallHeightMap[0][0]) * CHUNK_SIZE_MULT *
的 INSIDE_ITEM_CHUNK_SIZE_MULT 强> ));
或更容易
memset(outsideWallHeightMap, 0, sizeof(outsideWallHeightMap));
答案 1 :(得分:0)
您也可以通过这种方式将所有内容初始化为0:
quint8 outsideWallHeightMap[INSIDE_ITEM_CHUNK_SIZE_MULT][CHUNK_SIZE_MULT] = {{0}};