Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
illuna-minetest
Commits
ce1a70c7
Commit
ce1a70c7
authored
9 years ago
by
paramat
Browse files
Options
Downloads
Patches
Plain Diff
Mgv5: getGroundLevelAtPoint searches a larger range
parent
94464fce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mapgen_v5.cpp
+10
-9
10 additions, 9 deletions
src/mapgen_v5.cpp
with
10 additions
and
9 deletions
src/mapgen_v5.cpp
+
10
−
9
View file @
ce1a70c7
...
...
@@ -182,23 +182,24 @@ int MapgenV5::getGroundLevelAtPoint(v2s16 p)
f
*=
1.6
;
float
h
=
NoisePerlin2D
(
&
noise_height
->
np
,
p
.
X
,
p
.
Y
,
seed
);
s16
search_
top
=
water_level
+
15
;
s16
search_
base
=
water_level
;
s16
search_
start
=
128
;
// Only bother searching this range, actual
s16
search_
end
=
-
128
;
// ground level is rarely higher or lower.
s16
level
=
-
31000
;
for
(
s16
y
=
search_top
;
y
>=
search_base
;
y
--
)
{
for
(
s16
y
=
search_start
;
y
>=
search_end
;
y
--
)
{
float
n_ground
=
NoisePerlin3D
(
&
noise_ground
->
np
,
p
.
X
,
y
,
p
.
Y
,
seed
);
// If solid
if
(
n_ground
*
f
>
y
-
h
)
{
if
(
y
>=
search_top
-
7
)
break
;
// If either top 2 nodes of search are solid this is inside a
// mountain or floatland with no space for the player to spawn.
if
(
y
>=
search_start
-
1
)
return
MAX_MAP_GENERATION_LIMIT
;
else
level
=
y
;
break
;
return
y
;
// Ground below at least 2 nodes of space
}
}
//printf("getGroundLevelAtPoint: %dus\n", t.stop());
return
level
;
return
-
MAX_MAP_GENERATION_LIMIT
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment