Run cppcheck
This commit is contained in:
parent
bc55e84d5b
commit
d57a07edb8
7 changed files with 25 additions and 47 deletions
35
map.h
35
map.h
|
@ -275,29 +275,6 @@ void LCR_rampGetDimensions(uint8_t rampType, uint8_t *height4ths,
|
|||
*length6ths = rampType != LCR_BLOCK_RAMP_STEEP ? 6 : 1;
|
||||
}
|
||||
|
||||
uint8_t *LCR_getMapBlockAtCoordNumber(uint32_t coord)
|
||||
{
|
||||
// Binary search the block:
|
||||
|
||||
uint16_t a = 0, b = LCR_currentMap.blockCount - 1;
|
||||
|
||||
while (b >= a)
|
||||
{
|
||||
uint16_t mid = (a + b) / 2;
|
||||
uint8_t *block = LCR_currentMap.blocks + mid * LCR_BLOCK_SIZE;
|
||||
uint32_t coord2 = LCR_mapBlockGetCoordNumber(block);
|
||||
|
||||
if (coord2 == coord)
|
||||
return block;
|
||||
else if (coord2 > coord)
|
||||
b = mid - 1;
|
||||
else
|
||||
a = mid + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Adds given block to current map, including possibly deleting a block by
|
||||
adding LCR_BLOCK_NONE. The function handles sorting the block to the right
|
||||
|
@ -578,7 +555,7 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
|
|||
{
|
||||
case LCR_BLOCK_MIRROR:
|
||||
{
|
||||
uint8_t x, y, z, mat, transform, type;
|
||||
uint8_t x, y, z, m, transform, type;
|
||||
uint8_t tmpBlock[LCR_BLOCK_SIZE];
|
||||
|
||||
LCR_mapBlockGetCoords(prevBlock,&x,&y,&z);
|
||||
|
@ -591,7 +568,7 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
|
|||
|
||||
if (blockIndex >= 0)
|
||||
{
|
||||
mat = LCR_mapBlockGetMaterial(
|
||||
m = LCR_mapBlockGetMaterial(
|
||||
LCR_currentMap.blocks + blockIndex * LCR_BLOCK_SIZE);
|
||||
|
||||
transform = LCR_mapBlockGetTransform(
|
||||
|
@ -627,7 +604,7 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
|
|||
y2 >= 0 && y2 < LCR_MAP_SIZE_BLOCKS &&
|
||||
z2 >= 0 && z2 < LCR_MAP_SIZE_BLOCKS)
|
||||
{
|
||||
LCR_makeMapBlock(type,x2,y2,z2,mat,t2,tmpBlock);
|
||||
LCR_makeMapBlock(type,x2,y2,z2,m,t2,tmpBlock);
|
||||
|
||||
if (!_LCR_mapAddBlock(tmpBlock))
|
||||
return 0;
|
||||
|
@ -642,10 +619,10 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
|
|||
case LCR_BLOCK_CUBOID_FILL:
|
||||
case LCR_BLOCK_CUBOID_HOLLOW:
|
||||
{
|
||||
uint8_t x, y, z, mat, transform;
|
||||
uint8_t x, y, z, m, transform;
|
||||
uint8_t tmpBlock[LCR_BLOCK_SIZE];
|
||||
|
||||
mat = LCR_mapBlockGetMaterial(prevBlock);
|
||||
m = LCR_mapBlockGetMaterial(prevBlock);
|
||||
transform = LCR_mapBlockGetTransform(prevBlock);
|
||||
LCR_mapBlockGetCoords(prevBlock,&x,&y,&z);
|
||||
|
||||
|
@ -660,7 +637,7 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
|
|||
y + j < LCR_MAP_SIZE_BLOCKS &&
|
||||
z + k < LCR_MAP_SIZE_BLOCKS))
|
||||
{
|
||||
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,mat,transform,
|
||||
LCR_makeMapBlock(prevBlock[0],x + i,y + j,z + k,m,transform,
|
||||
tmpBlock);
|
||||
|
||||
if (!_LCR_mapAddBlock(tmpBlock))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue