Check map errors

This commit is contained in:
Miloslav Ciz 2025-03-11 16:49:11 +01:00
parent 0f40d57a22
commit a1e5f50e58
4 changed files with 72 additions and 33 deletions

41
map.h
View file

@ -85,6 +85,7 @@
// normal blocks:
#define LCR_BLOCK_FULL '=' ///< completely filled block
#define LCR_BLOCK_BOTTOM '-' ///< filled bottom half
#define LCR_BLOCK_LEFT ';' ///< filled left half
#define LCR_BLOCK_BOTTOM_LEFT ',' ///< filled bottom left quarter
@ -669,10 +670,39 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
LCR_currentMap.startPos[3] = trans;
break;
// kek, is this legit?
case LCR_BLOCK_CHECKPOINT_0:
LCR_currentMap.checkpointCount++;
// fall through
default: // normal block
LCR_currentMap.checkpointCount++; // fall through
case LCR_BLOCK_FULL: // fall through
case LCR_BLOCK_BOTTOM: // fall through
case LCR_BLOCK_LEFT: // fall through
case LCR_BLOCK_BOTTOM_LEFT: // fall through
case LCR_BLOCK_BOTTOM_LEFT_FRONT: // fall through
case LCR_BLOCK_LEFT_FRONT: // fall through
case LCR_BLOCK_RAMP: // fall through
case LCR_BLOCK_RAMP_34: // fall through
case LCR_BLOCK_RAMP_12: // fall through
case LCR_BLOCK_RAMP_14: // fall through
case LCR_BLOCK_RAMP_12_UP: // fall through
case LCR_BLOCK_RAMP_CORNER: // fall through
case LCR_BLOCK_RAMP_CURVED_PLAT: // fall through
case LCR_BLOCK_RAMP_CURVED: // fall through
case LCR_BLOCK_RAMP_CURVED_WALL: // fall through
case LCR_BLOCK_RAMP_STEEP: // fall through
case LCR_BLOCK_CORNER: // fall through
case LCR_BLOCK_CORNER_12: // fall through
case LCR_BLOCK_HILL: // fall through
case LCR_BLOCK_BUMP: // fall through
case LCR_BLOCK_CORNER_CONVEX: // fall through
case LCR_BLOCK_CORNER_CONCAVE: // fall through
case LCR_BLOCK_FULL_ACCEL: // fall through
case LCR_BLOCK_BOTTOM_ACCEL: // fall through
case LCR_BLOCK_RAMP_ACCEL: // fall through
case LCR_BLOCK_FULL_FAN: // fall through
case LCR_BLOCK_RAMP_FAN: // fall through
case LCR_BLOCK_CHECKPOINT_1: // fall through
case LCR_BLOCK_FINISH: // fall through
case LCR_BLOCK_NONE: // fall through
{
LCR_makeMapBlock(block,coords[0],coords[1],coords[2],mat,trans,
prevBlock);
@ -682,7 +712,10 @@ uint8_t LCR_mapLoadFromStr(char (*getNextCharFunc)(void), const char *name)
break;
}
// TODO: check for invalid blocks?
default:
LCR_LOG0("bad block type");
return 0;
break;
}
}
else