Commit Graph

26 Commits

Author SHA1 Message Date
Loïc Blot 13e995b811 Modernize src/c* src/d* and src/e* files (#6263)
* Modernize src/c* src/d* and src/e* files

* default operator
* redundant init
* delete default constructors on CraftDefinition childs (never used)
* fix some missing init values
* const ref fix reported by clang-tidy
* ranged-based for loops
* simple conditions & returns
* empty stl function instead of size
* emplace_back stl function instead of push_back + construct temp obj
* auto for some iterators
* code style fixes
* c++ stl headers instead of C stl headers (stdio.h -> cstdio)
2017-08-17 23:02:50 +02:00
Loïc Blot 9a17b65f26 VoxelManip cleanups (const ref, const move) + function removal (#6169)
* VoxelManip cleanups (const ref, const move) permitting to improve a little bit performance

* VoxelArea: precalculate extent (performance enhancement)

This permits to reduce extend high cost to zero and drop many v3s16 object creation/removal to calculate extent
It rebalance the client thread update to updateFastFaceRow instead of MapBlockMesh generation
This will also benefits to mapgen
2017-07-26 07:35:09 +02:00
paramat ab746b0704 Dungeons: Add setting to prevent projecting dungeons
Prevents dungeons generating into ignore nodes in ungenerated mapchunks,
which can occasionally result in a dungeon projecting from the terrain.
2017-07-02 13:33:21 +01:00
paramat a901a56859 Dungeongen: Add and improve parameters
Add:
Bool for 'only_in_ground'.
Min and max corridor length.
Min and max room size with X, Y, Z components.
Min and max large room size with X, Y, Z components.

'only_in_ground = false' allows core mapgens to create structures
in air and water using dungeongen.
Corridor length parameters replace a fixed random range.
Room size parameters replace the former system where one parameter
'roomsize' was added to fixed random ranges.

All parameters are set for no change to current dungeon behaviour.

Remove some now-redundant and long-unused code.
2017-02-26 06:46:14 +00:00
paramat 2a89531071 Dungeongen: Fix selection of diagonal corridors
The do .. while loop is waiting for both dir.X and dir.Z to be non-zero,
so should continue to loop if either dir.X or dir.Z are zero. The brackets
present suggest this was intended to be OR not AND.
2017-01-26 20:19:05 +00:00
paramat 9f108b56d3 Dungeongen: Fix out-of-voxelmanip access segfault
My recent dungeon commit allowed stairs to be placed across the full
width of corridors, but some of the new node positions accessed were
missing checks for being within the voxelmanip, causing occasional
segfaults near dungeons with corridors wider than 1 node.

Add 'vm->m_area.contains(pos)' checks just before stair position
voxelmanip access. This allows an earlier check to be removed as it
is now redundant.
2017-01-25 20:34:03 +01:00
paramat d413dfe87c Dungeons: Support nodebox stairs wider than 1 node
Previously, code did not support stair nodeboxes in corridors wider
than 1 node.
Make stair nodeboxes full width even in corridors with different
widths in X and Z directions.
2017-01-23 07:39:50 +00:00
paramat 04fb10914c Dungeons: Generalise use, add capabilities, various modifications
- Generalise node names to c_wall and c_alt_wall
- Remove 'mossratio' and instead disable alt_wall loop if
  c_alt_wall == CONTENT_IGNORE
- Use one generalised 3D noise for alternative wall nodes and in
  mgv6 create moss distribution similar to the previous

- Rename rarity noise to density noise and enable the option of multiple
  dungeons per chunk determined by the value. Recreate previous distribution
- Add parameters for min and max rooms per dungeon
- Add dungeon y limits

- Integrate river water properly

Generalisation is needed now that we have sandstone and desert stone
dungeons by default and can choose any node for alternative structure.
The current code is based around cobble dungeons with mossycobble
alternative nodes, the 2 noises controlling the alternative nodes
are based on wetness.

Enabling multiple dungeons per chunk with definable number of rooms
allows the option of very dense and complex underground structures
that could interconnect to create megastructures.
Y limits are added to be consistent with other mapgen elements, and
enable locaton of dungeon or megastructure realms as part of our
'stacked realms' philosophy.
2016-06-17 04:42:42 +01:00
kwolekr c8fd232678 Dungeongen: Remove dependency on Mapgen 2016-05-27 23:23:58 -04:00
kwolekr b1eb757e60 Fix undefined evaluation order when constructing random vectors
MSVC and GCC evaluate parameters in right-to-left order, whereas Clang
evaluates in left-to-right order, and of course, an optimization could
leave the order of evaluation completely indeterminate.

This commit fixes all instances of the error by explicitly assigning the
results of expressions that use PseudoRandom::next() or range() to their
respective vector components.

The right-to-left evaluation behavior is preserved since Clang is much less
commonly used to compile Minetest than GCC and MSVC combined, and would
therefore cause the least harm.
2016-05-27 23:23:58 -04:00
kinokoio 66af984e0e Dungeongen: Update disabled torch placement code 2016-04-03 04:12:07 -04:00
paramat 8fc8cb819b Mapgen: Various fixes and improvements
Lua_api.txt: Document 'minetest.registered_biomes'
Minimal: Remove 'mapgen_air' alias
Cavegen: Add fallback node for 'mapgen_ice'
Dungeongen: Add fallback node for 'mapgen_river_water_source'
Mgv5: Remove unnecessary '#include util/directiontables.h'
Add missing 'this->'s in makeChunk()
Mgv6: Edit empty line formatting
Remove leading spaces in makeChunk()
Add missing spaces after 'for' and 'if'
Mgv7: Edit empty line formatting
2016-01-11 01:32:20 +00:00
paramat 57b429574e Dungeongen: Fix rarely triggered segfault
A segfault exposed a missing 'vm->m_area.contains()'
check in makeCorridor that allowed the calculation
of vm index for a node outside the vm area. The huge
and invalid index number caused getContent to fail
2015-12-01 00:36:38 +00:00
paramat 452c88308c Dungeongen: Also preserve river water nodes
For future river mapgens
Dungeons will not generate in river water, to
avoid dungeons filling and blocking river channels
2015-11-29 21:55:43 +00:00
paramat 17b7b7c85f Dungeongen: Remove floating frames
Preserves the rare unbroken protruding dungeons
Fix random range for first room roomplace
Fix checked volume for first room 'fits' bool
and check for 'untouchable' flag instead of 'inside'
Remove 'enable floating dungeons' setting
2015-08-29 06:27:29 +01:00
paramat cfed682d04 Dungeon generation: Fix code style issues in dungeongen.cpp 2015-08-01 00:37:26 +01:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
paramat ffdf8dedb7 Dungeongen: Optionally set ignore to be untouchable to disable floating dungeons 2015-03-07 01:41:53 +00:00
paramat 7452d5399b MgV5/6/7: Generate dungeons above water level
Use/add stone_surface_max_y to speed-optimise/guide dungeon generation
MgV7: Don't let mountain terrain chop dungeons at mapchunk borders
Make mountain terrain update stone_surface_max_y for caves in mountains
2015-01-01 15:44:26 -05:00
kwolekr 2fd3d52020 Add flags and lacunarity as new noise parameters
Add 'absolute value' option to noise map functions
Extend persistence modulation to 3D noise
Extend 'eased' option to noise2d_perlin* functions
Some noise.cpp formatting fixups
2014-12-07 21:59:32 -05:00
kwolekr 5062b99cb0 Rewrite generate notification mechanism
Add support for notify-on-decoration
Clean up mapgen constructors
Clean up mapgen.cpp code style somewhat
Remove trailing whitespace from some files
2014-12-06 13:53:35 -05:00
kwolekr 5a34f40d80 Huge overhaul of the entire MapgenParams system
MapgenParams is no longer a polymorphic class, eliminating the need for messy and bug-prone reallocations.
Separation between the common and mapgen-specific parameters is now strongly defined.
Mapgen parameters objects are now properly encapsulated within the proper subsystems.
2014-02-03 22:50:14 -05:00
kwolekr c3708b456e Add map feature generation notify Lua API 2013-12-14 01:52:24 -05:00
kwolekr bbae8eb751 Dungeongen: Create dungeon gen tuneables; add desert temples for Mapgen V6 2013-12-07 22:45:26 -05:00
0gb.us 211b372e26 Standardized method of getting node info in dungeon mapgen. 2013-09-06 21:42:01 +02:00
kwolekr 650e932ddf Re-add dungeons in new dungeongen.cpp 2013-03-10 00:42:51 -05:00