]> git.lizzy.rs Git - minetest.git/blob - src/mapgen.h
Tool definition transfer to client
[minetest.git] / src / mapgen.h
1 /*
2 Minetest-c55
3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MAPGEN_HEADER
21 #define MAPGEN_HEADER
22
23 #include "common_irrlicht.h"
24 #include "utility.h" // UniqueQueue
25
26 struct BlockMakeData;
27 class MapBlock;
28 class ManualMapVoxelManipulator;
29 class INodeDefManager;
30
31 namespace mapgen
32 {
33         // Finds precise ground level at any position
34         s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
35
36         // Find out if block is completely underground
37         bool block_is_underground(u64 seed, v3s16 blockpos);
38
39         // Main map generation routine
40         void make_block(BlockMakeData *data);
41         
42         // Add objects according to block content
43         void add_random_objects(MapBlock *block);
44
45         // Add a tree
46         void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0, bool is_apple_tree);
47         
48         /*
49                 These are used by FarMesh
50         */
51         bool get_have_sand(u64 seed, v2s16 p2d);
52         double tree_amount_2d(u64 seed, v2s16 p);
53         
54
55         struct BlockMakeData
56         {
57                 bool no_op;
58                 ManualMapVoxelManipulator *vmanip; // Destructor deletes
59                 u64 seed;
60                 v3s16 blockpos;
61                 UniqueQueue<v3s16> transforming_liquid;
62                 INodeDefManager *nodemgr; // Destructor deletes
63
64                 BlockMakeData();
65                 ~BlockMakeData();
66         };
67
68 }; // namespace mapgen
69
70 #endif
71