Please sign in to comment.
Avoid crash caused by, and improve, 'findSpawnPos()' (#8728)
Avoid an unsuitable spawn position (which if outside mapgen limits can cause a crash) if the main 0-3999 loop reaches its end. Fallback to a spawn at 0,0,0. Check the mapgen-returned 'spawn_level' value for being outside limits. When 'air_count' reaches 2, move back down 1 to spawn in the lower empty node. If the spawn position is disallowed by 'objectpos_over_limit()', 'break' from loop instead of 'continue' because positions above are probably also over limit. Reset 'air_count' to 0 if an obstruction is found, to make 'air_count' consecutive empty nodes. Allow spawn in 'airlike' drawtype nodes such as mod-added vacuum, alien atmospheres, fog etc. Add clarifying comments and improve codestyle.
- Loading branch information...