diff options
Diffstat (limited to 'src/mapgen.h')
-rw-r--r-- | src/mapgen.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/mapgen.h b/src/mapgen.h index cf2120a7a..9cdb157e1 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -34,8 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MG_FLAT 0x08 #define MG_LIGHT 0x10 -#define NUM_GEN_NOTIFY 6 - class Settings; class ManualMapVoxelManipulator; class INodeDefManager; @@ -61,13 +59,39 @@ enum MapgenObject { MGOBJ_GENNOTIFY }; -enum GenNotify { +enum GenNotifyType { GENNOTIFY_DUNGEON, GENNOTIFY_TEMPLE, GENNOTIFY_CAVE_BEGIN, GENNOTIFY_CAVE_END, GENNOTIFY_LARGECAVE_BEGIN, - GENNOTIFY_LARGECAVE_END + GENNOTIFY_LARGECAVE_END, + GENNOTIFY_DECORATION, + NUM_GENNOTIFY_TYPES +}; + +struct GenNotifyEvent { + GenNotifyType type; + v3s16 pos; + u32 id; +}; + +class GenerateNotifier { +public: + GenerateNotifier(); + GenerateNotifier(u32 notify_on, std::set<u32> *notify_on_deco_ids); + + void setNotifyOn(u32 notify_on); + void setNotifyOnDecoIds(std::set<u32> *notify_on_deco_ids); + + bool addEvent(GenNotifyType type, v3s16 pos, u32 id=0); + void getEvents(std::map<std::string, std::vector<v3s16> > &event_map, + bool peek_events=false); + +private: + u32 m_notify_on; + std::set<u32> *m_notify_on_deco_ids; + std::list<GenNotifyEvent> m_notify_events; }; struct MapgenSpecificParams { @@ -85,7 +109,8 @@ struct MapgenParams { MapgenSpecificParams *sparams; - MapgenParams() { + MapgenParams() + { mg_name = DEFAULT_MAPGEN; seed = 0; water_level = 1; @@ -99,6 +124,7 @@ class Mapgen { public: int seed; int water_level; + u32 flags; bool generating; int id; ManualMapVoxelManipulator *vm; @@ -108,10 +134,10 @@ public: u8 *biomemap; v3s16 csize; - u32 gennotify; - std::vector<v3s16> *gen_notifications[NUM_GEN_NOTIFY]; + GenerateNotifier gennotify; Mapgen(); + Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge); virtual ~Mapgen(); s16 findGroundLevelFull(v2s16 p2d); |