]> git.lizzy.rs Git - minetest.git/blob - src/mg_biome.h
Fix RUN_IN_PLACE broken due to invalid usage of assert
[minetest.git] / src / mg_biome.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser 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 MG_BIOME_HEADER
21 #define MG_BIOME_HEADER
22
23 #include "mapgen.h"
24
25 struct NoiseParams;
26
27 enum BiomeType
28 {
29         BIOME_TYPE_NORMAL,
30         BIOME_TYPE_LIQUID,
31         BIOME_TYPE_NETHER,
32         BIOME_TYPE_AETHER,
33         BIOME_TYPE_FLAT
34 };
35
36 class Biome : public GenElement, public NodeResolver {
37 public:
38         u32 flags;
39
40         content_t c_top;
41         content_t c_filler;
42         content_t c_stone;
43         content_t c_water_top;
44         content_t c_water;
45         content_t c_dust;
46
47         s16 depth_top;
48         s16 depth_filler;
49         s16 depth_water_top;
50
51         s16 y_min;
52         s16 y_max;
53         float heat_point;
54         float humidity_point;
55
56         virtual void resolveNodeNames(NodeResolveInfo *nri);
57 };
58
59 class BiomeManager : public GenElementManager {
60 public:
61         static const char *ELEMENT_TITLE;
62         static const size_t ELEMENT_LIMIT = 0x100;
63
64         BiomeManager(IGameDef *gamedef);
65         ~BiomeManager();
66
67         Biome *create(int btt)
68         {
69                 return new Biome;
70         }
71
72         void clear();
73
74         void calcBiomes(s16 sx, s16 sy, float *heat_map, float *humidity_map,
75                 s16 *height_map, u8 *biomeid_map);
76         Biome *getBiome(float heat, float humidity, s16 y);
77 };
78
79 #endif
80