diff options
author | Paramat <paramat@users.noreply.github.com> | 2019-08-07 22:07:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-07 22:07:51 +0100 |
commit | 37923920a07f06d201662d8f1f4e5821efcc7b09 (patch) | |
tree | c90559dd092fea68a9e75ccdb81437564c34e627 /src/gui/guiVolumeChange.cpp | |
parent | 0c533dc4363747c8ccb4a0f519516cc8ae73d3fa (diff) | |
download | minetest-37923920a07f06d201662d8f1f4e5821efcc7b09.tar.gz minetest-37923920a07f06d201662d8f1f4e5821efcc7b09.tar.bz2 minetest-37923920a07f06d201662d8f1f4e5821efcc7b09.zip |
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.
Diffstat (limited to 'src/gui/guiVolumeChange.cpp')
0 files changed, 0 insertions, 0 deletions