A 600 × 600 map
broke the recursion.
A Cub3D map must be fully enclosed by walls. A common check is recursive flood fill: start at the player, visit every neighbour, and fail if the search reaches the outside. On a large map, that can produce hundreds of thousands of nested calls and overflow the stack before the check finishes.
My fix: don't walk the map. Check each floor tile once against its neighbours. If any of them is outside, the map is open. Constant memory, one pass, same answer.
See Cub3DLook at every floor tile once. If any of its 8 neighbours is outside the map, the map is open. No recursion, no stack, one pass.






